From 9721b6f5ea46704670e0f1c6bc788d3b3e0da4cf Mon Sep 17 00:00:00 2001 From: s30044129 Date: Thu, 4 Sep 2025 20:08:44 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: s30044129 --- common/src/dfx/standard/dm_hidumper.cpp | 1 + interfaces/cj/kits/src/device_manager_utils.cpp | 1 + .../inner_kits/native_cpp/include/dm_device_info.h | 5 +++++ .../inner_kits/native_cpp/src/dm_device_info.cpp | 1 + interfaces/kits/js/src/native_devicemanager_js.cpp | 4 ++++ interfaces/kits/js4.0/src/dm_native_util.cpp | 1 + services/service/src/softbus/softbus_publish.cpp | 10 +++++----- 7 files changed, 18 insertions(+), 5 deletions(-) diff --git a/common/src/dfx/standard/dm_hidumper.cpp b/common/src/dfx/standard/dm_hidumper.cpp index 77238b7bb..b81b9a426 100644 --- a/common/src/dfx/standard/dm_hidumper.cpp +++ b/common/src/dfx/standard/dm_hidumper.cpp @@ -36,6 +36,7 @@ static DumperInfo g_dumperDeviceType[] = { {DEVICE_TYPE_WATCH, "DEVICE_TYPE_WATCH"}, {DEVICE_TYPE_CAR, "DEVICE_TYPE_CAR"}, {DEVICE_TYPE_TV, "DEVICE_TYPE_TV"}, + {DEVICE_TYPE_GLASSES, "DEVICE_TYPE_GLASSES"}, }; // HiDumper info diff --git a/interfaces/cj/kits/src/device_manager_utils.cpp b/interfaces/cj/kits/src/device_manager_utils.cpp index eacec0c7c..bdec6f474 100644 --- a/interfaces/cj/kits/src/device_manager_utils.cpp +++ b/interfaces/cj/kits/src/device_manager_utils.cpp @@ -198,6 +198,7 @@ const std::string &GetDeviceTypeById(DmDeviceType type) {DEVICE_TYPE_PC, std::string(DEVICE_TYPE_PC_STRING)}, {DEVICE_TYPE_SMART_DISPLAY, std::string(DEVICE_TYPE_SMART_DISPLAY_STRING)}, {DEVICE_TYPE_2IN1, std::string(DEVICE_TYPE_2IN1_STRING)}, + {DEVICE_TYPE_GLASSES, std::string(DEVICE_TYPE_GLASSES_STRING)}, }; for (const auto& item : mapArray) { if (item.first == type) { diff --git a/interfaces/inner_kits/native_cpp/include/dm_device_info.h b/interfaces/inner_kits/native_cpp/include/dm_device_info.h index b7704d94d..41cc4ac94 100644 --- a/interfaces/inner_kits/native_cpp/include/dm_device_info.h +++ b/interfaces/inner_kits/native_cpp/include/dm_device_info.h @@ -99,6 +99,10 @@ typedef enum DmDeviceType { */ DEVICE_TYPE_2IN1 = 0xA2F, THIRD_TV = 0x2E, + /** + * Indicates ai glasses. + */ + DEVICE_TYPE_GLASSES = 0xA31, } DmDeviceType; /** @@ -371,6 +375,7 @@ DM_EXPORT extern const char* DEVICE_TYPE_WIFICAMERA_STRING; DM_EXPORT extern const char* DEVICE_TYPE_PC_STRING; DM_EXPORT extern const char* DEVICE_TYPE_SMART_DISPLAY_STRING; DM_EXPORT extern const char* DEVICE_TYPE_2IN1_STRING; +DM_EXPORT extern const char* DEVICE_TYPE_GLASSES_STRING; typedef struct DmAccessCaller { std::string accountId; diff --git a/interfaces/inner_kits/native_cpp/src/dm_device_info.cpp b/interfaces/inner_kits/native_cpp/src/dm_device_info.cpp index c80cbb4a4..4ed54ddf0 100644 --- a/interfaces/inner_kits/native_cpp/src/dm_device_info.cpp +++ b/interfaces/inner_kits/native_cpp/src/dm_device_info.cpp @@ -25,5 +25,6 @@ const char* DEVICE_TYPE_WIFICAMERA_STRING = "WiFiCamera"; const char* DEVICE_TYPE_PC_STRING = "PC"; const char* DEVICE_TYPE_SMART_DISPLAY_STRING = "SMART_DISPLAY"; const char* DEVICE_TYPE_2IN1_STRING = "2IN1"; +const char* DEVICE_TYPE_GLASSES_STRING = "GLASSES"; } // namespace DistributedHardware } // namespace OHOS \ No newline at end of file diff --git a/interfaces/kits/js/src/native_devicemanager_js.cpp b/interfaces/kits/js/src/native_devicemanager_js.cpp index e0571b6d7..bd1985cdd 100644 --- a/interfaces/kits/js/src/native_devicemanager_js.cpp +++ b/interfaces/kits/js/src/native_devicemanager_js.cpp @@ -3350,6 +3350,7 @@ napi_value DeviceManagerNapi::InitDeviceTypeEnum(napi_env env, napi_value export napi_value wearable; napi_value car; napi_value tv; + napi_value glasses; int32_t refCount = 1; napi_create_uint32(env, static_cast(DmDeviceType::DEVICE_TYPE_UNKNOWN), @@ -3366,6 +3367,8 @@ napi_value DeviceManagerNapi::InitDeviceTypeEnum(napi_env env, napi_value export &car); napi_create_uint32(env, static_cast(DmDeviceType::DEVICE_TYPE_TV), &tv); + napi_create_uint32(env, static_cast(DmDeviceType::DEVICE_TYPE_GLASSES), + &glasses); napi_property_descriptor desc[] = { DECLARE_NAPI_STATIC_PROPERTY("UNKNOWN_TYPE", unknown_type), @@ -3375,6 +3378,7 @@ napi_value DeviceManagerNapi::InitDeviceTypeEnum(napi_env env, napi_value export DECLARE_NAPI_STATIC_PROPERTY("WEARABLE", wearable), DECLARE_NAPI_STATIC_PROPERTY("CAR", car), DECLARE_NAPI_STATIC_PROPERTY("TV", tv), + DECLARE_NAPI_STATIC_PROPERTY("GLASSES", glasses), }; napi_value result = nullptr; diff --git a/interfaces/kits/js4.0/src/dm_native_util.cpp b/interfaces/kits/js4.0/src/dm_native_util.cpp index 60a8e66d8..21963460d 100644 --- a/interfaces/kits/js4.0/src/dm_native_util.cpp +++ b/interfaces/kits/js4.0/src/dm_native_util.cpp @@ -139,6 +139,7 @@ std::string GetDeviceTypeById(DmDeviceType type) {DEVICE_TYPE_PC, DEVICE_TYPE_PC_STRING}, {DEVICE_TYPE_SMART_DISPLAY, DEVICE_TYPE_SMART_DISPLAY_STRING}, {DEVICE_TYPE_2IN1, DEVICE_TYPE_2IN1_STRING}, + {DEVICE_TYPE_GLASSES, DEVICE_TYPE_GLASSES_STRING}, }; for (const auto& item : mapArray) { if (item.first == type) { diff --git a/services/service/src/softbus/softbus_publish.cpp b/services/service/src/softbus/softbus_publish.cpp index 94a605c14..bcfaf55ea 100644 --- a/services/service/src/softbus/softbus_publish.cpp +++ b/services/service/src/softbus/softbus_publish.cpp @@ -40,16 +40,16 @@ std::mutex g_publishMutex; void PublishCommonEventCallback(int32_t bluetoothState, int32_t wifiState, int32_t screenState) { - LOGI("PublishCommonEventCallback start, bleState: %{public}d, wifiState: %{public}d, screenState: %{public}d", - bluetoothState, wifiState, screenState); std::lock_guard saLock(g_publishMutex); DmDeviceInfo info; SoftbusCache::GetInstance().GetLocalDeviceInfo(info); - if (info.deviceTypeId == DmDeviceType::DEVICE_TYPE_WATCH) { - LOGE("deviceType: %{public}d is watch, not publish", static_cast(info.deviceTypeId)); + LOGI("PublishCommonEventCallback start, bleState: %{public}d, wifiState: %{public}d, screenState: %{public}d" + ", deviceType: %{public}d", bluetoothState, wifiState, screenState, static_cast(info.deviceTypeId)); + if (info.deviceTypeId == DmDeviceType::DEVICE_TYPE_WATCH || + info.deviceTypeId == DmDeviceType::DEVICE_TYPE_GLASSES) { + LOGE("deviceType: %{public}d, not publish", static_cast(info.deviceTypeId)); return; } - LOGI("deviceType: %{public}d", static_cast(info.deviceTypeId)); SoftbusPublish softbusPublish; if (screenState == DM_SCREEN_OFF) { int32_t ret = softbusPublish.StopPublishSoftbusLNN(DISTRIBUTED_HARDWARE_DEVICEMANAGER_SA_ID); -- Gitee From d57707f369c64cb41980c854dbacfb030ebf9343 Mon Sep 17 00:00:00 2001 From: s30044129 Date: Wed, 10 Sep 2025 08:55:21 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: s30044129 --- interfaces/inner_kits/native_cpp/include/dm_device_info.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/inner_kits/native_cpp/include/dm_device_info.h b/interfaces/inner_kits/native_cpp/include/dm_device_info.h index 41cc4ac94..015ad99c5 100644 --- a/interfaces/inner_kits/native_cpp/include/dm_device_info.h +++ b/interfaces/inner_kits/native_cpp/include/dm_device_info.h @@ -101,7 +101,7 @@ typedef enum DmDeviceType { THIRD_TV = 0x2E, /** * Indicates ai glasses. - */ + */ DEVICE_TYPE_GLASSES = 0xA31, } DmDeviceType; -- Gitee