flip_library.h 3.9 KB

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