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_KIT_H
17 #define DISTRIBUTED_INPUT_KIT_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include "constants_dinput.h"
23 #include "dinput_log.h"
24 #include "distributed_input_client.h"
25 #include "i_prepare_d_input_call_back.h"
26 #include "i_register_d_input_call_back.h"
27 #include "i_start_d_input_call_back.h"
28 #include "i_stop_d_input_call_back.h"
29 #include "i_start_stop_d_inputs_call_back.h"
30 #include "i_start_stop_result_call_back.h"
31 #include "i_unregister_d_input_call_back.h"
32 #include "i_unprepare_d_input_call_back.h"
33 #include "i_session_state_callback.h"
34 
35 namespace OHOS {
36 namespace DistributedHardware {
37 namespace DistributedInput {
38 class DistributedInputKit {
39 public:
40 
41     static int32_t PrepareRemoteInput(const std::string &sinkId, sptr<IPrepareDInputCallback> callback);
42     static int32_t UnprepareRemoteInput(const std::string &sinkId, sptr<IUnprepareDInputCallback> callback);
43 
44     static int32_t PrepareRemoteInput(const std::string &srcId, const std::string &sinkId,
45         sptr<IPrepareDInputCallback> callback);
46     static int32_t UnprepareRemoteInput(const std::string &srcId, const std::string &sinkId,
47         sptr<IUnprepareDInputCallback> callback);
48 
49     static int32_t StartRemoteInput(
50         const std::string &sinkId, const uint32_t &inputTypes, sptr<IStartDInputCallback> callback);
51     static int32_t StopRemoteInput(
52         const std::string &sinkId, const uint32_t &inputTypes, sptr<IStopDInputCallback> callback);
53 
54     static int32_t StartRemoteInput(const std::string &sinkId, const std::vector<std::string> &dhIds,
55         sptr<IStartStopDInputsCallback> callback);
56     static int32_t StopRemoteInput(const std::string &sinkId, const std::vector<std::string> &dhIds,
57         sptr<IStartStopDInputsCallback> callback);
58 
59     static int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes,
60         sptr<IStartDInputCallback> callback);
61     static int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes,
62         sptr<IStopDInputCallback> callback);
63 
64     static int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId,
65         const std::vector<std::string> &dhIds, sptr<IStartStopDInputsCallback> callback);
66     static int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId,
67         const std::vector<std::string> &dhIds, sptr<IStartStopDInputsCallback> callback);
68 
69     static bool IsNeedFilterOut(const std::string &sinkId, const BusinessEvent &event);
70     static bool IsTouchEventNeedFilterOut(const TouchScreenEvent &event);
71 
72     static DInputServerType IsStartDistributedInput(const uint32_t &inputType);
73     /*
74      * check is dhId sharing to other devices
75      * true: dhId sharing to other device
76      * false: dhId NOT sharing to other device
77      */
78     static bool IsStartDistributedInput(const std::string &dhId);
79 
80     static int32_t RegisterSimulationEventListener(sptr<ISimulationEventListener> listener);
81     static int32_t UnregisterSimulationEventListener(sptr<ISimulationEventListener> listener);
82 
83     static int32_t RegisterSessionStateCb(sptr<ISessionStateCallback> callback);
84     static int32_t UnregisterSessionStateCb();
85 };
86 } // namespace DistributedInput
87 } // namespace DistributedHardware
88 } // namespace OHOS
89 
90 #endif // DISTRIBUTED_INPUT_KIT_H
91