flip_wifi.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef FLIP_WIFI_E_H
  2. #define FLIP_WIFI_E_H
  3. #include <flipper_http/flipper_http.h>
  4. #include <easy_flipper/easy_flipper.h>
  5. #include <storage/storage.h>
  6. #define TAG "FlipWiFi"
  7. #define MAX_SCAN_NETWORKS 100
  8. #define MAX_SAVED_NETWORKS 25
  9. #define MAX_SSID_LENGTH 64
  10. // Define the submenu items for our FlipWiFi application
  11. typedef enum
  12. {
  13. FlipWiFiSubmenuIndexAbout,
  14. //
  15. FlipWiFiSubmenuIndexWiFiScan,
  16. FlipWiFiSubmenuIndexWiFiSaved,
  17. FlipWiFiSubmenuIndexCommands,
  18. //
  19. FlipWiFiSubmenuIndexWiFiSavedAddSSID,
  20. //
  21. FlipWiFiSubmenuIndexFastCommandStart = 50,
  22. FlipWiFiSubmenuIndexWiFiScanStart = 100,
  23. FlipWiFiSubmenuIndexWiFiSavedStart = 200,
  24. } FlipWiFiSubmenuIndex;
  25. // Define a single view for our FlipWiFi application
  26. typedef enum
  27. {
  28. FlipWiFiViewWiFiScan, // The view for the wifi scan screen
  29. FlipWiFiViewWiFiSaved, // The view for the wifi scan screen
  30. //
  31. FlipWiFiViewSubmenuMain, // The submenu for the main screen
  32. FlipWiFiViewSubmenuScan, // The submenu for the wifi scan screen
  33. FlipWiFiViewSubmenuSaved, // The submenu for the wifi saved screen
  34. FlipWiFiViewSubmenuCommands, // The submenu for the fast commands screen
  35. FlipWiFiViewAbout, // The about screen
  36. FlipWiFiViewTextInputScan, // The text input screen for the wifi scan screen
  37. FlipWiFiViewTextInputSaved, // The text input screen for the wifi saved screen
  38. //
  39. FlipWiFiViewTextInputSavedAddSSID, // The text input screen for the wifi saved screen
  40. FlipWiFiViewTextInputSavedAddPassword, // The text input screen for the wifi saved screen
  41. //
  42. FlipWiFiViewGeneric, // generic view
  43. FlipWiFiViewSubmenu, // generic submenu
  44. FlipWiFiViewTextInput, // generic text input
  45. } FlipWiFiView;
  46. // Define the WiFiPlaylist structure
  47. typedef struct
  48. {
  49. char ssids[MAX_SAVED_NETWORKS][MAX_SSID_LENGTH];
  50. char passwords[MAX_SAVED_NETWORKS][MAX_SSID_LENGTH];
  51. size_t count;
  52. } WiFiPlaylist;
  53. // Each screen will have its own view
  54. typedef struct
  55. {
  56. ViewDispatcher *view_dispatcher; // Switches between our views
  57. Widget *widget_info; // The widget for the about screen
  58. View *view_wifi; // generic view for the wifi scan and saved screens
  59. Submenu *submenu_main; // The submenu for the main screen
  60. Submenu *submenu_wifi; // generic submenu for the wifi scan and saved screens
  61. VariableItemList *variable_item_list_wifi; // The variable item list (settngs)
  62. VariableItem *variable_item_ssid; // The variable item
  63. UART_TextInput *uart_text_input; // The text input screen
  64. char *uart_text_input_buffer; // Buffer for the text input
  65. char *uart_text_input_temp_buffer; // Temporary buffer for the text input
  66. uint32_t uart_text_input_buffer_size; // Size of the text input buffer
  67. } FlipWiFiApp;
  68. // Function to free the resources used by FlipWiFiApp
  69. void flip_wifi_app_free(FlipWiFiApp *app);
  70. extern WiFiPlaylist *wifi_playlist; // The playlist of wifi networks
  71. #endif // FLIP_WIFI_E_H