now this shit works
Fork of ESP8266NodeMCUInterface by
Diff: ESP8266Interface.h
- Revision:
- 44:16da10e7b3f7
- Parent:
- 28:91e65e22e63a
--- a/ESP8266Interface.h Fri May 01 18:29:38 2015 +0000 +++ b/ESP8266Interface.h Wed Jun 03 21:44:20 2015 +0000 @@ -32,40 +32,42 @@ /** * Constructor * - * \param tx mbed pin to use for tx line of Serial interface - * \param rx mbed pin to use for rx line of Serial interface - * \param reset reset pin of the wifi module () - * \param ssid ssid of the network - * \param phrase WEP or WPA key - * \param baud the baudrate of the serial connection (defaults to 115200, diff revs of the firmware use diff baud rates + * @param tx mbed pin to use for tx line of Serial interface + * @param rx mbed pin to use for rx line of Serial interface + * @param reset reset pin of the wifi module () + * @param baud the baudrate of the serial connection + * @param timeout the timeout of the serial connection */ - ESP8266Interface(PinName tx, PinName rx, PinName reset, const char * ssid, const char * phrase, uint32_t baud = 115200 ); - - /** Initialize the interface with DHCP. - * Initialize the interface and configure it to use DHCP (no connection at this point). - * \return 0 on success, a negative number on failure - */ - int init(); //With DHCP + ESP8266Interface(PinName tx, PinName rx, PinName reset, int baud = 9600, int timeout = 3000); + + /** + * Initialize the wifi hardware + * + * @return true if successful + */ + bool init(); - /** Connect - * Bring the interface up, start DHCP if needed. - * \return 0 on success, a negative number on failure - */ - bool connect(); + /** + * Connect the wifi module to the specified ssid. + * + * @param ssid ssid of the network + * @param phrase WEP, WPA or WPA2 key + * @return true if successful + */ + bool connect(const char *ssid, const char *phrase); - /** Disconnect - * Bring the interface down - * \return 0 on success, a negative number on failure - */ - int disconnect(); + /** + * Disconnect the ESP8266 module from the access point + * + * @return true if successful + */ + int disconnect(); - /** Get IP address - * - * \return ip address - */ - char* getIPAddress(); - -private: + /** Get IP address + * + * @return Either a pointer to the internally stored IP address or null if not connected + */ + const char *getIPAddress(); }; #include "UDPSocket.h"