forked from hansvana/CMDWifi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMDWifi.h
47 lines (39 loc) · 992 Bytes
/
CMDWifi.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
/*
CMDWifi.h - Wrapper for the WiFiNINA library
Based on the Repeating Wifi Web Client example
Created 23 April 2012, modified 31 May 2012
by Tom Igoe
Modified 13 Jan 2014
by Federico Vanzati
CMDWifi wrapper created 4 April 2017
by Hans van Arken
Last updated 08 March 2024
by Michael Tjia
Released into the public domain.
*/
#ifndef CMDWifi_h
#define CMDWifi_h
#include "Arduino.h"
#include <SPI.h>
#include <WiFiNINA.h>
class CMDWifi {
public:
CMDWifi();
void connect(char* ssid, char* pass, char* server, int port);
int sendGet(char* sendKey, int value, char* getKey);
int send(char* sendKey, int value);
int get(char* getKey);
private:
int read();
void printWiFiStatus();
void httpRequest(char* urlPars);
char* grabContent(char* response);
int status;
WiFiClient client;
char* hosturl;
char urlPars[50];
int hostport;
unsigned long lastConnectionTime;
const unsigned long postingInterval = 1L * 1000L;
};
#endif