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.

Dependencies:   mbed

Committer:
pehrhovey
Date:
Wed Mar 17 03:17:38 2010 +0000
Revision:
0:439354122597

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pehrhovey 0:439354122597 1 #ifndef TCPLISTENER_H
pehrhovey 0:439354122597 2 #define TCPLISTENER_H
pehrhovey 0:439354122597 3
pehrhovey 0:439354122597 4 #include "TCPItem.h"
pehrhovey 0:439354122597 5
pehrhovey 0:439354122597 6 #include "arch/cc.h"
pehrhovey 0:439354122597 7 #include "lwip/err.h"
pehrhovey 0:439354122597 8 #include "lwip/tcp.h"
pehrhovey 0:439354122597 9
pehrhovey 0:439354122597 10 namespace mbed {
pehrhovey 0:439354122597 11 class NetServer;
pehrhovey 0:439354122597 12 class TCPConnection;
pehrhovey 0:439354122597 13
pehrhovey 0:439354122597 14 class TCPListener : public TCPItem {
pehrhovey 0:439354122597 15 public:
pehrhovey 0:439354122597 16 TCPListener(u16_t port) : _port(port) {
pehrhovey 0:439354122597 17 }
pehrhovey 0:439354122597 18
pehrhovey 0:439354122597 19 virtual ~TCPListener() {}
pehrhovey 0:439354122597 20
pehrhovey 0:439354122597 21 void bind();
pehrhovey 0:439354122597 22 protected:
pehrhovey 0:439354122597 23 /**
pehrhovey 0:439354122597 24 * Function to call when a listener has been connected.
pehrhovey 0:439354122597 25 * @param err an error argument (TODO: that is current always ERR_OK?)
pehrhovey 0:439354122597 26 * @return ERR_OK: accept the new connection,
pehrhovey 0:439354122597 27 * any other err_t abortsthe new connection
pehrhovey 0:439354122597 28 */
pehrhovey 0:439354122597 29 virtual err_t accept(struct tcp_pcb *, err_t err) = 0;
pehrhovey 0:439354122597 30
pehrhovey 0:439354122597 31 u16_t _port;
pehrhovey 0:439354122597 32 private:
pehrhovey 0:439354122597 33 static err_t accept_callback(void *arg, struct tcp_pcb *newpcb, err_t err);
pehrhovey 0:439354122597 34 friend NetServer;
pehrhovey 0:439354122597 35 friend TCPConnection;
pehrhovey 0:439354122597 36
pehrhovey 0:439354122597 37 };
pehrhovey 0:439354122597 38
pehrhovey 0:439354122597 39 };
pehrhovey 0:439354122597 40
pehrhovey 0:439354122597 41 #endif /* TCPLISTENER_H */