/* * B-134381 */ void ConnectionAuthSetPriorityDeviceTestExtra( Task theAppTask, const bdaddr *bd_addr, bool is_priority_device ) { CL_AUTH_SET_PRIORITY_DEVICE_IND_TEST_EXTRA_T *new_msg = PanicUnlessMalloc(sizeof(CL_AUTH_SET_PRIORITY_DEVICE_IND_TEST_EXTRA_T)); new_msg->result = ConnectionAuthSetPriorityDevice(bd_addr, is_priority_device); MessageSend(theAppTask, CL_AUTH_SET_PRIORITY_DEVICE_IND_TEST_EXTRA, new_msg); }
/**************************************************************************** NAME handleGetAuthDeviceCfm DESCRIPTION Called in response to CL_SM_GET_AUTH_DEVICE_CFM message, which is generated due to calling updatePermanentPairing. Both the BDADDR and linkkey contained in CL_SM_GET_AUTH_DEVICE_CFM are used to update CONFIG_PERMANENT_PAIRING to retain this as the permanently paired device RETURNS void */ void handleGetAuthDeviceCfm (CL_SM_GET_AUTH_DEVICE_CFM_T *cfm) { AUTH_DEBUG(("handleGetAuthDeviceCfm\n")); AUTH_DEBUG((" status = %u\n",cfm->status)); AUTH_DEBUG((" ps bd_addr = [%x:%x:%lx]\n", cfm->bd_addr.uap, cfm->bd_addr.nap, cfm->bd_addr.lap)); AUTH_DEBUG((" trusted = %u\n",cfm->trusted)); AUTH_DEBUG((" link key type = %u",cfm->link_key_type)); AUTH_DEBUG((" link key size = %u\n",cfm->size_link_key)); if ( cfm->status == success ) { /* Device exists in CL PDL */ sink_attributes attributes; uint16 link_key_status = ((cfm->trusted & 0xF)<<8) | ((cfm->link_key_type & 0xF)<<4) | (cfm->size_link_key & 0xF); /* Update permanent pairing info */ writePsPermanentPairing(&cfm->bd_addr, cfm->link_key, link_key_status, 0); /* Update attributes */ readPsPermanentPairing(0, 0, 0, &attributes); deviceManagerStoreAttributes(&attributes, (const bdaddr *)&cfm->bd_addr); /* Mark the device as trusted and push it to the top of the PDL */ ConnectionSmUpdateMruDevice((const bdaddr *)&cfm->bd_addr); #ifdef ENABLE_SOUNDBAR /* ensure priority devices are shifted back to top of PDL */ ConnectionAuthSetPriorityDevice((const bdaddr *)&cfm->bd_addr, FALSE); #endif } else { /* Device *does not* exist in CL PDL */ bdaddr ps_bd_addr; uint16 ps_link_key_status; uint16 ps_link_key[LINK_KEY_SIZE]; readPsPermanentPairing(&ps_bd_addr, ps_link_key, &ps_link_key_status, 0); if ( !BdaddrIsZero(&ps_bd_addr) ) { /* We have permanently paired device, add it to CL PDL */ bool trusted = (bool)((ps_link_key_status>>8) & 0xF); cl_sm_link_key_type key_type = (cl_sm_link_key_type)((ps_link_key_status>>4) & 0xF); uint16 size_link_key = ps_link_key_status & 0xF; ConnectionSmAddAuthDevice(&theSink.task, (const bdaddr *)&ps_bd_addr, trusted, TRUE, key_type, size_link_key, (const uint16 *)ps_link_key); } }