To work with GHI network interface drivers, we first need to call Open(). What does it mean to open a network interface? The documentation says nothing other than that the method call is required.
E.g.
var wiFiRs9110 = new WiFiRS9110(
SPI.SPI_module.SPI2,
GHI.Pins.G120.P1_10,
GHI.Pins.G120.P2_11,
GHI.Pins.G120.P1_9, 4000);
wiFiRs9110.Open(); // What does this do?
wiFiRs9110.EnableStaticIP(IpAddress, SubnetMask, GatewayAddress);
You can imagine that a piece of hardware would require some initialization before it can be used.
They could have chosen to integrate the code from
Open()in the constructor andClose()in theDispose()method, but then:Close()) the network interface without disposing the object, so if you'd want to access it again you'd have to pass the same parameters to a new instance againOpen()method that throws when the hardware does not respond.There are also some less obvious issues with "starting" something from within a constructor, which may not apply to these drivers: