| 基于adk6.4.2.26版本sink工程,可以获取远端设备蓝牙名称,这里只是将远端蓝牙名称log输出,根据实际用途可做串口输出或显示屏输出。 1. 运行ConnectionReadRemoteName函数,产生CL_DM_REMOTE_NAME_COMPLETE事件 
[code]/*!
@brief This function is called to read the remote name of the device with
the specified Bluetooth device address.
@param theAppTask The client task.
@param bd_addr The Bluetooth address of the remote device.
A CL_DM_REMOTE_NAME_COMPLETE message will be sent to the initiating task on
completion of the request.
*/
void ConnectionReadRemoteName(Task theAppTask, const bdaddr *bd_addr);[/code]
[code] case HFP_SLC_CONNECT_CFM:
{
const HFP_SLC_CONNECT_CFM_T *conncfm = (const HFP_SLC_CONNECT_CFM_T *)message;
ConnectionReadRemoteName(&theSink.task,&(conncfm->bd_addr)); /* 获取远端蓝牙名称 */
MAIN_DEBUG_L1(("HFP_SLC_CONNECT_CFM [%x]\n", conncfm->status ));
if (stateManagerGetState() == deviceLimbo)
{
if ( conncfm->status == hfp_success )
{
/*A connection has been made and we are now logically off*/
sinkDisconnectAllSlc();
}
}
else
{
sinkHandleSlcConnectCfm(conncfm);
#ifdef ENABLE_PEER
if(!peerLinkReservedCanDeviceConnect(&conncfm->bd_addr))
{ /* Another link is reserved for a peer device to connect, disconnect the second AG.*/
sinkDisconnectSlcFromDevice(&conncfm->bd_addr);
}
#endif
}
}
break;[/code]2.收到CL_DM_REMOTE_NAME_COMPLETE 事件后,解析远端蓝牙名称

[code] case CL_DM_REMOTE_NAME_COMPLETE:
/* 获取远端蓝牙名称 */
MAIN_DEBUG_L1(("remote name = %s\n",((CL_DM_REMOTE_NAME_COMPLETE_T *)message)->remote_name));
break;[/code]3.编译运行查看log输出

[code]2538.766 apps1: HS: HFP_BATTCHG_IND [2]
2538.862 apps1: HFP_SLC_CONNECT_CFM [0]
2538.966 apps1: Main : handleDeviceAndAudioRoutingInfoEvents() - Event 47bd
2538.966 apps1: HS : UE unhandled!! [47bd] (EventSysUpdateDevicesConnectedStatus)
2538.986 apps1: Main : handleDeviceAndAudioRoutingInfoEvents() - Event 47bd
2538.990 apps1: HS : UE unhandled!! [47bd] (EventSysUpdateDevicesConnectedStatus)
2538.990 apps1: Main : handleDeviceAndAudioRoutingInfoEvents() - Event 47bb
2538.990 apps1: HS : UE unhandled!! [47bb] (EventSysAgSourceConnected)
2538.990 apps1: remote name = TAS-AL00
2538.990 apps1: CL_SM_ENCRYPT_CFM
2539.027 apps1: HFP_CALLER_ID_ENABLE_CFM
2539.050 apps1: HS3 : HFP_CALL_WAITING_ENABLE_CFM_T [T]
2539.117 apps1: HS3: HFP_CURRENT_CALLS_CFM [T]
2539.213 apps1: Main : handleDeviceAndAudioRoutingInfoEvents() - Event 47bd
2539.213 apps1: HS : UE unhandled!! [47bd] (EventSysUpdateDevicesConnectedStatus)
2539.219 apps1: CL_SM_ENCRYPT_CFM
2541.359 apps1: CL_SM_ENCRYPT_CFM [/code] 问题思考:一拖二以后获取蓝牙名称怎么区分显示?
|