flip_store.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. FlipStoreViewMain, // The main screen for downloading apps
  51. //
  52. FlipStoreViewSubmenu, // The submenu
  53. FlipStoreViewSubmenuOptions, // The submenu options
  54. //
  55. FlipStoreViewAbout, // The about screen
  56. FlipStoreViewSettings, // The settings screen
  57. FlipStoreViewTextInputSSID, // The text input screen for SSID
  58. FlipStoreViewTextInputPass, // The text input screen for password
  59. //
  60. FlipStoreViewPopup, // The popup screen
  61. //
  62. FlipStoreViewAppList, // The app list screen
  63. FlipStoreViewFirmwares, // The firmwares screen (submenu)
  64. FlipStoreViewFirmwareDialog, // The firmware view (DialogEx) of the selected firmware
  65. FlipStoreViewFirmwareDownload, // The firmware download screen
  66. //
  67. FlipStoreViewAppInfo, // The app info screen (widget) of the selected app
  68. FlipStoreViewAppDownload, // The app download screen (widget) of the selected app
  69. FlipStoreViewAppDelete, // The app delete screen (DialogEx) of the selected app
  70. //
  71. FlipStoreViewAppListBluetooth, // the app list screen for Bluetooth
  72. FlipStoreViewAppListGames, // the app list screen for Games
  73. FlipStoreViewAppListGPIO, // the app list screen for GPIO
  74. FlipStoreViewAppListInfrared, // the app list screen for Infrared
  75. FlipStoreViewAppListiButton, // the app list screen for iButton
  76. FlipStoreViewAppListMedia, // the app list screen for Media
  77. FlipStoreViewAppListNFC, // the app list screen for NFC
  78. FlipStoreViewAppListRFID, // the app list screen for RFID
  79. FlipStoreViewAppListSubGHz, // the app list screen for Sub-GHz
  80. FlipStoreViewAppListTools, // the app list screen for Tools
  81. FlipStoreViewAppListUSB, // the app list screen for USB
  82. } FlipStoreView;
  83. // Each screen will have its own view
  84. typedef struct
  85. {
  86. ViewDispatcher *view_dispatcher; // Switches between our views
  87. View *view_main; // The main screen for downloading apps
  88. View *view_app_info; // The app info screen (view) of the selected app
  89. //
  90. DialogEx *dialog_firmware; // The dialog for installing a firmware
  91. View *view_firmware_download; // The firmware download screen (view) of the selected firmware
  92. //
  93. Submenu *submenu_main; // The submenu (main)
  94. //
  95. Submenu *submenu_options; // The submenu (options)
  96. Submenu *submenu_app_list; // The submenu (app list) for the selected category
  97. Submenu *submenu_firmwares; // The submenu (firmwares)
  98. //
  99. Submenu *submenu_app_list_bluetooth; // The submenu (app list) for Bluetooth
  100. Submenu *submenu_app_list_games; // The submenu (app list) for Games
  101. Submenu *submenu_app_list_gpio; // The submenu (app list) for GPIO
  102. Submenu *submenu_app_list_infrared; // The submenu (app list) for Infrared
  103. Submenu *submenu_app_list_ibutton; // The submenu (app list) for iButton
  104. Submenu *submenu_app_list_media; // The submenu (app list) for Media
  105. Submenu *submenu_app_list_nfc; // The submenu (app list) for NFC
  106. Submenu *submenu_app_list_rfid; // The submenu (app list) for RFID
  107. Submenu *submenu_app_list_subghz; // The submenu (app list) for Sub-GHz
  108. Submenu *submenu_app_list_tools; // The submenu (app list) for Tools
  109. Submenu *submenu_app_list_usb; // The submenu (app list) for USB
  110. //
  111. Widget *widget; // The widget
  112. Popup *popup; // The popup
  113. DialogEx *dialog_delete; // The dialog for deleting an app
  114. VariableItemList *variable_item_list; // The variable item list (settngs)
  115. VariableItem *variable_item_ssid; // The variable item
  116. VariableItem *variable_item_pass; // The variable item
  117. UART_TextInput *uart_text_input_ssid; // The text input
  118. UART_TextInput *uart_text_input_pass; // The text input
  119. char *uart_text_input_buffer_ssid; // Buffer for the text input
  120. char *uart_text_input_temp_buffer_ssid; // Temporary buffer for the text input
  121. uint32_t uart_text_input_buffer_size_ssid; // Size of the text input buffer
  122. char *uart_text_input_buffer_pass; // Buffer for the text input
  123. char *uart_text_input_temp_buffer_pass; // Temporary buffer for the text input
  124. uint32_t uart_text_input_buffer_size_pass; // Size of the text input buffer
  125. } FlipStoreApp;
  126. void flip_store_app_free(FlipStoreApp *app);
  127. void flip_store_request_error(Canvas *canvas);
  128. #endif // FLIP_STORE_E_H