weather_station_app_i.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #pragma once
  2. #include "helpers/weather_station_types.h"
  3. #include "scenes/weather_station_scene.h"
  4. #include <gui/gui.h>
  5. #include <gui/view_dispatcher.h>
  6. #include <gui/scene_manager.h>
  7. #include <gui/modules/submenu.h>
  8. #include <gui/modules/variable_item_list.h>
  9. #include <gui/modules/widget.h>
  10. #include <notification/notification_messages.h>
  11. #include "views/weather_station_receiver.h"
  12. #include "views/weather_station_receiver_info.h"
  13. #include "weather_station_history.h"
  14. #include <lib/subghz/subghz_setting.h>
  15. #include <lib/subghz/subghz_worker.h>
  16. #include <lib/subghz/receiver.h>
  17. #include <lib/subghz/transmitter.h>
  18. #include <lib/subghz/registry.h>
  19. #include "helpers/radio_device_loader.h"
  20. typedef struct WeatherStationApp WeatherStationApp;
  21. struct WeatherStationTxRx {
  22. SubGhzWorker* worker;
  23. const SubGhzDevice* radio_device;
  24. SubGhzEnvironment* environment;
  25. SubGhzReceiver* receiver;
  26. SubGhzRadioPreset* preset;
  27. WSHistory* history;
  28. uint16_t idx_menu_chosen;
  29. WSTxRxState txrx_state;
  30. WSHopperState hopper_state;
  31. uint8_t hopper_timeout;
  32. uint8_t hopper_idx_frequency;
  33. WSRxKeyState rx_key_state;
  34. };
  35. typedef struct WeatherStationTxRx WeatherStationTxRx;
  36. struct WeatherStationApp {
  37. Gui* gui;
  38. ViewDispatcher* view_dispatcher;
  39. WeatherStationTxRx* txrx;
  40. SceneManager* scene_manager;
  41. NotificationApp* notifications;
  42. VariableItemList* variable_item_list;
  43. Submenu* submenu;
  44. Widget* widget;
  45. WSReceiver* ws_receiver;
  46. WSReceiverInfo* ws_receiver_info;
  47. WSLock lock;
  48. SubGhzSetting* setting;
  49. };
  50. void ws_preset_init(
  51. void* context,
  52. const char* preset_name,
  53. uint32_t frequency,
  54. uint8_t* preset_data,
  55. size_t preset_data_size);
  56. bool ws_set_preset(WeatherStationApp* app, const char* preset);
  57. void ws_get_frequency_modulation(
  58. WeatherStationApp* app,
  59. FuriString* frequency,
  60. FuriString* modulation);
  61. void ws_begin(WeatherStationApp* app, uint8_t* preset_data);
  62. uint32_t ws_rx(WeatherStationApp* app, uint32_t frequency);
  63. void ws_idle(WeatherStationApp* app);
  64. void ws_rx_end(WeatherStationApp* app);
  65. void ws_sleep(WeatherStationApp* app);
  66. void ws_hopper_update(WeatherStationApp* app);