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 #include "distributed_input_kit.h"
17 
18 namespace OHOS {
19 namespace DistributedHardware {
20 namespace DistributedInput {
PrepareRemoteInput(const std::string & sinkId,sptr<IPrepareDInputCallback> callback)21 int32_t DistributedInputKit::PrepareRemoteInput(
22     const std::string &sinkId, sptr<IPrepareDInputCallback> callback)
23 {
24     DHLOGI("PrepareRemoteInput entrance by sinkId");
25     return DistributedInputClient::GetInstance().PrepareRemoteInput(sinkId, callback);
26 }
27 
UnprepareRemoteInput(const std::string & sinkId,sptr<IUnprepareDInputCallback> callback)28 int32_t DistributedInputKit::UnprepareRemoteInput(
29     const std::string &sinkId, sptr<IUnprepareDInputCallback> callback)
30 {
31     DHLOGI("UnprepareRemoteInput entrance by sinkId");
32     return DistributedInputClient::GetInstance().UnprepareRemoteInput(sinkId, callback);
33 }
34 
StartRemoteInput(const std::string & sinkId,const uint32_t & inputTypes,sptr<IStartDInputCallback> callback)35 int32_t DistributedInputKit::StartRemoteInput(
36     const std::string &sinkId, const uint32_t &inputTypes, sptr<IStartDInputCallback> callback)
37 {
38     DHLOGI("StartRemoteInput entrance by sinkId and inputTypes");
39     return DistributedInputClient::GetInstance().StartRemoteInput(sinkId, inputTypes, callback);
40 }
41 
StopRemoteInput(const std::string & sinkId,const uint32_t & inputTypes,sptr<IStopDInputCallback> callback)42 int32_t DistributedInputKit::StopRemoteInput(
43     const std::string &sinkId, const uint32_t &inputTypes, sptr<IStopDInputCallback> callback)
44 {
45     DHLOGI("StopRemoteInput entrance by sinkId and inputTypes");
46     return DistributedInputClient::GetInstance().StopRemoteInput(sinkId, inputTypes, callback);
47 }
48 
StartRemoteInput(const std::string & srcId,const std::string & sinkId,const uint32_t & inputTypes,sptr<IStartDInputCallback> callback)49 int32_t DistributedInputKit::StartRemoteInput(const std::string &srcId, const std::string &sinkId,
50     const uint32_t &inputTypes, sptr<IStartDInputCallback> callback)
51 {
52     DHLOGI("StartRemoteInput entrance by srcId,sinkId,inputTypes");
53     return DistributedInputClient::GetInstance().StartRemoteInput(srcId, sinkId, inputTypes, callback);
54 }
55 
StopRemoteInput(const std::string & srcId,const std::string & sinkId,const uint32_t & inputTypes,sptr<IStopDInputCallback> callback)56 int32_t DistributedInputKit::StopRemoteInput(const std::string &srcId, const std::string &sinkId,
57     const uint32_t &inputTypes, sptr<IStopDInputCallback> callback)
58 {
59     DHLOGI("StopRemoteInput entrance by srcId,sinkId,inputTypes");
60     return DistributedInputClient::GetInstance().StopRemoteInput(srcId, sinkId, inputTypes, callback);
61 }
62 
IsNeedFilterOut(const std::string & sinkId,const BusinessEvent & event)63 bool DistributedInputKit::IsNeedFilterOut(const std::string &sinkId, const BusinessEvent &event)
64 {
65     return DistributedInputClient::GetInstance().IsNeedFilterOut(sinkId, event);
66 }
67 
IsTouchEventNeedFilterOut(const TouchScreenEvent & event)68 bool DistributedInputKit::IsTouchEventNeedFilterOut(const TouchScreenEvent &event)
69 {
70     return DistributedInputClient::GetInstance().IsTouchEventNeedFilterOut(event);
71 }
72 
IsStartDistributedInput(const uint32_t & inputType)73 DInputServerType DistributedInputKit::IsStartDistributedInput(const uint32_t &inputType)
74 {
75     return DInputServerType::NULL_SERVER_TYPE;
76 }
77 
IsStartDistributedInput(const std::string & dhId)78 bool DistributedInputKit::IsStartDistributedInput(const std::string &dhId)
79 {
80     return DistributedInputClient::GetInstance().IsStartDistributedInput(dhId);
81 }
82 
PrepareRemoteInput(const std::string & srcId,const std::string & sinkId,sptr<IPrepareDInputCallback> callback)83 int32_t DistributedInputKit::PrepareRemoteInput(const std::string &srcId, const std::string &sinkId,
84     sptr<IPrepareDInputCallback> callback)
85 {
86     DHLOGI("PrepareRemoteInput entrance by srcId and sinkId");
87     return DistributedInputClient::GetInstance().PrepareRemoteInput(srcId, sinkId, callback);
88 }
89 
UnprepareRemoteInput(const std::string & srcId,const std::string & sinkId,sptr<IUnprepareDInputCallback> callback)90 int32_t DistributedInputKit::UnprepareRemoteInput(const std::string &srcId, const std::string &sinkId,
91     sptr<IUnprepareDInputCallback> callback)
92 {
93     DHLOGI("UnprepareRemoteInput entrance by srcId and sinkId");
94     return DistributedInputClient::GetInstance().UnprepareRemoteInput(srcId, sinkId, callback);
95 }
96 
StartRemoteInput(const std::string & sinkId,const std::vector<std::string> & dhIds,sptr<IStartStopDInputsCallback> callback)97 int32_t DistributedInputKit::StartRemoteInput(const std::string &sinkId, const std::vector<std::string> &dhIds,
98     sptr<IStartStopDInputsCallback> callback)
99 {
100     DHLOGI("StartRemoteInput entrance by sinkId and dhIds");
101     return DistributedInputClient::GetInstance().StartRemoteInput(sinkId, dhIds, callback);
102 }
103 
StopRemoteInput(const std::string & sinkId,const std::vector<std::string> & dhIds,sptr<IStartStopDInputsCallback> callback)104 int32_t DistributedInputKit::StopRemoteInput(const std::string &sinkId, const std::vector<std::string> &dhIds,
105     sptr<IStartStopDInputsCallback> callback)
106 {
107     DHLOGI("StopRemoteInput entrance by sinkId and dhIds");
108     return DistributedInputClient::GetInstance().StopRemoteInput(sinkId, dhIds, callback);
109 }
110 
StartRemoteInput(const std::string & srcId,const std::string & sinkId,const std::vector<std::string> & dhIds,sptr<IStartStopDInputsCallback> callback)111 int32_t DistributedInputKit::StartRemoteInput(const std::string &srcId, const std::string &sinkId,
112     const std::vector<std::string> &dhIds, sptr<IStartStopDInputsCallback> callback)
113 {
114     DHLOGI("StartRemoteInput entrance by srcId,sinkId,dhIds");
115     return DistributedInputClient::GetInstance().StartRemoteInput(srcId, sinkId, dhIds, callback);
116 }
117 
StopRemoteInput(const std::string & srcId,const std::string & sinkId,const std::vector<std::string> & dhIds,sptr<IStartStopDInputsCallback> callback)118 int32_t DistributedInputKit::StopRemoteInput(const std::string &srcId, const std::string &sinkId,
119     const std::vector<std::string> &dhIds, sptr<IStartStopDInputsCallback> callback)
120 {
121     DHLOGI("StopRemoteInput entrance by srcId,sinkId,dhIds");
122     return DistributedInputClient::GetInstance().StopRemoteInput(srcId, sinkId, dhIds, callback);
123 }
124 
RegisterSimulationEventListener(sptr<ISimulationEventListener> listener)125 int32_t DistributedInputKit::RegisterSimulationEventListener(sptr<ISimulationEventListener> listener)
126 {
127     DHLOGI("RegisterSimulationEventListener entrance");
128     return DistributedInputClient::GetInstance().RegisterSimulationEventListener(listener);
129 }
130 
UnregisterSimulationEventListener(sptr<ISimulationEventListener> listener)131 int32_t DistributedInputKit::UnregisterSimulationEventListener(sptr<ISimulationEventListener> listener)
132 {
133     DHLOGI("UnregisterSimulationEventListener entrance");
134     return DistributedInputClient::GetInstance().UnregisterSimulationEventListener(listener);
135 }
136 
RegisterSessionStateCb(sptr<ISessionStateCallback> callback)137 int32_t DistributedInputKit::RegisterSessionStateCb(sptr<ISessionStateCallback> callback)
138 {
139     DHLOGI("RegisterSessionStateCb entrance");
140     return DistributedInputClient::GetInstance().RegisterSessionStateCb(callback);
141 }
UnregisterSessionStateCb()142 int32_t DistributedInputKit::UnregisterSessionStateCb()
143 {
144     DHLOGI("UnregisterSessionStateCb entrance");
145     return DistributedInputClient::GetInstance().UnregisterSessionStateCb();
146 }
147 } // namespace DistributedInput
148 } // namespace DistributedHardware
149 } // namespace OHOS
150