subghz_scene_frequency_analyzer.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #include "../subghz_i.h"
  2. #include "../views/subghz_frequency_analyzer.h"
  3. void subghz_scene_frequency_analyzer_callback(SubGhzCustomEvent event, void* context) {
  4. furi_assert(context);
  5. SubGhz* subghz = context;
  6. view_dispatcher_send_custom_event(subghz->view_dispatcher, event);
  7. }
  8. void subghz_scene_frequency_analyzer_on_enter(void* context) {
  9. SubGhz* subghz = context;
  10. subghz_frequency_analyzer_set_callback(
  11. subghz->subghz_frequency_analyzer, subghz_scene_frequency_analyzer_callback, subghz);
  12. view_dispatcher_switch_to_view(subghz->view_dispatcher, SubGhzViewIdFrequencyAnalyzer);
  13. }
  14. bool subghz_scene_frequency_analyzer_on_event(void* context, SceneManagerEvent event) {
  15. SubGhz* subghz = context;
  16. if(event.type == SceneManagerEventTypeCustom) {
  17. if(event.event == SubGhzCustomEventSceneAnalyzerLock) {
  18. notification_message(subghz->notifications, &sequence_set_green_255);
  19. notification_message(subghz->notifications, &sequence_single_vibro);
  20. notification_message(subghz->notifications, &sequence_display_backlight_on);
  21. return true;
  22. } else if(event.event == SubGhzCustomEventSceneAnalyzerUnlock) {
  23. notification_message(subghz->notifications, &sequence_reset_rgb);
  24. return true;
  25. }
  26. }
  27. return false;
  28. }
  29. void subghz_scene_frequency_analyzer_on_exit(void* context) {
  30. SubGhz* subghz = context;
  31. notification_message(subghz->notifications, &sequence_reset_rgb);
  32. }