aboutsummaryrefslogtreecommitdiffstats
path: root/src/displayapp/screens/Weather.h
diff options
context:
space:
mode:
authorVictor Kareh <vkareh@redhat.com>2024-01-31 17:41:39 -0500
committerJF <JF002@users.noreply.github.com>2024-02-18 12:57:48 +0100
commitf422929d8cd0877c56e55d285f3ab3cc1223ea96 (patch)
treec3c3aeafae0305eaaec66f6e65773d1a6d6b4f6b /src/displayapp/screens/Weather.h
parent5d971690cb7fcf51e0215a9eda16136607cf1851 (diff)
weather: Add new app with forecast
Diffstat (limited to 'src/displayapp/screens/Weather.h')
-rw-r--r--src/displayapp/screens/Weather.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/displayapp/screens/Weather.h b/src/displayapp/screens/Weather.h
new file mode 100644
index 00000000..6975311e
--- /dev/null
+++ b/src/displayapp/screens/Weather.h
@@ -0,0 +1,56 @@
+#pragma once
+
+#include <cstdint>
+#include <lvgl/lvgl.h>
+#include "displayapp/screens/Screen.h"
+#include "components/ble/SimpleWeatherService.h"
+#include "displayapp/apps/Apps.h"
+#include "displayapp/Controllers.h"
+#include "Symbols.h"
+#include "utility/DirtyValue.h"
+
+namespace Pinetime {
+
+ namespace Controllers {
+ class Settings;
+ }
+
+ namespace Applications {
+ namespace Screens {
+
+ class Weather : public Screen {
+ public:
+ Weather(Controllers::Settings& settingsController, Controllers::SimpleWeatherService& weatherService);
+ ~Weather() override;
+
+ void Refresh() override;
+
+ private:
+ Controllers::Settings& settingsController;
+ Controllers::SimpleWeatherService& weatherService;
+
+ Utility::DirtyValue<std::optional<Controllers::SimpleWeatherService::CurrentWeather>> currentWeather {};
+ Utility::DirtyValue<std::optional<Controllers::SimpleWeatherService::Forecast>> currentForecast {};
+
+ lv_obj_t* icon;
+ lv_obj_t* condition;
+ lv_obj_t* temperature;
+ lv_obj_t* minTemperature;
+ lv_obj_t* maxTemperature;
+ lv_obj_t* forecast;
+
+ lv_task_t* taskRefresh;
+ };
+ }
+
+ template <>
+ struct AppTraits<Apps::Weather> {
+ static constexpr Apps app = Apps::Weather;
+ static constexpr const char* icon = Screens::Symbols::cloudSunRain;
+
+ static Screens::Screen* Create(AppControllers& controllers) {
+ return new Screens::Weather(controllers.settingsController, *controllers.weatherController);
+ };
+ };
+ }
+}