diff --git a/interfaces/kits/taihe/include/ohos.distributedDeviceManager.h b/interfaces/kits/taihe/include/ohos.distributedDeviceManager.h index 0242f0efac793acaf0310cd2d55f74d5156f12d2..6a9d3100a818cf86901233eaf27bff6798364c40 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 a05aeefca620d465229e789884b10896d8a478df..c08342f1110628c6018b546969eb4bf677464c66 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)