1 /* 2 * Copyright (c) 2021-2022 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_CAMERA_INFO_H 17 #define OHOS_CAMERA_CAMERA_INFO_H 18 19 #include <iostream> 20 #include <vector> 21 #include <refbase.h> 22 #include "camera_metadata_info.h" 23 24 namespace OHOS { 25 namespace CameraStandard { 26 class CameraInfo : public RefBase { 27 public: 28 CameraInfo() = default; 29 CameraInfo(std::string cameraID, std::shared_ptr<OHOS::Camera::CameraMetadata> metadata); 30 ~CameraInfo(); 31 /** 32 * @brief Get the camera Id. 33 * 34 * @return Returns the camera Id. 35 */ 36 std::string GetID(); 37 38 /** 39 * @brief Get the metadata corresponding to current camera object. 40 * 41 * @return Returns the metadata corresponding to current object. 42 */ 43 std::shared_ptr<OHOS::Camera::CameraMetadata> GetMetadata(); 44 45 /** 46 * @brief Set the metadata to current camera object. 47 * 48 * @param Metadat to set. 49 */ 50 void SetMetadata(std::shared_ptr<OHOS::Camera::CameraMetadata> metadata); 51 52 /** 53 * @brief Get the position of the camera. 54 * 55 * @return Returns the position of the camera. 56 */ 57 camera_position_enum_t GetPosition(); 58 59 /** 60 * @brief Get the Camera type of the camera. 61 * 62 * @return Returns the Camera type of the camera. 63 */ 64 camera_type_enum_t GetCameraType(); 65 66 /** 67 * @brief Get the Camera connection type. 68 * 69 * @return Returns the Camera type of the camera. 70 */ 71 camera_connection_type_t GetConnectionType(); 72 73 /** 74 * @brief Check if mirror mode supported. 75 * 76 * @return Returns True is supported. 77 */ 78 bool IsMirrorSupported(); 79 80 /** 81 * @brief Get the supported Zoom Ratio range. 82 * 83 * @return Returns vector<float> of supported Zoom ratio range. 84 */ 85 std::vector<float> GetZoomRatioRange(); 86 87 /** 88 * @brief Get the supported exposure compensation range. 89 * 90 * @return Returns vector<int32_t> of supported exposure compensation range. 91 */ 92 std::vector<int32_t> GetExposureBiasRange(); 93 94 private: 95 std::string cameraID_; 96 std::shared_ptr<OHOS::Camera::CameraMetadata> metadata_; 97 camera_position_enum_t cameraPosition_ = OHOS_CAMERA_POSITION_OTHER; 98 camera_type_enum_t cameraType_ = OHOS_CAMERA_TYPE_UNSPECIFIED; 99 camera_connection_type_t connectionType_ = OHOS_CAMERA_CONNECTION_TYPE_BUILTIN; 100 bool isMirrorSupported_ = false; 101 std::vector<float> zoomRatioRange_; 102 std::vector<int32_t> exposureBiasRange_; 103 104 void init(common_metadata_header_t* metadataHeader); 105 std::vector<float> CalculateZoomRange(); 106 }; 107 } // namespace CameraStandard 108 } // namespace OHOS 109 #endif // OHOS_CAMERA_CAMERA_INFO_H 110