Using the include files and .dll file from www.nordicsemi.com/.../nRF51822 -> "DOWNLOADS" -> "nRF51-BLE-Driver-Win" I have created a C# wrapper for the driver. I works so far as that I can discover devices and create a C# version of the "advertise" example project. Yay!
I am also able to connect to a device but when I get the reply from a primary service discovery there seems to be a disagreement between the ble_gattc_evt_prim_srvc_disc_rsp_t structure used when building the .hex in the archive and the one found in the include folder. The event id indicates that it is a BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP (0x30/48) but when I try to decode the struct something looks wrong. 'count' of services is indicated to be 28273 which I don't think is correct...! The two bytes coming after the count field is the value 2 when read as an uint16 (little endian) which seems closer to the truth but still not correct (there are 3 services). It seems like more than just a padding issue as the values are not just nulls.
The peripheral device is an existing proprietary device which is working fine. Discovering the device using Master Control Panel gives the expected results.
The two files attached are:
- Output from my failing program: DiscoverPrimaryServiceFails.txt
- Log from Master Control Panel: DiscoverPrimaryServiceSucceds_MasterControlPanel.txt
Are there any plans for a .NET wrapper from Nordic? Python is not an option.
/Claus