subghz_scene_frequency_analyzer.c 1.6 KB

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