flip_weather.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. FlipWeatherViewWeather, // The weather screen
  20. FlipWeatherViewGPS, // The GPS screen
  21. FlipWeatherViewSubmenu, // The main submenu
  22. FlipWeatherViewAbout, // The about screen
  23. FlipWeatherViewSettings, // The wifi settings screen
  24. FlipWeatherViewTextInputSSID, // The text input screen for SSID
  25. FlipWeatherViewTextInputPassword, // The text input screen for password
  26. } FlipWeatherView;
  27. // Each screen will have its own view
  28. typedef struct
  29. {
  30. ViewDispatcher *view_dispatcher; // Switches between our views
  31. View *view_weather; // The weather view
  32. View *view_gps; // The GPS view
  33. Submenu *submenu; // The main submenu
  34. Widget *widget; // The widget (about)
  35. VariableItemList *variable_item_list; // The variable item list (settngs)
  36. VariableItem *variable_item_ssid; // The variable item
  37. VariableItem *variable_item_password; // The variable item
  38. UART_TextInput *uart_text_input_ssid; // The text input
  39. UART_TextInput *uart_text_input_password; // The text input
  40. char *uart_text_input_buffer_ssid; // Buffer for the text input
  41. char *uart_text_input_temp_buffer_ssid; // Temporary buffer for the text input
  42. uint32_t uart_text_input_buffer_size_ssid; // Size of the text input buffer
  43. char *uart_text_input_buffer_password; // Buffer for the text input
  44. char *uart_text_input_temp_buffer_password; // Temporary buffer for the text input
  45. uint32_t uart_text_input_buffer_size_password; // Size of the text input buffer
  46. } FlipWeatherApp;
  47. extern char city_data[48];
  48. extern char region_data[48];
  49. extern char country_data[48];
  50. extern char lat_data[32];
  51. extern char lon_data[32];
  52. extern char ip_data[32];
  53. extern char temperature_data[32];
  54. extern char precipitation_data[32];
  55. extern char rain_data[32];
  56. extern char showers_data[32];
  57. extern char snowfall_data[32];
  58. extern char time_data[32];
  59. extern char ip_address[16];
  60. // Function to free the resources used by FlipWeatherApp
  61. void flip_weather_app_free(FlipWeatherApp *app);
  62. #endif