-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNetwork.h
More file actions
47 lines (37 loc) · 1.23 KB
/
Network.h
File metadata and controls
47 lines (37 loc) · 1.23 KB
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
/*
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
*/
#include "Arduino.h"
#include <HTTPClient.h>
#include <WiFi.h>
#include <WiFiClientSecure.h>
// Wifi ssid and password
extern char ssid[];
extern char pass[];
#ifndef NETWORK_H
#define NETWORK_H
#define NETWORK_RC_OK 0
#define NETWORK_RC_BUFFULL -1
#define NETWORK_RC_PARSEFAIL -2 //function parsing the streamed data failed
#define NETWORK_RC_DATACOMPLETE 1
//As we download data we send it in chunks to the the following function:
//First arg: data to parse
//Second arg: Parsing Context
//
//returns: pointer to start of unparsed data or NULL for error
typedef char *dataParsingFn_t(char *, void *);
// All functions defined in Network.cpp
class Network
{
public:
// Functions we can access in main file
void begin(const char *timeZoneString);
int getData(const char *url, size_t maxbufsize, dataParsingFn_t parser, void *parsingContext);
private:
// Functions called from within our class
void setTime(const char *timeZoneString);
};
#endif