修改函数名称

Signed-off-by: guoyi <guoyi39@huawei.com>
This commit is contained in:
guoyi 2024-07-02 19:15:08 +08:00
parent 607a0f1e4c
commit 6d6fca07a1
3 changed files with 8 additions and 5 deletions

View File

@ -101,7 +101,7 @@ void DpDeviceManager::DpDeviceStateCallback::OnDeviceOnline(const DmDeviceInfo &
DistributedDeviceProfileService::GetInstance().DeviceOnline();
std::string networkId = deviceInfo.networkId;
DistributedDeviceProfile::ProfileCache::GetInstance().OnNodeOnline(networkId);
DistributedDeviceProfile::DeviceProfileManager::GetInstance().ClearDataOnDeviceOnline(
DistributedDeviceProfile::DeviceProfileManager::GetInstance().FixDataOnDeviceOnline(
deviceInfo.networkId, deviceInfo.extraData);
}

View File

@ -68,7 +68,7 @@ public:
int32_t SavePutTempCache(std::map<std::string, std::string>& entries);
bool IsFirstInitDB();
void ResetFirst();
void ClearDataOnDeviceOnline(const std::string& networkId, const std::string& extraData);
void FixDataOnDeviceOnline(const std::string& networkId, const std::string& extraData);
private:
bool LoadDpSyncAdapter();

View File

@ -608,7 +608,7 @@ void DeviceProfileManager::ResetFirst()
isFirst_.store(false);
}
void DeviceProfileManager::ClearDataOnDeviceOnline(const std::string& networkId, const std::string& extraData)
void DeviceProfileManager::FixDataOnDeviceOnline(const std::string& networkId, const std::string& extraData)
{
HILOGI("networkId:%{public}s", ProfileUtils::GetAnonyString(networkId).c_str());
if (networkId.empty() || extraData.empty()) {
@ -623,9 +623,12 @@ void DeviceProfileManager::ClearDataOnDeviceOnline(const std::string& networkId,
}
int32_t osType = DEFAULT_OS_TYPE;
cJSON* osTypeJson = cJSON_GetObjectItem(extraDataJson, DistributedHardware::PARAM_KEY_OS_TYPE);
if (cJSON_IsNumber(osTypeJson)) {
osType = static_cast<int32_t>(osTypeJson->valueint);
if (!cJSON_IsNumber(osTypeJson)) {
HILOGE("osTypeJson is not a number");
cJSON_Delete(extraDataJson);
return;
}
osType = static_cast<int32_t>(osTypeJson->valueint);
cJSON_Delete(extraDataJson);
if (osType != DEFAULT_OS_TYPE) {
return;