The driver for the ESP8266 WiFi module - isConnected function added, working and tested with mbed os 5.7.6
Fork of esp8266-driver by
Revision 2:0bc0b654995c, committed 2018-11-04
- Comitter:
- mareszym
- Date:
- Sun Nov 04 12:50:49 2018 +0000
- Parent:
- 1:b4980986fe65
- Commit message:
- isConnected function added
Changed in this revision
ESP8266Interface.cpp | Show annotated file Show diff for this revision Revisions of this file |
ESP8266Interface.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r b4980986fe65 -r 0bc0b654995c ESP8266Interface.cpp --- a/ESP8266Interface.cpp Sun Nov 04 10:15:47 2018 +0000 +++ b/ESP8266Interface.cpp Sun Nov 04 12:50:49 2018 +0000 @@ -67,6 +67,11 @@ return NSAPI_ERROR_OK; } +bool ESP8266Interface::isConnected() +{ + return _esp.isConnected(); + } + int ESP8266Interface::set_credentials(const char *ssid, const char *pass, nsapi_security_t security) { memset(ap_ssid, 0, sizeof(ap_ssid));
diff -r b4980986fe65 -r 0bc0b654995c ESP8266Interface.h --- a/ESP8266Interface.h Sun Nov 04 10:15:47 2018 +0000 +++ b/ESP8266Interface.h Sun Nov 04 12:50:49 2018 +0000 @@ -44,6 +44,14 @@ * @return 0 on success, negative error code on failure */ virtual int connect(); + + /** Check interface connection status + * + * Attempts to check connection to a WiFi network. + * + * @return true only if the chip has an IP address + */ + virtual bool isConnected(); /** Start the interface *