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: DnsQuery
Fork of NetworkSocketAPI by
Diff: UDPSocket.h
- Revision:
- 9:1600369a29dd
- Parent:
- 8:9c6673c93082
--- a/UDPSocket.h Tue Apr 05 12:02:56 2016 -0500
+++ b/UDPSocket.h Tue Apr 05 12:52:07 2016 -0500
@@ -28,6 +28,7 @@
/** UDPSocket lifetime
*/
UDPSocket(NetworkInterface *iface);
+ virtual ~UDPSocket();
/** Bind a UDP Server Socket to a specific port
\param port The port to listen for incoming connections on
@@ -59,11 +60,25 @@
*/
void attach_send(mbed::FuncPtr<void()> callback);
+ template <typename T, typename M>
+ void attach_send(T *tptr, M mptr) {
+ attach_send(mbed::FuncPtr<void()>(tptr, mptr));
+ }
+
/** Register a callback on when recv is ready
\param callback Function to call when recv will succeed, may be called in
interrupt context.
*/
void attach_recv(mbed::FuncPtr<void()> callback);
+
+ template <typename T, typename M>
+ void attach_recv(T *tptr, M mptr) {
+ attach_recv(mbed::FuncPtr<void()>(tptr, mptr));
+ }
+
+private:
+ mbed::FuncPtr<void()> _send_cb;
+ mbed::FuncPtr<void()> _recv_cb;
};
#endif
