summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2015-01-13 09:01:11 +0100
committerlouis <louis.braun@gmx.de>2015-01-13 09:01:11 +0100
commit4d8d1cc629ce5db3862aac75baafa0d1dae69b21 (patch)
tree4850c485c72b61d7576dc6698e6ae8faba44e53f /views
parentc59cc4e6103c38897ceba54b6a88e6934147f263 (diff)
downloadvdr-plugin-skindesigner-4d8d1cc629ce5db3862aac75baafa0d1dae69b21.tar.gz
vdr-plugin-skindesigner-4d8d1cc629ce5db3862aac75baafa0d1dae69b21.tar.bz2
introduced weather service interface
Diffstat (limited to 'views')
-rw-r--r--views/displaychannelview.c13
-rw-r--r--views/displaychannelview.h1
-rw-r--r--views/viewhelpers.c28
-rw-r--r--views/viewhelpers.h1
4 files changed, 43 insertions, 0 deletions
diff --git a/views/displaychannelview.c b/views/displaychannelview.c
index dc4eeea..6526530 100644
--- a/views/displaychannelview.c
+++ b/views/displaychannelview.c
@@ -539,6 +539,19 @@ void cDisplayChannelView::DrawCustomTokens(void) {
DrawViewElement(veCustomTokens, &stringTokens, &intTokens);
}
+void cDisplayChannelView::DrawCurrentWeather(void) {
+ if (!ViewElementImplemented(veCurrentWeather)) {
+ return;
+ }
+ map < string, string > stringTokens;
+ map < string, int > intTokens;
+ SetCurrentWeatherTokens(stringTokens, intTokens);
+
+ ClearViewElement(veCurrentWeather);
+ DrawViewElement(veCurrentWeather, &stringTokens, &intTokens);
+}
+
+
void cDisplayChannelView::Action(void) {
SetInitFinished();
FadeIn();
diff --git a/views/displaychannelview.h b/views/displaychannelview.h
index bae9910..5990232 100644
--- a/views/displaychannelview.h
+++ b/views/displaychannelview.h
@@ -51,6 +51,7 @@ public:
void ClearChannelGroups(void);
void DisplayMessage(eMessageType Type, const char *Text);
void DrawCustomTokens(void);
+ void DrawCurrentWeather(void);
void DoStart(void) { Start(); };
void Flush(void) { DoFlush(); };
};
diff --git a/views/viewhelpers.c b/views/viewhelpers.c
index af56b5b..af2233a 100644
--- a/views/viewhelpers.c
+++ b/views/viewhelpers.c
@@ -1,5 +1,6 @@
#include <vdr/menu.h>
#include "../services/scraper2vdr.h"
+#include "../services/weatherforecast.h"
#include "../config.h"
#include "../libcore/helpers.h"
#include "viewhelpers.h"
@@ -425,3 +426,30 @@ bool cViewHelpers::SetDate(map < string, string > &stringTokens, map < string, i
return true;
}
+
+void cViewHelpers::SetCurrentWeatherTokens(map < string, string > &stringTokens, map < string, int > &intTokens) {
+ static cPlugin *pWeatherForecast = cPluginManager::GetPlugin("weatherforecast");
+ if (!pWeatherForecast)
+ return;
+ cServiceCurrentWeather currentWeather;
+ if (!pWeatherForecast->Service("GetCurrentWeather", &currentWeather)) {
+ return;
+ }
+esyslog("skindesigner: service call successfull");
+ stringTokens.insert(pair<string,string>("timestamp", currentWeather.timeStamp));
+ stringTokens.insert(pair<string,string>("temperature", currentWeather.temperature));
+ stringTokens.insert(pair<string,string>("apparenttemperature", currentWeather.apparentTemperature));
+ stringTokens.insert(pair<string,string>("summary", currentWeather.summary));
+ stringTokens.insert(pair<string,string>("icon", currentWeather.icon));
+ stringTokens.insert(pair<string,string>("precipitationintensity", currentWeather.precipitationIntensity));
+ intTokens.insert(pair<string,int>("precipitationprobability", currentWeather.precipitationProbability));
+ stringTokens.insert(pair<string,string>("precipitationtype", currentWeather.precipitationType));
+ intTokens.insert(pair<string,int>("humidity", currentWeather.humidity));
+ stringTokens.insert(pair<string,string>("windspeed", currentWeather.windSpeed));
+ intTokens.insert(pair<string,int>("windbearing", currentWeather.windBearing));
+ stringTokens.insert(pair<string,string>("windbearingstring", currentWeather.windBearingString));
+ stringTokens.insert(pair<string,string>("visibility", currentWeather.visibility));
+ intTokens.insert(pair<string,int>("cloudcover", currentWeather.cloudCover));
+ stringTokens.insert(pair<string,string>("pressure", currentWeather.pressure));
+ stringTokens.insert(pair<string,string>("ozone", currentWeather.ozone));
+}
diff --git a/views/viewhelpers.h b/views/viewhelpers.h
index 2b3167b..82dd7c9 100644
--- a/views/viewhelpers.h
+++ b/views/viewhelpers.h
@@ -16,6 +16,7 @@ protected:
void SetScraperTokens(const cEvent *event, const cRecording *recording, map < string, string > &stringTokens, map < string, int > &intTokens, map < string, vector< map< string, string > > > &loopTokens);
bool SetTime(map < string, string > &stringTokens, map < string, int > &intTokens);
bool SetDate(map < string, string > &stringTokens, map < string, int > &intTokens);
+ void SetCurrentWeatherTokens(map < string, string > &stringTokens, map < string, int > &intTokens);
public:
cViewHelpers(void);
virtual ~cViewHelpers(void);