(*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...)

git-svn-id: svn+ssh://oldsvn/home/mlalondesvn/svn/cral@97 3ee9b42a-b53c-0410-a25e-f0b6218d5d5b
master
follower 17 years ago
parent 0252654324
commit 3e04fbc259

@ -215,6 +215,33 @@ void Wiz810MjDevice::setMac(byte b0, byte b1, byte b2, byte b3, byte b4, byte b5
/* ----------------------- */
/* -- NetworkInterface -- */
class NetworkInterface {
public:
NetworkInterface(Wiz810MjDevice& networkDevice);
Wiz810MjDevice& device; // TODO: Make this a generic "network device" interface
};
NetworkInterface::NetworkInterface(Wiz810MjDevice& networkDevice) : device (networkDevice) {
/*
Note: The "weirdness" in this function declaration is a "initalization list",
i.e. this bit:
) : device (networkDevice) {
it is needed to give the 'device' Reference a value supplied to the method
rather than having a new 'Wiz810MjDevice' instance created.
*/
};
// NetworkInterface Network = NetworkInterface(...); // TODO: Make this a global
/* ----------------------- */
// #define PIN_RESET 9 // WIZnet module /RESET
@ -238,10 +265,14 @@ void setup () {
WIZ810MJ.setMac(0x02,0xDE,0xAD,0xBE,0xEF,0x00);
WIZ810MJ.setIp(192,168,2,105);
// WIZ810MJ.setIp(192,168,2,105);
WIZ810MJ.setMask(255,255,255,0);
WIZ810MJ.setGateway(192,168,2,101);
NetworkInterface Network = NetworkInterface(WIZ810MJ);
Network.device.setIp(192,168,2,105);
Serial.println("End test W5100 configuration...");

Loading…
Cancel
Save