diff --git a/common/src/dfx/standard/dm_hidumper.cpp b/common/src/dfx/standard/dm_hidumper.cpp index 77238b7bb4612f7688b7dee6eff4da4450e9daf0..b81b9a426a8a785cf9662ab86fc716c13551b795 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 eacec0c7c6994adf95dcba97baf5760b2841e9fe..bdec6f474aceb0b5ee06b1fb00b22e206eda74f8 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 b7704d94df412168e0e12abc80305242450246e6..015ad99c5d80e7cfde4aa27c8c068066eee424d7 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 c80cbb4a4b72f9f5ce1096228e4d3b16335f732d..4ed54ddf0ecc9a9f2184020e6c700b67d08d97e2 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 e0571b6d7d7c987f7a410bb8447fbe5304510d8c..bd1985cdda9551115b6608cfa4b55874b8c1fd87 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 60a8e66d8961bb36eefe820ee606de9b2a560388..21963460d61525dc71427310936539773ddfc6b1 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 94a605c1424d5e3ecc1614a5e4c0d1614cfb893b..bcfaf55ea66a2c2404b15df4eb397490537d7fc6 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);