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: Unfortunately we don't have an example. We do have example for central device which handle bonding but it uses devicemanager/peermanager. You may need to look into those example to figure out. In addition, I just checked with the developer, if you are using the pc-ble-driver v0.5 downloaded from our website. Bonding may not work. We had some issue with that.

    You may need to use the one on our github. You have two option, either you compile this to get the dll, or you use this and get the dll precompiled by callling "pip install pc-ble-driver-py"

    I would suggest you test and make sure things work by directly use S130/S132 as the central(without the driver, you write code on the nRF5 chip) so you know how bonding is handled, after that you can move to the driver.

Reply
  • @jpo: Unfortunately we don't have an example. We do have example for central device which handle bonding but it uses devicemanager/peermanager. You may need to look into those example to figure out. In addition, I just checked with the developer, if you are using the pc-ble-driver v0.5 downloaded from our website. Bonding may not work. We had some issue with that.

    You may need to use the one on our github. You have two option, either you compile this to get the dll, or you use this and get the dll precompiled by callling "pip install pc-ble-driver-py"

    I would suggest you test and make sure things work by directly use S130/S132 as the central(without the driver, you write code on the nRF5 chip) so you know how bonding is handled, after that you can move to the driver.

Children
No Data
Related