screenIdentification.hpp (1447B)
1 #ifndef SCREEN_IDENTIFICATION_H 2 #define SCREEN_IDENTIFICATION_H 3 4 #include "screen.hpp" 5 #include <src/misc/lv_types.h> 6 #include <src/widgets/label/lv_label.h> 7 8 #include "global.hpp" 9 10 class ScreenIdentification : public Screen { 11 private: 12 lv_obj_t *abortButton; 13 lv_obj_t *identButton; 14 15 static void abortButtonEvent(lv_event_t *e){ 16 event(EVENT_BUTTON_ABORT); 17 } 18 19 static void identButtonEvent(lv_event_t *e){ 20 event(EVENT_IDENTIFICATION_SUCCESS); 21 } 22 23 protected: 24 public: 25 ScreenIdentification(){ 26 //Set the instruction 27 lv_label_set_text(instructionLabel, "Identificate presenting a NFC-Tag to the NFC-Reader."); 28 29 30 //Add button "Abort" 31 abortButton = lv_button_create(buttonsContainer); 32 lv_obj_add_style(abortButton, &buttonDefaultStyle, 0); 33 lv_obj_t *label = lv_label_create(abortButton); 34 lv_label_set_text(label, "Abort"); 35 lv_obj_add_style(label, &buttonLabelDefaultStyle, 0); 36 lv_obj_add_event_cb(abortButton, abortButtonEvent, LV_EVENT_CLICKED, NULL); 37 38 //Add button "Identificate" as long as identification is not implemented... 39 identButton = lv_button_create(buttonsContainer); 40 lv_obj_add_style(identButton, &buttonDefaultStyle, 0); 41 label = lv_label_create(identButton); 42 lv_label_set_text(label, "Identificate"); 43 lv_obj_add_style(label, &buttonLabelDefaultStyle, 0); 44 lv_obj_add_event_cb(identButton, identButtonEvent, LV_EVENT_CLICKED, NULL); 45 46 } 47 }; 48 #endif