Connect Wi-Fi

Dependencies:   mbed

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