Changeset 101 for branches/follower

Show
Ignore:
Timestamp:
12/10/07 04:19:27 (13 months ago)
Author:
follower
Message:

Add initial skeleton of the plain socket wrapping 'NetworkConnection?' class--it is not yet used though.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/follower/wiz810mj/src/demo/WizDemo4/WizDemo4.pde

    r100 r101  
    216216/* ----------------------- */ 
    217217 
     218/* ---- NetworkConnection ---- */ 
     219 
     220 
     221// TODO: Make this 'NetworkServerConnection'? Or just 'ServerConnection'? 
     222class NetworkConnection { // Essentially a Socket wrapper 
     223 
     224  public: 
     225    NetworkConnection(uint8_t port); // TODO: Add UDP, TCP choice? 
     226 
     227    void listen(); // TODO: Return a useful value? 
     228 
     229  private: 
     230    SOCKET _socket; 
     231}; 
     232 
     233NetworkConnection::NetworkConnection(uint8_t port) { 
     234  /* 
     235 
     236   */   
     237  socket(_socket, Sn_MR_TCP, port, 0); 
     238} 
     239 
     240void NetworkConnection::listen() { // TODO: Make private or protected? 
     241  /* 
     242 
     243   */   
     244  ::listen(_socket); // TODO: Use C++ namespaces for the driver functions? 
     245} 
     246 
     247/* ----------------------- */ 
     248 
    218249/* --  NetworkInterface -- */ 
    219250 
     
    222253  public: 
    223254    NetworkInterface(Wiz810MjDevice& networkDevice); 
     255     
     256    NetworkConnection listen(uint8_t port); 
    224257 
    225258    Wiz810MjDevice& device; // TODO: Make this a generic "network device" interface 
     
    248281}; 
    249282 
     283NetworkConnection NetworkInterface::listen(uint8_t port) { 
     284   /* 
     285   
     286   
     287      Returns a NetworkConnection listening on the specified TCP port. 
     288   
     289    */ 
     290    NetworkConnection connection = NetworkConnection(port); 
     291     
     292    connection.listen(); 
     293     
     294    return connection; 
     295} 
     296 
    250297// NetworkInterface Network = NetworkInterface(...); // TODO: Make this a global 
    251298 
    252299/* ----------------------- */ 
    253  
    254300 
    255301// #define PIN_RESET 9 // WIZnet module /RESET