flip_library.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. FlipLibrarySubmenuIndexLibrary, // Click to view the library
  23. //
  24. FlipLibrarySubmenuIndexRandomFactsCats, // Click to view the random facts (cats)
  25. FlipLibrarySubmenuIndexRandomFactsDogs, // Click to view the random facts (dogs)
  26. FlipLibrarySubmenuIndexRandomFactsQuotes, // Click to view the random facts (quotes)
  27. FlipLibrarySubmenuIndexRandomFactsAll, // Click to view the random facts (all)
  28. FlipLibrarySubmenuIndexRandomAdvice, // Click to view the random (advice)
  29. FlipLibrarySubmenuIndexRandomTrivia, // Click to view the random trivia
  30. FlipLibrarySubmenuIndexRandomTechPhrase, // Click to view the random tech phrase
  31. FlipLibrarySubmenuIndexRandomUUID, // Click to view the random UUID
  32. FlipLibrarySubmenuIndexRandomAddress, // Click to view the random address
  33. FlipLibrarySubmenuIndexRandomCreditCard, // Click to view the random credit card
  34. FlipLibrarySubmenuIndexRandomUserInfo, // Click to view the random user info
  35. FlipLibrarySubmenuIndexWiki, // Click to view the Wikipedia search
  36. //
  37. FlipLibrarySubmenuIndexGPS, // Click to view the GPS
  38. FlipLibrarySubmenuIndexWeather, // Click to view the weather
  39. FlipLibrarySubmenuIndexElevation, // Click to view the elevation
  40. FlipLibrarySubmenuIndexAssetPrice, // Click to view the asset price
  41. FlipLibrarySubmenuIndexNextHoliday, // Click to view the next holiday
  42. //
  43. FlipLibrarySubmenuIndexPredict, // Click to view the predict submenu
  44. FlipLibrarySubmenuIndexPredictGender, // Click to view the predict gender view,
  45. FlipLibrarySubmenuIndexPredictAge, // Click to view the predict age
  46. FlipLibrarySubmenuIndexPredictEthnicity, // Click to view the predict
  47. } FlipLibrarySubmenuIndex;
  48. // Define a single view for our FlipLibrary application
  49. typedef enum
  50. {
  51. FlipLibraryViewRandomFacts, // The random facts main screen
  52. FlipLibraryViewLoader, // The loader screen retrieves data from the internet
  53. FlipLibraryViewSubmenuMain, // The submenu screen
  54. FlipLibraryViewAbout, // The about screen
  55. FlipLibraryViewSettings, // The settings screen
  56. FlipLibraryViewTextInputSSID, // The text input screen (SSID)
  57. FlipLibraryViewTextInputPassword, // The text input screen (password)
  58. FlipLibraryViewTextInputQuery, // Query the user for information
  59. FlipLibraryViewWidgetResult, // The text box that displays the result
  60. FlipLibraryViewPredict, // The predict screen
  61. FlipLibraryViewSubmenuLibrary, // The library submenu
  62. } FlipLibraryView;
  63. // Each screen will have its own view
  64. typedef struct
  65. {
  66. ViewDispatcher *view_dispatcher; // Switches between our views
  67. View *view_loader; // The screen that loads data from internet
  68. Submenu *submenu_main; // The submenu for the main screen
  69. Submenu *submenu_library; // The submenu for the library screen
  70. Submenu *submenu_random_facts; // The submenu for the random facts screen
  71. Submenu *submenu_predict; // The submenu for the predict screen
  72. Widget *widget_about; // The widget for the about screen
  73. VariableItemList *variable_item_list_wifi; // The variable item list (WiFi settings)
  74. VariableItem *variable_item_ssid; // The variable item (SSID)
  75. VariableItem *variable_item_password; // The variable item (password)
  76. TextInput *uart_text_input_ssid; // The text input for the SSID
  77. TextInput *uart_text_input_password; // The text input for the password
  78. TextInput *uart_text_input_query; // The text input for querying information
  79. //
  80. Widget *widget_result; // The text box that displays the result
  81. char *uart_text_input_buffer_ssid; // Buffer for the text input (SSID)
  82. char *uart_text_input_temp_buffer_ssid; // Temporary buffer for the text input (SSID)
  83. uint32_t uart_text_input_buffer_size_ssid; // Size of the text input buffer (SSID)
  84. char *uart_text_input_buffer_password; // Buffer for the text input (password)
  85. char *uart_text_input_temp_buffer_password; // Temporary buffer for the text input (password)
  86. uint32_t uart_text_input_buffer_size_password; // Size of the text input buffer (password)
  87. char *uart_text_input_buffer_query; // Buffer for the text input (query)
  88. char *uart_text_input_temp_buffer_query; // Temporary buffer for the text input (query)
  89. uint32_t uart_text_input_buffer_size_query; // Size of the text input buffer (query)
  90. } FlipLibraryApp;
  91. // Function to free the resources used by FlipLibraryApp
  92. void flip_library_app_free(FlipLibraryApp *app);
  93. extern FlipLibraryApp *app_instance;
  94. #endif // FLIP_LIBRARY_E_H