flip_wifi.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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 VERSION "1.6"
  8. #define VERSION_TAG TAG " " VERSION
  9. #define MAX_SCAN_NETWORKS 100
  10. #define MAX_SAVED_NETWORKS 25
  11. #define MAX_SSID_LENGTH 64
  12. // Define the submenu items for our FlipWiFi application
  13. typedef enum
  14. {
  15. FlipWiFiSubmenuIndexAbout,
  16. //
  17. FlipWiFiSubmenuIndexWiFiScan,
  18. FlipWiFiSubmenuIndexWiFiDeauth,
  19. FlipWiFiSubmenuIndexWiFiAP,
  20. FlipWiFiSubmenuIndexWiFiSaved,
  21. FlipWiFiSubmenuIndexCommands,
  22. //
  23. FlipWiFiSubmenuIndexWiFiAPStart,
  24. FlipWiFiSubmenuIndexWiFiAPSetSSID,
  25. FlipWiFiSubmenuIndexWiFiAPSetHTML,
  26. //
  27. FlipWiFiSubmenuIndexWiFiSavedAddSSID,
  28. //
  29. FlipWiFiSubmenuIndexFastCommandStart = 50,
  30. FlipWiFiSubmenuIndexWiFiScanStart = 100,
  31. FlipWiFiSubmenuIndexWiFiSavedStart = 200
  32. } FlipWiFiSubmenuIndex;
  33. // Define a single view for our FlipWiFi application
  34. typedef enum
  35. {
  36. FlipWiFiViewWiFiScan, // The view for the wifi scan screen
  37. FlipWiFiViewWiFiDeauth, // The view for the wifi scan screen
  38. FlipWiFiViewWiFiDeauthWait, // The view for the wifi scan screen
  39. FlipWiFiViewWiFiAP, // The view for the wifi AP screen
  40. FlipWiFiViewWiFiSaved, // The view for the wifi scan screen
  41. //
  42. FlipWiFiViewSubmenuMain, // The submenu for the main screen
  43. FlipWiFiViewSubmenuScan, // The submenu for the wifi scan screen
  44. FlipWiFiViewSubmenuAP, // The submenu for the wifi AP screen
  45. FlipWiFiViewSubmenuSaved, // The submenu for the wifi saved screen
  46. FlipWiFiViewSubmenuCommands, // The submenu for the fast commands screen
  47. FlipWiFiViewAbout, // The about screen
  48. FlipWiFiViewTextInputScan, // The text input screen for the wifi scan screen
  49. FlipWiFiViewTextInputDeauth, // The text input screen for the wifi scan screen
  50. FlipWiFiViewTextInputSaved, // The text input screen for the wifi saved screen
  51. //
  52. FlipWiFiViewTextInputSavedAddSSID, // The text input screen for the wifi saved screen
  53. FlipWiFiViewTextInputSavedAddPassword, // The text input screen for the wifi saved screen
  54. //
  55. FlipWiFiViewGeneric, // generic view
  56. FlipWiFiViewSubmenu, // generic submenu
  57. FlipWiFiViewTextInput, // generic text input
  58. //
  59. FlipWiFiViewWidgetResult, // The text box that displays the random fact
  60. FlipWiFiViewLoader, // The loader screen retrieves data from the internet
  61. } FlipWiFiView;
  62. typedef enum
  63. {
  64. FlipWiFiCustomEventAP,
  65. FlipWiFiCustomEventProcess
  66. } FlipWiFiCustomEvent;
  67. // Define the WiFiPlaylist structure
  68. typedef struct
  69. {
  70. char ssids[MAX_SAVED_NETWORKS][MAX_SSID_LENGTH];
  71. char passwords[MAX_SAVED_NETWORKS][MAX_SSID_LENGTH];
  72. size_t count;
  73. } WiFiPlaylist;
  74. // Each screen will have its own view
  75. typedef struct
  76. {
  77. View *view_loader;
  78. Widget *widget_result;
  79. View *view_message;
  80. //
  81. ViewDispatcher *view_dispatcher; // Switches between our views
  82. Widget *widget_info; // The widget for the about screen
  83. View *view_wifi; // generic view for the wifi scan,ap and saved screens
  84. Submenu *submenu_main; // The submenu for the main screen
  85. Submenu *submenu_wifi; // generic submenu for the wifi scan and saved screens
  86. VariableItemList *variable_item_list_wifi; // The variable item list (settngs)
  87. VariableItem *variable_item_ssid; // The variable item
  88. TextInput *uart_text_input; // The text input screen
  89. char *uart_text_input_buffer; // Buffer for the text input
  90. char *uart_text_input_temp_buffer; // Temporary buffer for the text input
  91. uint32_t uart_text_input_buffer_size; // Size of the text input buffer
  92. TextBox *textbox; // The text box
  93. FlipperHTTP *fhttp; // FlipperHTTP (UART, simplified loading, etc.)
  94. FuriTimer *timer; // timer to redraw the UART data as it comes in
  95. } FlipWiFiApp;
  96. // Function to free the resources used by FlipWiFiApp
  97. void flip_wifi_app_free(FlipWiFiApp *app);
  98. extern WiFiPlaylist *wifi_playlist; // The playlist of wifi networks
  99. extern char *ssid_list[64];
  100. extern uint32_t ssid_index;
  101. extern char current_ssid[64];
  102. extern char current_password[64];
  103. extern bool back_from_ap;
  104. #endif // FLIP_WIFI_E_H