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_NIGHT_SESSION_H
17 #define OHOS_CAMERA_NIGHT_SESSION_H
18 
19 #include <iostream>
20 #include <set>
21 #include <vector>
22 #include "camera_error_code.h"
23 #include "input/capture_input.h"
24 #include "output/capture_output.h"
25 #include "icamera_util.h"
26 #include "icapture_session.h"
27 #include "icapture_session_callback.h"
28 #include "capture_session.h"
29 
30 namespace OHOS {
31 namespace CameraStandard {
32 class CaptureOutput;
33 class NightSession : public CaptureSession {
34 public:
35     class NightSessionMetadataResultProcessor : public MetadataResultProcessor {
36     public:
NightSessionMetadataResultProcessor(wptr<NightSession> session)37         explicit NightSessionMetadataResultProcessor(wptr<NightSession> session) : session_(session) {}
38         void ProcessCallbacks(
39             const uint64_t timestamp, const std::shared_ptr<OHOS::Camera::CameraMetadata>& result) override;
40 
41     private:
42         wptr<NightSession> session_;
43     };
44 
NightSession(sptr<ICaptureSession> & nightSession)45     explicit NightSession(sptr<ICaptureSession>& nightSession) : CaptureSession(nightSession)
46     {
47         metadataResultProcessor_ = std::make_shared<NightSessionMetadataResultProcessor>(this);
48     }
49     ~NightSession();
50 
51     /**
52     * @brief Get exposure compensation range.
53     * @param vector of exposure bias range.
54     * @return errCode.
55     */
56     int32_t GetExposureRange(std::vector<uint32_t> &exposureRange);
57 
58     /**
59     * @brief Set exposure compensation value.
60     * @param exposure compensation value to be set.
61     * @return errCode.
62     */
63     int32_t SetExposure(uint32_t exposureValue);
64 
65     /**
66     * @brief Get exposure compensation value.
67     * @param exposure current exposure compensation value .
68     * @return Returns errCode.
69     */
70     int32_t GetExposure(uint32_t &exposureValue);
71 
72     /**
73      * @brief Determine if the given Ouput can be added to session.
74      *
75      * @param CaptureOutput to be added to session.
76      */
77     bool CanAddOutput(sptr<CaptureOutput>& output) override;
78 };
79 } // namespace CameraStandard
80 } // namespace OHOS
81 #endif // OHOS_CAMERA_NIGHT_SESSION_H
82