-
Notifications
You must be signed in to change notification settings - Fork 0
/
GoogleGeolocation.h
119 lines (105 loc) · 2.67 KB
/
GoogleGeolocation.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#pragma once
#include "ESP8266WiFi.h"
#include "JsonListener.h"
#include "Wsclient.h"
class Timezone : public JsonListener, public WsClient
{
public:
Timezone() {
// Serial.println("Timezone constructor");
};
~Timezone() {
// Serial.println("Timezone destructor");
};
bool acquire(double latitude, double longitude, String timestamp);
bool isValid();
virtual void whitespace(char c);
virtual void startDocument();
virtual void key(String key);
virtual void value(String value);
virtual void endArray();
virtual void endObject();
virtual void endDocument();
virtual void startArray();
virtual void startObject();
String getTimeZoneId();
String getTimeZoneName();
int getDstOffset();
int getRawOffset();
private:
bool valid = false;
String currentKey;
String currentParent;
int dstOffset;
int rawOffset;
String timeZoneId;
String timeZoneName;
};
class Geolocate : public JsonListener, public WsClient
{
public:
Geolocate() {
// Serial.println("Geolocate constructor");
};
~Geolocate() {
// Serial.println("Geolocate destructor");
};
bool acquire();
bool isValid();
virtual void whitespace(char c);
virtual void startDocument();
virtual void key(String key);
virtual void value(String value);
virtual void endArray();
virtual void endObject();
virtual void endDocument();
virtual void startArray();
virtual void startObject();
double getLatitude();
double getLongitude();
private:
bool valid = false;
double latitude = 0.0;
double longitude = 0.0;
String currentKey;
String currentParent;
};
class Geocode : public JsonListener, public WsClient
{
public:
Geocode() {
// Serial.println("Geocode constructor");
};
~Geocode() {
// Serial.println("Geocode destructor");
};
bool acquire(double latitude, double longitude);
bool isValid();
String getStreet();
String getStreetNumber();
String getPostCode();
String getSubLocality();
String getTown();
String getCountry();
String getFormattedAddress();
virtual void whitespace(char c);
virtual void startDocument();
virtual void key(String key);
virtual void value(String value);
virtual void endArray();
virtual void endObject();
virtual void endDocument();
virtual void startArray();
virtual void startObject();
private:
bool valid = false;
String currentKey;
String savedValue;
String street;
String streetNumber;
String postCode;
String subLocality;
String town;
String country;
String formattedAddress;
};