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.

  • @jpo: I'm sorry that our resource for the pc_ble_driver is not as much as we have on the nRF5 SDK. However, you can also have a look at the nRF_Connect project here.

    The project uses the pc_ble_driver_js as the base. It's open source, you can actually find some reference code for your project by looking at the source on github.

    Regarding your questions, I would suggest you to create another case to ask. Most of it related to how BLE works. There are some books covered them. I would suggest this and this

Reply
  • @jpo: I'm sorry that our resource for the pc_ble_driver is not as much as we have on the nRF5 SDK. However, you can also have a look at the nRF_Connect project here.

    The project uses the pc_ble_driver_js as the base. It's open source, you can actually find some reference code for your project by looking at the source on github.

    Regarding your questions, I would suggest you to create another case to ask. Most of it related to how BLE works. There are some books covered them. I would suggest this and this

Children
No Data
Related