• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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 "multimodal_input_connect_proxy.h"
17 #include "pixel_map.h"
18 #include "message_option.h"
19 #include "mmi_log.h"
20 #include "multimodal_input_connect_def_parcel.h"
21 #include "multimodal_input_connect_define.h"
22 #include "string_ex.h"
23 #include "multimodalinput_ipc_interface_code.h"
24 
25 namespace OHOS {
26 namespace MMI {
27 namespace {
28 constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, MMI_LOG_DOMAIN, "MultimodalInputConnectProxy" };
29 
ParseInputDevice(MessageParcel & reply,std::shared_ptr<InputDevice> & inputDevice)30 int32_t ParseInputDevice(MessageParcel &reply, std::shared_ptr<InputDevice> &inputDevice)
31 {
32     int32_t value;
33     READINT32(reply, value, IPC_PROXY_DEAD_OBJECT_ERR);
34     inputDevice->SetId(value);
35     READINT32(reply, value, IPC_PROXY_DEAD_OBJECT_ERR);
36     inputDevice->SetType(value);
37     std::string name;
38     READSTRING(reply, name, IPC_PROXY_DEAD_OBJECT_ERR);
39     inputDevice->SetName(name);
40     READINT32(reply, value, IPC_PROXY_DEAD_OBJECT_ERR);
41     inputDevice->SetBus(value);
42     READINT32(reply, value, IPC_PROXY_DEAD_OBJECT_ERR);
43     inputDevice->SetVersion(value);
44     READINT32(reply, value, IPC_PROXY_DEAD_OBJECT_ERR);
45     inputDevice->SetProduct(value);
46     READINT32(reply, value, IPC_PROXY_DEAD_OBJECT_ERR);
47     inputDevice->SetVendor(value);
48     std::string phys;
49     READSTRING(reply, phys, IPC_PROXY_DEAD_OBJECT_ERR);
50     inputDevice->SetPhys(phys);
51     std::string uniq;
52     READSTRING(reply, uniq, IPC_PROXY_DEAD_OBJECT_ERR);
53     inputDevice->SetUniq(uniq);
54     uint64_t caps;
55     READUINT64(reply, caps, IPC_PROXY_DEAD_OBJECT_ERR);
56     inputDevice->SetCapabilities(static_cast<unsigned long>(caps));
57 
58     uint32_t size;
59     READUINT32(reply, size, IPC_PROXY_DEAD_OBJECT_ERR);
60     InputDevice::AxisInfo axis;
61     for (uint32_t i = 0; i < size; ++i) {
62         int32_t val;
63         READINT32(reply, val, IPC_PROXY_DEAD_OBJECT_ERR);
64         axis.SetMinimum(val);
65         READINT32(reply, val, IPC_PROXY_DEAD_OBJECT_ERR);
66         axis.SetMaximum(val);
67         READINT32(reply, val, IPC_PROXY_DEAD_OBJECT_ERR);
68         axis.SetAxisType(val);
69         READINT32(reply, val, IPC_PROXY_DEAD_OBJECT_ERR);
70         axis.SetFuzz(val);
71         READINT32(reply, val, IPC_PROXY_DEAD_OBJECT_ERR);
72         axis.SetFlat(val);
73         READINT32(reply, val, IPC_PROXY_DEAD_OBJECT_ERR);
74         axis.SetResolution(val);
75         inputDevice->AddAxisInfo(axis);
76     }
77     return RET_OK;
78 }
79 } // namespace
80 
MultimodalInputConnectProxy(const sptr<IRemoteObject> & impl)81 MultimodalInputConnectProxy::MultimodalInputConnectProxy(const sptr<IRemoteObject> &impl)
82     : IRemoteProxy<IMultimodalInputConnect>(impl)
83 {
84     MMI_HILOGD("Enter MultimodalInputConnectProxy");
85 }
86 
AllocSocketFd(const std::string & programName,const int32_t moduleType,int32_t & socketFd,int32_t & tokenType)87 int32_t MultimodalInputConnectProxy::AllocSocketFd(const std::string &programName,
88     const int32_t moduleType, int32_t &socketFd, int32_t &tokenType)
89 {
90     CALL_DEBUG_ENTER;
91     MessageParcel data;
92     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
93         MMI_HILOGE("Failed to write descriptor");
94         return ERR_INVALID_VALUE;
95     }
96 
97     ConnectReqParcel req;
98     req.data.moduleId = moduleType;
99     req.data.clientName = programName;
100     if (!data.WriteParcelable(&req)) {
101         MMI_HILOGE("Failed to write programName");
102         return ERR_INVALID_VALUE;
103     }
104 
105     MessageParcel reply;
106     MessageOption option;
107     sptr<IRemoteObject> remote = Remote();
108     CHKPR(remote, RET_ERR);
109     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::ALLOC_SOCKET_FD),
110         data, reply, option);
111     if (ret != RET_OK) {
112         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
113         return RET_ERR;
114     }
115     socketFd = reply.ReadFileDescriptor();
116     if (socketFd < RET_OK) {
117         MMI_HILOGE("Read file descriptor failed, fd: %{public}d", socketFd);
118         return IPC_PROXY_DEAD_OBJECT_ERR;
119     }
120     READINT32(reply, tokenType, IPC_PROXY_DEAD_OBJECT_ERR);
121     MMI_HILOGD("socketFd:%{public}d tokenType:%{public}d", socketFd, tokenType);
122     return RET_OK;
123 }
124 
AddInputEventFilter(sptr<IEventFilter> filter,int32_t filterId,int32_t priority,uint32_t deviceTags)125 int32_t MultimodalInputConnectProxy::AddInputEventFilter(sptr<IEventFilter> filter, int32_t filterId, int32_t priority,
126     uint32_t deviceTags)
127 {
128     CALL_DEBUG_ENTER;
129     MessageParcel data;
130     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
131         MMI_HILOGE("Failed to write descriptor");
132         return ERR_INVALID_VALUE;
133     }
134     if (!data.WriteRemoteObject(filter->AsObject().GetRefPtr())) {
135         MMI_HILOGE("Failed to write filter");
136         return ERR_INVALID_VALUE;
137     }
138     WRITEINT32(data, filterId, ERR_INVALID_VALUE);
139     WRITEINT32(data, priority, ERR_INVALID_VALUE);
140     WRITEUINT32(data, deviceTags, ERR_INVALID_VALUE);
141     MessageParcel reply;
142     MessageOption option;
143     sptr<IRemoteObject> remote = Remote();
144     CHKPR(remote, RET_ERR);
145     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
146         ADD_INPUT_EVENT_FILTER), data, reply, option);
147     if (ret != RET_OK) {
148         MMI_HILOGE("Send request message failed, ret:%{public}d", ret);
149         return ret;
150     }
151     return RET_OK;
152 }
153 
RemoveInputEventFilter(int32_t filterId)154 int32_t MultimodalInputConnectProxy::RemoveInputEventFilter(int32_t filterId)
155 {
156     CALL_DEBUG_ENTER;
157     MessageParcel data;
158     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
159         MMI_HILOGE("Failed to write descriptor");
160         return ERR_INVALID_VALUE;
161     }
162     WRITEINT32(data, filterId, ERR_INVALID_VALUE);
163     MessageParcel reply;
164     MessageOption option;
165     sptr<IRemoteObject> remote = Remote();
166     CHKPR(remote, RET_ERR);
167     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
168         RMV_INPUT_EVENT_FILTER), data, reply, option);
169     if (ret != RET_OK) {
170         MMI_HILOGE("Send request message failed, ret:%{public}d", ret);
171         return ret;
172     }
173     return RET_OK;
174 }
175 
SetMouseScrollRows(int32_t rows)176 int32_t MultimodalInputConnectProxy::SetMouseScrollRows(int32_t rows)
177 {
178     CALL_DEBUG_ENTER;
179     MessageParcel data;
180     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
181         MMI_HILOGE("Failed to write descriptor");
182         return ERR_INVALID_VALUE;
183     }
184 
185     WRITEINT32(data, rows, ERR_INVALID_VALUE);
186 
187     MessageParcel reply;
188     MessageOption option;
189     sptr<IRemoteObject> remote = Remote();
190     CHKPR(remote, RET_ERR);
191     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::SET_MOUSE_SCROLL_ROWS),
192         data, reply, option);
193     if (ret != RET_OK) {
194         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
195         return ret;
196     }
197     return RET_OK;
198 }
199 
SetMouseIcon(int32_t windowId,void * pixelMap)200 int32_t MultimodalInputConnectProxy::SetMouseIcon(int32_t windowId, void* pixelMap)
201 {
202     CALL_DEBUG_ENTER;
203     OHOS::Media::PixelMap* pixelMapPtr = static_cast<OHOS::Media::PixelMap*>(pixelMap);
204     if (pixelMapPtr->GetCapacity() == 0) {
205         MMI_HILOGE("pixelMap is empty, we dont have to pass it to the server");
206         return ERR_INVALID_VALUE;
207     }
208     MessageParcel data;
209     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
210         MMI_HILOGE("Failed to write descriptor");
211         return ERR_INVALID_VALUE;
212     }
213     std::vector<uint8_t> buff;
214     pixelMapPtr->EncodeTlv(buff);
215     uint32_t size = buff.size();
216 
217     MMI_HILOGD("image buffer size being sent is %{public}d", size);
218     WRITEINT32(data, size, ERR_INVALID_VALUE);
219     for (uint32_t i = 0; i < size; i++) {
220         WRITEUINT8(data, buff[i], ERR_INVALID_VALUE);
221     }
222     MMI_HILOGD("windowId being sent is %{public}d", windowId);
223     WRITEINT32(data, windowId, ERR_INVALID_VALUE);
224 
225     MessageParcel reply;
226     MessageOption option;
227     sptr<IRemoteObject> remote = Remote();
228     CHKPR(remote, RET_ERR);
229     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::SET_MOUSE_ICON),
230         data, reply, option);
231     if (ret != RET_OK) {
232         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
233         return ret;
234     }
235     return RET_OK;
236 }
237 
SetMouseHotSpot(int32_t windowId,int32_t hotSpotX,int32_t hotSpotY)238 int32_t MultimodalInputConnectProxy::SetMouseHotSpot(int32_t windowId, int32_t hotSpotX, int32_t hotSpotY)
239 {
240     CALL_DEBUG_ENTER;
241     MessageParcel data;
242     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
243         MMI_HILOGE("Failed to write descriptor");
244         return ERR_INVALID_VALUE;
245     }
246     WRITEINT32(data, windowId, ERR_INVALID_VALUE);
247     WRITEINT32(data, hotSpotX, ERR_INVALID_VALUE);
248     WRITEINT32(data, hotSpotY, ERR_INVALID_VALUE);
249     MessageParcel reply;
250     MessageOption option;
251     sptr<IRemoteObject> remote = Remote();
252     CHKPR(remote, RET_ERR);
253     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::SET_MOUSE_HOT_SPOT),
254         data, reply, option);
255     if (ret != RET_OK) {
256         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
257     }
258     return ret;
259 }
260 
GetMouseScrollRows(int32_t & rows)261 int32_t MultimodalInputConnectProxy::GetMouseScrollRows(int32_t &rows)
262 {
263     CALL_DEBUG_ENTER;
264     MessageParcel data;
265     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
266         MMI_HILOGE("Failed to write descriptor");
267         return ERR_INVALID_VALUE;
268     }
269     MessageParcel reply;
270     MessageOption option;
271     sptr<IRemoteObject> remote = Remote();
272     CHKPR(remote, RET_ERR);
273     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::GET_MOUSE_SCROLL_ROWS),
274         data, reply, option);
275     if (ret != RET_OK) {
276         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
277         return ret;
278     }
279     READINT32(reply, rows, IPC_PROXY_DEAD_OBJECT_ERR);
280     return RET_OK;
281 }
282 
SetPointerSize(int32_t size)283 int32_t MultimodalInputConnectProxy::SetPointerSize(int32_t size)
284 {
285     CALL_DEBUG_ENTER;
286     MessageParcel data;
287     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
288         MMI_HILOGE("Failed to write descriptor");
289         return ERR_INVALID_VALUE;
290     }
291 
292     WRITEINT32(data, size, ERR_INVALID_VALUE);
293 
294     MessageParcel reply;
295     MessageOption option;
296     sptr<IRemoteObject> remote = Remote();
297     CHKPR(remote, RET_ERR);
298     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::SET_POINTER_SIZE),
299         data, reply, option);
300     if (ret != RET_OK) {
301         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
302         return ret;
303     }
304     return RET_OK;
305 }
306 
GetPointerSize(int32_t & size)307 int32_t MultimodalInputConnectProxy::GetPointerSize(int32_t &size)
308 {
309     CALL_DEBUG_ENTER;
310     MessageParcel data;
311     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
312         MMI_HILOGE("Failed to write descriptor");
313         return ERR_INVALID_VALUE;
314     }
315     MessageParcel reply;
316     MessageOption option;
317     sptr<IRemoteObject> remote = Remote();
318     CHKPR(remote, RET_ERR);
319     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::GET_POINTER_SIZE),
320         data, reply, option);
321     if (ret != RET_OK) {
322         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
323         return ret;
324     }
325     READINT32(reply, size, IPC_PROXY_DEAD_OBJECT_ERR);
326     return RET_OK;
327 }
328 
SetMousePrimaryButton(int32_t primaryButton)329 int32_t MultimodalInputConnectProxy::SetMousePrimaryButton(int32_t primaryButton)
330 {
331     CALL_DEBUG_ENTER;
332     MessageParcel data;
333     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
334         MMI_HILOGE("Failed to write descriptor");
335         return ERR_INVALID_VALUE;
336     }
337 
338     WRITEINT32(data, primaryButton, ERR_INVALID_VALUE);
339 
340     MessageParcel reply;
341     MessageOption option;
342     sptr<IRemoteObject> remote = Remote();
343     CHKPR(remote, RET_ERR);
344     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
345         SET_MOUSE_PRIMARY_BUTTON), data, reply, option);
346     if (ret != RET_OK) {
347         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
348         return ret;
349     }
350     return RET_OK;
351 }
352 
GetMousePrimaryButton(int32_t & primaryButton)353 int32_t MultimodalInputConnectProxy::GetMousePrimaryButton(int32_t &primaryButton)
354 {
355     CALL_DEBUG_ENTER;
356     MessageParcel data;
357     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
358         MMI_HILOGE("Failed to write descriptor");
359         return ERR_INVALID_VALUE;
360     }
361     MessageParcel reply;
362     MessageOption option;
363     sptr<IRemoteObject> remote = Remote();
364     CHKPR(remote, RET_ERR);
365     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
366         GET_MOUSE_PRIMARY_BUTTON), data, reply, option);
367     if (ret != RET_OK) {
368         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
369         return ret;
370     }
371     READINT32(reply, primaryButton, IPC_PROXY_DEAD_OBJECT_ERR);
372     return RET_OK;
373 }
374 
SetHoverScrollState(bool state)375 int32_t MultimodalInputConnectProxy::SetHoverScrollState(bool state)
376 {
377     CALL_DEBUG_ENTER;
378     MessageParcel data;
379     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
380         MMI_HILOGE("Failed to write descriptor");
381         return ERR_INVALID_VALUE;
382     }
383 
384     WRITEBOOL(data, state, ERR_INVALID_VALUE);
385 
386     MessageParcel reply;
387     MessageOption option;
388     sptr<IRemoteObject> remote = Remote();
389     CHKPR(remote, RET_ERR);
390     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
391         SET_HOVER_SCROLL_STATE), data, reply, option);
392     if (ret != RET_OK) {
393         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
394         return ret;
395     }
396     return RET_OK;
397 }
398 
GetHoverScrollState(bool & state)399 int32_t MultimodalInputConnectProxy::GetHoverScrollState(bool &state)
400 {
401     CALL_DEBUG_ENTER;
402     MessageParcel data;
403     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
404         MMI_HILOGE("Failed to write descriptor");
405         return ERR_INVALID_VALUE;
406     }
407     MessageParcel reply;
408     MessageOption option;
409     sptr<IRemoteObject> remote = Remote();
410     CHKPR(remote, RET_ERR);
411     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
412         GET_HOVER_SCROLL_STATE), data, reply, option);
413     if (ret != RET_OK) {
414         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
415         return ret;
416     }
417     READBOOL(reply, state, IPC_PROXY_DEAD_OBJECT_ERR);
418     return RET_OK;
419 }
420 
SetPointerVisible(bool visible)421 int32_t MultimodalInputConnectProxy::SetPointerVisible(bool visible)
422 {
423     CALL_DEBUG_ENTER;
424     MessageParcel data;
425     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
426         MMI_HILOGE("Failed to write descriptor");
427         return ERR_INVALID_VALUE;
428     }
429 
430     WRITEBOOL(data, visible, ERR_INVALID_VALUE);
431 
432     MessageParcel reply;
433     MessageOption option;
434     sptr<IRemoteObject> remote = Remote();
435     CHKPR(remote, RET_ERR);
436     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::SET_POINTER_VISIBLE),
437         data, reply, option);
438     if (ret != RET_OK) {
439         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
440         return ret;
441     }
442     return RET_OK;
443 }
444 
IsPointerVisible(bool & visible)445 int32_t MultimodalInputConnectProxy::IsPointerVisible(bool &visible)
446 {
447     CALL_DEBUG_ENTER;
448     MessageParcel data;
449     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
450         MMI_HILOGE("Failed to write descriptor");
451         return ERR_INVALID_VALUE;
452     }
453 
454     MessageParcel reply;
455     MessageOption option;
456     sptr<IRemoteObject> remote = Remote();
457     CHKPR(remote, RET_ERR);
458     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::IS_POINTER_VISIBLE),
459         data, reply, option);
460     if (ret != RET_OK) {
461         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
462         return ret;
463     }
464     READBOOL(reply, visible, IPC_PROXY_DEAD_OBJECT_ERR);
465     return RET_OK;
466 }
467 
MarkProcessed(int32_t eventType,int32_t eventId)468 int32_t MultimodalInputConnectProxy::MarkProcessed(int32_t eventType, int32_t eventId)
469 {
470     CALL_DEBUG_ENTER;
471     MessageParcel data;
472     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
473         MMI_HILOGE("Failed to write descriptor");
474         return ERR_INVALID_VALUE;
475     }
476     WRITEINT32(data, eventType, ERR_INVALID_VALUE);
477     WRITEINT32(data, eventId, ERR_INVALID_VALUE);
478 
479     MessageParcel reply;
480     MessageOption option;
481     sptr<IRemoteObject> remote = Remote();
482     CHKPR(remote, RET_ERR);
483     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::MARK_PROCESSED),
484         data, reply, option);
485     if (ret != RET_OK) {
486         MMI_HILOGE("Send request fail, ret:%{public}d", ret);
487         return ret;
488     }
489     return RET_OK;
490 }
491 
SetPointerColor(int32_t color)492 int32_t MultimodalInputConnectProxy::SetPointerColor(int32_t color)
493 {
494     CALL_DEBUG_ENTER;
495     MessageParcel data;
496     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
497         MMI_HILOGE("Failed to write descriptor");
498         return ERR_INVALID_VALUE;
499     }
500 
501     WRITEINT32(data, color, ERR_INVALID_VALUE);
502 
503     MessageParcel reply;
504     MessageOption option;
505     sptr<IRemoteObject> remote = Remote();
506     CHKPR(remote, RET_ERR);
507     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::SET_POINTER_COLOR),
508         data, reply, option);
509     if (ret != RET_OK) {
510         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
511         return ret;
512     }
513     return RET_OK;
514 }
515 
GetPointerColor(int32_t & color)516 int32_t MultimodalInputConnectProxy::GetPointerColor(int32_t &color)
517 {
518     CALL_DEBUG_ENTER;
519     MessageParcel data;
520     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
521         MMI_HILOGE("Failed to write descriptor");
522         return ERR_INVALID_VALUE;
523     }
524     MessageParcel reply;
525     MessageOption option;
526     sptr<IRemoteObject> remote = Remote();
527     CHKPR(remote, RET_ERR);
528     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::GET_POINTER_COLOR),
529         data, reply, option);
530     if (ret != RET_OK) {
531         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
532         return ret;
533     }
534     READINT32(reply, color, IPC_PROXY_DEAD_OBJECT_ERR);
535     return RET_OK;
536 }
537 
SetPointerSpeed(int32_t speed)538 int32_t MultimodalInputConnectProxy::SetPointerSpeed(int32_t speed)
539 {
540     CALL_DEBUG_ENTER;
541     MessageParcel data;
542     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
543         MMI_HILOGE("Failed to write descriptor");
544         return ERR_INVALID_VALUE;
545     }
546     WRITEINT32(data, speed, ERR_INVALID_VALUE);
547     MessageParcel reply;
548     MessageOption option;
549     sptr<IRemoteObject> remote = Remote();
550     CHKPR(remote, RET_ERR);
551     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::SET_POINTER_SPEED),
552         data, reply, option);
553     if (ret != RET_OK) {
554         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
555         return RET_ERR;
556     }
557     return RET_OK;
558 }
559 
GetPointerSpeed(int32_t & speed)560 int32_t MultimodalInputConnectProxy::GetPointerSpeed(int32_t &speed)
561 {
562     CALL_DEBUG_ENTER;
563     MessageParcel data;
564     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
565         MMI_HILOGE("Failed to write descriptor");
566         return ERR_INVALID_VALUE;
567     }
568     MessageParcel reply;
569     MessageOption option;
570     sptr<IRemoteObject> remote = Remote();
571     CHKPR(remote, RET_ERR);
572     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::GET_POINTER_SPEED),
573         data, reply, option);
574     if (ret != RET_OK) {
575         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
576         return RET_ERR;
577     }
578     READINT32(reply, speed, IPC_PROXY_DEAD_OBJECT_ERR);
579     return RET_OK;
580 }
581 
SetPointerStyle(int32_t windowId,PointerStyle pointerStyle)582 int32_t MultimodalInputConnectProxy::SetPointerStyle(int32_t windowId, PointerStyle pointerStyle)
583 {
584     CALL_DEBUG_ENTER;
585     MessageParcel data;
586     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
587         MMI_HILOGE("Failed to write descriptor");
588         return RET_ERR;
589     }
590 
591     WRITEINT32(data, windowId, RET_ERR);
592     WRITEINT32(data, pointerStyle.size, RET_ERR);
593     WRITEUINT8(data, pointerStyle.color.r, RET_ERR);
594     WRITEUINT8(data, pointerStyle.color.g, RET_ERR);
595     WRITEUINT8(data, pointerStyle.color.b, RET_ERR);
596     WRITEINT32(data, pointerStyle.id, RET_ERR);
597 
598     MessageParcel reply;
599     MessageOption option;
600     sptr<IRemoteObject> remote = Remote();
601     CHKPR(remote, RET_ERR);
602     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::SET_POINTER_STYLE),
603         data, reply, option);
604     if (ret != RET_OK) {
605         MMI_HILOGE("Send request fail, ret:%{public}d", ret);
606         return ret;
607     }
608     return RET_OK;
609 }
610 
GetPointerStyle(int32_t windowId,PointerStyle & pointerStyle)611 int32_t MultimodalInputConnectProxy::GetPointerStyle(int32_t windowId, PointerStyle &pointerStyle)
612 {
613     CALL_DEBUG_ENTER;
614     MessageParcel data;
615     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
616         MMI_HILOGE("Failed to write descriptor");
617         return RET_ERR;
618     }
619     WRITEINT32(data, windowId, RET_ERR);
620     MessageParcel reply;
621     MessageOption option;
622     sptr<IRemoteObject> remote = Remote();
623     CHKPR(remote, RET_ERR);
624     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::GET_POINTER_STYLE),
625         data, reply, option);
626     if (ret != RET_OK) {
627         MMI_HILOGE("Send request fail, ret:%{public}d", ret);
628         return ret;
629     }
630     READINT32(reply, pointerStyle.size, IPC_PROXY_DEAD_OBJECT_ERR);
631     READUINT8(reply, pointerStyle.color.r, IPC_PROXY_DEAD_OBJECT_ERR);
632     READUINT8(reply, pointerStyle.color.g, IPC_PROXY_DEAD_OBJECT_ERR);
633     READUINT8(reply, pointerStyle.color.b, IPC_PROXY_DEAD_OBJECT_ERR);
634     READINT32(reply, pointerStyle.id, IPC_PROXY_DEAD_OBJECT_ERR);
635     return RET_OK;
636 }
637 
RegisterDevListener()638 int32_t MultimodalInputConnectProxy::RegisterDevListener()
639 {
640     MessageParcel data;
641     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
642         MMI_HILOGE("Failed to write descriptor");
643         return ERR_INVALID_VALUE;
644     }
645 
646     MessageParcel reply;
647     MessageOption option;
648     sptr<IRemoteObject> remote = Remote();
649     CHKPR(remote, RET_ERR);
650     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::REGISTER_DEV_MONITOR),
651         data, reply, option);
652     if (ret != RET_OK) {
653         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
654         return ret;
655     }
656     return RET_OK;
657 }
658 
UnregisterDevListener()659 int32_t MultimodalInputConnectProxy::UnregisterDevListener()
660 {
661     MessageParcel data;
662     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
663         MMI_HILOGE("Failed to write descriptor");
664         return ERR_INVALID_VALUE;
665     }
666 
667     MessageParcel reply;
668     MessageOption option;
669     sptr<IRemoteObject> remote = Remote();
670     CHKPR(remote, RET_ERR);
671     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
672         UNREGISTER_DEV_MONITOR), data, reply, option);
673     if (ret != RET_OK) {
674         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
675         return ret;
676     }
677     return RET_OK;
678 }
679 
SupportKeys(int32_t deviceId,std::vector<int32_t> & keys,std::vector<bool> & keystroke)680 int32_t MultimodalInputConnectProxy::SupportKeys(int32_t deviceId, std::vector<int32_t> &keys,
681     std::vector<bool> &keystroke)
682 {
683     CALL_DEBUG_ENTER;
684     MessageParcel data;
685     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
686         MMI_HILOGE("Failed to write descriptor");
687         return RET_ERR;
688     }
689     WRITEINT32(data, deviceId);
690     WRITEINT32(data, static_cast<int32_t>(keys.size()));
691     for (const auto &item : keys) {
692         WRITEINT32(data, item);
693     }
694 
695     MessageParcel reply;
696     MessageOption option;
697     sptr<IRemoteObject> remote = Remote();
698     CHKPR(remote, RET_ERR);
699     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::SUPPORT_KEYS),
700         data, reply, option);
701     if (ret != RET_OK) {
702         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
703         return ret;
704     }
705     if (!reply.ReadBoolVector(&keystroke)) {
706         MMI_HILOGE("Read ids failed");
707         return RET_ERR;
708     }
709     MMI_HILOGE("keystroke size:%{public}zu", keystroke.size());
710     return RET_OK;
711 }
712 
GetDeviceIds(std::vector<int32_t> & ids)713 int32_t MultimodalInputConnectProxy::GetDeviceIds(std::vector<int32_t> &ids)
714 {
715     CALL_DEBUG_ENTER;
716     MessageParcel data;
717     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
718         MMI_HILOGE("Failed to write descriptor");
719         return RET_ERR;
720     }
721     MessageParcel reply;
722     MessageOption option;
723     sptr<IRemoteObject> remote = Remote();
724     CHKPR(remote, RET_ERR);
725     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::GET_DEVICE_IDS),
726         data, reply, option);
727     if (ret != RET_OK) {
728         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
729         return ret;
730     }
731     if (!reply.ReadInt32Vector(&ids)) {
732         MMI_HILOGE("Read vector failed");
733         return RET_ERR;
734     }
735     MMI_HILOGE("ids size:%{public}zu", ids.size());
736     return RET_OK;
737 }
738 
GetDevice(int32_t deviceId,std::shared_ptr<InputDevice> & inputDevice)739 int32_t MultimodalInputConnectProxy::GetDevice(int32_t deviceId, std::shared_ptr<InputDevice> &inputDevice)
740 {
741     CALL_DEBUG_ENTER;
742     MessageParcel data;
743     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
744         MMI_HILOGE("Failed to write descriptor");
745         return RET_ERR;
746     }
747     WRITEINT32(data, deviceId);
748     MessageParcel reply;
749     MessageOption option;
750     sptr<IRemoteObject> remote = Remote();
751     CHKPR(remote, RET_ERR);
752     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::GET_DEVICE),
753         data, reply, option);
754     if (ret != RET_OK) {
755         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
756         return ret;
757     }
758     ret = ParseInputDevice(reply, inputDevice);
759     if (ret != RET_OK) {
760         MMI_HILOGE("ParseInputDevice failed");
761         return RET_ERR;
762     }
763     return RET_OK;
764 }
765 
GetKeyboardType(int32_t deviceId,int32_t & keyboardType)766 int32_t MultimodalInputConnectProxy::GetKeyboardType(int32_t deviceId, int32_t &keyboardType)
767 {
768     CALL_DEBUG_ENTER;
769     MessageParcel data;
770     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
771         MMI_HILOGE("Failed to write descriptor");
772         return RET_ERR;
773     }
774     WRITEINT32(data, deviceId);
775     MessageParcel reply;
776     MessageOption option;
777     sptr<IRemoteObject> remote = Remote();
778     CHKPR(remote, RET_ERR);
779     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::GET_KEYBOARD_TYPE),
780         data, reply, option);
781     if (ret != RET_OK) {
782         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
783         return ret;
784     }
785     READINT32(reply, keyboardType, IPC_PROXY_DEAD_OBJECT_ERR);
786     return RET_OK;
787 }
788 
SetKeyboardRepeatDelay(int32_t delay)789 int32_t MultimodalInputConnectProxy::SetKeyboardRepeatDelay(int32_t delay)
790 {
791     CALL_DEBUG_ENTER;
792     MessageParcel data;
793     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
794         MMI_HILOGE("Failed to write descriptor");
795         return ERR_INVALID_VALUE;
796     }
797     WRITEINT32(data, delay, ERR_INVALID_VALUE);
798     MessageParcel reply;
799     MessageOption option;
800     sptr<IRemoteObject> remote = Remote();
801     CHKPR(remote, RET_ERR);
802     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
803         SET_KEYBOARD_REPEAT_DELAY), data, reply, option);
804     if (ret != RET_OK) {
805         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
806         return RET_ERR;
807     }
808     return RET_OK;
809 }
810 
SetKeyboardRepeatRate(int32_t rate)811 int32_t MultimodalInputConnectProxy::SetKeyboardRepeatRate(int32_t rate)
812 {
813     CALL_DEBUG_ENTER;
814     MessageParcel data;
815     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
816         MMI_HILOGE("Failed to write descriptor");
817         return ERR_INVALID_VALUE;
818     }
819     WRITEINT32(data, rate, ERR_INVALID_VALUE);
820     MessageParcel reply;
821     MessageOption option;
822     sptr<IRemoteObject> remote = Remote();
823     CHKPR(remote, RET_ERR);
824     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
825         SET_KEYBOARD_REPEAT_RATE), data, reply, option);
826     if (ret != RET_OK) {
827         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
828         return RET_ERR;
829     }
830     return RET_OK;
831 }
832 
GetKeyboardRepeatDelay(int32_t & delay)833 int32_t MultimodalInputConnectProxy::GetKeyboardRepeatDelay(int32_t &delay)
834 {
835     CALL_DEBUG_ENTER;
836     MessageParcel data;
837     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
838         MMI_HILOGE("Failed to write descriptor");
839         return ERR_INVALID_VALUE;
840     }
841     MessageParcel reply;
842     MessageOption option;
843     sptr<IRemoteObject> remote = Remote();
844     CHKPR(remote, RET_ERR);
845     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
846         GET_KEYBOARD_REPEAT_DELAY), data, reply, option);
847     if (ret != RET_OK) {
848         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
849         return RET_ERR;
850     }
851     READINT32(reply, delay, IPC_PROXY_DEAD_OBJECT_ERR);
852     return RET_OK;
853 }
854 
GetKeyboardRepeatRate(int32_t & rate)855 int32_t MultimodalInputConnectProxy::GetKeyboardRepeatRate(int32_t &rate)
856 {
857     CALL_DEBUG_ENTER;
858     MessageParcel data;
859     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
860         MMI_HILOGE("Failed to write descriptor");
861         return ERR_INVALID_VALUE;
862     }
863     MessageParcel reply;
864     MessageOption option;
865     sptr<IRemoteObject> remote = Remote();
866     CHKPR(remote, RET_ERR);
867     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
868         GET_KEYBOARD_REPEAT_RATE), data, reply, option);
869     if (ret != RET_OK) {
870         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
871         return RET_ERR;
872     }
873     READINT32(reply, rate, IPC_PROXY_DEAD_OBJECT_ERR);
874     return RET_OK;
875 }
876 
AddInputHandler(InputHandlerType handlerType,HandleEventType eventType,int32_t priority,uint32_t deviceTags)877 int32_t MultimodalInputConnectProxy::AddInputHandler(InputHandlerType handlerType,
878     HandleEventType eventType, int32_t priority, uint32_t deviceTags)
879 {
880     CALL_DEBUG_ENTER;
881     MessageParcel data;
882     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
883         MMI_HILOGE("Failed to write descriptor");
884         return ERR_INVALID_VALUE;
885     }
886     WRITEINT32(data, handlerType, ERR_INVALID_VALUE);
887     WRITEUINT32(data, eventType, ERR_INVALID_VALUE);
888     WRITEINT32(data, priority, ERR_INVALID_VALUE);
889     WRITEUINT32(data, deviceTags, ERR_INVALID_VALUE);
890     MessageParcel reply;
891     MessageOption option;
892     sptr<IRemoteObject> remote = Remote();
893     CHKPR(remote, RET_ERR);
894     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::ADD_INPUT_HANDLER),
895         data, reply, option);
896     if (ret != RET_OK) {
897         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
898         return ret;
899     }
900     return RET_OK;
901 }
902 
RemoveInputHandler(InputHandlerType handlerType,HandleEventType eventType,int32_t priority,uint32_t deviceTags)903 int32_t MultimodalInputConnectProxy::RemoveInputHandler(InputHandlerType handlerType,
904     HandleEventType eventType, int32_t priority, uint32_t deviceTags)
905 {
906     CALL_DEBUG_ENTER;
907     MessageParcel data;
908     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
909         MMI_HILOGE("Failed to write descriptor");
910         return ERR_INVALID_VALUE;
911     }
912     WRITEINT32(data, handlerType, ERR_INVALID_VALUE);
913     WRITEUINT32(data, eventType, ERR_INVALID_VALUE);
914     WRITEINT32(data, priority, ERR_INVALID_VALUE);
915     WRITEUINT32(data, eventType, ERR_INVALID_VALUE);
916     MessageParcel reply;
917     MessageOption option;
918     sptr<IRemoteObject> remote = Remote();
919     CHKPR(remote, RET_ERR);
920     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::REMOVE_INPUT_HANDLER),
921         data, reply, option);
922     if (ret != RET_OK) {
923         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
924         return ret;
925     }
926     return RET_OK;
927 }
928 
MarkEventConsumed(int32_t eventId)929 int32_t MultimodalInputConnectProxy::MarkEventConsumed(int32_t eventId)
930 {
931     CALL_DEBUG_ENTER;
932     MessageParcel data;
933     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
934         MMI_HILOGE("Failed to write descriptor");
935         return ERR_INVALID_VALUE;
936     }
937     WRITEINT32(data, eventId, ERR_INVALID_VALUE);
938     MessageParcel reply;
939     MessageOption option;
940     sptr<IRemoteObject> remote = Remote();
941     CHKPR(remote, RET_ERR);
942     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::MARK_EVENT_CONSUMED),
943         data, reply, option);
944     if (ret != RET_OK) {
945         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
946         return ret;
947     }
948     return RET_OK;
949 }
950 
MoveMouseEvent(int32_t offsetX,int32_t offsetY)951 int32_t MultimodalInputConnectProxy::MoveMouseEvent(int32_t offsetX, int32_t offsetY)
952 {
953     CALL_DEBUG_ENTER;
954     MessageParcel data;
955     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
956         MMI_HILOGE("Failed to write descriptor");
957         return ERR_INVALID_VALUE;
958     }
959     WRITEINT32(data, offsetX, ERR_INVALID_VALUE);
960     WRITEINT32(data, offsetY, ERR_INVALID_VALUE);
961 
962     MessageParcel reply;
963     MessageOption option;
964     sptr<IRemoteObject> remote = Remote();
965     CHKPR(remote, RET_ERR);
966     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::MOVE_MOUSE),
967         data, reply, option);
968     if (ret != RET_OK) {
969         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
970         return ret;
971     }
972     return RET_OK;
973 }
974 
InjectKeyEvent(const std::shared_ptr<KeyEvent> keyEvent)975 int32_t MultimodalInputConnectProxy::InjectKeyEvent(const std::shared_ptr<KeyEvent> keyEvent)
976 {
977     CALL_DEBUG_ENTER;
978     CHKPR(keyEvent, ERR_INVALID_VALUE);
979     MessageParcel data;
980     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
981         MMI_HILOGE("Failed to write descriptor");
982         return ERR_INVALID_VALUE;
983     }
984     if (!keyEvent->WriteToParcel(data)) {
985         MMI_HILOGE("Failed to write inject event");
986         return ERR_INVALID_VALUE;
987     }
988     MessageParcel reply;
989     MessageOption option;
990     sptr<IRemoteObject> remote = Remote();
991     CHKPR(remote, RET_ERR);
992     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::INJECT_KEY_EVENT),
993         data, reply, option);
994     if (ret != RET_OK) {
995         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
996         return ret;
997     }
998     return RET_OK;
999 }
1000 
SubscribeKeyEvent(int32_t subscribeId,const std::shared_ptr<KeyOption> keyOption)1001 int32_t MultimodalInputConnectProxy::SubscribeKeyEvent(int32_t subscribeId, const std::shared_ptr<KeyOption> keyOption)
1002 {
1003     CALL_DEBUG_ENTER;
1004     CHKPR(keyOption, ERR_INVALID_VALUE);
1005 
1006     MessageParcel data;
1007     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
1008         MMI_HILOGE("Failed to write descriptor");
1009         return ERR_INVALID_VALUE;
1010     }
1011     WRITEINT32(data, subscribeId, ERR_INVALID_VALUE);
1012     if (!keyOption->WriteToParcel(data)) {
1013         MMI_HILOGE("Failed to write key option");
1014         return ERR_INVALID_VALUE;
1015     }
1016 
1017     MessageParcel reply;
1018     MessageOption option;
1019     sptr<IRemoteObject> remote = Remote();
1020     CHKPR(remote, RET_ERR);
1021     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::SUBSCRIBE_KEY_EVENT),
1022         data, reply, option);
1023     if (ret != RET_OK) {
1024         MMI_HILOGE("Send request failed, result:%{public}d", ret);
1025         return ret;
1026     }
1027     return RET_OK;
1028 }
1029 
UnsubscribeKeyEvent(int32_t subscribeId)1030 int32_t MultimodalInputConnectProxy::UnsubscribeKeyEvent(int32_t subscribeId)
1031 {
1032     CALL_DEBUG_ENTER;
1033     MessageParcel data;
1034     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
1035         MMI_HILOGE("Failed to write descriptor");
1036         return ERR_INVALID_VALUE;
1037     }
1038     WRITEINT32(data, subscribeId, ERR_INVALID_VALUE);
1039 
1040     MessageParcel reply;
1041     MessageOption option;
1042     sptr<IRemoteObject> remote = Remote();
1043     CHKPR(remote, RET_ERR);
1044     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::UNSUBSCRIBE_KEY_EVENT),
1045         data, reply, option);
1046     if (ret != RET_OK) {
1047         MMI_HILOGE("Send request failed, result:%{public}d", ret);
1048         return ret;
1049     }
1050     return RET_OK;
1051 }
1052 
SubscribeSwitchEvent(int32_t subscribeId)1053 int32_t MultimodalInputConnectProxy::SubscribeSwitchEvent(int32_t subscribeId)
1054 {
1055     CALL_DEBUG_ENTER;
1056     MessageParcel data;
1057     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
1058         MMI_HILOGE("Failed to write descriptor");
1059         return ERR_INVALID_VALUE;
1060     }
1061     WRITEINT32(data, subscribeId, ERR_INVALID_VALUE);
1062 
1063     MessageParcel reply;
1064     MessageOption option;
1065     sptr<IRemoteObject> remote = Remote();
1066     CHKPR(remote, RET_ERR);
1067     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
1068         SUBSCRIBE_SWITCH_EVENT), data, reply, option);
1069     if (ret != RET_OK) {
1070         MMI_HILOGE("Send request failed, result:%{public}d", ret);
1071     }
1072     return ret;
1073 }
1074 
UnsubscribeSwitchEvent(int32_t subscribeId)1075 int32_t MultimodalInputConnectProxy::UnsubscribeSwitchEvent(int32_t subscribeId)
1076 {
1077     CALL_DEBUG_ENTER;
1078     MessageParcel data;
1079     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
1080         MMI_HILOGE("Failed to write descriptor");
1081         return ERR_INVALID_VALUE;
1082     }
1083     WRITEINT32(data, subscribeId, ERR_INVALID_VALUE);
1084 
1085     MessageParcel reply;
1086     MessageOption option;
1087     sptr<IRemoteObject> remote = Remote();
1088     CHKPR(remote, RET_ERR);
1089     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
1090         UNSUBSCRIBE_SWITCH_EVENT), data, reply, option);
1091     if (ret != RET_OK) {
1092         MMI_HILOGE("Send request failed, result:%{public}d", ret);
1093     }
1094     return ret;
1095 }
1096 
InjectPointerEvent(const std::shared_ptr<PointerEvent> pointerEvent)1097 int32_t MultimodalInputConnectProxy::InjectPointerEvent(const std::shared_ptr<PointerEvent> pointerEvent)
1098 {
1099     CALL_DEBUG_ENTER;
1100     CHKPR(pointerEvent, ERR_INVALID_VALUE);
1101     MessageParcel data;
1102     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
1103         MMI_HILOGE("Failed to write descriptor");
1104         return ERR_INVALID_VALUE;
1105     }
1106     if (!pointerEvent->WriteToParcel(data)) {
1107         MMI_HILOGE("Failed to write inject point event");
1108         return ERR_INVALID_VALUE;
1109     }
1110     MessageParcel reply;
1111     MessageOption option;
1112     sptr<IRemoteObject> remote = Remote();
1113     CHKPR(remote, RET_ERR);
1114     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::INJECT_POINTER_EVENT),
1115         data, reply, option);
1116     if (ret != RET_OK) {
1117         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
1118         return ret;
1119     }
1120     return RET_OK;
1121 }
1122 
SetAnrObserver()1123 int32_t MultimodalInputConnectProxy::SetAnrObserver()
1124 {
1125     CALL_DEBUG_ENTER;
1126     MessageParcel data;
1127     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
1128         MMI_HILOGE("Failed to write descriptor");
1129         return ERR_INVALID_VALUE;
1130     }
1131     MessageParcel reply;
1132     MessageOption option;
1133     sptr<IRemoteObject> remote = Remote();
1134     CHKPR(remote, RET_ERR);
1135     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::SET_ANR_OBSERVER),
1136         data, reply, option);
1137     if (ret != RET_OK) {
1138         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
1139         return ret;
1140     }
1141     return RET_OK;
1142 }
1143 
GetDisplayBindInfo(DisplayBindInfos & infos)1144 int32_t MultimodalInputConnectProxy::GetDisplayBindInfo(DisplayBindInfos &infos)
1145 {
1146     CALL_DEBUG_ENTER;
1147     MessageParcel data;
1148     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
1149         MMI_HILOGE("Failed to write descriptor");
1150         return ERR_INVALID_VALUE;
1151     }
1152     MessageParcel reply;
1153     MessageOption option;
1154     sptr<IRemoteObject> remote = Remote();
1155     CHKPR(remote, RET_ERR);
1156     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::GET_DISPLAY_BIND_INFO),
1157         data, reply, option);
1158     if (ret != RET_OK) {
1159         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
1160         return ret;
1161     }
1162     int32_t size = 0;
1163     READINT32(reply, size, ERR_INVALID_VALUE);
1164     infos.reserve(size);
1165     for (int32_t i = 0; i < size; ++i) {
1166         DisplayBindInfo info;
1167         READINT32(reply, info.inputDeviceId, ERR_INVALID_VALUE);
1168         READSTRING(reply, info.inputDeviceName, ERR_INVALID_VALUE);
1169         READINT32(reply, info.displayId, ERR_INVALID_VALUE);
1170         READSTRING(reply, info.displayName, ERR_INVALID_VALUE);
1171         infos.push_back(info);
1172     }
1173     return RET_OK;
1174 }
1175 
SetDisplayBind(int32_t deviceId,int32_t displayId,std::string & msg)1176 int32_t MultimodalInputConnectProxy::SetDisplayBind(int32_t deviceId, int32_t displayId, std::string &msg)
1177 {
1178     CALL_DEBUG_ENTER;
1179     MessageParcel data;
1180     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
1181         MMI_HILOGE("Failed to write descriptor");
1182         return ERR_INVALID_VALUE;
1183     }
1184 
1185     WRITEINT32(data, deviceId, ERR_INVALID_VALUE);
1186     WRITEINT32(data, displayId, ERR_INVALID_VALUE);
1187 
1188     MessageParcel reply;
1189     MessageOption option;
1190     sptr<IRemoteObject> remote = Remote();
1191     CHKPR(remote, RET_ERR);
1192     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::SET_DISPLAY_BIND),
1193         data, reply, option);
1194     if (ret != RET_OK) {
1195         MMI_HILOGE("Send request fail, result:%{public}d", ret);
1196         return ret;
1197     }
1198     return RET_OK;
1199 }
1200 
GetWindowPid(int32_t windowId)1201 int32_t MultimodalInputConnectProxy::GetWindowPid(int32_t windowId)
1202 {
1203     CALL_DEBUG_ENTER;
1204     MessageParcel data;
1205     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
1206         MMI_HILOGE("Failed to write descriptor");
1207         return ERR_INVALID_VALUE;
1208     }
1209 
1210     WRITEINT32(data, windowId, ERR_INVALID_VALUE);
1211 
1212     MessageParcel reply;
1213     MessageOption option;
1214     sptr<IRemoteObject> remote = Remote();
1215     CHKPR(remote, RET_ERR);
1216     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::GET_WINDOW_PID),
1217         data, reply, option);
1218     if (ret != RET_OK) {
1219         MMI_HILOGE("Send request fail, result:%{public}d", ret);
1220         return ret;
1221     }
1222     int32_t windowPid = -1;
1223     READINT32(reply, windowPid, ERR_INVALID_VALUE);
1224     return windowPid;
1225 }
1226 
GetFunctionKeyState(int32_t funcKey,bool & state)1227 int32_t MultimodalInputConnectProxy::GetFunctionKeyState(int32_t funcKey, bool &state)
1228 {
1229     CALL_DEBUG_ENTER;
1230     MessageParcel data;
1231     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
1232         MMI_HILOGE("Failed to write descriptor");
1233         return ERR_INVALID_VALUE;
1234     }
1235     MessageParcel reply;
1236     MessageOption option;
1237     WRITEINT32(data, funcKey, ERR_INVALID_VALUE);
1238     sptr<IRemoteObject> remote = Remote();
1239     CHKPR(remote, RET_ERR);
1240     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
1241         GET_FUNCTION_KEY_STATE), data, reply, option);
1242     if (ret != RET_OK) {
1243         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
1244         return ret;
1245     }
1246     READBOOL(reply, state, ERR_INVALID_VALUE);
1247     return RET_OK;
1248 }
1249 
SetFunctionKeyState(int32_t funcKey,bool enable)1250 int32_t MultimodalInputConnectProxy::SetFunctionKeyState(int32_t funcKey, bool enable)
1251 {
1252     CALL_DEBUG_ENTER;
1253     MessageParcel data;
1254     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
1255         MMI_HILOGE("Failed to write descriptor");
1256         return ERR_INVALID_VALUE;
1257     }
1258     MessageParcel reply;
1259     MessageOption option;
1260     WRITEINT32(data, funcKey, ERR_INVALID_VALUE);
1261     WRITEBOOL(data, enable, ERR_INVALID_VALUE);
1262     sptr<IRemoteObject> remote = Remote();
1263     CHKPR(remote, RET_ERR);
1264     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
1265         SET_FUNCTION_KEY_STATE), data, reply, option);
1266     if (ret != RET_OK) {
1267         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
1268     }
1269     return ret;
1270 }
1271 
SetPointerLocation(int32_t x,int32_t y)1272 int32_t MultimodalInputConnectProxy::SetPointerLocation(int32_t x, int32_t y)
1273 {
1274     CALL_DEBUG_ENTER;
1275     MessageParcel data;
1276     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
1277         MMI_HILOGE("Failed to write descriptor");
1278         return ERR_INVALID_VALUE;
1279     }
1280     MessageParcel reply;
1281     MessageOption option;
1282     WRITEINT32(data, x, ERR_INVALID_VALUE);
1283     WRITEINT32(data, y, ERR_INVALID_VALUE);
1284     sptr<IRemoteObject> remote = Remote();
1285     CHKPR(remote, RET_ERR);
1286     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::SET_POINTER_LOCATION),
1287         data, reply, option);
1288     if (ret != RET_OK) {
1289         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
1290     }
1291     return ret;
1292 }
1293 
SetMouseCaptureMode(int32_t windowId,bool isCaptureMode)1294 int32_t MultimodalInputConnectProxy::SetMouseCaptureMode(int32_t windowId, bool isCaptureMode)
1295 {
1296     CALL_DEBUG_ENTER;
1297     MessageParcel data;
1298     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
1299         MMI_HILOGE("Failed to write descriptor");
1300         return ERR_INVALID_VALUE;
1301     }
1302     WRITEINT32(data, windowId, ERR_INVALID_VALUE);
1303     WRITEBOOL(data, isCaptureMode, ERR_INVALID_VALUE);
1304     MessageParcel reply;
1305     MessageOption option;
1306     sptr<IRemoteObject> remote = Remote();
1307     CHKPR(remote, RET_ERR);
1308     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::SET_CAPTURE_MODE),
1309         data, reply, option);
1310     if (ret != RET_OK) {
1311         MMI_HILOGE("Send request fail, ret:%{public}d", ret);
1312     }
1313     return ret;
1314 }
1315 
AppendExtraData(const ExtraData & extraData)1316 int32_t MultimodalInputConnectProxy::AppendExtraData(const ExtraData& extraData)
1317 {
1318     CALL_DEBUG_ENTER;
1319     MessageParcel data;
1320     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
1321         MMI_HILOGE("Failed to write descriptor");
1322         return ERR_INVALID_VALUE;
1323     }
1324     WRITEBOOL(data, extraData.appended, ERR_INVALID_VALUE);
1325     WRITEINT32(data, static_cast<int32_t>(extraData.buffer.size()));
1326     for (const auto &item : extraData.buffer) {
1327         WRITEUINT8(data, item);
1328     }
1329     WRITEINT32(data, extraData.sourceType, ERR_INVALID_VALUE);
1330     WRITEINT32(data, extraData.pointerId, ERR_INVALID_VALUE);
1331     MessageParcel reply;
1332     MessageOption option;
1333     sptr<IRemoteObject> remote = Remote();
1334     CHKPR(remote, RET_ERR);
1335     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::APPEND_EXTRA_DATA),
1336         data, reply, option);
1337     if (ret != RET_OK) {
1338         MMI_HILOGE("Send request fail, ret:%{public}d", ret);
1339     }
1340     return ret;
1341 }
1342 
EnableInputDevice(bool enable)1343 int32_t MultimodalInputConnectProxy::EnableInputDevice(bool enable)
1344 {
1345     CALL_DEBUG_ENTER;
1346     MessageParcel data;
1347     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
1348         MMI_HILOGE("Failed to write descriptor");
1349         return ERR_INVALID_VALUE;
1350     }
1351     WRITEBOOL(data, enable, ERR_INVALID_VALUE);
1352     MessageParcel reply;
1353     MessageOption option;
1354     sptr<IRemoteObject> remote = Remote();
1355     CHKPR(remote, RET_ERR);
1356     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::ENABLE_INPUT_DEVICE),
1357         data, reply, option);
1358     if (ret != RET_OK) {
1359         MMI_HILOGE("Send request fail, ret:%{public}d", ret);
1360     }
1361     return ret;
1362 }
1363 
SetKeyDownDuration(const std::string & businessId,int32_t delay)1364 int32_t MultimodalInputConnectProxy::SetKeyDownDuration(const std::string &businessId, int32_t delay)
1365 {
1366     CALL_DEBUG_ENTER;
1367     MessageParcel data;
1368     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
1369         MMI_HILOGE("Failed to write descriptor");
1370         return ERR_INVALID_VALUE;
1371     }
1372     WRITESTRING(data, businessId, ERR_INVALID_VALUE);
1373     WRITEINT32(data, delay, ERR_INVALID_VALUE);
1374     MessageParcel reply;
1375     MessageOption option;
1376     sptr<IRemoteObject> remote = Remote();
1377     CHKPR(remote, RET_ERR);
1378     int32_t ret = remote->SendRequest(static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::SET_KEY_DOWN_DURATION),
1379         data, reply, option);
1380     if (ret != RET_OK) {
1381         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
1382         return ret;
1383     }
1384     return RET_OK;
1385 }
1386 
SetTouchpadBoolData(bool switchFlag,int32_t type)1387 int32_t MultimodalInputConnectProxy::SetTouchpadBoolData(bool switchFlag, int32_t type)
1388 {
1389     CALL_DEBUG_ENTER;
1390     MessageParcel data;
1391     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
1392         MMI_HILOGE("Failed to write descriptor");
1393         return ERR_INVALID_VALUE;
1394     }
1395 
1396     WRITEBOOL(data, switchFlag, ERR_INVALID_VALUE);
1397 
1398     MessageParcel reply;
1399     MessageOption option;
1400     sptr<IRemoteObject> remote = Remote();
1401     CHKPR(remote, RET_ERR);
1402     int32_t ret = remote->SendRequest(type, data, reply, option);
1403     if (ret != RET_OK) {
1404         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
1405         return ret;
1406     }
1407     return RET_OK;
1408 }
1409 
GetTouchpadBoolData(bool & switchFlag,int32_t type)1410 int32_t MultimodalInputConnectProxy::GetTouchpadBoolData(bool &switchFlag, int32_t type)
1411 {
1412     CALL_DEBUG_ENTER;
1413     MessageParcel data;
1414     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
1415         MMI_HILOGE("Failed to write descriptor");
1416         return ERR_INVALID_VALUE;
1417     }
1418     MessageParcel reply;
1419     MessageOption option;
1420     sptr<IRemoteObject> remote = Remote();
1421     CHKPR(remote, RET_ERR);
1422     int32_t ret = remote->SendRequest(type, data, reply, option);
1423     if (ret != RET_OK) {
1424         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
1425         return RET_ERR;
1426     }
1427     READBOOL(reply, switchFlag, IPC_PROXY_DEAD_OBJECT_ERR);
1428     return RET_OK;
1429 }
1430 
SetTouchpadInt32Data(int32_t value,int32_t type)1431 int32_t MultimodalInputConnectProxy::SetTouchpadInt32Data(int32_t value, int32_t type)
1432 {
1433     CALL_DEBUG_ENTER;
1434     MessageParcel data;
1435     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
1436         MMI_HILOGE("Failed to write descriptor");
1437         return ERR_INVALID_VALUE;
1438     }
1439 
1440     WRITEINT32(data, value, ERR_INVALID_VALUE);
1441 
1442     MessageParcel reply;
1443     MessageOption option;
1444     sptr<IRemoteObject> remote = Remote();
1445     CHKPR(remote, RET_ERR);
1446     int32_t ret = remote->SendRequest(type, data, reply, option);
1447     if (ret != RET_OK) {
1448         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
1449         return ret;
1450     }
1451     return RET_OK;
1452 }
1453 
GetTouchpadInt32Data(int32_t & value,int32_t type)1454 int32_t MultimodalInputConnectProxy::GetTouchpadInt32Data(int32_t &value, int32_t type)
1455 {
1456     CALL_DEBUG_ENTER;
1457     MessageParcel data;
1458     if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) {
1459         MMI_HILOGE("Failed to write descriptor");
1460         return ERR_INVALID_VALUE;
1461     }
1462     MessageParcel reply;
1463     MessageOption option;
1464     sptr<IRemoteObject> remote = Remote();
1465     CHKPR(remote, RET_ERR);
1466     int32_t ret = remote->SendRequest(type, data, reply, option);
1467     if (ret != RET_OK) {
1468         MMI_HILOGE("Send request failed, ret:%{public}d", ret);
1469         return RET_ERR;
1470     }
1471     READINT32(reply, value, IPC_PROXY_DEAD_OBJECT_ERR);
1472     return RET_OK;
1473 }
1474 
SetTouchpadScrollSwitch(bool switchFlag)1475 int32_t MultimodalInputConnectProxy::SetTouchpadScrollSwitch(bool switchFlag)
1476 {
1477     return SetTouchpadBoolData(switchFlag, static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
1478         SET_TP_SCROLL_SWITCH));
1479 }
1480 
GetTouchpadScrollSwitch(bool & switchFlag)1481 int32_t MultimodalInputConnectProxy::GetTouchpadScrollSwitch(bool &switchFlag)
1482 {
1483     return GetTouchpadBoolData(switchFlag, static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
1484         GET_TP_SCROLL_SWITCH));
1485 }
1486 
SetTouchpadScrollDirection(bool state)1487 int32_t MultimodalInputConnectProxy::SetTouchpadScrollDirection(bool state)
1488 {
1489     return SetTouchpadBoolData(state, static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
1490         SET_TP_SCROLL_DIRECT_SWITCH));
1491 }
1492 
GetTouchpadScrollDirection(bool & switchFlag)1493 int32_t MultimodalInputConnectProxy::GetTouchpadScrollDirection(bool &switchFlag)
1494 {
1495     return GetTouchpadBoolData(switchFlag, static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
1496         GET_TP_SCROLL_DIRECT_SWITCH));
1497 }
1498 
SetTouchpadTapSwitch(bool switchFlag)1499 int32_t MultimodalInputConnectProxy::SetTouchpadTapSwitch(bool switchFlag)
1500 {
1501     return SetTouchpadBoolData(switchFlag, static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
1502         SET_TP_TAP_SWITCH));
1503 }
1504 
GetTouchpadTapSwitch(bool & switchFlag)1505 int32_t MultimodalInputConnectProxy::GetTouchpadTapSwitch(bool &switchFlag)
1506 {
1507     return GetTouchpadBoolData(switchFlag, static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
1508         GET_TP_TAP_SWITCH));
1509 }
1510 
SetTouchpadPointerSpeed(int32_t speed)1511 int32_t MultimodalInputConnectProxy::SetTouchpadPointerSpeed(int32_t speed)
1512 {
1513     return SetTouchpadInt32Data(speed, static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
1514         SET_TP_POINTER_SPEED));
1515 }
1516 
GetTouchpadPointerSpeed(int32_t & speed)1517 int32_t MultimodalInputConnectProxy::GetTouchpadPointerSpeed(int32_t &speed)
1518 {
1519     return GetTouchpadInt32Data(speed, static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
1520         GET_TP_POINTER_SPEED));
1521 }
1522 
SetTouchpadPinchSwitch(bool switchFlag)1523 int32_t MultimodalInputConnectProxy::SetTouchpadPinchSwitch(bool switchFlag)
1524 {
1525     return SetTouchpadBoolData(switchFlag, static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
1526         SET_TP_PINCH_SWITCH));
1527 }
1528 
GetTouchpadPinchSwitch(bool & switchFlag)1529 int32_t MultimodalInputConnectProxy::GetTouchpadPinchSwitch(bool &switchFlag)
1530 {
1531     return GetTouchpadBoolData(switchFlag, static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
1532         GET_TP_PINCH_SWITCH));
1533 }
1534 
SetTouchpadSwipeSwitch(bool switchFlag)1535 int32_t MultimodalInputConnectProxy::SetTouchpadSwipeSwitch(bool switchFlag)
1536 {
1537     return SetTouchpadBoolData(switchFlag, static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
1538         SET_TP_SWIPE_SWITCH));
1539 }
1540 
GetTouchpadSwipeSwitch(bool & switchFlag)1541 int32_t MultimodalInputConnectProxy::GetTouchpadSwipeSwitch(bool &switchFlag)
1542 {
1543     return GetTouchpadBoolData(switchFlag, static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
1544         GET_TP_SWIPE_SWITCH));
1545 }
1546 
SetTouchpadRightClickType(int32_t type)1547 int32_t MultimodalInputConnectProxy::SetTouchpadRightClickType(int32_t type)
1548 {
1549     return SetTouchpadInt32Data(type, static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
1550         SET_TP_RIGHT_CLICK_TYPE));
1551 }
1552 
GetTouchpadRightClickType(int32_t & type)1553 int32_t MultimodalInputConnectProxy::GetTouchpadRightClickType(int32_t &type)
1554 {
1555     return GetTouchpadInt32Data(type, static_cast<uint32_t>(MultimodalinputConnectInterfaceCode::
1556         GET_TP_RIGHT_CLICK_TYPE));
1557 }
1558 } // namespace MMI
1559 } // namespace OHOS
1560