• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 #ifndef OHOS_CAMERA_ROTATE_SERVICE_PARAM_INCLUDE_CAMERA_ROTATE_PARAM_READER_H
17 #define OHOS_CAMERA_ROTATE_SERVICE_PARAM_INCLUDE_CAMERA_ROTATE_PARAM_READER_H
18 
19 #include <string>
20 #include <mutex>
21 
22 namespace OHOS {
23 namespace CameraStandard {
24 
25 namespace {
26 const std::string ABS_CONTENT_FILE_PATH = "/system/etc/camera/"; // 本地配置路径通过服务配置
27 const std::string CAMERA_SERVICE_ABS_PATH = "/data/service/el1/public/camera_service/";  // 本地沙箱路径
28 const std::string PARAM_UPDATE_ABS_PATH = "/data/service/el1/public/update/param_service/install/";  // 云推下载路径
29 const std::string PARAM_SERVICE_INSTALL_PATH = "/data/service/el1/public/update/param_service/install/system";
30 const std::string CAMERA_ROTATE_CFG_DIR = "/etc/camera/";
31 const std::string PUB_KEY_NAME = "hwkey_param_upgrade_v1.pem";
32 const std::string VERSION_FILE_NAME = "version.txt";
33 const std::string DEFAULT_VERSION = "1.0.0.0"; // 版本号非硬编
34 }
35 
36 class CameraRoateParamReader {
37 public:
38     CameraRoateParamReader() = default;
39     virtual ~CameraRoateParamReader() = default;
40 
41     virtual std::string GetConfigFilePath();
42     virtual bool VerifyCertSfFile(
43         const std::string &certFile, const std::string &verifyFile, const std::string &manifestFile);
44     virtual bool VerifyParamFile(const std::string &cfgDirPath, const std::string &filePathStr);
45     std::string GetPathVersion();
46     std::string GetVersionInfoStr(const std::string &filePathStr);
47     bool VersionStrToNumber(const std::string &versionStr, std::vector<std::string> &versionNum);
48     bool CompareVersion(const std::vector<std::string> &localVersion, const std::vector<std::string> &pathVersion);
49 private:
50     std::mutex custMethodLock;
51 };
52 
53 } // namespace CameraStandard
54 } // namespace OHOS
55 #endif // OHOS_CAMERA_ROTATE_SERVICE_PARAM_INCLUDE_CAMERA_ROTATE_PARAM_READER_H
56