1 /*
2  * Copyright (c) 2021-2024 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_ICAMERA_OPERATOR_H
17 #define OHOS_ICAMERA_OPERATOR_H
18 
19 #include <cstdint>
20 #include <memory>
21 #include <string>
22 #include <vector>
23 
24 #include "data_buffer.h"
25 #include "dcamera_capture_info_cmd.h"
26 #include "dcamera_event_cmd.h"
27 #include "v1_1/dcamera_types.h"
28 
29 #include "surface.h"
30 
31 namespace OHOS {
32 namespace DistributedHardware {
33 using namespace OHOS::HDI::DistributedCamera::V1_1;
34 class StateCallback {
35 public:
36     StateCallback() = default;
37     virtual ~StateCallback() = default;
38 
39     virtual void OnStateChanged(std::shared_ptr<DCameraEvent>& event) = 0;
40     virtual void OnMetadataResult(std::vector<std::shared_ptr<DCameraSettings>>& settings) = 0;
41 };
42 
43 class ResultCallback {
44 public:
45     ResultCallback() = default;
46     virtual ~ResultCallback() = default;
47 
48     virtual void OnPhotoResult(std::shared_ptr<DataBuffer>& buffer) = 0;
49     virtual void OnVideoResult(std::shared_ptr<DataBuffer>& buffer) = 0;
50 };
51 
52 class ICameraOperator {
53 public:
54     ICameraOperator() = default;
55     virtual ~ICameraOperator() = default;
56 
57     virtual int32_t Init() = 0;
58     virtual int32_t UnInit() = 0;
59     virtual int32_t UpdateSettings(std::vector<std::shared_ptr<DCameraSettings>>& settings) = 0;
60     virtual int32_t StartCapture(std::vector<std::shared_ptr<DCameraCaptureInfo>>& captureInfos,
61         sptr<Surface>& surface, int32_t sceneMode) = 0;
62     virtual int32_t StopCapture() = 0;
63     virtual int32_t SetStateCallback(std::shared_ptr<StateCallback>& callback) = 0;
64     virtual int32_t SetResultCallback(std::shared_ptr<ResultCallback>& callback) = 0;
65     virtual int32_t PauseCapture() = 0;
66     virtual int32_t ResumeCapture() = 0;
67 };
68 } // namespace DistributedHardware
69 } // namespace OHOS
70 #endif // OHOS_ICAMERA_OPERATOR_H