lfrfid_scene_emulate.c 1.3 KB

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