C027 Interface

Dependencies:   C027_Support(p)

Fork of C027Interface by NetworkSocketAPI

Files at this revision

API Documentation at this revision

Comitter:
sarahmarshy
Date:
Mon Oct 03 22:45:57 2016 +0000
Parent:
18:529fe9a37e0e
Commit message:
Socket attach implemented

Changed in this revision

C027Interface.cpp Show annotated file Show diff for this revision Revisions of this file
C027Interface.h Show annotated file Show diff for this revision Revisions of this file
C027_Support.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 529fe9a37e0e -r 1527acac8b80 C027Interface.cpp
--- a/C027Interface.cpp	Fri Sep 30 13:56:24 2016 +0000
+++ b/C027Interface.cpp	Mon Oct 03 22:45:57 2016 +0000
@@ -207,6 +207,17 @@
     return recv;
 }
 
+void C027Interface::_run()
+{
+    while (true) {
+        _callback(_data);
+        wait(0.25f);
+    }
+}
+
 void C027Interface::socket_attach(void *handle, void (*callback)(void *), void *data)
 {
-}
+    _callback = callback;
+    _data = data;
+    _thread.start(this, &C027Interface::_run);
+}
\ No newline at end of file
diff -r 529fe9a37e0e -r 1527acac8b80 C027Interface.h
--- a/C027Interface.h	Fri Sep 30 13:56:24 2016 +0000
+++ b/C027Interface.h	Mon Oct 03 22:45:57 2016 +0000
@@ -31,7 +31,7 @@
      * @param simpin    Optional PIN for the SIM
      * @param debug     Enable debugging
      */
-    C027Interface(const char *simpin=0, bool debug=true);
+    C027Interface(const char *simpin=0, bool debug=false);
 
     /** Start the interface
      *
@@ -172,6 +172,10 @@
     SocketAddress _ip_address;
     char _mac_address[NSAPI_MAC_SIZE];
     char _pin[sizeof "1234"];
+
+    Thread _thread;
+        void (*_callback)(void *); void *_data;
+      void _run();
 };
 
 #endif
diff -r 529fe9a37e0e -r 1527acac8b80 C027_Support.lib
--- a/C027_Support.lib	Fri Sep 30 13:56:24 2016 +0000
+++ b/C027_Support.lib	Mon Oct 03 22:45:57 2016 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/users/sarahmarshy/code/C027_Support/#b2e9ff5f1bd1
+https://developer.mbed.org/users/sarahmarshy/code/C027_Support/#634f42ee282b