summaryrefslogtreecommitdiff
path: root/config.c
blob: 3762b9d8af186bfe01f8009dd68915cefca6333e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "config.h"

cWeatherforecastConfig::cWeatherforecastConfig() {
    //number of hours to wait till next update from forecast.io is fetched 
    hoursToUpdate = 20;
    //if own API Key is set, user can configure its own udate frequence
    userHoursToUpdate = 0;
    //city to display in menus
    city = "";
    //latitude and longitude of location for forecast.io query
    lat = 0.0;
    lon = 0.0;
    //User can configure individual API Key
    userApiKey = "";
}

cWeatherforecastConfig::~cWeatherforecastConfig() {
}

bool cWeatherforecastConfig::SetupParse(const char *Name, const char *Value) {
    if      (!strcasecmp(Name, "city"))           city = Value;
    else if (!strcasecmp(Name, "lat"))            lat = atod(Value);
    else if (!strcasecmp(Name, "lon"))            lon = atod(Value);
    else if (!strcasecmp(Name, "userapikey"))     userApiKey = Value;
    else if (!strcasecmp(Name, "updatefreq"))     userHoursToUpdate = atoi(Value);
    else return false;
    return true;
}