nfc_scene_emulate_apdu_sequence.c 949 B

12345678910111213141516171819202122232425262728293031323334
  1. #include "../nfc_i.h"
  2. void nfc_scene_emulate_apdu_sequence_on_enter(void* context) {
  3. 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 = context;
  13. bool consumed = false;
  14. if(event.type == SceneManagerEventTypeTick) {
  15. notification_message(nfc->notifications, &sequence_blink_blue_10);
  16. consumed = true;
  17. }
  18. return consumed;
  19. }
  20. void nfc_scene_emulate_apdu_sequence_on_exit(void* context) {
  21. Nfc* nfc = context;
  22. // Stop worker
  23. nfc_worker_stop(nfc->worker);
  24. // Clear view
  25. popup_reset(nfc->popup);
  26. }