This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

C# API for nRF51 Dongle

Hi, I would like to use a nRF51 Dongle to connect to BLE devices and retrieve some data.

I already tried my scenario through nRF Connect for Desktop and it works, so I assume I can develop a custom C# application to do the same thing.

I looked for some API/library and so far I just found 3 possibilities:

- PC BLE Driver: https://github.com/NordicSemiconductor/pc-ble-driver
- PC BLE Driver JS: https://github.com/NordicSemiconductor/pc-ble-driver-js
-
 PC BLE Driver Py: https://github.com/NordicSemiconductor/pc-ble-driver-py

If I'm right, the last two should be higher level APIs that would perfectly fit my needs, but unfortunately the C# language is a requirement and then I cannot use those drivers.

The first question I want to ask is: is the PC BLE Driver the right choice for developing such a C# application or is there anything better?

The second (and last) question is: where can I find some documentation about how to import that driver in C# and how to use the APIs in order to connect to BLE devices and read/write some Characteristics?

Thanks a lot for your help!

Parents
  • Hi,

    I can confirm that s130 v2.0.1 is the SoftDevice to be used with pc-ble-driver for the nRF51. The documentation that you linked to is for an older version SoftDevice, and although Just Works Pairing seems to be the same there are some differences. You find the s130 v2.0.1 documentation here.

    For sd_ble_gap_sec_params_reply(), in the central role, p_sec_params should be NULL, as the parameters are previously given through sd_ble_gap_authenticate(). Based on your code excerpts I think that the following may be correct:

    uint8_t errorCode = sd_ble_gap_sec_params_reply(this->adapter, this->connection_handle, BLE_GAP_SEC_STATUS_SUCCESS, NULL, &this->keyset);

    You can also have a look at how this is done in the Peer Manager library in nRF5 SDK v12.3, for reference. (Search for sd_ble_gap_authenticate and sd_ble_gap_sec_params_reply in components\ble\peer_manager\security_dispatcher.c.)

    Regards,
    Terje

Reply
  • Hi,

    I can confirm that s130 v2.0.1 is the SoftDevice to be used with pc-ble-driver for the nRF51. The documentation that you linked to is for an older version SoftDevice, and although Just Works Pairing seems to be the same there are some differences. You find the s130 v2.0.1 documentation here.

    For sd_ble_gap_sec_params_reply(), in the central role, p_sec_params should be NULL, as the parameters are previously given through sd_ble_gap_authenticate(). Based on your code excerpts I think that the following may be correct:

    uint8_t errorCode = sd_ble_gap_sec_params_reply(this->adapter, this->connection_handle, BLE_GAP_SEC_STATUS_SUCCESS, NULL, &this->keyset);

    You can also have a look at how this is done in the Peer Manager library in nRF5 SDK v12.3, for reference. (Search for sd_ble_gap_authenticate and sd_ble_gap_sec_params_reply in components\ble\peer_manager\security_dispatcher.c.)

    Regards,
    Terje

Children
No Data
Related