ESP8266

Dependencies:   mbed

Fork of Client-ESP8266 by Digital dog

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ESP8266.h Source File

ESP8266.h

00001 #ifndef ESP8266_H
00002 #define ESP8266_H
00003 
00004 #include <string>
00005 #include "mbed.h"
00006 
00007 class ESP8266
00008 {
00009 public:
00010 /**
00011   * ESP8266 constructor
00012   *
00013   * @param tx TX pin
00014   * @param rx RX pin
00015   * @param br Baud Rate
00016   */
00017   ESP8266(PinName tx, PinName rx, int br);
00018 
00019   /**
00020   * ESP8266 destructor
00021   */
00022   ~ESP8266();
00023 
00024 void check(void);
00025 void SendData(char * str);
00026 void transfer(void);
00027 void look(void);
00028 void SetPath(char * t, char* o, char * v);
00029 void Check(char * con);
00030 void SendCMD(char * s);
00031 void Reset(void);
00032 void RcvReply(char * r, int to);
00033 void GetList(char * l);
00034 void Join(char * id, char * pwd);
00035 void GetIP(char * ip);
00036 void SetMode(char mode);
00037 void Quit(void);
00038 void SetSingle(void);
00039 void SetMultiple(void);
00040 void GetConnStatus(char * st);
00041 void StartServerMode(int port);
00042 void CloseServerMode(void);
00043 
00044 private:
00045 Serial comm;
00046 void AddEOL(char * s);
00047 void AddChar(char * s, char c);
00048 void itoa(int c, char s[]);
00049 
00050 };
00051   
00052 #endif
00053 /*
00054     COMMAND TABLE
00055     Basic:
00056     AT: Just to generate "OK" reply
00057     Wifi:
00058     AT+RST:  restart the module
00059     AT+CWMODE: define wifi mode; AT+CWMODE=<mode> 1= Sta, 2= AP, 3=both; Inquiry: AT+CWMODE? or AT+CWMODE=?
00060     AT+CWJAP: join the AP wifi; AT+ CWJAP =<ssid>,< pwd > - ssid = ssid, pwd = wifi password, both between quotes; Inquiry: AT+ CWJAP?
00061     AT+CWLAP: list the AP wifi
00062     AT+CWQAP: quit the AP wifi; Inquiry: AT+CWQAP=?  
00063     * AT+CWSAP: set the parameters of AP; AT+CWSAP= <ssid>,<pwd>,<chl>,<ecn> - ssid, pwd, chl = channel, ecn = encryption; Inquiry: AT+CWJAP?
00064     TCP/IP:
00065     AT+CIPSTATUS: get the connection status
00066     * AT+CIPSTART: set up TCP or UDP connection 1)single connection (+CIPMUX=0) AT+CIPSTART= <type>,<addr>,<port>; 2) multiple connection (+CIPMUX=1) AT+CIPSTART= <id><type>,<addr>, <port> - id = 0-4, type = TCP/UDP, addr = IP address, port= port; Inquiry: AT+CIPSTART=?
00067     * AT+CIPSEND: send data; 1)single connection(+CIPMUX=0) AT+CIPSEND=<length>; 2) multiple connection (+CIPMUX=1) AT+CIPSEND= <id>,<length>; Inquiry: AT+CIPSEND=?
00068     * AT+CIPCLOSE: close TCP or UDP connection; AT+CIPCLOSE=<id> or AT+CIPCLOSE; Inquiry: AT+CIPCLOSE=?
00069     AT+CIFSR: Get IP address; Inquiry: AT+ CIFSR=?
00070     AT+CIPMUX:  set mutiple connection; AT+ CIPMUX=<mode> - 0 for single connection 1 for mutiple connection; Inquiry: AT+CIPMUX?
00071     AT+CIPSERVER: set as server; AT+ CIPSERVER= <mode>[,<port> ] - mode 0 to close server mode, mode 1 to open; port = port; Inquiry: AT+CIFSR=?
00072     * +IPD: received data
00073 */