• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef CAMERA_HOST_HCS_DEAL_H
18 #define CAMERA_HOST_HCS_DEAL_H
19 
20 #include <string>
21 #include <list>
22 #include <map>
23 #include "utils.h"
24 #include "camera_metadata_info.h"
25 #include "device_resource_if.h"
26 
27 namespace OHOS::Camera {
28 class HcsDeal {
29 using CameraIdMap = std::map<std::string, std::vector<std::string>>;
30 using CameraMetadataMap = std::map<std::string, std::shared_ptr<CameraStandard::CameraMetadata>>;
31 public:
32     HcsDeal(const std::string &pathName);
33     virtual ~HcsDeal();
34     HcsDeal(const HcsDeal &other) = delete;
35     HcsDeal(HcsDeal &&other) = delete;
36     HcsDeal& operator=(const HcsDeal &other) = delete;
37     HcsDeal& operator=(HcsDeal &&other) = delete;
38 
39 public:
40     void SetHcsPathName(const std::string &pathName);
41     RetCode Init();
42     RetCode GetMetadata(CameraMetadataMap &metadataMap) const;
43     RetCode GetCameraId(CameraIdMap &cameraIdMap) const;
44 
45 private:
46     RetCode DealHcsData();
47     void ChangeToMetadata();
48     RetCode DealCameraAbility(const struct DeviceResourceNode &node);
49     RetCode DealPhysicsCameraId(const struct DeviceResourceNode &node, std::vector<std::string> &cameraIds);
50     RetCode DealMetadata(const std::string &cameraId, const struct DeviceResourceNode &node);
51 
52     RetCode DealAeAvailableAntiBandingModes(
53         const struct DeviceResourceNode &metadataNode,
54         std::shared_ptr<CameraStandard::CameraMetadata> &metadata);
55     RetCode DealAeAvailableModes(
56         const struct DeviceResourceNode &metadataNode,
57         std::shared_ptr<CameraStandard::CameraMetadata> &metadata);
58     RetCode DealAvailableAeFpsTargets(
59         const struct DeviceResourceNode &metadataNode,
60         std::shared_ptr<CameraStandard::CameraMetadata> &metadata);
61     RetCode DealAeCompensationRange(
62         const struct DeviceResourceNode &metadataNode,
63         std::shared_ptr<CameraStandard::CameraMetadata> &metadata);
64     RetCode DealAeCompensationSteps(
65         const struct DeviceResourceNode &metadataNode,
66         std::shared_ptr<CameraStandard::CameraMetadata> &metadata);
67     RetCode DealAvailableAwbModes(
68         const struct DeviceResourceNode &metadataNode,
69         std::shared_ptr<CameraStandard::CameraMetadata> &metadata);
70     RetCode DealSensitivityRange(
71         const struct DeviceResourceNode &metadataNode,
72         std::shared_ptr<CameraStandard::CameraMetadata> &metadata);
73     RetCode DealFaceDetectMode(
74         const struct DeviceResourceNode &metadataNode,
75         std::shared_ptr<CameraStandard::CameraMetadata> &metadata);
76     RetCode DealAvailableResultKeys(
77         const struct DeviceResourceNode &metadataNode,
78         std::shared_ptr<CameraStandard::CameraMetadata> &metadata);
79 
80 private:
81     std::string sPathName;
82     const struct DeviceResourceIface *pDevResIns;
83     const struct DeviceResourceNode *pRootNode;
84     CameraIdMap cameraIdMap_;
85     CameraMetadataMap cameraMetadataMap_;
86 };
87 } // namespace OHOS::Camera
88 #endif /* CAMERA_HOST_HCS_DEAL_H */
89