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.
Fork of C027Interface by
Revision 19:1527acac8b80, committed 2016-10-03
- Comitter:
- sarahmarshy
- Date:
- Mon Oct 03 22:45:57 2016 +0000
- Parent:
- 18:529fe9a37e0e
- Commit message:
- Socket attach implemented
Changed in this revision
--- 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
--- 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
--- 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
