MiCO MXCHIP
/
MXCHIP_WIFI_Demo
It's MXCHIP WIFI demo.
MXCHIP_WIFI_Driver/MXCHIP/MXCHIP.h
- Committer:
- lizhibo32
- Date:
- 2017-03-21
- Revision:
- 0:cd7c54f07d25
File content as of revision 0:cd7c54f07d25:
#ifndef __MBED_MXCHIP_H #define __MBED_MXCHIP_H #include "ATParser.h" class MXCHIP { public: MXCHIP(PinName tx, PinName rx, bool debug=false); /** * Startup the ESP8266 * * @param mode mode of WIFI 1-client, 2-host, 3-both * @return true only if ESP8266 was setup correctly */ bool startup(int mode); /** * Reset ESP8266 * * @return true only if ESP8266 resets successfully */ bool reset(void); /** * Enable/Disable DHCP * * @param enabled DHCP enabled when true * @param mode mode of DHCP 0-softAP, 1-station, 2-both * @return true only if ESP8266 enables/disables DHCP successfully */ bool dhcp(bool enabled, int mode); /** * Connect ESP8266 to AP * * @param ap the name of the AP * @param passPhrase the password of AP * @return true only if ESP8266 is connected successfully */ bool connect(const char *ap, const char *passPhrase); /** * Disconnect ESP8266 from AP * * @return true only if ESP8266 is disconnected successfully */ bool disconnect(void); /** * Get the IP address of ESP8266 * * @return null-teriminated IP address or null if no IP address is assigned */ const char *getIPAddress(void); /** * Get the MAC address of ESP8266 * * @return null-terminated MAC address or null if no MAC address is assigned */ const char *getMACAddress(void); /** Get the local gateway * * @return Null-terminated representation of the local gateway * or null if no network mask has been recieved */ const char *getGateway(); /** Get the local network mask * * @return Null-terminated representation of the local network mask * or null if no network mask has been recieved */ const char *getNetmask(); private: BufferedSerial _serial; ATParser _parser; struct packet { struct packet *next; int id; uint32_t len; // data follows } *_packets, **_packets_end; //buffer char _ip_buffer[16]; char _gateway_buffer[16]; char _netmask_buffer[16]; char _mac_buffer[18]; } #endif