1/*
2 * Copyright (c) 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_HDI_CAMERA_V1_0_STREAMOPERATORPROXY_H
17#define OHOS_HDI_CAMERA_V1_0_STREAMOPERATORPROXY_H
18
19#include "v1_0/istream_operator.h"
20#include <iproxy_broker.h>
21
22namespace OHOS {
23namespace HDI {
24namespace Camera {
25namespace V1_0 {
26
27class StreamOperatorProxy : public IProxyBroker<OHOS::HDI::Camera::V1_0::IStreamOperator> {
28public:
29    explicit StreamOperatorProxy(const sptr<IRemoteObject>& remote) : IProxyBroker<OHOS::HDI::Camera::V1_0::IStreamOperator>(remote) {
30    }
31    virtual ~StreamOperatorProxy() = default;
32
33    inline bool IsProxy() override
34    {
35        return true;
36    }
37
38    int32_t IsStreamsSupported(OHOS::HDI::Camera::V1_0::OperationMode mode, const std::vector<uint8_t>& modeSetting,
39         const std::vector<OHOS::HDI::Camera::V1_0::StreamInfo>& infos, OHOS::HDI::Camera::V1_0::StreamSupportType& type) override;
40
41    int32_t CreateStreams(const std::vector<OHOS::HDI::Camera::V1_0::StreamInfo>& streamInfos) override;
42
43    int32_t ReleaseStreams(const std::vector<int32_t>& streamIds) override;
44
45    int32_t CommitStreams(OHOS::HDI::Camera::V1_0::OperationMode mode,
46         const std::vector<uint8_t>& modeSetting) override;
47
48    int32_t GetStreamAttributes(std::vector<OHOS::HDI::Camera::V1_0::StreamAttribute>& attributes) override;
49
50    int32_t AttachBufferQueue(int32_t streamId,
51         const sptr<OHOS::HDI::Camera::V1_0::BufferProducerSequenceable>& bufferProducer) override;
52
53    int32_t DetachBufferQueue(int32_t streamId) override;
54
55    int32_t Capture(int32_t captureId, const OHOS::HDI::Camera::V1_0::CaptureInfo& info, bool isStreaming) override;
56
57    int32_t CancelCapture(int32_t captureId) override;
58
59    int32_t ChangeToOfflineStream(const std::vector<int32_t>& streamIds,
60         const sptr<OHOS::HDI::Camera::V1_0::IStreamOperatorCallback>& callbackObj, sptr<OHOS::HDI::Camera::V1_0::IOfflineStreamOperator>& offlineOperator) override;
61
62    int32_t GetVersion(uint32_t& majorVer, uint32_t& minorVer) override;
63
64    static int32_t IsStreamsSupported_(OHOS::HDI::Camera::V1_0::OperationMode mode,
65         const std::vector<uint8_t>& modeSetting, const std::vector<OHOS::HDI::Camera::V1_0::StreamInfo>& infos, OHOS::HDI::Camera::V1_0::StreamSupportType& type, const sptr<IRemoteObject> remote);
66
67    static int32_t CreateStreams_(const std::vector<OHOS::HDI::Camera::V1_0::StreamInfo>& streamInfos,
68         const sptr<IRemoteObject> remote);
69
70    static int32_t ReleaseStreams_(const std::vector<int32_t>& streamIds, const sptr<IRemoteObject> remote);
71
72    static int32_t CommitStreams_(OHOS::HDI::Camera::V1_0::OperationMode mode, const std::vector<uint8_t>& modeSetting,
73         const sptr<IRemoteObject> remote);
74
75    static int32_t GetStreamAttributes_(std::vector<OHOS::HDI::Camera::V1_0::StreamAttribute>& attributes,
76         const sptr<IRemoteObject> remote);
77
78    static int32_t AttachBufferQueue_(int32_t streamId,
79         const sptr<OHOS::HDI::Camera::V1_0::BufferProducerSequenceable>& bufferProducer, const sptr<IRemoteObject> remote);
80
81    static int32_t DetachBufferQueue_(int32_t streamId, const sptr<IRemoteObject> remote);
82
83    static int32_t Capture_(int32_t captureId, const OHOS::HDI::Camera::V1_0::CaptureInfo& info, bool isStreaming,
84         const sptr<IRemoteObject> remote);
85
86    static int32_t CancelCapture_(int32_t captureId, const sptr<IRemoteObject> remote);
87
88    static int32_t ChangeToOfflineStream_(const std::vector<int32_t>& streamIds,
89         const sptr<OHOS::HDI::Camera::V1_0::IStreamOperatorCallback>& callbackObj, sptr<OHOS::HDI::Camera::V1_0::IOfflineStreamOperator>& offlineOperator, const sptr<IRemoteObject> remote);
90
91    static int32_t GetVersion_(uint32_t& majorVer, uint32_t& minorVer, const sptr<IRemoteObject> remote);
92
93private:
94    static inline BrokerDelegator<OHOS::HDI::Camera::V1_0::StreamOperatorProxy> delegator_;
95};
96
97} // V1_0
98} // Camera
99} // HDI
100} // OHOS
101
102#endif // OHOS_HDI_CAMERA_V1_0_STREAMOPERATORPROXY_H
103
104