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