1 /* 2 * Copyright (C) 2021 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 "types.h" 28 29 namespace OHOS { 30 namespace DistributedHardware { 31 class StateCallback { 32 public: 33 StateCallback() = default; 34 virtual ~StateCallback() = default; 35 36 virtual void OnStateChanged(std::shared_ptr<DCameraEvent>& event) = 0; 37 virtual void OnMetadataResult() = 0; 38 }; 39 40 class ResultCallback { 41 public: 42 ResultCallback() = default; 43 virtual ~ResultCallback() = default; 44 45 virtual void OnPhotoResult(std::shared_ptr<DataBuffer>& buffer) = 0; 46 virtual void OnVideoResult(std::shared_ptr<DataBuffer>& buffer) = 0; 47 }; 48 49 class ICameraOperator { 50 public: 51 ICameraOperator() = default; 52 virtual ~ICameraOperator() = default; 53 54 virtual int32_t Init() = 0; 55 virtual int32_t UnInit() = 0; 56 virtual int32_t UpdateSettings(std::vector<std::shared_ptr<DCameraSettings>>& settings) = 0; 57 virtual int32_t StartCapture(std::vector<std::shared_ptr<DCameraCaptureInfo>>& captureInfos) = 0; 58 virtual int32_t StopCapture() = 0; 59 virtual int32_t SetStateCallback(std::shared_ptr<StateCallback>& callback) = 0; 60 virtual int32_t SetResultCallback(std::shared_ptr<ResultCallback>& callback) = 0; 61 }; 62 } // namespace DistributedHardware 63 } // namespace OHOS 64 #endif // OHOS_ICAMERA_OPERATOR_H