1 /*
2  * Copyright (c) 2022-2024 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_DSCREEN_SOURCE_STUB_H
17 #define OHOS_DSCREEN_SOURCE_STUB_H
18 
19 #include <map>
20 #include "iremote_stub.h"
21 #include "idscreen_source.h"
22 
23 namespace OHOS {
24 namespace DistributedHardware {
25 class DScreenSourceStub : public IRemoteStub<IDScreenSource> {
26 public:
27     DScreenSourceStub();
28     ~DScreenSourceStub() override = default;
29     int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply,
30         MessageOption &option) override;
31 
32 private:
33     int32_t InitSourceInner(MessageParcel &data, MessageParcel &reply,
34         MessageOption &option);
35     int32_t ReleaseSourceInner(MessageParcel &data, MessageParcel &reply,
36         MessageOption &option);
37     int32_t RegisterDistributedHardwareInner(MessageParcel &data, MessageParcel &reply,
38         MessageOption &option);
39     int32_t UnregisterDistributedHardwareInner(MessageParcel &data, MessageParcel &reply,
40         MessageOption &option);
41     int32_t ConfigDistributedHardwareInner(MessageParcel &data, MessageParcel &reply,
42         MessageOption &option);
43     int32_t DScreenNotifyInner(MessageParcel &data, MessageParcel &reply,
44         MessageOption &option);
45     bool CheckRegParams(const std::string &devId, const std::string &dhId,
46         const std::string &version, const std::string &attrs, const std::string &reqId) const;
47     bool CheckUnregParams(const std::string &devId, const std::string &dhId, const std::string &reqId) const;
48     bool CheckConfigParams(const std::string &devId, const std::string &dhId,
49         const std::string &key, const std::string &value) const;
50     bool HasEnableDHPermission();
51 };
52 } // namespace DistributedHardware
53 } // namespace OHOS
54 #endif