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_DISTRIBUTED_CAMERA_SOURCE_STUB_H 17 #define OHOS_DISTRIBUTED_CAMERA_SOURCE_STUB_H 18 19 #include <map> 20 #include "iremote_stub.h" 21 22 #include "idistributed_camera_source.h" 23 24 namespace OHOS { 25 namespace DistributedHardware { 26 class DistributedCameraSourceStub : public IRemoteStub<IDistributedCameraSource> { 27 public: 28 DistributedCameraSourceStub(); 29 virtual ~DistributedCameraSourceStub(); 30 int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 31 32 private: 33 int32_t InitSourceInner(MessageParcel &data, MessageParcel &reply); 34 int32_t ReleaseSourceInner(MessageParcel &data, MessageParcel &reply); 35 int32_t RegisterDistributedHardwareInner(MessageParcel &data, MessageParcel &reply); 36 int32_t UnregisterDistributedHardwareInner(MessageParcel &data, MessageParcel &reply); 37 int32_t DCameraNotifyInner(MessageParcel &data, MessageParcel &reply); 38 bool CheckRegParams(const std::string& devId, const std::string& dhId, 39 const std::string& reqId, const EnableParam& param); 40 bool CheckUnregParams(const std::string& devId, const std::string& dhId, const std::string& reqId); 41 bool CheckNotifyParams(const std::string& devId, const std::string& dhId, std::string& events); 42 bool HasEnableDHPermission(); 43 44 using DCameraFunc = int32_t (DistributedCameraSourceStub::*)(MessageParcel &data, MessageParcel &reply); 45 std::map<uint32_t, DCameraFunc> memberFuncMap_; 46 const size_t PARAM_MAX_SIZE = 50 * 1024 * 1024; 47 const size_t DID_MAX_SIZE = 256; 48 }; 49 } // namespace DistributedHardware 50 } // namespace OHOS 51 #endif // OHOS_DISTRIBUTED_CAMERA_SOURCE_STUB_H 52