2021-10-19 06:33 AM
My device init looks like this:
ret = aci_gap_init(GAP_PERIPHERAL_ROLE, 0,0x08, &service_handle, &dev_name_char_handle, &appearance_char_handle);
if(ret != BLE_STATUS_SUCCESS) {
//PRINTF("GAP_Init failed: 0x%02x\n", ret);
return ret;
}
ret = aci_gap_set_io_capability (IO_CAP_NO_INPUT_NO_OUTPUT);
ret = aci_gap_set_authentication_requirement(BONDING,MITM_PROTECTION_REQUIRED,SC_IS_SUPPORTED,KEYPRESS_IS_NOT_SUPPORTED,7,16,USE_FIXED_PIN_FOR_PAIRING,123456,1);
if(ret != BLE_STATUS_SUCCESS)
{
//PRINTF("aci_gap_set_authentication_requirement()--> Failed 0x%02x\r\n", ret);
while(1);
}
/* Add Device Service & Characteristics */
ret = Add_ChatService();
if(ret != BLE_STATUS_SUCCESS) {
//PRINTF("Error while adding service: 0x%02x\n", ret);
return ret;
}
But when I use the nrf Connect, or lightBlue android App to test, it just connects without prompting for a PIN. Anyone able to point out what I might be missing?
2021-10-19 08:20 AM
I think I've now managed to understand that the fixed PIN is used in bonding, not in pairing. When choosing to bond, I now get prompted for the PIN after changing my io capability to display only. So that's progress. Now trying to find an event callback for when bonding is completed (similar to the hci_le_connection_complete_event), anyone know the best way to do that?