flip_store.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #ifndef FLIP_STORE_E_H
  2. #define FLIP_STORE_E_H
  3. #include <text_input/uart_text_input.h>
  4. #include <flipper_http/flipper_http.h>
  5. #include <easy_flipper/easy_flipper.h>
  6. #include <furi.h>
  7. #include <furi_hal.h>
  8. #include <gui/gui.h>
  9. #include <gui/view.h>
  10. #include <gui/modules/submenu.h>
  11. #include <gui/view_dispatcher.h>
  12. #include <notification/notification.h>
  13. #include <dialogs/dialogs.h>
  14. #include <jsmn/jsmn.h>
  15. #include <flip_store_icons.h>
  16. #define TAG "FlipStore"
  17. #define FIRMWARE_COUNT 3
  18. #define FIRMWARE_LINKS 3
  19. // Define the submenu items for our FlipStore application
  20. typedef enum
  21. {
  22. FlipStoreSubmenuIndexMain, // Click to start downloading the selected app
  23. FlipStoreSubmenuIndexAbout,
  24. FlipStoreSubmenuIndexSettings,
  25. //
  26. FlipStoreSubmenuIndexOptions, // Click to view the options
  27. //
  28. FlipStoreSubmenuIndexAppList,
  29. FlipStoreSubmenuIndexFirmwares,
  30. //
  31. FlipStoreSubmenuIndexAppListBluetooth,
  32. FlipStoreSubmenuIndexAppListGames,
  33. FlipStoreSubmenuIndexAppListGPIO,
  34. FlipStoreSubmenuIndexAppListInfrared,
  35. FlipStoreSubmenuIndexAppListiButton,
  36. FlipStoreSubmenuIndexAppListMedia,
  37. FlipStoreSubmenuIndexAppListNFC,
  38. FlipStoreSubmenuIndexAppListRFID,
  39. FlipStoreSubmenuIndexAppListSubGHz,
  40. FlipStoreSubmenuIndexAppListTools,
  41. FlipStoreSubmenuIndexAppListUSB,
  42. //
  43. FlipStoreSubmenuIndexStartFirmwares,
  44. //
  45. FlipStoreSubmenuIndexStartAppList = 100,
  46. } FlipStoreSubmenuIndex;
  47. // Define a single view for our FlipStore application
  48. typedef enum
  49. {
  50. //
  51. FlipStoreViewSubmenu, // The submenu
  52. FlipStoreViewSubmenuOptions, // The submenu options
  53. //
  54. FlipStoreViewAbout, // The about screen
  55. FlipStoreViewSettings, // The settings screen
  56. FlipStoreViewTextInputSSID, // The text input screen for SSID
  57. FlipStoreViewTextInputPass, // The text input screen for password
  58. //
  59. FlipStoreViewPopup, // The popup screen
  60. //
  61. FlipStoreViewAppList, // The app list screen
  62. FlipStoreViewFirmwares, // The firmwares screen (submenu)
  63. FlipStoreViewFirmwareDialog, // The firmware view (DialogEx) of the selected firmware
  64. //
  65. FlipStoreViewAppInfo, // The app info screen (widget) of the selected app
  66. FlipStoreViewAppDownload, // The app download screen (widget) of the selected app
  67. FlipStoreViewAppDelete, // The app delete screen (DialogEx) of the selected app
  68. //
  69. FlipStoreViewAppListCategory, // the app list screen for each category
  70. //
  71. //
  72. FlipStoreViewWidgetResult, // The text box that displays the random fact
  73. FlipStoreViewLoader, // The loader screen retrieves data from the internet
  74. } FlipStoreView;
  75. // Each screen will have its own view
  76. typedef struct
  77. {
  78. View *view_loader;
  79. Widget *widget_result;
  80. //
  81. ViewDispatcher *view_dispatcher; // Switches between our views
  82. View *view_app_info; // The app info screen (view) of the selected app
  83. //
  84. DialogEx *dialog_firmware; // The dialog for installing a firmware
  85. View *view_firmware_download; // The firmware download screen (view) of the selected firmware
  86. //
  87. Submenu *submenu_main; // The submenu (main)
  88. //
  89. Submenu *submenu_options; // The submenu (options)
  90. Submenu *submenu_app_list; // The submenu (app list) for the selected category
  91. Submenu *submenu_firmwares; // The submenu (firmwares)
  92. Submenu *submenu_app_list_category; // The submenu (app list) for each category
  93. Widget *widget; // The widget
  94. Popup *popup; // The popup
  95. DialogEx *dialog_delete; // The dialog for deleting an app
  96. VariableItemList *variable_item_list; // The variable item list (settngs)
  97. VariableItem *variable_item_ssid; // The variable item
  98. VariableItem *variable_item_pass; // The variable item
  99. UART_TextInput *uart_text_input_ssid; // The text input
  100. UART_TextInput *uart_text_input_pass; // The text input
  101. char *uart_text_input_buffer_ssid; // Buffer for the text input
  102. char *uart_text_input_temp_buffer_ssid; // Temporary buffer for the text input
  103. uint32_t uart_text_input_buffer_size_ssid; // Size of the text input buffer
  104. char *uart_text_input_buffer_pass; // Buffer for the text input
  105. char *uart_text_input_temp_buffer_pass; // Temporary buffer for the text input
  106. uint32_t uart_text_input_buffer_size_pass; // Size of the text input buffer
  107. } FlipStoreApp;
  108. void flip_store_app_free(FlipStoreApp *app);
  109. void flip_store_request_error(Canvas *canvas);
  110. extern FlipStoreApp *app_instance;
  111. #endif // FLIP_STORE_E_H