Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: ESP8266
Dependents: ESP8266InterfaceTests HelloESP8266Interface
Fork of ESP8266Interface by
Revision 57:2ad35ade7a83, committed 2016-05-10
- Comitter:
- Christopher Haster 
- Date:
- Tue May 10 14:31:58 2016 -0500
- Parent:
- 56:34829ec3a3da
- Commit message:
- Minor documentation changes
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 | 
--- a/ESP8266Interface.cpp	Thu Apr 21 06:11:08 2016 -0500
+++ b/ESP8266Interface.cpp	Tue May 10 14:31:58 2016 -0500
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+ 
 
 #include "ESP8266Interface.h"
 
@@ -31,9 +32,9 @@
 }
 
 int ESP8266Interface::connect(
-    const char *ap, 
-    const char *pass_phrase, 
-    nsapi_security_t)
+    const char *ssid,
+    const char *pass,
+    nsapi_security_t security)
 {
     _esp.setTimeout(ESP8266_CONNECT_TIMEOUT);
 
@@ -45,7 +46,7 @@
         return NSAPI_ERROR_DHCP_FAILURE;
     }
 
-    if (!_esp.connect(ap, pass_phrase)) {
+    if (!_esp.connect(ssid, pass)) {
         return NSAPI_ERROR_NO_CONNECTION;
     }
 
@@ -87,7 +88,7 @@
 {
     // Look for an unused socket
     int id = -1;
-
+ 
     for (int i = 0; i < ESP8266_SOCKET_COUNT; i++) {
         if (!_ids[i]) {
             id = i;
@@ -95,16 +96,16 @@
             break;
         }
     }
-
+ 
     if (id == -1) {
         return NSAPI_ERROR_NO_SOCKET;
     }
-
+    
     struct esp8266_socket *socket = new struct esp8266_socket;
     if (!socket) {
         return NSAPI_ERROR_NO_SOCKET;
     }
-
+    
     socket->id = id;
     socket->proto = proto;
     socket->connected = false;
@@ -203,4 +204,3 @@
 void ESP8266Interface::socket_attach(void *handle, void (*callback)(void *), void *data)
 {
 }
-
--- a/ESP8266Interface.h	Thu Apr 21 06:11:08 2016 -0500
+++ b/ESP8266Interface.h	Tue May 10 14:31:58 2016 -0500
@@ -23,15 +23,15 @@
 #define ESP8266_SOCKET_COUNT 5
 
 /** ESP8266Interface class
- *  Implementation of the NetworkStack for LWIP
+ *  Implementation of the NetworkStack for the ESP8266
  */
 class ESP8266Interface : public NetworkStack, public WiFiInterface
 {
 public:
     /** ESP8266Interface lifetime
-     * @param tx TX pin
-     * @param rx RX pin
-     * @param debug Enable debugging
+     * @param tx        TX pin
+     * @param rx        RX pin
+     * @param debug     Enable debugging
      */
     ESP8266Interface(PinName tx, PinName rx, bool debug = false);
 
@@ -137,7 +137,7 @@
      *  @param address      The remote SocketAddress
      *  @param data         The packet to be sent
      *  @param size         The length of the packet to be sent
-     *  @return the         number of written bytes on success, negative on failure
+     *  @return             The number of written bytes on success, negative on failure
      *  @note This call is not-blocking, if this call would block, must
      *        immediately return NSAPI_ERROR_WOULD_WAIT
      */
@@ -150,7 +150,7 @@
      *                      If a packet is too long to fit in the supplied buffer,
      *                      excess bytes are discarded
      *  @param size         The length of the buffer
-     *  @return the         number of received bytes on success, negative on failure
+     *  @return             The number of received bytes on success, negative on failure
      *  @note This call is not-blocking, if this call would block, must
      *        immediately return NSAPI_ERROR_WOULD_WAIT
      */
@@ -163,7 +163,7 @@
      *  @note Callback may be called in an interrupt context.
      */
     virtual void socket_attach(void *handle, void (*callback)(void *), void *data);
-
+    
 private:
     ESP8266 _esp;
     bool _ids[ESP8266_SOCKET_COUNT];
    