summaryrefslogtreecommitdiff
path: root/weatherforecast.c
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2015-01-17 10:23:39 +0100
committerlouis <louis.braun@gmx.de>2015-01-17 10:23:39 +0100
commita5aa281e337f148e27b17c287e04d8a023856667 (patch)
tree6ff69709bfd9815ece9b29a31ae8397653ff8848 /weatherforecast.c
parentc7f71f3f2b580714bd9e5a5c773bc2179c0e8567 (diff)
downloadvdr-plugin-weatherforecast-0.0.2.tar.gz
vdr-plugin-weatherforecast-0.0.2.tar.bz2
added possibility to use own api key0.0.2
Diffstat (limited to 'weatherforecast.c')
-rw-r--r--weatherforecast.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/weatherforecast.c b/weatherforecast.c
index 49c01ee..5d82fda 100644
--- a/weatherforecast.c
+++ b/weatherforecast.c
@@ -18,7 +18,7 @@
//***************************************************************************
// Constants
//***************************************************************************
-static const char *VERSION = "0.0.1";
+static const char *VERSION = "0.0.2";
static const char *DESCRIPTION = "Weatherforecast based on forecast.io";
static const char *MAINMENUENTRY = "WeatherForecast";
@@ -61,8 +61,9 @@ cPluginWeatherforecast::cPluginWeatherforecast(void) {
}
cPluginWeatherforecast::~cPluginWeatherforecast() {
- if (forecastIO)
+ if (forecastIO) {
delete forecastIO;
+ }
}
const char *cPluginWeatherforecast::CommandLineHelp(void) {
@@ -108,7 +109,9 @@ bool cPluginWeatherforecast::Start(void) {
}
void cPluginWeatherforecast::Stop(void) {
-
+ if (forecastIO) {
+ forecastIO->Stop();
+ }
}
void cPluginWeatherforecast::Housekeeping(void) {
@@ -145,7 +148,11 @@ bool cPluginWeatherforecast::Service(const char *Id, void *Data) {
return false;
if (strcmp(Id, "GetCurrentWeather") == 0) {
cServiceCurrentWeather* call = (cServiceCurrentWeather*) Data;
- return forecastIO->SetCurrentWeather(call);
+ bool ok = false;
+ forecastIO->LockForecasts();
+ ok = forecastIO->SetCurrentWeather(call);
+ forecastIO->UnlockForecasts();
+ return ok;
}
return false;
}