-
Notifications
You must be signed in to change notification settings - Fork 0
Default Screen
The DefaultScreen is the layout that is displayed once the program is booted. The layout shows the Solar Team Eindhoven logo and 'Stella Pay' written in bold under the logo. If the user presses the Solar Team Eindhoven logo, the program will switch to CreditsScreen, where an explanation of the way the program works is displayed and the developers and designers of the program get a shoutout.
The DefaultScreen uses three threads, that is, three program sequences are performed in parallel. One is the main thread of the program and will ensure that the program remains responsive. On another thread the NFCReader object is created and since this is a blocking call, it will block until a card has been presented. The third thread listens whether the second thread is finished, since waiting for a thread to finish is also a blocking thread of course.
Once a card has been presented, the second and third thread return. This will trigger the main thread to make a query to the back-end; namely requesting the user name and e-mail from the UID of the NFC card presented. If the UID is recognized, then the program will proceed to the WelcomeScreen. If the card is not recognized, the program will proceed to the RegisterUIDScreen, where the user can connect this NFC card to their account.
def init(self, kwargs)
Once the screen is created upon launching the Python script, the class object is created. The class object will initialize the local member variables and start the NFC reader thread and the NFC reader monitor thread.
def create_nfc_reader(self)
This function creates an NFC_Reader object and stores it in a local member variable. The NFC_Reader object is blocking, hence this is performed on the secondary thread. This function is called from the init function.
def launch_nfc_reader_monitor(self, nfc_thread)
This function waits for the NFC_reader to finish, that is, waits until a card is presented. Once a card is presented, this function will trigger the main thread to start the API request.
def on_enter(self, args)
This is an override function that is triggered once the ScreenManager loads this screen. After a purchase is completed, this function is used to reset this class to a 'fresh' one.
def to_credits(self)
This is an on_press callback function when the STE-logo in the centre of the screen is pressed. It will take the user to the CreditsScreen/
POST: http://staartvin.com:8181/identification/request-user/ + NFC_UID Forwards the discovered NFC_UID to the back-end server and requests the name and mailadress of the connected account. If the NFC_UID is not found, then a 'user not found' message is returned and the user will be taken to the RegisterUIDScreen.