pocsag_pager_scene_about.c 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #include "../pocsag_pager_app_i.h"
  2. #include "../helpers/pocsag_pager_types.h"
  3. void pocsag_pager_scene_about_widget_callback(GuiButtonType result, InputType type, void* context) {
  4. POCSAGPagerApp* app = context;
  5. if(type == InputTypeShort) {
  6. view_dispatcher_send_custom_event(app->view_dispatcher, result);
  7. }
  8. }
  9. void pocsag_pager_scene_about_on_enter(void* context) {
  10. POCSAGPagerApp* app = context;
  11. FuriString* temp_str;
  12. temp_str = furi_string_alloc();
  13. furi_string_printf(temp_str, "\e#%s\n", "Information");
  14. furi_string_cat_printf(temp_str, "Version: %s\n", PCSG_VERSION_APP);
  15. furi_string_cat_printf(temp_str, "Developed by:\n%s\n\n", PCSG_DEVELOPED);
  16. furi_string_cat_printf(temp_str, "Github: %s\n\n", PCSG_GITHUB);
  17. furi_string_cat_printf(temp_str, "\e#%s\n", "Description");
  18. furi_string_cat_printf(temp_str, "Receiving POCSAG Pager \nmessages\n\n");
  19. furi_string_cat_printf(temp_str, "Supported protocols:\n");
  20. size_t i = 0;
  21. const char* protocol_name =
  22. subghz_environment_get_protocol_name_registry(app->txrx->environment, i++);
  23. do {
  24. furi_string_cat_printf(temp_str, "%s\n", protocol_name);
  25. protocol_name = subghz_environment_get_protocol_name_registry(app->txrx->environment, i++);
  26. } while(protocol_name != NULL);
  27. widget_add_text_box_element(
  28. app->widget,
  29. 0,
  30. 0,
  31. 128,
  32. 14,
  33. AlignCenter,
  34. AlignBottom,
  35. "\e#\e! \e!\n",
  36. false);
  37. widget_add_text_box_element(
  38. app->widget,
  39. 0,
  40. 2,
  41. 128,
  42. 14,
  43. AlignCenter,
  44. AlignBottom,
  45. "\e#\e! POCSAG Pager \e!\n",
  46. false);
  47. widget_add_text_scroll_element(app->widget, 0, 16, 128, 50, furi_string_get_cstr(temp_str));
  48. furi_string_free(temp_str);
  49. view_dispatcher_switch_to_view(app->view_dispatcher, POCSAGPagerViewWidget);
  50. }
  51. bool pocsag_pager_scene_about_on_event(void* context, SceneManagerEvent event) {
  52. POCSAGPagerApp* app = context;
  53. bool consumed = false;
  54. UNUSED(app);
  55. UNUSED(event);
  56. return consumed;
  57. }
  58. void pocsag_pager_scene_about_on_exit(void* context) {
  59. POCSAGPagerApp* app = context;
  60. // Clear views
  61. widget_reset(app->widget);
  62. }