blabla
Fork of ESP8266Interface by
Revision 14:4d1128f72e00, committed 2014-11-30
- Comitter:
- michaeljkoster
- Date:
- Sun Nov 30 21:37:16 2014 +0000
- Parent:
- 13:41098c907200
- Child:
- 15:37a7a56a424f
- Commit message:
- Add getIPAddress
Changed in this revision
--- a/ESP8266/ESP8266.cpp Sun Nov 30 21:14:09 2014 +0000 +++ b/ESP8266/ESP8266.cpp Sun Nov 30 21:37:16 2014 +0000 @@ -137,6 +137,10 @@ return true; } +char* ESP8266::getIPAddress() +{ + return ipString; +} void ESP8266::reset() { @@ -169,7 +173,7 @@ char ESP8266::getc() { - char c; + char c=0; while (!buf_ESP8266.available()); buf_ESP8266.dequeue(&c); return c;
--- a/ESP8266/ESP8266.h Sun Nov 30 21:14:09 2014 +0000 +++ b/ESP8266/ESP8266.h Sun Nov 30 21:37:16 2014 +0000 @@ -77,6 +77,11 @@ bool is_connected(); /** + * Return the IP address + * @return IP address as a string + */ + char* getIPAddress(); + /** * Reset the wifi module */ void reset(); @@ -162,7 +167,7 @@ DigitalOut reset_pin; char phrase[30]; char ssid[30]; - const char * ip; + char ipString[20]; CircBuffer<char> buf_ESP8266; static ESP8266 * inst;
--- a/ESP8266Interface.cpp Sun Nov 30 21:14:09 2014 +0000 +++ b/ESP8266Interface.cpp Sun Nov 30 21:37:16 2014 +0000 @@ -4,18 +4,17 @@ const char * ssid, const char * phrase ) : ESP8266(tx, rx, reset, ssid, phrase ) { - ip_set = false; } int ESP8266Interface::init() { - reset(); + ESP8266::reset(); return 0; } int ESP8266Interface::connect() { - return join(); + return ESP8266::join(); } int ESP8266Interface::disconnect() @@ -25,7 +24,5 @@ char * ESP8266Interface::getIPAddress() { - ip_set = true; - - return ip_string; + return ESP8266::getIPAddress(); } \ No newline at end of file
--- a/ESP8266Interface.h Sun Nov 30 21:14:09 2014 +0000 +++ b/ESP8266Interface.h Sun Nov 30 21:37:16 2014 +0000 @@ -64,8 +64,6 @@ char* getIPAddress(); private: - char ip_string[20]; - bool ip_set; }; #include "UDPSocket.h"