flip_library.h 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef FLIP_LIBRARY_E_H
  2. #define FLIP_LIBRARY_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. #define TAG "FlipLibrary"
  15. // Define the submenu items for our FlipLibrary application
  16. typedef enum {
  17. FlipLibrarySubmenuIndexRandomFacts, // Click to run the random facts
  18. FlipLibrarySubmenuIndexDictionary, // click to view the dictionary variable item list
  19. FlipLibrarySubmenuIndexAbout, // Click to view the about screen
  20. FlipLibrarySubmenuIndexSettings, // Click to view the WiFi settings
  21. //
  22. FlipLibrarySubmenuIndexRandomFactsCats, // Click to view the random facts (cats)
  23. FlipLibrarySubmenuIndexRandomFactsDogs, // Click to view the random facts (dogs)
  24. FlipLibrarySubmenuIndexRandomFactsQuotes, // Click to view the random facts (quotes)
  25. FlipLibrarySubmenuIndexRandomFactsAll, // Click to view the random facts (all)
  26. } FlipLibrarySubmenuIndex;
  27. // Define a single view for our FlipLibrary application
  28. typedef enum {
  29. FlipLibraryViewRandomFacts = 7, // The random facts main screen
  30. FlipLibraryViewLoader, // The loader screen retrieves data from the internet
  31. FlipLibraryViewSubmenuMain, // The submenu screen
  32. FlipLibraryViewAbout, // The about screen
  33. FlipLibraryViewSettings, // The settings screen
  34. FlipLibraryViewTextInputSSID, // The text input screen (SSID)
  35. FlipLibraryViewTextInputPassword, // The text input screen (password)
  36. FlipLibraryViewTextInputQuery, // Query the user for information
  37. FlipLibraryViewWidgetResult, // The text box that displays the random fact
  38. } FlipLibraryView;
  39. // Each screen will have its own view
  40. typedef struct {
  41. ViewDispatcher* view_dispatcher; // Switches between our views
  42. View* view_loader; // The screen that loads data from internet
  43. Submenu* submenu_main; // The submenu for the main screen
  44. Submenu* submenu_random_facts; // The submenu for the random facts screen
  45. Widget* widget_about; // The widget for the about screen
  46. VariableItemList* variable_item_list_wifi; // The variable item list (WiFi settings)
  47. VariableItem* variable_item_ssid; // The variable item (SSID)
  48. VariableItem* variable_item_password; // The variable item (password)
  49. TextInput* uart_text_input_ssid; // The text input for the SSID
  50. TextInput* uart_text_input_password; // The text input for the password
  51. TextInput* uart_text_input_query; // The text input for querying information
  52. //
  53. Widget* widget_result; // The text box that displays the result
  54. char* uart_text_input_buffer_ssid; // Buffer for the text input (SSID)
  55. char* uart_text_input_temp_buffer_ssid; // Temporary buffer for the text input (SSID)
  56. uint32_t uart_text_input_buffer_size_ssid; // Size of the text input buffer (SSID)
  57. char* uart_text_input_buffer_password; // Buffer for the text input (password)
  58. char* uart_text_input_temp_buffer_password; // Temporary buffer for the text input (password)
  59. uint32_t uart_text_input_buffer_size_password; // Size of the text input buffer (password)
  60. char* uart_text_input_buffer_query; // Buffer for the text input (query)
  61. char* uart_text_input_temp_buffer_query; // Temporary buffer for the text input (query)
  62. uint32_t uart_text_input_buffer_size_query; // Size of the text input buffer (query)
  63. } FlipLibraryApp;
  64. // Function to free the resources used by FlipLibraryApp
  65. void flip_library_app_free(FlipLibraryApp* app);
  66. extern FlipLibraryApp* app_instance;
  67. #endif // FLIP_LIBRARY_E_H