nfc_scene_emulate_apdu_sequence.c 961 B

123456789101112131415161718192021222324252627282930313233343536
  1. #include "../nfc_i.h"
  2. void nfc_scene_emulate_apdu_sequence_on_enter(void* context) {
  3. Nfc* nfc = (Nfc*)context;
  4. // Setup view
  5. Popup* popup = nfc->popup;
  6. popup_set_header(popup, "Run APDU reader", 64, 31, AlignCenter, AlignTop);
  7. // Setup and start worker
  8. view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup);
  9. nfc_worker_start(nfc->worker, NfcWorkerStateEmulateApdu, &nfc->dev->dev_data, NULL, nfc);
  10. }
  11. bool nfc_scene_emulate_apdu_sequence_on_event(void* context, SceneManagerEvent event) {
  12. Nfc* nfc = (Nfc*)context;
  13. if(event.type == SceneManagerEventTypeTick) {
  14. notification_message(nfc->notifications, &sequence_blink_blue_10);
  15. return true;
  16. }
  17. return false;
  18. }
  19. void nfc_scene_emulate_apdu_sequence_on_exit(void* context) {
  20. Nfc* nfc = (Nfc*)context;
  21. // Stop worker
  22. nfc_worker_stop(nfc->worker);
  23. // Clear view
  24. Popup* popup = nfc->popup;
  25. popup_reset(popup);
  26. }