/**************************************************************************** NAME deviceManagerGetAttributes DESCRIPTION Get the attributes for a given device, or check device is in PDL if attributes is NULL. RETURNS TRUE if device in PDL, otherwise FALSE */ bool deviceManagerGetAttributes(sink_attributes* attributes, const bdaddr* dev_addr) { /* NULL is valid if we just want to check dev is in PDL */ uint8 size = (attributes ? sizeof(sink_attributes) : 0); /* Attempt to retrieve attributes from PS */ return ConnectionSmGetAttributeNow(PSKEY_ATTRIBUTE_BASE, dev_addr, size, (uint8*)attributes); }
static void handleA2DPOpenInd(Sink sink, uint8 seid) { bdaddr bdaddr_ind; SendEvent(EVT_A2DP_OPEN_IND,0); if (SinkGetBdAddr(sink, &bdaddr_ind)) { uint8 lAttributes[ATTRIBUTE_SIZE]; avrcpConnectReq(bdaddr_ind, FALSE); /* Retrieve attributes for this device */ if (ConnectionSmGetAttributeNow(PSKEY_ATTRIBUTE_BASE, &bdaddr_ind, ATTRIBUTE_SIZE, lAttributes)) { bool write_params = FALSE; if (lAttributes[attribute_seid] != seid) { lAttributes[attribute_seid] = seid; write_params = TRUE; } if (lAttributes[attribute_a2dp_volume] != theHeadset.gAvVolumeLevel) { lAttributes[attribute_a2dp_volume] = theHeadset.gAvVolumeLevel; write_params = TRUE; } if (write_params) { /* Write params to PS */ ConnectionSmPutAttribute(PSKEY_ATTRIBUTE_BASE, &bdaddr_ind, ATTRIBUTE_SIZE, lAttributes); A2DP_MSG_DEBUG(("A2DP: Store A2DP attributes [%d][%d][%d][%d][%d][%d]\n",lAttributes[0], lAttributes[1],lAttributes[2],lAttributes[3],lAttributes[4],lAttributes[5])) ; } } theHeadset.seid = seid; theHeadset.last_used_seid = seid; A2DP_MSG_DEBUG((" Selected SEID = %d\n", seid)); stateManagerEnterA2dpConnectedState(); PROFILE_MEMORY(("A2DPOpen")) }
void hfpHandlerDisconnectInd(const HFP_SLC_DISCONNECT_IND_T *ind) { bdaddr ag_addr; bool last_ag = FALSE; /* Check if this was the result of an abnormal link loss */ if (ind->status == hfp_disconnect_link_loss ) { HFP_DEBUG(("HFP: Link Loss Detect\n")) ; MessageSend( &theHeadset.task , EventLinkLoss , 0 ) ; } else { theHeadset.combined_link_loss = FALSE; } if (last_ag) { uint8 lAttributes[ATTRIBUTE_SIZE]; /* Retrieve attributes for this device */ if (ConnectionSmGetAttributeNow(PSKEY_ATTRIBUTE_BASE, &ag_addr, ATTRIBUTE_SIZE, lAttributes)) { bool write_params = FALSE; if (!lAttributes[attribute_hfp_hsp_profile]) { lAttributes[attribute_hfp_hsp_profile] = ATTRIBUTE_GET_HF_PROFILE(theHeadset.profile_connected); write_params = TRUE; } if (lAttributes[attribute_hfp_volume] != theHeadset.gHfpVolumeLevel) { lAttributes[attribute_hfp_volume] = theHeadset.gHfpVolumeLevel; write_params = TRUE; } if (write_params) { /* Write params to PS */ ConnectionSmPutAttribute(PSKEY_ATTRIBUTE_BASE, &ag_addr, ATTRIBUTE_SIZE, lAttributes); HFP_DEBUG(("HFP: Store HFP attributes [%d][%d][%d][%d][%d][%d]\n",lAttributes[0], lAttributes[1],lAttributes[2],lAttributes[3],lAttributes[4],lAttributes[5])) ; } } } /* Handle the case where an incoming call is rejected using the headset profile. As we get no indicator info, the AV must be restarted on a SLC disconnect. */ if ((theHeadset.profile_connected == hfp_headset_profile)) { streamControlResumeA2dpStreaming(0); } /* Update the app state if we are connected */ if ( stateManagerIsHfpConnected() ) { stateManagerEnterHfpConnectableState( FALSE ) ; } MessageSend(&theHeadset.task , EventSLCDisconnected , 0) ; /* Connection disconnected */ theHeadset.profile_connected = hfp_no_profile; theHeadset.hfp_hsp = NULL; /* Reset in-band ring tone support flag */ theHeadset.InBandRingEnabled = FALSE; /* Update Link Policy as HFP has disconnected. */ linkPolicySLCdisconnect(); PROFILE_MEMORY(("HFPDisco")) }