SmartCard reader. PC is interface through USB or TCPport. SmartCard is interfaced through UART@ 1MHz, DIV372
Dependencies: EthernetNetIf mbed
Diff: TcpServer.h
- Revision:
- 0:5bf6fcf71548
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TcpServer.h Sun Feb 27 22:20:40 2011 +0000 @@ -0,0 +1,33 @@ +#include "EthernetNetIf.h" +#include "TCPSocket.h" + + class TcpServer + { + EthernetNetIf eth; + /* + EthernetNetIf eth( + IpAddr(192,168,0,25), //IP Address + IpAddr(255,255,255,0), //Network Mask + IpAddr(192,168,0,1), //Gateway + IpAddr(192,168,0,1) //DNS + );*/ + + + TCPSocket ListeningSock; + TCPSocket* pConnectedSock; // for ConnectedSock + Host client; + TCPSocketErr err; + char buff[256]; + + void (*onReceive)(char* buf, int len); + int Setup(int port); + void onConnectedTCPSocketEvent(TCPSocketEvent e); + void onListeningTCPSocketEvent(TCPSocketEvent e); + + void noprintf(const char * format, ...); + public: + TcpServer(int port); + static void doEvents(); + void Tprintf(const char * format, ...); + void SetReceiveCallback(void (*f)(char*buf, int len)); + }; \ No newline at end of file