• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 CAMERA_DEVICE_CAMERA_DEVICE_H
17 #define CAMERA_DEVICE_CAMERA_DEVICE_H
18 
19 #include "icamera_device.h"
20 #include "camera_device_service_stub.h"
21 #include "camera.h"
22 
23 namespace OHOS::Camera {
24 class StreamOperator;
25 class IPipelineCore;
26 class CameraDevice : public CameraDeviceStub {
27 public:
28     static std::shared_ptr<CameraDevice> CreateCameraDevice(const std::string &cameraId);
29     CameraDevice() = default;
30     virtual ~CameraDevice() = default;
31     CameraDevice(const CameraDevice &other) = delete;
32     CameraDevice(CameraDevice &&other) = delete;
33     CameraDevice& operator=(const CameraDevice &other) = delete;
34     CameraDevice& operator=(CameraDevice &&other) = delete;
35 
36 public:
37     virtual std::shared_ptr<IPipelineCore> GetPipelineCore() const = 0;
38     virtual CamRetCode SetCallback(const OHOS::sptr<ICameraDeviceCallback> &callback) = 0;
39     virtual ResultCallbackMode GetMetaResultMode() const = 0;
40     /* RC_OK metadata changed;RC_ERROR metadata unchanged; */
41     virtual RetCode GetMetadataResults(std::shared_ptr<CameraStandard::CameraMetadata> &metadata) = 0;
42     virtual void ResultMetadata() = 0;
43     virtual void GetCameraId(std::string &cameraId) const = 0;
44     virtual bool IsOpened() const = 0;
45     virtual void SetStatus(bool isOpened) = 0;
46 
47 protected:
48     virtual void OnMetadataChanged(const std::shared_ptr<CameraStandard::CameraMetadata> &metadata) = 0;
49     virtual void OnDevStatusErr() = 0;
50 };
51 } // end namespace OHOS::Camera
52 #endif // CAMERA_DEVICE_CAMERA_DEVICE_H
53