pengfei wu
/
ESP8266Program
For test
Diff: uartWiFi.h
- Revision:
- 9:95a0ce98e12b
- Parent:
- 8:577f955031ea
--- a/uartWiFi.h Sat Jan 31 11:33:31 2015 +0000 +++ b/uartWiFi.h Sat Jan 31 12:21:04 2015 +0000 @@ -1,6 +1,5 @@ #ifndef __UARTWIFI_H__ #define __UARTWIFI_H__ -#if 0 #include "mbed.h" @@ -21,22 +20,24 @@ #define ESP8266_TCP 1 #define ESP8266_UDP 0 -//The type of initialized WIFI +//The type of initialized ESP8266 #define ESP8266_MODE_STA 1 #define ESP8266_MODE_SAP 2 #define ESP8266_MODE_STA_SAP 3 +//Default channel +#define ESP8266_DEFAULT_CHANNEL (7) /* 1 - 13 */ -class WIFI +class ESP8266 { public: void begin(void); //Initialize port - bool Initialize(byte mode, String ssid, String pwd, byte chl = 1, byte ecn = 2); + bool Initialize(byte mode, String ssid, String pwd, byte chl = ESP8266_DEFAULT_CHANNEL, byte ecn = ESP8266_ECN_WAP_WAP2_PSK); - bool ipConfig(byte type, String addr, int port, bool a = 0, byte id = 0); + bool ipConfig(byte type, String addr, int port, byte a = 0, byte id = 0); //send data in sigle connection mode bool Send(String str); @@ -101,5 +102,5 @@ bool confServer(byte mode, int port); }; -#endif + #endif \ No newline at end of file