1/* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16#include "device_param_mgr.h" 17 18#include <parameter.h> 19 20#include "distributed_hardware_log.h" 21 22namespace OHOS { 23namespace DistributedHardware { 24namespace { 25 const int32_t BUF_LENTH = 128; 26 const char *SYNC_TYPE_E2E = "1"; 27 const char *DATA_SYNC_PARAM = "persist.distributed_scene.sys_settings_data_sync"; 28} 29IMPLEMENT_SINGLE_INSTANCE(DeviceParamMgr); 30void DeviceParamMgr::QueryDeviceDataSyncMode() 31{ 32 char paramBuf[BUF_LENTH] = {0}; 33 int32_t ret = GetParameter(DATA_SYNC_PARAM, "", paramBuf, BUF_LENTH); 34 DHLOGI("The device paramBuf: %{public}s", paramBuf); 35 if (ret > 0 && strncmp(paramBuf, SYNC_TYPE_E2E, strlen(SYNC_TYPE_E2E)) == 0) { 36 DHLOGI("Determine the e2e device success"); 37 isDeviceE2ESync_.store(true); 38 } 39} 40 41bool DeviceParamMgr::IsDeviceE2ESync() 42{ 43 return isDeviceE2ESync_; 44} 45} 46}