Miguel Maldonado / ESP8266

Dependents:   ESP8266_Connect

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 SendCMD(char * s);
00025 void Reset(void);
00026 void RcvReply(char * r, int to);
00027 void RcvSingleReply(char * r);
00028 void GetList(char * l);
00029 void Join(char * id, char * pwd);
00030 void GetIP(char * ip);
00031 void SetMode(char mode);
00032 void Quit(void);
00033 void SetSingle(void);
00034 void SetMultiple(void);
00035 void GetConnStatus(char * st);
00036 void StartServerMode(int port);
00037 void CloseServerMode(void);
00038 //Funciones que yo he agregado
00039 void StartSmartConfig(void);
00040 void DisableEcho(void);
00041 
00042 private:
00043 Serial comm;
00044 void AddEOL(char * s);
00045 void AddChar(char * s, char c);
00046 void itoa(int c, char s[]);
00047 
00048 };
00049   
00050 #endif
00051 /*
00052     COMMAND TABLE
00053     Basic:
00054     AT: Just to generate "OK" reply
00055     Wifi:
00056     AT+RST:  restart the module
00057     AT+CWMODE: define wifi mode; AT+CWMODE=<mode> 1= Sta, 2= AP, 3=both; Inquiry: AT+CWMODE? or AT+CWMODE=?
00058     AT+CWJAP: join the AP wifi; AT+ CWJAP =<ssid>,< pwd > - ssid = ssid, pwd = wifi password, both between quotes; Inquiry: AT+ CWJAP?
00059     AT+CWLAP: list the AP wifi
00060     AT+CWQAP: quit the AP wifi; Inquiry: AT+CWQAP=?  
00061     * AT+CWSAP: set the parameters of AP; AT+CWSAP= <ssid>,<pwd>,<chl>,<ecn> - ssid, pwd, chl = channel, ecn = encryption; Inquiry: AT+CWJAP?
00062     TCP/IP:
00063     AT+CIPSTATUS: get the connection status
00064     * 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=?
00065     * AT+CIPSEND: send data; 1)single connection(+CIPMUX=0) AT+CIPSEND=<length>; 2) multiple connection (+CIPMUX=1) AT+CIPSEND= <id>,<length>; Inquiry: AT+CIPSEND=?
00066     * AT+CIPCLOSE: close TCP or UDP connection; AT+CIPCLOSE=<id> or AT+CIPCLOSE; Inquiry: AT+CIPCLOSE=?
00067     AT+CIFSR: Get IP address; Inquiry: AT+ CIFSR=?
00068     AT+CIPMUX:  set mutiple connection; AT+ CIPMUX=<mode> - 0 for single connection 1 for mutiple connection; Inquiry: AT+CIPMUX?
00069     AT+CIPSERVER: set as server; AT+ CIPSERVER= <mode>[,<port> ] - mode 0 to close server mode, mode 1 to open; port = port; Inquiry: AT+CIFSR=?
00070     * +IPD: received data
00071 */