return tagConnectView;\r
}\r
\r
+//设置是否需要跳转连接失败界面\r
void BluetoothModel::SetTagDisconnectView(bool tag)\r
{\r
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothModel::SetTagDisconnectView:%d", tag);\r
return tagReturnToDeviceListView;\r
}\r
\r
-// 判断断开连接时是否需要马上连接新设备\r
+// 获取断开连接时是否需要马上连接新设备\r
bool BluetoothModel::IsTagConnectNew(void)\r
{\r
return tagConnectNew;\r
}\r
\r
-// è\8e·å\8f\96断开连接时是否需要马上连接新设备\r
+// 设置断开连接时是否需要马上连接新设备\r
void BluetoothModel::SetTagConnectNew(bool tag)\r
{\r
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothModel::SetTagConnectNew:%d", tag);\r
return tagScanDeviceClicked;\r
}\r
\r
+//检查给定的 BluetoothCaseInfo 结构体实例 caseInfo 所代表的蓝牙设备是否已经存在于已连接设备列表中\r
bool BluetoothModel::CheckExistConnedList(BluetoothCaseInfo caseInfo)\r
{\r
ListNode<BluetoothCaseInfo> *node = btConnedDevicesList_ ->Begin();\r
return false;\r
}\r
}\r
-\r
+//在已连接设备列表 btConnedDevicesList_ 和扫描设备列表 btScansDevicesList_ \r
+//中查找与输入的 BluetoothCaseInfo 结构体实例 caseInfo 地址匹配的设备,并尝试获取该设备的名称\r
bool BluetoothModel::FindNameFromList(BluetoothCaseInfo *caseInfo)\r
{\r
ListNode<BluetoothCaseInfo> *node = btConnedDevicesList_->Begin();\r
bool BluetoothModel::ConnectRemoteCheck(const bd_addr_t *addr)\r
{\r
bool ret;\r
+ if ((remoteConnectAddr.addr[0] == 0) && (remoteConnectAddr.addr[1] == 0) &&\r
+ (remoteConnectAddr.addr[2] == 0) && (remoteConnectAddr.addr[3] == 0) &&\r
+ (remoteConnectAddr.addr[4] == 0) && (remoteConnectAddr.addr[5] == 0)) {\r
+ return true;\r
+ } \r
if ((remoteConnectAddr.addr[0] == addr->addr[0]) && (remoteConnectAddr.addr[1] == addr->addr[1]) &&\r
(remoteConnectAddr.addr[2] == addr->addr[2]) && (remoteConnectAddr.addr[3] == addr->addr[3]) &&\r
(remoteConnectAddr.addr[4] == addr->addr[4]) && (remoteConnectAddr.addr[5] == addr->addr[5])) {\r
}\r
}\r
\r
-//处理蓝牙耳机连接成功操作\r
+//处理蓝牙耳机连接成功的UI操作\r
static void ACLConnectionSuss(const bd_addr_t &bdAddr)\r
{\r
// 判断是否已退出蓝牙模块(无需跳转)\r
return;\r
}\r
// 成功提示\r
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "GAP_ACL_STATE_CONNECTED");\r
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "蓝牙耳机连接成功");\r
HandleBeforeChangeView();\r
if (BluetoothModel::GetInstance()->GetBluetoothCalleridStatus() == CALLERPLAYERS) {\r
JumpView *jumpView = JumpView::GetInstance();\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ACLConnectionSuss tipsSuccMessageView GetInstance fail");\r
return;\r
}\r
- tipsSuccMessageView->RefreshNameLabel(bdAddr);\r
+ tipsSuccMessageView->RefreshNameLabel(bdAddr); //更新连接成功的提示视图的蓝牙名称\r
/* -------------------------------------------------------------------------- */\r
if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()))\r
{\r
return;\r
}\r
// 失败提示页\r
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "conn fail");\r
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "蓝牙耳机连接失败");\r
HandleBeforeChangeView();\r
if (BluetoothModel::GetInstance()->GetBluetoothCalleridStatus() == CALLERPLAYERS) {\r
JumpView *jumpView = JumpView::GetInstance();\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ACLConnectionFail tipsConnFailMessageView GetInstance fail");\r
return;\r
}\r
- tipsConnFailMessageView->RefreshNameLabel(bdAddr);\r
+ tipsConnFailMessageView->RefreshNameLabel(bdAddr);//更新连接失败的提示视图的蓝牙名称\r
/* -------------------------------------------------------------------------- */\r
if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()))\r
{\r
/* -------------------------------------------------------------------------- */\r
}\r
\r
-//处理断开蓝牙耳机连接\r
+//处理断开蓝牙耳机连接的UI操作\r
static void DisconnectedHandle()\r
{\r
BluetoothModel::GetInstance()->SetTagDisconnectView(false);\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DisconnectedHandle deviceList nullptr");\r
return;\r
}\r
- deviceList->RefreshList();\r
- // BluetoothOptionsView *bluetoothOptionsView = BluetoothOptionsView::GetInstance();\r
- // if (bluetoothOptionsView == nullptr) {\r
- // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AclStateChangedCallback bluetoothOptionsView == nullptr");\r
- // return;\r
- // }\r
- // bluetoothOptionsView->RefreshText();\r
+ deviceList->RefreshList();//刷新列表\r
}\r
\r
void BluetoothModel::BtGapAclStateChangedHandle(gap_acl_state_t state, unsigned int reason, const bd_addr_t &bdAddr)\r
{\r
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"ACL回调,%d",state);\r
bool tag = BluetoothModel::GetInstance()->IsTagScanDeviceClicked();\r
if ((reason == 0x13) || (reason == 0x14) || (reason == 0x15) || (reason == 0x3D) || (reason == 0x08 && (!tag))) { // 连接断开\r
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "The peer end is disconnected.");\r
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "蓝牙设备主动断开与手表连接 reason is %x", reason);\r
DisconnectedHandle();\r
} else if (reason == 0x16) { // 主动断开连接\r
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "手表主动断开与蓝牙设备连接,reason is%x", reason);\r
DisconnectedHandle();\r
BluetoothCaseInfo *onClickBtCaseInfo = BluetoothModel::GetInstance()->GetTempMacValue();\r
if (BluetoothModel::GetInstance()->IsTagConnectNew()) {\r
int32_t retA2dp = a2dp_src_connect(&bdAddr);\r
if (retA2dp) {\r
ACLConnectionFail(bdAddr);\r
- }\r
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "a2dp_src_connect result 0x%x", retA2dp);\r
- #ifdef SUPPORT_CAT1_HFP_AG_SERV\r
+ #ifdef SUPPORT_CAT1_HFP_AG_SERV\r
errcode_t rethfp= hfp_ag_cmd_conn_hfp(&bdAddr);\r
- if(rethfp)\r
+ if(!rethfp)\r
{\r
- ACLConnectionFail(bdAddr);\r
+ errcode_t retVal = ConnectRemoteDevice((const bd_addr_t *)&onClickBtCaseInfo->addr);\r
}\r
- #endif\r
-\r
+ #endif\r
+ }\r
+ else\r
+ {\r
+ errcode_t retVal = ConnectRemoteDevice((const bd_addr_t *)&onClickBtCaseInfo->addr);\r
+ }\r
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "a2dp_src_connect result 0x%x", retA2dp);\r
\r
} else {\r
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ingore a2dp_src_connect");\r
SendMsgToUIService(EARPHONE_CONNECTED_TO_UI, 0, nullptr, 0);\r
uapi_dev_runtime_set_earphone_connect_stat(1);\r
uapi_save_runtime_log(RUNTIME_LOG_BR_CONNECT_A2DP_HEADSET);\r
+ if(headset_Is_connect() == false)\r
+ do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CONNECT_AG, nullptr, 0);\r
\r
}\r
\r