From 8ef76368f371695767f5206d054f32350baeef39 Mon Sep 17 00:00:00 2001 From: BrainL Date: Tue, 2 Sep 2025 11:40:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=80=BC=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: BrainL --- .../kits/taihe/include/ohos.distributedDeviceManager.h | 2 +- interfaces/kits/taihe/src/ohos.distributedDeviceManager.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/interfaces/kits/taihe/include/ohos.distributedDeviceManager.h b/interfaces/kits/taihe/include/ohos.distributedDeviceManager.h index 0242f0efa..6a9d3100a 100644 --- a/interfaces/kits/taihe/include/ohos.distributedDeviceManager.h +++ b/interfaces/kits/taihe/include/ohos.distributedDeviceManager.h @@ -39,7 +39,7 @@ public: ~DeviceManagerImpl() = default; std::string GetLocalDeviceId(); void UnbindTarget(taihe::string_view deviceId); - double GetDeviceType(taihe::string_view networkId); + int32_t GetDeviceType(taihe::string_view networkId); std::string GetDeviceName(taihe::string_view networkId); std::string GetLocalDeviceNetworkId(); diff --git a/interfaces/kits/taihe/src/ohos.distributedDeviceManager.cpp b/interfaces/kits/taihe/src/ohos.distributedDeviceManager.cpp index a05aeefca..c08342f11 100644 --- a/interfaces/kits/taihe/src/ohos.distributedDeviceManager.cpp +++ b/interfaces/kits/taihe/src/ohos.distributedDeviceManager.cpp @@ -25,7 +25,7 @@ namespace ANI::distributedDeviceManager { namespace { -constexpr double DEVICE_TYPE_UNKNOWN = -1.0; +constexpr int32_t DEVICE_TYPE_UNKNOWN = -1; constexpr const char *DEVICE_TYPE_EMPTY_STR = ""; constexpr const char *ERROR_DEVICE_ID = "error deviceId"; constexpr const char *ERROR_NETWORK_ID = "error networkId"; @@ -140,7 +140,7 @@ void DeviceManagerImpl::UnbindTarget(taihe::string_view deviceId) } } -double DeviceManagerImpl::GetDeviceType(taihe::string_view networkId) +int32_t DeviceManagerImpl::GetDeviceType(taihe::string_view networkId) { int32_t deviceType; int32_t ret = OHOS::DistributedHardware::DeviceManager::GetInstance().GetDeviceType( @@ -149,7 +149,7 @@ double DeviceManagerImpl::GetDeviceType(taihe::string_view networkId) taihe::set_business_error(DM_ERR_FAILED, "GetDeviceType for failed"); return DEVICE_TYPE_UNKNOWN; } - return static_cast(deviceType); + return deviceType; } std::string DeviceManagerImpl::GetDeviceName(taihe::string_view networkId) -- Gitee