forked from rszimm/sprinklers_pi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Weather.h
61 lines (54 loc) · 1.32 KB
/
Weather.h
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Weather.h
// This file manages the retrieval of Weather related information and adjustment of durations
// from Weather Underground
// Author: Richard Zimmerman
// Copyright (c) 2013 Richard Zimmerman
//
#ifndef _WEATHER_h
#define _WEATHER_h
#include "port.h"
#include "settings.h"
#define NEUTRAL_HUMIDITY 30
#define PRECIP_FACTOR 100.0
#define WIND_FACTOR 10.0
#define UV_FACTOR 10.0
#define MM_TO_IN 25.4
class Weather
{
public:
struct ReturnVals
{
bool valid;
bool keynotfound;
const char* resolvedIP;
// Yesterday's Values
short minhumidity;
short maxhumidity;
short meantempi;
short precipi;
short windmph;
// Today's Values
short precip_today;
short UV;
};
struct Settings
{
char key[17]; //16 character hex
char apiId[LEN_APIID+1]; // 32 character string
char apiSecret[LEN_APISECRET+1]; // 64 character string
uint32_t zip;
char pws[LEN_PWS+1]; // 11 character string
bool usePws;
char location[LEN_LOC+1]; // 50 character string
};
public:
static Settings GetSettings(void);
int16_t GetScale(void) const;
int16_t GetScale(const Settings & settings) const;
int16_t GetScale(const ReturnVals & vals) const;
ReturnVals GetVals(void) const;
ReturnVals GetVals(const Settings & settings) const;
private:
virtual ReturnVals InternalGetVals(const Settings & settings) const;
};
#endif