pengfei wu
/
ESP8266Program
For test
uartWiFi.h
- Committer:
- shennongmin
- Date:
- 2015-01-31
- Revision:
- 8:577f955031ea
- Parent:
- 7:a11e381ce969
- Child:
- 9:95a0ce98e12b
File content as of revision 8:577f955031ea:
#ifndef __UARTWIFI_H__ #define __UARTWIFI_H__ #if 0 #include "mbed.h" #include "WString.h" #include "misc.h" typedef unsigned char byte; //The way of encrypstion #define ESP8266_ECN_OPEN 0 #define ESP8266_ECN_WEP 1 #define ESP8266_ECN_WAP_PSK 2 #define ESP8266_ECN_WAP2_PSK 3 #define ESP8266_ECN_WAP_WAP2_PSK 4 //Communication mode #define ESP8266_TCP 1 #define ESP8266_UDP 0 //The type of initialized WIFI #define ESP8266_MODE_STA 1 #define ESP8266_MODE_SAP 2 #define ESP8266_MODE_STA_SAP 3 class WIFI { public: void begin(void); //Initialize port bool Initialize(byte mode, String ssid, String pwd, byte chl = 1, byte ecn = 2); bool ipConfig(byte type, String addr, int port, bool a = 0, byte id = 0); //send data in sigle connection mode bool Send(String str); //send data int multiple connection mode bool Send(byte id, String str); int ReceiveMessage(char *buf); //reset the module void Reset(void); //set the working mode of module bool confMode(byte a); //set the name and password of wifi bool confJAP(String ssid , String pwd); //set the parametter of SSID, password, channel, encryption in AP mode. bool confSAP(String ssid , String pwd , byte chl , byte ecn); //inquire the current mode of wifi module String showMode(void); //show the list of wifi hotspot String showAP(void); //show the name of current wifi access port String showJAP(void); //quit the connection of current wifi bool quitAP(void); //show the parameter of ssid, password, channel, encryption in AP mode String showSAP(void); //inquire the connection status String showStatus(void); //show the current connection mode(sigle or multiple) String showMux(void); //set the connection mode(sigle:0 or multiple:1) bool confMux(int a); //create new tcp or udp connection (sigle connection mode) bool newMux(byte type, String addr, int port); //create new tcp or udp connection (multiple connection mode)(id:0-4) bool newMux(byte id, byte type, String addr, int port); //close tcp or udp (sigle connection mode) void closeMux(void); //close tcp or udp (multiple connection mode) void closeMux(byte id); //show the current ip address String showIP(void); //set the parameter of server bool confServer(byte mode, int port); }; #endif #endif