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
  • yes, the passkey pairing works with Android phone by providing an input PIN dialog box, but didnot in win10 UWP. The UWP app cannot register PairingRequestedHandler, for the nrf52840 device do not support "providepin" option.

  • I think the fact that it works with android indicates that your nrf device is correctly set up for passkey pairing and that the problem is on the windows side. So I think it would be better if you ask Microsoft about this. I don't have experience with windows app dev unfortunately.

  • 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] */

Related