-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathESP8266Modem.h
More file actions
42 lines (30 loc) · 948 Bytes
/
ESP8266Modem.h
File metadata and controls
42 lines (30 loc) · 948 Bytes
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
#include <Arduino.h>
#include <stdint.h>
#include <stddef.h>
class ESP8266Modem
{
public:
ESP8266Modem(Stream *ptxSerial, Stream *prxSerial, Stream *pdebugSerial=NULL);
bool isPresent(uint16_t timeout=500, uint8_t retries=2);
String connectWifi(const char * ssid, const char * password, uint16_t timeout=10000);
String disconnectWifi();
String showNetworkStatus();
String swReset();
void setHwResetPin(uint8_t pin);
void hwReset();
String connectToServer(String type, String server, uint16_t port);
String httpGet(String data, uint16_t timeout_ms = 3000);
String sendModemCommand(String cmd, uint16_t timeout=500);
void enableDebug();
void disableDebug();
private:
bool _isDebugEnabled = false;
Stream *_txSerial = NULL;
Stream *_rxSerial = NULL;
Stream *_debugSerial = NULL;
uint8_t _rstPin = 99;
template <typename Output>
void debug_print(Output text);
template <typename Output>
void tx_print(Output text);
};