From: SnickerSun Date: Wed, 20 Mar 2024 11:00:36 +0000 (+0800) Subject: 优化代码,通过ble_service SUPPORT_BLE_SERVICE可以控制ble服务模块是否添加到系统中 X-Git-Tag: release_V1.2.70_20241020_135402~1288 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=21cf66ef831997fd9c4f9236a287415b2e8e652f;p=mirrors%2FFD230.git 优化代码,通过ble_service SUPPORT_BLE_SERVICE可以控制ble服务模块是否添加到系统中 --- diff --git a/code/sdk/application/brandy/brandy_standard/thread_pri_init.c b/code/sdk/application/brandy/brandy_standard/thread_pri_init.c index 24eba13c3..c34ab780f 100755 --- a/code/sdk/application/brandy/brandy_standard/thread_pri_init.c +++ b/code/sdk/application/brandy/brandy_standard/thread_pri_init.c @@ -9,7 +9,9 @@ #include "common_def.h" #include "pm.h" #include "watchdog.h" +#ifdef SUPPORT_BLE_SERVICE #include "bleService.h" +#endif // #include "hidService.h" // #include "ble_hid_take_photo_server.h" /* after reboot system emmc need write exc info to the file system from sector */ diff --git a/code/sdk/application/wearable/alipay/service/alipay_bluetooth.c b/code/sdk/application/wearable/alipay/service/alipay_bluetooth.c index e03503436..c83f5fb2d 100644 --- a/code/sdk/application/wearable/alipay/service/alipay_bluetooth.c +++ b/code/sdk/application/wearable/alipay/service/alipay_bluetooth.c @@ -15,7 +15,9 @@ #include "alipay_feature.h" #include "securec.h" #include "wearable_log.h" +#ifdef SUPPORT_BLE_SERVICE #include "bleService.h" +#endif #include "alipay_bluetooth.h" // Alipay 蓝牙模块全局变量 diff --git a/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/ClassicBlueToothPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/ClassicBlueToothPresenter.cpp index cf45fc220..908b12f75 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/ClassicBlueToothPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/ClassicBlueToothPresenter.cpp @@ -119,18 +119,19 @@ namespace OHOS { case UICheckBox::SELECTED: WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BlueTooth Capability Is Enabled"); + #ifdef SUPPORT_BLE_SERVICE openBle();//主动开启蓝牙 + #else + init_btaddr_btname(); + #endif break; case UICheckBox::UNSELECTED: WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BlueTooth Capability Is Disabled"); + #ifdef SUPPORT_BLE_SERVICE closeBle(); - - // init_btaddr_btname(); - // break; - //case UICheckBox::UNSELECTED: - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BlueTooth Capability Is Disabled"); - // disable_bt_service(); - + #else + disable_bt_service(); + #endif break; default: break; diff --git a/code/sdk/application/wearable/service/ble_service/bleEvent.c b/code/sdk/application/wearable/service/ble_service/bleEvent.c index 3db715ced..f1ff522c7 100644 --- a/code/sdk/application/wearable/service/ble_service/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleEvent.c @@ -25,7 +25,9 @@ #include "bts_a2dp_sink.h" #include "osal_timer.h" #include "bleEvent.h" +#ifdef SUPPORT_BLE_SERVICE #include "app_common_api.h" +#endif #include "../../../../../open_source/openharmony/third_party/cJSON/cJSON.h" #include "errcode.h" diff --git a/code/sdk/application/wearable/service/hid_service/hidService.c b/code/sdk/application/wearable/service/hid_service/hidService.c index e1c88266f..ed8a5ca42 100644 --- a/code/sdk/application/wearable/service/hid_service/hidService.c +++ b/code/sdk/application/wearable/service/hid_service/hidService.c @@ -3,7 +3,9 @@ * Description: BT HID Service Server Module. */ #include "hidService.h" +#ifdef SUPPORT_BLE_SERVICE #include "bleService.h" +#endif #include "bts_gatt_stru.h" #include "bts_a2dp_source.h" #include "bts_gatt_server.h" @@ -269,7 +271,7 @@ void ble_hid_add_characters_and_descriptors(uint8_t server_id, uint16_t srvc_han /* HID Control Point */ ble_hid_add_character_hid_control_point(server_id, srvc_handle); } -#include "bleService.h" + /* 初始化HID device */ void ble_hid_server_init(void) {