Changeset 97 for branches

Show
Ignore:
Timestamp:
12/08/07 06:01:59 (13 months ago)
Author:
follower
Message:

(*Much* later...) Include skeleton of 'NetworkInterface?' class and enable it to be initialised with a pre-configured 'Wiz810MjDevice' instance. (This required the use of 'References' and an 'initialization list' which was all news to me...)

Files:
1 modified

Legend:

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

    r96 r97  
    216216/* ----------------------- */ 
    217217 
     218/* --  NetworkInterface -- */ 
     219 
     220class NetworkInterface { 
     221   
     222  public: 
     223    NetworkInterface(Wiz810MjDevice& networkDevice); 
     224 
     225    Wiz810MjDevice& device; // TODO: Make this a generic "network device" interface 
     226}; 
     227 
     228NetworkInterface::NetworkInterface(Wiz810MjDevice& networkDevice) : device (networkDevice) { 
     229  /* 
     230 
     231    Note: The "weirdness" in this function declaration is a "initalization list", 
     232          i.e. this bit: 
     233     
     234         ) : device (networkDevice) { 
     235   
     236          it is needed to give the 'device' Reference a value supplied to the method 
     237          rather than having a new 'Wiz810MjDevice' instance created.  
     238   */ 
     239}; 
     240 
     241// NetworkInterface Network = NetworkInterface(...); // TODO: Make this a global 
     242 
     243/* ----------------------- */ 
     244 
    218245 
    219246// #define PIN_RESET 9 // WIZnet module /RESET 
     
    239266  WIZ810MJ.setMac(0x02,0xDE,0xAD,0xBE,0xEF,0x00); 
    240267    
    241   WIZ810MJ.setIp(192,168,2,105); 
     268  // WIZ810MJ.setIp(192,168,2,105); 
    242269  WIZ810MJ.setMask(255,255,255,0); 
    243270  WIZ810MJ.setGateway(192,168,2,101); 
     271    
     272  NetworkInterface Network = NetworkInterface(WIZ810MJ);  
     273   
     274  Network.device.setIp(192,168,2,105); 
    244275    
    245276  Serial.println("End test W5100 configuration...");