1 /* 2 * Copyright (c) 2021-2023 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_DISTRIBUTED_CAMERA_SINK_STUB_H 17 #define OHOS_DISTRIBUTED_CAMERA_SINK_STUB_H 18 19 #include <map> 20 #include "iremote_stub.h" 21 22 #include "idistributed_camera_sink.h" 23 24 namespace OHOS { 25 namespace DistributedHardware { 26 class DistributedCameraSinkStub : public IRemoteStub<IDistributedCameraSink> { 27 public: 28 DistributedCameraSinkStub(); 29 virtual ~DistributedCameraSinkStub(); 30 int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 31 32 private: 33 int32_t InitSinkInner(MessageParcel &data, MessageParcel &reply); 34 int32_t ReleaseSinkInner(MessageParcel &data, MessageParcel &reply); 35 int32_t SubscribeLocalHardwareInner(MessageParcel &data, MessageParcel &reply); 36 int32_t UnsubscribeLocalHardwareInner(MessageParcel &data, MessageParcel &reply); 37 int32_t StopCaptureInner(MessageParcel &data, MessageParcel &reply); 38 int32_t ChannelNegInner(MessageParcel &data, MessageParcel &reply); 39 int32_t GetCameraInfoInner(MessageParcel &data, MessageParcel &reply); 40 int32_t OpenChannelInner(MessageParcel &data, MessageParcel &reply); 41 int32_t CloseChannelInner(MessageParcel &data, MessageParcel &reply); 42 bool HasEnableDHPermission(); 43 int32_t PauseDistributedHardwareInner(MessageParcel &data, MessageParcel &reply); 44 int32_t ResumeDistributedHardwareInner(MessageParcel &data, MessageParcel &reply); 45 int32_t StopDistributedHardwareInner(MessageParcel &data, MessageParcel &reply); 46 bool HasAccessDHPermission(); 47 48 using DCameraFunc = int32_t (DistributedCameraSinkStub::*)(MessageParcel &data, MessageParcel &reply); 49 std::map<uint32_t, DCameraFunc> memberFuncMap_; 50 51 const size_t DID_MAX_SIZE = 256; 52 const size_t PARAM_MAX_SIZE = 50 * 1024 * 1024; 53 }; 54 } // namespace DistributedHardware 55 } // namespace OHOS 56 #endif // OHOS_DISTRIBUTED_CAMERA_SINK_STUB_H