From aabfc36427035938cef23a398f6b1fd3f12a67bc Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Tue, 8 Oct 2024 15:41:05 +0800 Subject: [PATCH] =?utf8?q?ble=E5=AF=B9=E6=8E=A5=E8=B0=83=E8=AF=95=E7=AA=97?= =?utf8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../ble_service/bleservice/bleService.c | 58 ++++++++++--------- .../ble_service/bleservice/bleService.h | 4 ++ .../debug_output_notification.cpp | 11 ++-- 3 files changed, 41 insertions(+), 32 deletions(-) diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c b/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c index f0a03b5af..bbb73ee17 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c @@ -178,7 +178,7 @@ static void clean_phone_info(uint16_t conn_id)//保存手机信息 包含手机m } -static bool get_ble_connect()//保存手机信息 包含手机mac地址 +bool get_ble_connect(void)//保存手机信息 包含手机mac地址 { for(int i=0;i #include #include +#include "bleService.h" namespace OHOS { @@ -119,7 +120,7 @@ namespace OHOS { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DebugOutputViewEventListener::get_bt_runtime_status_t"); std::string result = "bt_powerOn:" + std::to_string(uapi_dev_runtime_get_bt_powerstat()) + " "; - result += "bt_ble_connectstat:" + std::to_string(uapi_dev_runtime_get_ble_connect_stat()) + " "; + result += "bt_ble_connectstat:" + std::to_string(get_ble_connect()) + " "; result += "bt_br_connectstat:" + std::to_string(uapi_dev_runtime_get_br_connect_stat()) + " "; result += "bt_earphone_connectstat:" + std::to_string(uapi_dev_runtime_get_earphone_connect_stat()) + " "; result += "android_app_connected:" + std::to_string(uapi_dev_runtime_get_android_connection_status()) + " "; @@ -133,7 +134,7 @@ namespace OHOS result += "spp_service_handler: "; result += "hfp_service_handler: "; result += "localAddress:" + (getCurrentWatchMacAddress()) + " "; - result += "ble广播状态:" + std::to_string(BluetoothModel::GetInstance()->GetAdvStartState()); + result += "ble广播状态:" + std::to_string(get_ble_adv_status()); // 蓝牙ble广播开关,基础信息如,地址,广播状态 @@ -288,8 +289,10 @@ namespace OHOS std::string str; if (viewId == DEBUGOUTPUTBLESERVICELABELBUTTON) // 开启ble广播 { - if (BluetoothModel::GetInstance()->GetAdvStartState() == false) // 如果广播是关的就去开启广播 - BleAdvStart(); + // if (BluetoothModel::GetInstance()->GetAdvStartState() == false) // 如果广播是关的就去开启广播 + // BleAdvStart(); + + svr_ble_adv_start(); return true; } else if (viewId == DEBUGOUTPUTLABELBUTTON) // 点击的是刷新按钮 -- 2.17.1