infrared_scene_rpc.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #include "../infrared_i.h"
  2. #include "gui/canvas.h"
  3. void infrared_scene_rpc_on_enter(void* context) {
  4. Infrared* infrared = context;
  5. Popup* popup = infrared->popup;
  6. popup_set_text(popup, "Rpc mode", 64, 28, AlignCenter, AlignCenter);
  7. popup_set_context(popup, context);
  8. popup_set_callback(popup, infrared_popup_closed_callback);
  9. infrared_play_notification_message(infrared, InfraredNotificationMessageYellowOn);
  10. view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewPopup);
  11. notification_message(infrared->notifications, &sequence_display_backlight_on);
  12. }
  13. bool infrared_scene_rpc_on_event(void* context, SceneManagerEvent event) {
  14. Infrared* infrared = context;
  15. bool consumed = false;
  16. if(event.type == SceneManagerEventTypeCustom) {
  17. consumed = true;
  18. if(event.event == InfraredCustomEventTypeBackPressed) {
  19. view_dispatcher_stop(infrared->view_dispatcher);
  20. } else if(event.event == InfraredCustomEventTypePopupClosed) {
  21. view_dispatcher_stop(infrared->view_dispatcher);
  22. }
  23. }
  24. return consumed;
  25. }
  26. void infrared_scene_rpc_on_exit(void* context) {
  27. Infrared* infrared = context;
  28. popup_reset(infrared->popup);
  29. }