nfc_scene_emulate_apdu_sequence.c 901 B

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