ap
Dependencies: DnsQuery
Dependents: WizFi310_TCP_Echo_Server_Example
Fork of NetworkSocketAPI by
Diff: UDPSocket.h
- Revision:
- 81:1600369a29dd
- Parent:
- 80:9c6673c93082
- Child:
- 89:b1d417383c0d
--- 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