How to use Gadgeteer Drivers with pure NETMF?

I want to test the Cellular Radio driver with my Cobra 2 board but the code is written as a pure NETMF and I don’t want to use the socket on the board for the modem, instead connecting to one on the header.

How do you initialise the drive when it expects a socket? Is this possible?

Is there an alternative driver that is not Gadgeteer and if so, which reference can I find it?

@ Dave McLaughlin.

I have not tested this but I believe this will work. And you can even use the Gadgeteer Driver. All you need to do is create a virtual socket and pass this to the constructor of the CellularRadio driver.

var virtualSocket = GT.Socket.SocketInterfaces.CreateNumberedSocket(22);
virtualSocket.SerialPortName = "COM1";
virtualSocket.AnalogInput3 = Cpu.AnalogChannel.ANALOG_0;
virtualSocket.CpuPins[0] = Cpu.Pin.GPIO_Pin1; // or whatever your pin assignments are.
// and so on.
virtualSocket.SupportedTypes = new []{'K', 'U'};

this.cellularRadio = new CellularRadio(virtualSocket.SocketNumber);
// or
this.cellularRadio = new CellularRadio(22);


I had to use Gageteer.Socket instead of var with C# but it works so a big thank you.

You’re welcome. I have been using this technique for quite some time now and thought is was common knowledge.

Damn. It creates the socket but the Cellular driver can’t use it. I am suing COM1 and I suspect as the port does not have RTS and CTS.

I’ll need to move to another COM port that does. COM2 is the only one on the Cobra 2 that doe.s

Just a quick one. I got it working but your post missed out the RegisterSocket call and that is why it wasn’t working for me.

Yes that will explain why it did not work. I forgot the rest of the initialization. Glad that you worked through it though.

Thanks. I have an issue with the CellularDriver though so grabbed the code and will post my findings in a little while. :slight_smile: