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

BLEGapSecStatus.confirm_value on passkey bonding.

Hi all, I'm trying to implement passkey bonding using pc-ble-driver-py.

It doesn't appear to be supported in the BLEDriver.py itself, so I tried to add the sd_ble_gap_auth_key_reply call to pc-ble-driver myself.

I'm using:

    @NordicSemiErrorCheck
    @wrapt.synchronized(api_lock)
    def ble_gap_auth_key_reply(self, conn_handle, key_type, key):

        assert (driver.BLE_GAP_AUTH_KEY_TYPE_PASSKEY ==
                key_type)
        print( util.list_to_uint8_array(key))    
        print( util.list_to_uint8_array(key).cast())   
        return driver.sd_ble_gap_auth_key_reply(
            self.rpc_adapter,
            conn_handle,
            key_type,
            util.list_to_uint8_array(key).cast())

And feeding in:

input_val = map(ord,raw_input("Enter passkey: ")[:-1])

As far as I can see, i'm sending it a list of ASCII characters of 6 bytes, removing the null terminator (as per https://github.com/NordicSemiconductor/pc-ble-driver/blob/971241c19abc33bbc6469e1be601a2ab78fbb35b/src/sd_api_v5/sdk/components/softdevice/s132/headers/ble_gap.h#L1183)

I'm getting a auth_status returned of (BLEGapSecStatus.confirm_value), as far I can see that's an error telling me I have fed it an incorrect passcode?

What am I doing wrong?

Cheers!

Parents Reply
  • Hi there, I've just checked this, it's giving me a 6 element array of 0x30-0x39, as required. I'd like to mention, this code did/does work perfectly with the old nrf51-ble-driver_win_0.5.0. Given I've tried this with multiple Bluetooth devices, of which work fine with passcodes on my phone, I think it's an issue with the Softdevice / DLL driver layer provided with the python pc-ble-central-py PIP/github package. Cheers.

Children
Related