SmartCard reader. PC is interface through USB or TCPport. SmartCard is interfaced through UART@ 1MHz, DIV372

Dependencies:   EthernetNetIf mbed

TcpServer.h

Committer:
bcalin1984
Date:
2011-02-27
Revision:
0:5bf6fcf71548

File content as of revision 0:5bf6fcf71548:

#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));
   };