weather_station_scene_receiver_info.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #include "../weather_station_app_i.h"
  2. #include "../views/weather_station_receiver.h"
  3. void weather_station_scene_receiver_info_callback(WSCustomEvent event, void* context) {
  4. furi_assert(context);
  5. WeatherStationApp* app = context;
  6. view_dispatcher_send_custom_event(app->view_dispatcher, event);
  7. }
  8. static void weather_station_scene_receiver_info_add_to_history_callback(
  9. SubGhzReceiver* receiver,
  10. SubGhzProtocolDecoderBase* decoder_base,
  11. void* context) {
  12. furi_assert(context);
  13. WeatherStationApp* app = context;
  14. if(ws_history_add_to_history(app->txrx->history, decoder_base, app->txrx->preset) ==
  15. WSHistoryStateAddKeyUpdateData) {
  16. ws_view_receiver_info_update(
  17. app->ws_receiver_info,
  18. ws_history_get_raw_data(app->txrx->history, app->txrx->idx_menu_chosen));
  19. subghz_receiver_reset(receiver);
  20. notification_message(app->notifications, &sequence_blink_green_10);
  21. app->txrx->rx_key_state = WSRxKeyStateAddKey;
  22. }
  23. }
  24. void weather_station_scene_receiver_info_on_enter(void* context) {
  25. WeatherStationApp* app = context;
  26. subghz_receiver_set_rx_callback(
  27. app->txrx->receiver, weather_station_scene_receiver_info_add_to_history_callback, app);
  28. ws_view_receiver_info_update(
  29. app->ws_receiver_info,
  30. ws_history_get_raw_data(app->txrx->history, app->txrx->idx_menu_chosen));
  31. view_dispatcher_switch_to_view(app->view_dispatcher, WeatherStationViewReceiverInfo);
  32. }
  33. bool weather_station_scene_receiver_info_on_event(void* context, SceneManagerEvent event) {
  34. WeatherStationApp* app = context;
  35. bool consumed = false;
  36. UNUSED(app);
  37. UNUSED(event);
  38. return consumed;
  39. }
  40. void weather_station_scene_receiver_info_on_exit(void* context) {
  41. UNUSED(context);
  42. }