找回密码
 立即注册

使用微信账号登录

只需一步,快速开始

qcc30xx qcc51xx adk6.4 sink获取远端设备蓝牙名称

2021-7-10 11:50| 发布者: 522315697| 查看: 2359| 评论: 2

摘要: 基于adk6.4.2.26版本sink工程,可以获取远端设备蓝牙名称,这里只是将远端蓝牙名称log输出,根据实际用途可做串口输出或显示屏输出。1. 运行ConnectionReadRemoteName函数,产生CL_DM_REMOTE_NAME_COMPLETE事件/*! @ ...
基于adk6.4.2.26版本sink工程,可以获取远端设备蓝牙名称,这里只是将远端蓝牙名称log输出,根据实际用途可做串口输出或显示屏输出。
1. 运行ConnectionReadRemoteName函数,产生CL_DM_REMOTE_NAME_COMPLETE事件

/*!
    @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);
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;
2.收到CL_DM_REMOTE_NAME_COMPLETE 事件后,解析远端蓝牙名称

case CL_DM_REMOTE_NAME_COMPLETE:
        /* 获取远端蓝牙名称 */
        MAIN_DEBUG_L1(("remote name = %s\n",((CL_DM_REMOTE_NAME_COMPLETE_T *)message)->remote_name));

        break;
3.编译运行查看log输出

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

问题思考:一拖二以后获取蓝牙名称怎么区分显示?


路过

雷人

握手

鲜花

鸡蛋

相关阅读

发表评论

最新评论

引用 吉永良 2021-9-29 14:40
学习学习,增长知识,谢谢分享!
引用 天中雨水 2021-9-2 11:41
牛皮

查看全部评论(2)

小黑屋|手机版|我爱蓝牙网 - 52Bluetooth

GMT+8, 2024-4-18 13:54 , Processed in 0.124194 second(s), 32 queries , Gzip On, MemCached On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

返回顶部