flip_store.h 6.2 KB

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