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 DISTRIBUTED_INPUT_SOURCE_PROXY_H
17 #define DISTRIBUTED_INPUT_SOURCE_PROXY_H
18 
19 #include "i_distributed_source_input.h"
20 
21 #include <iostream>
22 
23 #include "iremote_proxy.h"
24 
25 namespace OHOS {
26 namespace DistributedHardware {
27 namespace DistributedInput {
28 class DistributedInputSourceProxy : public IRemoteProxy<IDistributedSourceInput> {
29 public:
30     explicit DistributedInputSourceProxy(const sptr<IRemoteObject> &object);
31     ~DistributedInputSourceProxy() override;
32 
33     int32_t Init() override;
34 
35     int32_t Release() override;
36 
37     int32_t RegisterDistributedHardware(const std::string &devId, const std::string &dhId,
38         const std::string &parameters, sptr<IRegisterDInputCallback> callback) override;
39 
40     int32_t UnregisterDistributedHardware(const std::string &devId, const std::string &dhId,
41         sptr<IUnregisterDInputCallback> callback) override;
42 
43     int32_t PrepareRemoteInput(const std::string &deviceId, sptr<IPrepareDInputCallback> callback) override;
44 
45     int32_t UnprepareRemoteInput(const std::string &deviceId, sptr<IUnprepareDInputCallback> callback) override;
46 
47     int32_t StartRemoteInput(
48         const std::string &deviceId, const uint32_t &inputTypes, sptr<IStartDInputCallback> callback) override;
49 
50     int32_t StopRemoteInput(
51         const std::string &deviceId, const uint32_t &inputTypes, sptr<IStopDInputCallback> callback) override;
52 
53     int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes,
54         sptr<IStartDInputCallback> callback) override;
55 
56     int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes,
57         sptr<IStopDInputCallback> callback) override;
58 
59     int32_t PrepareRemoteInput(const std::string &srcId, const std::string &sinkId,
60         sptr<IPrepareDInputCallback> callback) override;
61 
62     int32_t UnprepareRemoteInput(const std::string &srcId, const std::string &sinkId,
63         sptr<IUnprepareDInputCallback> callback) override;
64 
65     int32_t StartRemoteInput(const std::string &sinkId, const std::vector<std::string> &dhIds,
66         sptr<IStartStopDInputsCallback> callback) override;
67 
68     int32_t StopRemoteInput(const std::string &sinkId, const std::vector<std::string> &dhIds,
69         sptr<IStartStopDInputsCallback> callback) override;
70 
71     int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId,
72         const std::vector<std::string> &dhIds, sptr<IStartStopDInputsCallback> callback) override;
73 
74     int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId,
75         const std::vector<std::string> &dhIds, sptr<IStartStopDInputsCallback> callback) override;
76 
77     int32_t RegisterAddWhiteListCallback(sptr<IAddWhiteListInfosCallback> addWhiteListCallback) override;
78     int32_t RegisterDelWhiteListCallback(sptr<IDelWhiteListInfosCallback> delWhiteListCallback) override;
79 
80     int32_t RegisterSimulationEventListener(sptr<ISimulationEventListener> listener) override;
81     int32_t UnregisterSimulationEventListener(sptr<ISimulationEventListener> listener) override;
82 
83     int32_t RegisterSessionStateCb(sptr<ISessionStateCallback> callback) override;
84     int32_t UnregisterSessionStateCb() override;
85 
86 private:
87     bool SendRequest(const uint32_t code, MessageParcel &data, MessageParcel &reply);
88 
89     static inline BrokerDelegator<DistributedInputSourceProxy> delegator_;
90 };
91 } // namespace DistributedInput
92 } // namespace DistributedHardware
93 } // namespace OHOS
94 
95 #endif // DISTRIBUTED_INPUT_PROXY_H
96