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

bounding with pc-ble-driver

I'm using pc-ble-driver on Windows7 (from master as I'm using a s130v2 programmed dongle) to connect a BLE device (developer.nordicsemi.com/.../a00053.html).

This device supports bounding and I could find no example explaining how this should be handled using the pc-ble-driver API.

When I connect the "Nordic_Mouse" device, I receive BLE_GAP_EVT_CONNECTED event and BLE_GAP_EVT_DISCONNECTED right after it (with reason set to 0x3E, BLE_HCI_CONN_FAILED_TO_BE_ESTABLISHED).

How should I bound the device? What pc-ble-driver function should I use to bound the device as I do in the "Master Control Panel" when I click "Bound"?


Edit: With metch and Hung Bui help, I started trying to call sd_ble_gap_authenticate, like this:

ble_gap_sec_params_t params;
params.bond = (pairing != BTLE::Bound); // 1 to bond, 0 to pair?
params.mitm = 0;
params.lesc = 0;
params.keypress = 0;
params.io_caps = 1;
params.oob = 0;
params.min_key_size = 8;
params.max_key_size = 15;
params.kdist_own.enc = 1;
params.kdist_own.id = 1;
params.kdist_own.link = 1;
params.kdist_own.sign = 1;
params.kdist_peer.enc = 1;
params.kdist_peer.id = 1;
params.kdist_peer.link = 1;
params.kdist_peer.sign = 1;

uint32_t err_code = sd_ble_gap_authenticate(adapter, connectionHandle, &params );

However, this fails with code 6. Is there no working C-based example able to connect Dev kit programmed with "Nordic Mouse " example?

Parents
  • Hi jpo38,

    To initialize bonding, you do it the same way you do as a central device, please have a look at our device_manager_central.c library.

    You need to call sd_ble_gap_authenticate() to initialize bonding, store bonding information (the keys) and then call sd_ble_gap_encrypt() to re-encrypt the link based on the keys you stored.

  • @HangBui: Thanks for the answer. It would be really great if you could consider adding an example for the coming release. This bonding process does not seem to be very obvious and it would really help to have a working example to adapt. I'm already using the driver from github (as I use s130v2). I'll probably try to move to the latest version and try again. Could you provide me a link to the example doing bonding as the central (firmware team members are on vacation....I'm alone to try to work this out ;-)

Reply
  • @HangBui: Thanks for the answer. It would be really great if you could consider adding an example for the coming release. This bonding process does not seem to be very obvious and it would really help to have a working example to adapt. I'm already using the driver from github (as I use s130v2). I'll probably try to move to the latest version and try again. Could you provide me a link to the example doing bonding as the central (firmware team members are on vacation....I'm alone to try to work this out ;-)

Children
No Data
Related