1 of 1 people found this helpful
Could you please set the IO capabilities as well.
When the Master attempts to Pair with you, it sends its I/O capabilities.
When you get the event asking for your I/O Capabilities, you need to respond by changing the event data. You need to add the local IO capabilities. For example, if your device has a display and you want to use numeric comparison, you could use BTM_IO_CAPABILITIES_DISPLAY_AND_YES_NO_INPUT (you may refer other IO capabilities in wiced_bt_dev.h file) as shown here:
/* This application supports only Just Works pairing */
WICED_BT_TRACE("BTM_PAIRING_IO_CAPABILITIES_REQUEST_EVT bda %B\n", p_event_data->pairing_io_capabilities_br_edr_request.bd_addr);
p_event_data->pairing_io_capabilities_br_edr_request.local_io_cap = BTM_IO_CAPABILITIES_DISPLAY_AND_YES_NO_INPUT;
p_event_data->pairing_io_capabilities_br_edr_request.auth_req = BTM_AUTH_SINGLE_PROFILE_GENERAL_BONDING_YES;
p_event_data->pairing_io_capabilities_br_edr_request.is_orig = WICED_FALSE;
p_event_data->pairing_io_capabilities_br_edr_request.oob_data = BTM_OOB_NONE;
Depending on the IO capabilities of both devices, a pairing method is negotiated. If the devices have sufficient IO capabilities, you will either get a confirmation request event (for Numeric Comparison) or a passkey notification event (for Passkey Entry).
For numeric comparison, you need to display the value so that the user can confirm the value is the same on both devices. At that point, you can wait for user input to confirm the value, or you can just automatically confirm. If you do the latter, then you are depending on the other side of the connection to confirm the value. If the other side also automatically confirms, then the numeric comparison method doesn't protect you against MIM. By default, WICED Bluetooth Designer includes the following code to print the numeric value and confirm it automatically:
/* This application always confirms peer's attempt to pair */
WICED_BT_TRACE("numeric_value: %d\n", p_event_data->user_confirmation_request.numeric_value);
wiced_bt_dev_confirm_req_reply (WICED_BT_SUCCESS, p_event_data->user_confirmation_request.bd_addr);
For passkey entry, you just need to display the Passkey on your device so that the user can enter it on the other device. WICED Bluetooth Designer does NOT include this state so you must include it if you are using Passkey Entry.
WICED_BT_TRACE( "Passkey Notification\n\r");
WICED_BT_TRACE(">>>>>>>>>>>>>>>>>>>>>>>> PassKey Required for BDA %B, Enter Key: %06d \n\r",
p_event_data->user_passkey_notification.bd_addr, p_event_data->user_passkey_notification.passkey );
This is just an example , you may use as per your requirement.