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