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
  • Ah, yes. I missed that when I read the question. In that case it seems you are successfully providing six bytes, but for some reason they are corrupted. Can you do the conversion with util.list_to_uint8_array(key).cast() before the call to driver::sd_ble_gap_auth_key_reply(), just so you can verify that it is what you would expect? It should be a ASCII string with only 0-9, so each byte in the array should be between 0x30 and 0x39.

Children
Related