• 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_CAPTURE_SESSION_FOR_SYS_H
17 #define OHOS_CAMERA_CAPTURE_SESSION_FOR_SYS_H
18 
19 #include "session/capture_session.h"
20 
21 namespace OHOS {
22 namespace CameraStandard {
23 class CaptureSessionForSys : public CaptureSession {
24 public:
CaptureSessionForSys(sptr<ICaptureSession> & captureSession)25     explicit CaptureSessionForSys(sptr<ICaptureSession> &captureSession) : CaptureSession(captureSession) {}
26     virtual ~CaptureSessionForSys();
27 
28     /**
29      * @brief Query whether given focus range type supported.
30      * @param focusRangeType focus range type to query.
31      * @param isSupported True is supported false otherwise.
32      * @return Returns errCode.
33      */
34     int32_t IsFocusRangeTypeSupported(FocusRangeType focusRangeType, bool& isSupported);
35 
36     /**
37      * @brief Get focus range type.
38      * @param focusRangeType focus range type.
39      * @return Returns errCode.
40      */
41     int32_t GetFocusRange(FocusRangeType& focusRangeType);
42 
43     /**
44      * @brief Set focus range type.
45      * @param focusRangeType focus range type to be set.
46      * @return Returns errCode.
47      */
48     int32_t SetFocusRange(FocusRangeType focusRangeType);
49 
50     /**
51      * @brief Query whether given focus driven type supported.
52      * @param focusDrivenType focus driven type to query.
53      * @param isSupported True is supported false otherwise.
54      * @return Returns errCode.
55      */
56     int32_t IsFocusDrivenTypeSupported(FocusDrivenType focusDrivenType, bool& isSupported);
57 
58     /**
59      * @brief Get focus driven type.
60      * @param focusDrivenType focus driven type.
61      * @return Returns errCode.
62      */
63     int32_t GetFocusDriven(FocusDrivenType& focusDrivenType);
64 
65     /**
66      * @brief Set focus driven type.
67      * @param focusDrivenType focus driven type to be set.
68      * @return Returns errCode.
69      */
70     int32_t SetFocusDriven(FocusDrivenType focusDrivenType);
71 
72     /**
73      * @brief Get the vector of color reservation types.
74      * @param types vector of color reservation types.
75      * @return Returns errCode.
76      */
77     int32_t GetSupportedColorReservationTypes(std::vector<ColorReservationType>& types);
78 
79     /**
80      * @brief Get color reservation type.
81      * @param colorReservationType color reservation type.
82      * @return Returns errCode.
83      */
84     int32_t GetColorReservation(ColorReservationType& colorReservationType);
85 
86     /**
87      * @brief Set color reservation type.
88      * @param colorReservationType color reservation type to be set.
89      * @return Returns errCode.
90      */
91     int32_t SetColorReservation(ColorReservationType colorReservationType);
92 
93     /**
94      * @brief Get the supported Zoom point info.
95      *
96      * @param vector<ZoomPointInfo> of supported ZoomPointInfo.
97      * @return Returns errCode.
98      */
99     int32_t GetZoomPointInfos(std::vector<ZoomPointInfo>& zoomPointInfoList);
100 
101     /**
102      * @brief according type to get the strength.
103      */
104     int32_t GetBeauty(BeautyType type);
105 
106     /**
107      * @brief Sets a portrait theme type for a camera device.
108      * @param type PortraitTheme type to be sety.
109      * @return Returns errCode.
110      */
111     int32_t SetPortraitThemeType(PortraitThemeType type);
112 
113     /**
114      * @brief Get the current color effect.
115      *
116      * @return Returns current color effect.
117      */
118     ColorEffect GetColorEffect();
119 
120     /**
121      * @brief Set the color effect.
122      */
123     void SetColorEffect(ColorEffect colorEffect);
124 
125 // Focus Distance
126     /**
127      * @brief Get the current FocusDistance.
128      * @param distance current Focus Distance.
129      * @return Returns errCode.
130      */
131     int32_t GetFocusDistance(float& distance);
132 
133     /**
134      * @brief Check current status is support depth fusion or not.
135      */
136     bool IsDepthFusionSupported();
137 
138     /**
139      * @brief Enable depth fusion.
140      */
141     int32_t EnableDepthFusion(bool isEnable);
142 
143     /**
144      * @brief Get the depth fusion supported Zoom Ratio range,
145      *
146      * @return Returns vector<float> of depth fusion supported Zoom ratio range.
147      */
148     std::vector<float> GetDepthFusionThreshold();
149 
150     /**
151      * @brief Get the depth fusion supported Zoom ratio range.
152      *
153      * @param vector<float> of depth fusion supported Zoom ratio range.
154      * @return Returns errCode.
155      */
156     int32_t GetDepthFusionThreshold(std::vector<float>& depthFusionThreshold);
157 
158     /**
159     * @brief Check curernt status is enabled depth fusion.
160     */
161     bool IsDepthFusionEnabled();
162 
163     /**
164      * @brief Set the feature detection status callback.
165      * which will be called when there is feature detection state change.
166      *
167      * @param The FeatureDetectionStatusCallback pointer.
168      */
169     void SetFeatureDetectionStatusCallback(std::shared_ptr<FeatureDetectionStatusCallback> callback);
170 
171     void SetEffectSuggestionCallback(std::shared_ptr<EffectSuggestionCallback> effectSuggestionCallback);
172 
173     /**
174      * @brief Get whether effectSuggestion Supported.
175      *
176      * @return True if supported false otherwise.
177      */
178     bool IsEffectSuggestionSupported();
179 
180     /**
181      * @brief Enable EffectSuggestion.
182      * @param isEnable switch to control Effect Suggestion.
183      * @return errCode
184      */
185     int32_t EnableEffectSuggestion(bool isEnable);
186 
187     /**
188      * @brief Batch set effect suggestion status.
189      * @param effectSuggestionStatusList effect suggestion status list to be set.
190      * @return errCode
191      */
192     int32_t SetEffectSuggestionStatus(std::vector<EffectSuggestionStatus> effectSuggestionStatusList);
193 
194     /**
195      * @brief Get supported EffectSuggestionInfo.
196      * @return EffectSuggestionInfo parsed from tag
197      */
198     EffectSuggestionInfo GetSupportedEffectSuggestionInfo();
199 
200     /**
201      * @brief Get supported effectSuggestionType.
202      * @return EffectSuggestionTypeList which current mode supported.
203      */
204     std::vector<EffectSuggestionType> GetSupportedEffectSuggestionType();
205 
206     /**
207      * @brief Set ar mode.
208      * @param effectSuggestionType switch to control effect suggestion.
209      * @param isEnable switch to control effect suggestion status.
210      * @return errCode
211      */
212     int32_t UpdateEffectSuggestion(EffectSuggestionType effectSuggestionType, bool isEnable);
213 
214     /**
215      * @brief Get the virtual aperture.
216      * @param aperture returns the current virtual aperture.
217      * @return Error code.
218      */
219     int32_t GetVirtualAperture(float& aperture);
220 
221     /**
222      * @brief Set the virtual aperture.
223      * @param virtualAperture set virtual aperture value.
224      * @return Error code.
225      */
226     int32_t SetVirtualAperture(const float virtualAperture);
227 
228     /**
229      * @brief Get the physical aperture.
230      * @param aperture returns current physical aperture.
231      * @return Error code.
232      */
233     int32_t GetPhysicalAperture(float& aperture);
234 
235     /**
236      * @brief Set the physical aperture.
237      * @param physicalAperture set physical aperture value.
238      * @return Error code.
239      */
240     int32_t SetPhysicalAperture(float physicalAperture);
241 
242     /**
243      * @brief Enables or disables LCD flash detection.
244      *
245      * This function enables or disables the detection of the LCD flash feature based on the provided `isEnable` flag.
246      *
247      * @param isEnable A boolean flag indicating whether to enable (`true`) or disable (`false`) LCD flash detection.
248      *
249      * @return Returns an `int32_t` value indicating the outcome of the operation.
250      *         A return value of 0 typically signifies success, while a non-zero value indicates an error.
251      */
252     int32_t EnableLcdFlashDetection(bool isEnable);
253 
254     /**
255      * @brief Sets the callback for LCD flash status updates.
256      *
257      * This function assigns a callback to be invoked whenever there is a change in the LCD flash status.
258      * The callback is passed as a shared pointer, allowing for shared ownership and automatic memory management.
259      *
260      * @param lcdFlashStatusCallback A shared pointer to an LcdFlashStatusCallback object. This callback will
261      *        be called to handle updates related to the LCD flash status. If the callback is already set,
262      *        it will be overwritten with the new one.
263      */
264     void SetLcdFlashStatusCallback(std::shared_ptr<LcdFlashStatusCallback> lcdFlashStatusCallback);
265 
266     /**
267      * @brief Enables or disables tripod detection.
268      *
269      * This function enables or disables the tripod detection feature based on the provided `enabled` flag.
270      *
271      * @param enabled A boolean flag that specifies whether to enable or disable tripod detection.
272      *
273      * @return Returns an `int32_t` value indicating the outcome of the operation.
274      *         A return value of 0 typically indicates success, while a non-zero value indicates an error.
275      */
276     int32_t EnableTripodDetection(bool enabled);
277 
278     /**
279      * @brief Set usage for the capture session.
280      * @param usage - The capture session usage.
281      * @param enabled - Enable usage for session if TRUE.
282      */
283     void SetUsage(UsageType usageType, bool enabled);
284 
285     /**
286      * @brief Enables or disables the LCD flash feature.
287      *
288      * This function enables or disables the LCD flash feature based on the provided `isEnable` flag.
289      *
290      * @param isEnable A boolean flag indicating whether to enable (`true`) or disable (`false`) the LCD flash feature.
291      *
292      * @return Returns an `int32_t` value indicating the result of the operation.
293      *         Typically, a return value of 0 indicates success, while a non-zero value indicates an error.
294      */
295     int32_t EnableLcdFlash(bool isEnable);
296 
297 private:
298     int32_t IsColorReservationTypeSupported(ColorReservationType colorReservationType, bool& isSupported);
299     volatile bool isDepthFusionEnable_ = false;
300     static const std::unordered_map<EffectSuggestionType, CameraEffectSuggestionType> fwkEffectSuggestionTypeMap_;
301 };
302 } // namespace CameraStandard
303 } // namespace OHOS
304 #endif // OHOS_CAMERA_CAPTURE_SESSION_FOR_SYS_H
305