lfrfid_app_scene_rpc.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #include "lfrfid_app_scene_rpc.h"
  2. #include "furi/common_defines.h"
  3. #include <dolphin/dolphin.h>
  4. void LfRfidAppSceneRpc::on_enter(LfRfidApp* app, bool /* need_restore */) {
  5. auto popup = app->view_controller.get<PopupVM>();
  6. popup->set_header("RPC Mode", 64, 30, AlignCenter, AlignTop);
  7. app->view_controller.switch_to<PopupVM>();
  8. notification_message(app->notification, &sequence_display_backlight_on);
  9. }
  10. bool LfRfidAppSceneRpc::on_event(LfRfidApp* app, LfRfidApp::Event* event) {
  11. UNUSED(app);
  12. UNUSED(event);
  13. bool consumed = false;
  14. if(event->type == LfRfidApp::EventType::Exit) {
  15. consumed = true;
  16. LfRfidApp::Event view_event;
  17. view_event.type = LfRfidApp::EventType::Back;
  18. app->view_controller.send_event(&view_event);
  19. } else if(event->type == LfRfidApp::EventType::EmulateStart) {
  20. consumed = true;
  21. emulating = true;
  22. }
  23. return consumed;
  24. }
  25. void LfRfidAppSceneRpc::on_exit(LfRfidApp* app) {
  26. if(emulating) {
  27. app->worker.stop_emulate();
  28. }
  29. app->view_controller.get<PopupVM>()->clean();
  30. }