![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Control of mbed using OSC. Based on code from the Make Controller. Right now you can turn the onboard LEDs on/off and toggle 8 digital out pins. More I/O will be done in the future.
lwip/TCPCallbackListener.h@0:439354122597, 2010-03-17 (annotated)
- Committer:
- pehrhovey
- Date:
- Wed Mar 17 03:17:38 2010 +0000
- Revision:
- 0:439354122597
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pehrhovey | 0:439354122597 | 1 | #ifndef TCPCALLBACKLISTENER_H |
pehrhovey | 0:439354122597 | 2 | #define TCPCALLBACKLISTENER_H |
pehrhovey | 0:439354122597 | 3 | |
pehrhovey | 0:439354122597 | 4 | #include "TCPListener.h" |
pehrhovey | 0:439354122597 | 5 | |
pehrhovey | 0:439354122597 | 6 | namespace mbed { |
pehrhovey | 0:439354122597 | 7 | class NetServer; |
pehrhovey | 0:439354122597 | 8 | |
pehrhovey | 0:439354122597 | 9 | class TCPCallbackListener : public TCPListener { |
pehrhovey | 0:439354122597 | 10 | public: |
pehrhovey | 0:439354122597 | 11 | TCPCallbackListener( |
pehrhovey | 0:439354122597 | 12 | u16_t port, |
pehrhovey | 0:439354122597 | 13 | err_t (*paccept)(TCPCallbackListener *, struct tcp_pcb *, err_t)) |
pehrhovey | 0:439354122597 | 14 | : TCPListener(port), _accept(paccept) { |
pehrhovey | 0:439354122597 | 15 | } |
pehrhovey | 0:439354122597 | 16 | |
pehrhovey | 0:439354122597 | 17 | private: |
pehrhovey | 0:439354122597 | 18 | virtual err_t accept(struct tcp_pcb *newpcb, err_t err) { |
pehrhovey | 0:439354122597 | 19 | if(_accept) { |
pehrhovey | 0:439354122597 | 20 | return (_accept)(this, newpcb, err); |
pehrhovey | 0:439354122597 | 21 | } else { |
pehrhovey | 0:439354122597 | 22 | return ERR_OK; |
pehrhovey | 0:439354122597 | 23 | } |
pehrhovey | 0:439354122597 | 24 | } |
pehrhovey | 0:439354122597 | 25 | |
pehrhovey | 0:439354122597 | 26 | err_t (*_accept)(TCPCallbackListener *, struct tcp_pcb *newpcb, err_t err); |
pehrhovey | 0:439354122597 | 27 | |
pehrhovey | 0:439354122597 | 28 | friend class NetServer; |
pehrhovey | 0:439354122597 | 29 | }; |
pehrhovey | 0:439354122597 | 30 | |
pehrhovey | 0:439354122597 | 31 | }; |
pehrhovey | 0:439354122597 | 32 | |
pehrhovey | 0:439354122597 | 33 | #endif /* TCPCALLBACKLISTENER_H */ |