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: C027_Support
Dependents: HelloC027Interface U_Blox_DeviceConnector U_Blox_DeviceConnector U-Blox_Client
Fork of LWIPInterface by
Revision 16:eaf31bd133f0, committed 2017-02-02
- Comitter:
- sarahmarshy
- Date:
- Thu Feb 02 16:17:35 2017 +0000
- Parent:
- 15:21d4f56eb172
- Child:
- 17:3f1e33e638a4
- Commit message:
- socket_attach and get_stack functions implemented
Changed in this revision
--- a/C027Interface.cpp Tue Apr 26 20:34:29 2016 +0000
+++ b/C027Interface.cpp Thu Feb 02 16:17:35 2017 +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);
}
--- a/C027Interface.h Tue Apr 26 20:34:29 2016 +0000
+++ b/C027Interface.h Thu Feb 02 16:17:35 2017 +0000
@@ -155,6 +155,15 @@
* @note Callback may be called in an interrupt context.
*/
virtual void socket_attach(void *handle, void (*callback)(void *), void *data);
+
+ /** Provide access to the NetworkStack object
+ *
+ * @return The underlying NetworkStack object
+ */
+ virtual NetworkStack *get_stack()
+ {
+ return this;
+ }
private:
// Modem object
@@ -163,6 +172,9 @@
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 Tue Apr 26 20:34:29 2016 +0000 +++ b/C027_Support.lib Thu Feb 02 16:17:35 2017 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/teams/NetworkSocketAPI/code/C027_Support/#596bcb599ac1 +https://developer.mbed.org/teams/NetworkSocketAPI/code/C027_Support/#0d91c7fe072b
