Project in FIBO

Fork of ESP8266 by Janhavi Kulkarni

Committer:
Pairam
Date:
Tue Dec 12 11:39:55 2017 +0000
Revision:
4:8dfe0574a040
Parent:
3:4f24e7e803a1
Project

Who changed what in which revision?

UserRevisionLine numberNew contents of line
quevedo 0:e58f27687450 1 #ifndef ESP8266_H
quevedo 0:e58f27687450 2 #define ESP8266_H
quevedo 0:e58f27687450 3
quevedo 0:e58f27687450 4 #include <string>
quevedo 0:e58f27687450 5 #include "mbed.h"
quevedo 0:e58f27687450 6
quevedo 0:e58f27687450 7 class ESP8266
quevedo 0:e58f27687450 8 {
quevedo 0:e58f27687450 9 public:
quevedo 0:e58f27687450 10 /**
quevedo 0:e58f27687450 11 * ESP8266 constructor
quevedo 0:e58f27687450 12 *
quevedo 0:e58f27687450 13 * @param tx TX pin
quevedo 0:e58f27687450 14 * @param rx RX pin
quevedo 2:77388e8f0697 15 * @param br Baud Rate
quevedo 0:e58f27687450 16 */
quevedo 2:77388e8f0697 17 ESP8266(PinName tx, PinName rx, int br);
quevedo 0:e58f27687450 18
quevedo 0:e58f27687450 19 /**
quevedo 0:e58f27687450 20 * ESP8266 destructor
quevedo 0:e58f27687450 21 */
quevedo 0:e58f27687450 22 ~ESP8266();
quevedo 0:e58f27687450 23
quevedo 0:e58f27687450 24 void SendCMD(char * s);
quevedo 0:e58f27687450 25 void Reset(void);
janhavi 3:4f24e7e803a1 26 bool RcvReply(char * r, int to);
quevedo 0:e58f27687450 27 void GetList(char * l);
quevedo 0:e58f27687450 28 void Join(char * id, char * pwd);
quevedo 0:e58f27687450 29 void GetIP(char * ip);
Pairam 4:8dfe0574a040 30 void Check(char * i);
Pairam 4:8dfe0574a040 31 void GetCon(char * ipp);
quevedo 1:399414d48048 32 void SetMode(char mode);
quevedo 1:399414d48048 33 void Quit(void);
Pairam 4:8dfe0574a040 34 void Close(void);
Pairam 4:8dfe0574a040 35 void Disconnect(void);
quevedo 1:399414d48048 36 void SetSingle(void);
quevedo 1:399414d48048 37 void SetMultiple(void);
quevedo 2:77388e8f0697 38 void GetConnStatus(char * st);
quevedo 2:77388e8f0697 39 void StartServerMode(int port);
quevedo 2:77388e8f0697 40 void CloseServerMode(void);
janhavi 3:4f24e7e803a1 41 void setTransparent(void);
Pairam 4:8dfe0574a040 42 void startTCPConn(char *IP, int port, char * data );
janhavi 3:4f24e7e803a1 43 void sendURL(char *URL, char *command);
Pairam 4:8dfe0574a040 44 void sendURL(char *URL, char *command, char * data);
quevedo 0:e58f27687450 45
quevedo 0:e58f27687450 46 private:
quevedo 0:e58f27687450 47 Serial comm;
quevedo 0:e58f27687450 48 void AddEOL(char * s);
quevedo 0:e58f27687450 49 void AddChar(char * s, char c);
quevedo 2:77388e8f0697 50 void itoa(int c, char s[]);
quevedo 0:e58f27687450 51
quevedo 0:e58f27687450 52 };
quevedo 0:e58f27687450 53
quevedo 0:e58f27687450 54 #endif
quevedo 0:e58f27687450 55 /*
quevedo 0:e58f27687450 56 COMMAND TABLE
quevedo 0:e58f27687450 57 Basic:
quevedo 0:e58f27687450 58 AT: Just to generate "OK" reply
quevedo 0:e58f27687450 59 Wifi:
quevedo 0:e58f27687450 60 AT+RST: restart the module
quevedo 0:e58f27687450 61 AT+CWMODE: define wifi mode; AT+CWMODE=<mode> 1= Sta, 2= AP, 3=both; Inquiry: AT+CWMODE? or AT+CWMODE=?
quevedo 0:e58f27687450 62 AT+CWJAP: join the AP wifi; AT+ CWJAP =<ssid>,< pwd > - ssid = ssid, pwd = wifi password, both between quotes; Inquiry: AT+ CWJAP?
quevedo 0:e58f27687450 63 AT+CWLAP: list the AP wifi
quevedo 0:e58f27687450 64 AT+CWQAP: quit the AP wifi; Inquiry: AT+CWQAP=?
quevedo 1:399414d48048 65 * AT+CWSAP: set the parameters of AP; AT+CWSAP= <ssid>,<pwd>,<chl>,<ecn> - ssid, pwd, chl = channel, ecn = encryption; Inquiry: AT+CWJAP?
quevedo 0:e58f27687450 66 TCP/IP:
quevedo 2:77388e8f0697 67 AT+CIPSTATUS: get the connection status
quevedo 1:399414d48048 68 * 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=?
quevedo 1:399414d48048 69 * AT+CIPSEND: send data; 1)single connection(+CIPMUX=0) AT+CIPSEND=<length>; 2) multiple connection (+CIPMUX=1) AT+CIPSEND= <id>,<length>; Inquiry: AT+CIPSEND=?
quevedo 1:399414d48048 70 * AT+CIPCLOSE: close TCP or UDP connection; AT+CIPCLOSE=<id> or AT+CIPCLOSE; Inquiry: AT+CIPCLOSE=?
quevedo 0:e58f27687450 71 AT+CIFSR: Get IP address; Inquiry: AT+ CIFSR=?
quevedo 0:e58f27687450 72 AT+CIPMUX: set mutiple connection; AT+ CIPMUX=<mode> - 0 for single connection 1 for mutiple connection; Inquiry: AT+CIPMUX?
quevedo 2:77388e8f0697 73 AT+CIPSERVER: set as server; AT+ CIPSERVER= <mode>[,<port> ] - mode 0 to close server mode, mode 1 to open; port = port; Inquiry: AT+CIFSR=?
quevedo 1:399414d48048 74 * +IPD: received data
quevedo 0:e58f27687450 75 */