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
  • Didn't I describe the problem clearly? Who can reply?

    I haven't got a technical response yet

  • Sorry for the delayed response. I think your description is clear enough. On the nRF side, have you defined SEC_PARAM_IO_CAPABILITIES as BLE_GAP_IO_CAPS_DISPLAY_ONLY, and did you configure the static passkey with the sd_ble_opt_set() function?

    // Setting a static passkey
    
        ble_opt_t opt;
    
        opt.gap_opt.passkey.p_passkey ="123456"
    
        err_code = sd_ble_opt_set(BLE_GAP_OPT_PASSKEY, &opt);
        APP_ERROR_CHECK(err_code);

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

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

Reply Children
No Data
Related