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

UWP custom pairing nrf52840 with static passkey , PairingKind ?

My UWP(Universal windows platform) app in Windows 10, Windows 10 tablet as master bluetooth, nrf52840(nRF5_SDK_15.3.0_59ac345) module as slave device.
The PIN static-passkey is set for the device. UWP app custom pairing slave device(\Windows-universal-samples-master\Samples\DeviceEnumerationAndPairing),
Here is pairing event handler(PairingRequestedHandler), This function gets some parameter information from slave bluetooth module, such as args.PairingKind.
Now the problem is that the getting information(args.PairingKind) from the device is default value "ConfirmOnly",
I want to change this value to "providepin" or "providepasswordcredential".
Please tell me which configuration parameters in which file need to be modified in the module SDK(nRF5_SDK_15.3.0_59ac345) ?
I hope you understand what I'm saying. Thanks.

Parents Reply Children
  • OK, but from the literal meaning of a macro,I think SEC_PARAM_IO_CAPABILITIES should be defined as BLE_GAP_IO_CAPS_KEYBOARD_ONLY or BLE_GAP_IO_CAPS_KEYBOARD_DISPLAY. I will try it in the weekend.

  • The IO capabilities are referring to what IO capabilities are available to the user. And with a static passkey, you could print the key on the final product and thus claim to have display capabilities.  

  • Yes, you are right.
    The marco "SEC_PARAM_IO_CAPABILITIES" should be defined "as BLE_GAP_IO_CAPS_DISPLAY_ONLY".
    In addition, the next five places are setted to SEC_MITM, is it correct?

    // Add the RX Characteristic.
    memset(&add_char_params, 0, sizeof(add_char_params));
    add_char_params.uuid = BLE_UUID_NUS_RX_CHARACTERISTIC;
    add_char_params.uuid_type = p_nus->uuid_type;
    add_char_params.max_len = BLE_NUS_MAX_RX_CHAR_LEN;
    add_char_params.init_len = sizeof(uint8_t);
    add_char_params.is_var_len = true;
    add_char_params.char_props.write = 1;
    add_char_params.char_props.write_wo_resp = 1;

    add_char_params.read_access = SEC_MITM; ////////// It was the SEC_OPEN
    add_char_params.write_access = SEC_MITM; ////////// It was the SEC_OPEN

    err_code = characteristic_add(p_nus->service_handle, &add_char_params, &p_nus->rx_handles);
    if (err_code != NRF_SUCCESS)
    {
    return err_code;
    }

    // Add the TX Characteristic.
    /**@snippet [Adding proprietary characteristic to the SoftDevice] */
    memset(&add_char_params, 0, sizeof(add_char_params));
    add_char_params.uuid = BLE_UUID_NUS_TX_CHARACTERISTIC;
    add_char_params.uuid_type = p_nus->uuid_type;
    add_char_params.max_len = BLE_NUS_MAX_TX_CHAR_LEN;
    add_char_params.init_len = sizeof(uint8_t);
    add_char_params.is_var_len = true;
    add_char_params.char_props.notify = 1;

    add_char_params.read_access = SEC_MITM; ////////// It was the SEC_OPEN
    add_char_params.write_access = SEC_MITM; ////////// It was the SEC_OPEN
    add_char_params.cccd_write_access = SEC_MITM; ////////// It was the SEC_OPEN

    return characteristic_add(p_nus->service_handle, &add_char_params, &p_nus->tx_handles);
    /**@snippet [Adding proprietary characteristic to the SoftDevice] */

  • Yes, it looks to be correct. Remember that you can use your Android phone to verify that it works

Related