lfrfid_scene_emulate.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "../lfrfid_i.h"
  2. #include <dolphin/dolphin.h>
  3. void lfrfid_scene_emulate_on_enter(void* context) {
  4. LfRfid* app = context;
  5. Popup* popup = app->popup;
  6. DOLPHIN_DEED(DolphinDeedRfidEmulate);
  7. popup_set_header(popup, "Emulating", 89, 30, AlignCenter, AlignTop);
  8. if(!furi_string_empty(app->file_name)) {
  9. popup_set_text(popup, furi_string_get_cstr(app->file_name), 89, 43, AlignCenter, AlignTop);
  10. } else {
  11. popup_set_text(
  12. popup,
  13. protocol_dict_get_name(app->dict, app->protocol_id),
  14. 89,
  15. 43,
  16. AlignCenter,
  17. AlignTop);
  18. }
  19. popup_set_icon(popup, 0, 3, &I_RFIDDolphinSend_97x61);
  20. lfrfid_worker_start_thread(app->lfworker);
  21. lfrfid_worker_emulate_start(app->lfworker, (LFRFIDProtocol)app->protocol_id);
  22. notification_message(app->notifications, &sequence_blink_start_magenta);
  23. view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup);
  24. }
  25. bool lfrfid_scene_emulate_on_event(void* context, SceneManagerEvent event) {
  26. UNUSED(context);
  27. UNUSED(event);
  28. bool consumed = false;
  29. return consumed;
  30. }
  31. void lfrfid_scene_emulate_on_exit(void* context) {
  32. LfRfid* app = context;
  33. notification_message(app->notifications, &sequence_blink_stop);
  34. popup_reset(app->popup);
  35. lfrfid_worker_stop(app->lfworker);
  36. lfrfid_worker_stop_thread(app->lfworker);
  37. }