1794c9f46Sopenharmony_ci/* 2794c9f46Sopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 3794c9f46Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4794c9f46Sopenharmony_ci * you may not use this file except in compliance with the License. 5794c9f46Sopenharmony_ci * You may obtain a copy of the License at 6794c9f46Sopenharmony_ci * 7794c9f46Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8794c9f46Sopenharmony_ci * 9794c9f46Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10794c9f46Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11794c9f46Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12794c9f46Sopenharmony_ci * See the License for the specific language governing permissions and 13794c9f46Sopenharmony_ci * limitations under the License. 14794c9f46Sopenharmony_ci */ 15794c9f46Sopenharmony_ci 16794c9f46Sopenharmony_ci#include "device_param_mgr.h" 17794c9f46Sopenharmony_ci 18794c9f46Sopenharmony_ci#include <parameter.h> 19794c9f46Sopenharmony_ci 20794c9f46Sopenharmony_ci#include "distributed_hardware_log.h" 21794c9f46Sopenharmony_ci 22794c9f46Sopenharmony_cinamespace OHOS { 23794c9f46Sopenharmony_cinamespace DistributedHardware { 24794c9f46Sopenharmony_cinamespace { 25794c9f46Sopenharmony_ci const int32_t BUF_LENTH = 128; 26794c9f46Sopenharmony_ci const char *SYNC_TYPE_E2E = "1"; 27794c9f46Sopenharmony_ci const char *DATA_SYNC_PARAM = "persist.distributed_scene.sys_settings_data_sync"; 28794c9f46Sopenharmony_ci} 29794c9f46Sopenharmony_ciIMPLEMENT_SINGLE_INSTANCE(DeviceParamMgr); 30794c9f46Sopenharmony_civoid DeviceParamMgr::QueryDeviceDataSyncMode() 31794c9f46Sopenharmony_ci{ 32794c9f46Sopenharmony_ci char paramBuf[BUF_LENTH] = {0}; 33794c9f46Sopenharmony_ci int32_t ret = GetParameter(DATA_SYNC_PARAM, "", paramBuf, BUF_LENTH); 34794c9f46Sopenharmony_ci DHLOGI("The device paramBuf: %{public}s", paramBuf); 35794c9f46Sopenharmony_ci if (ret > 0 && strncmp(paramBuf, SYNC_TYPE_E2E, strlen(SYNC_TYPE_E2E)) == 0) { 36794c9f46Sopenharmony_ci DHLOGI("Determine the e2e device success"); 37794c9f46Sopenharmony_ci isDeviceE2ESync_.store(true); 38794c9f46Sopenharmony_ci } 39794c9f46Sopenharmony_ci} 40794c9f46Sopenharmony_ci 41794c9f46Sopenharmony_cibool DeviceParamMgr::IsDeviceE2ESync() 42794c9f46Sopenharmony_ci{ 43794c9f46Sopenharmony_ci return isDeviceE2ESync_; 44794c9f46Sopenharmony_ci} 45794c9f46Sopenharmony_ci} 46794c9f46Sopenharmony_ci}