Socket interface for C027Interface. Implements the NetworkSocketAPI

Dependencies:   C027_Support

Dependents:   HelloC027Interface U_Blox_DeviceConnector U_Blox_DeviceConnector U-Blox_Client

Fork of LWIPInterface by NetworkSocketAPI

Revision:
21:0c4d90bc84af
Parent:
20:be7a08046b6d
Child:
22:69ea34ad7fc6
--- a/C027Interface.h	Mon Mar 27 15:57:50 2017 +0000
+++ b/C027Interface.h	Mon Mar 27 14:10:06 2017 -0500
@@ -20,6 +20,7 @@
 #include "CellularInterface.h"
 #include "MDM.h"
 
+#define NUMSOCKETS 12
 
 /** C027Interface class
  *  Implementation of the NetworkInterface for C027
@@ -32,7 +33,8 @@
      * @param debug     Enable debugging
      */
     C027Interface(const char *simpin=0, bool debug=false);
-    
+   
+    ~C027Interface(); 
     /** Set the cellular network APN and credentials
      *
      *  @param apn      Optional name of the network to connect to
@@ -119,7 +121,8 @@
      *  @note This call is not-blocking, if this call would block, must
      *        immediately return NSAPI_ERROR_WOULD_WAIT
      */
-    virtual int socket_accept(void **handle, void *server);
+    virtual nsapi_error_t socket_accept(nsapi_socket_t server,
+            nsapi_socket_t *handle, SocketAddress *address=0);
     /** Send data to the remote host
      *  @param handle       Socket handle
      *  @param data         The buffer to send to the host
@@ -193,6 +196,10 @@
     char _username[25];
     char _password[25];
     Thread _thread;
+    struct {
+        void (*callback)(void *);
+        void *data;
+    } _cbs[NUMSOCKETS]; // Callbacks for socket_attach 
     void (*_callback)(void *); void *_data;
     void *_handle;
     void socket_check();