flip_weather.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef FLIP_WEATHER_E_H
  2. #define FLIP_WEATHER_E_H
  3. #include <flipper_http/flipper_http.h>
  4. #include <easy_flipper/easy_flipper.h>
  5. #include <jsmn/jsmn.h>
  6. #define TAG "FlipWeather"
  7. #define MAX_TOKENS 64 // Adjust based on expected JSON size (50)
  8. // Define the submenu items for our FlipWeather application
  9. typedef enum
  10. {
  11. FlipWeatherSubmenuIndexWeather, // Click to view the weather
  12. FlipWeatherSubmenuIndexGPS, // Click to view the GPS
  13. FlipWeatherSubmenuIndexAbout, // Click to view the about screen
  14. FlipWeatherSubmenuIndexSettings, // Click to view the settings screen
  15. } FlipWeatherSubmenuIndex;
  16. // Define a single view for our FlipWeather application
  17. typedef enum
  18. {
  19. FlipWeatherViewSubmenu, // The main submenu
  20. FlipWeatherViewAbout, // The about screen
  21. FlipWeatherViewSettings, // The wifi settings screen
  22. FlipWeatherViewTextInputSSID, // The text input screen for SSID
  23. FlipWeatherViewTextInputPassword, // The text input screen for password
  24. //
  25. FlipWeatherViewPopupError, // The error popup screen
  26. FlipWeatherViewWidgetResult, // The text box that displays the random fact
  27. FlipWeatherViewLoader, // The loader screen retrieves data from the internet
  28. } FlipWeatherView;
  29. // Each screen will have its own view
  30. typedef struct
  31. {
  32. ViewDispatcher *view_dispatcher; // Switches between our views
  33. View *view_loader; // The screen that loads data from internet
  34. Submenu *submenu; // The main submenu
  35. Widget *widget; // The widget (about)
  36. Widget *widget_result; // The widget that displays the result
  37. Popup *popup_error; // The error popup
  38. VariableItemList *variable_item_list; // The variable item list (settngs)
  39. VariableItem *variable_item_ssid; // The variable item
  40. VariableItem *variable_item_password; // The variable item
  41. TextInput *uart_text_input_ssid; // The text input
  42. TextInput *uart_text_input_password; // The text input
  43. char *uart_text_input_buffer_ssid; // Buffer for the text input
  44. char *uart_text_input_temp_buffer_ssid; // Temporary buffer for the text input
  45. uint32_t uart_text_input_buffer_size_ssid; // Size of the text input buffer
  46. char *uart_text_input_buffer_password; // Buffer for the text input
  47. char *uart_text_input_temp_buffer_password; // Temporary buffer for the text input
  48. uint32_t uart_text_input_buffer_size_password; // Size of the text input buffer
  49. } FlipWeatherApp;
  50. extern char lat_data[32];
  51. extern char lon_data[32];
  52. extern char *total_data;
  53. extern char *weather_data;
  54. // Function to free the resources used by FlipWeatherApp
  55. void flip_weather_app_free(FlipWeatherApp *app);
  56. extern FlipWeatherApp *app_instance;
  57. #endif