weather_station_scene_about.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #include "../weather_station_app_i.h"
  2. #include "../helpers/weather_station_types.h"
  3. void weather_station_scene_about_widget_callback(
  4. GuiButtonType result,
  5. InputType type,
  6. void* context) {
  7. WeatherStationApp* app = context;
  8. if(type == InputTypeShort) {
  9. view_dispatcher_send_custom_event(app->view_dispatcher, result);
  10. }
  11. }
  12. void weather_station_scene_about_on_enter(void* context) {
  13. WeatherStationApp* app = context;
  14. FuriString* temp_str;
  15. temp_str = furi_string_alloc();
  16. furi_string_printf(temp_str, "\e#%s\n", "Information");
  17. furi_string_cat_printf(temp_str, "Version: %s\n", WS_VERSION_APP);
  18. furi_string_cat_printf(temp_str, "Developed by: %s\n", WS_DEVELOPED);
  19. furi_string_cat_printf(temp_str, "Github: %s\n\n", WS_GITHUB);
  20. furi_string_cat_printf(temp_str, "\e#%s\n", "Description");
  21. furi_string_cat_printf(
  22. temp_str, "Reading messages from\nweather stations that work\nwith SubGhz sensors\n\n");
  23. furi_string_cat_printf(temp_str, "Supported protocols:\n");
  24. size_t i = 0;
  25. const char* protocol_name =
  26. subghz_environment_get_protocol_name_registry(app->txrx->environment, i++);
  27. do {
  28. furi_string_cat_printf(temp_str, "%s\n", protocol_name);
  29. protocol_name = subghz_environment_get_protocol_name_registry(app->txrx->environment, i++);
  30. } while(protocol_name != NULL);
  31. widget_add_text_box_element(
  32. app->widget,
  33. 0,
  34. 0,
  35. 128,
  36. 14,
  37. AlignCenter,
  38. AlignBottom,
  39. "\e#\e! \e!\n",
  40. false);
  41. widget_add_text_box_element(
  42. app->widget,
  43. 0,
  44. 2,
  45. 128,
  46. 14,
  47. AlignCenter,
  48. AlignBottom,
  49. "\e#\e! Weather station \e!\n",
  50. false);
  51. widget_add_text_scroll_element(app->widget, 0, 16, 128, 50, furi_string_get_cstr(temp_str));
  52. furi_string_free(temp_str);
  53. view_dispatcher_switch_to_view(app->view_dispatcher, WeatherStationViewWidget);
  54. }
  55. bool weather_station_scene_about_on_event(void* context, SceneManagerEvent event) {
  56. WeatherStationApp* app = context;
  57. bool consumed = false;
  58. UNUSED(app);
  59. UNUSED(event);
  60. return consumed;
  61. }
  62. void weather_station_scene_about_on_exit(void* context) {
  63. WeatherStationApp* app = context;
  64. // Clear views
  65. widget_reset(app->widget);
  66. }