马上注册,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册 
×
目前遇到的问题是无法将CSR8670的BLE和传统蓝牙双模给兼容起来,不知是参数配置问题,
还是代码流程问题,还请各位大侠帮忙分析解决下,谢谢。
操作流程: 1、 首先 调整Project Properties如下四项: Battery Operation: Enabled Enable GATT: GATT Server Enabled Enable BLE BLE Enable Execution mode Assisted Native 2、 在上述基本工作完成后,编译ADK3.0自带的sink,F7->F5,启动后,android4.4的手机能够识别到BLE蓝牙设备,并能够通过gatt读取CSR8670调试版上的电源电压。但是,不能进行传统蓝牙的配对连接,android2.2手机也识别不到蓝牙,音频无法使用,相当于是BLE单模。 3、为解决5中的问题,我在CSR8670(做server端)开启广播start_ble_advertising()之后添加了如下标红代码,但F7->F5后,现象同上。 void server_handle_gatt_connect_cfm(GATT_CONNECT_CFM_T * cfm) { GATT_SERVER_DEBUG(("GATT server_handle_gatt_connect_cfm \n ")); switch(cfm->status) { case gatt_status_initialising: { GATT_SERVER_DEBUG(("GATT: Connection initialising\n")); #if defined(BLE_ENABLED) { GATT_SERVER_DEBUG(("GATT:start_ble_advertising\n")); /* Start Advertising so a remote device can find and connect */ start_ble_advertising(); MessageSend(&theSink.task , EventUsrPowerOn, 0); stateManagerEnterConnectableState(TRUE); MessageSendLater(&theSink.task , EventUsrEnterPairing, 0, 1000); } #endif } 对应的log如下,从log上看已经enable Connectable 和Discoverable了,但为什么还是扫描不到 传统蓝牙设备呢? : GATT:start_ble_advertising BLE : Start AD //在此后加入 @@***stateManagerEnterConnectableState HS: Power On --hello-- SM : PowerOn SM: @@***stateManagerEnterConnectableState SM: @@***stateManagerEnterConnectableState->sinkEnableConnectable MP Enable Connectable -i SM: @@***stateManagerEnterConnectableState->stateManagerSetState deviceConnectable SM:[Connectable]->[Connectable][1] HS: EnterPair [1] ***SM :stateManagerEnterConnDiscoverableState MP Enable Connectable -i MP Enable Discoverable +p MP Enable Discoverable scan:3 SM : Pair [258] SM:[Connectable]->[ConnDisc][2] HS : EventSysCheckAudioAmpDrive turn off amp 4、在源代码基础上(去掉3中在start_ble_advertising()之后添加的代码),在main.c的CL_DM_BLE_SET_ADVERTISING_DATA_CFM下添加如下标红代码,F7->F5,启动后,android4.4和android2.2的手机均能扫描到传统蓝牙设备,音频正常,音乐可正常播放,电话可正常接听。但BLE设备却识别不到,android4.4手机上专门用于扫描BLE设备的apk应用无法找到BLE设备(在2和3情况下可以找到BLE设备),故也只体现了传统蓝牙的单模。 case CL_DM_BLE_SET_ADVERTISING_DATA_CFM: { MAIN_DEBUG(("CL_DM_BLE_SET_ADVERTISING_DATA_CFM\n")); MessageSend(task , EventUsrPowerOn, 0); //如果没有,无声音输出。 stateManagerEnterConnectableState(TRUE); MessageSendLater(task , EventUsrEnterPairing, 0, 1000); #ifdef GATT_SERVER_ENABLED { handle_set_ble_ad_data_cfm( (CL_DM_BLE_SET_ADVERTISING_DATA_CFM_T*)message ); } #endif } 对应log如下,在log上看,GATT:start_ble_advertising,BLE : Start AD//gatt已经发送了广播了,但为什么android4.4手机找不到BLE设备呢? CL_DM_BLE_SET_ADVERTISING_DATA_CFM//在此处加 SM: @@***stateManagerEnterConnectableState CL : AD Data registered GATT_INIT_CFM [0] GATT server_handle_gatt_init_cfm GATT will GattConnectRequest HS: Power On --hello-- SM : PowerOn SM: @@***stateManagerEnterConnectableState SM: @@***stateManagerEnterConnectableState->sinkEnableConnectable MP Enable Connectable -i SM: @@***stateManagerEnterConnectableState->stateManagerSetState deviceConnectable SM:[Connectable]->[Connectable][1] GATT_CONNECT_CFM [13] GATT server_handle_gatt_connect_cfm GATT: Connection initialising GATT:start_ble_advertising BLE : Start AD HS: EnterPair [1] ***SM :stateManagerEnterConnDiscoverableState MP Enable Connectable -i MP Enable Discoverable +p MP Enable Discoverable scan:3 SM : Pair [258] SM:[Connectable]->[ConnDisc][2]
|