forked from FKainka/NanoESP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NanoESP.h
79 lines (62 loc) · 2.03 KB
/
NanoESP.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
/*
NanoESP.h - Library for the IoT WiFi-Board NanoESP (aka Pretzelboard)
Created by Fabian Kainka, [email protected], 29.09.2015
www.iot.fkainka.de
*/
#define STATION 1
#define ACCESSPOINT 2
#define DUAL 3
#define TCP "TCP"
#define UDP "UDP"
#define GET "GET"
#define POST "PSOT"
#ifndef _NANOESP_H_
#define _NANOESP_H_
#include "Arduino.h"
#include <SoftwareSerial.h>
class NanoESP : public SoftwareSerial {
public:
NanoESP() ;
boolean init(boolean vDebug=false);
boolean sendCom(String command, char respond[]);
String sendCom(String command);
boolean setMultipleConnections();
boolean setTransferMode() ;
boolean reset();
boolean configWifi(int modus, String ssid, String password);
boolean configWifiMode(int modus);
boolean configWifiStation(String ssid, String password);
boolean configWifiAP(String ssid, String password);
boolean configWifiAP(String ssid, String password, int channel, int crypt);
boolean disconnectWifi();
String getIp();
boolean newConnection(int id, String type, String ip , unsigned int port);
boolean closeConnection(int id) ;
boolean startUdpServer(int id, String ip , unsigned int port, unsigned int recvport, int mode=0);
boolean endUdpServer(int id);
boolean startTcpServer(unsigned int port) ;
boolean endTcpServer();
boolean sendData(int id, String msg);
boolean sendDataClose(int id, String msg);
int getId(); //Obsolet? !!!
//int ping(String adress);
//----NEW----14.04.2016
bool wifiConnected(); //changed 19.04.2016
bool recvData(int &id,int &len);
//----NEW----19.04.2016
bool getIpMac(String &ip, String &mac);
//----NEW----21.04.2016
bool sendRaw(int id, unsigned char data[], int LenChar);
//----NEW----28.04.2016
int ping(String adress);
//bool sendNTPpacket(int id, String address);
//long getNTPpacket(int id, String address, int timeZone);
//----TEST------
void serialDebug();
private :
String at = "AT+";
String cip = "CIP";
String cw = "CW";
boolean debug = false;
};
#endif