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 34 namespace OHOS { 35 namespace DistributedHardware { 36 namespace DistributedInput { 37 class DistributedInputKit { 38 public: 39 40 static int32_t PrepareRemoteInput(const std::string &sinkId, sptr<IPrepareDInputCallback> callback); 41 static int32_t UnprepareRemoteInput(const std::string &sinkId, sptr<IUnprepareDInputCallback> callback); 42 43 static int32_t PrepareRemoteInput(const std::string &srcId, const std::string &sinkId, 44 sptr<IPrepareDInputCallback> callback); 45 static int32_t UnprepareRemoteInput(const std::string &srcId, const std::string &sinkId, 46 sptr<IUnprepareDInputCallback> callback); 47 48 static int32_t StartRemoteInput( 49 const std::string &sinkId, const uint32_t &inputTypes, sptr<IStartDInputCallback> callback); 50 static int32_t StopRemoteInput( 51 const std::string &sinkId, const uint32_t &inputTypes, sptr<IStopDInputCallback> callback); 52 53 static int32_t StartRemoteInput(const std::string &sinkId, const std::vector<std::string> &dhIds, 54 sptr<IStartStopDInputsCallback> callback); 55 static int32_t StopRemoteInput(const std::string &sinkId, const std::vector<std::string> &dhIds, 56 sptr<IStartStopDInputsCallback> callback); 57 58 static int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, 59 sptr<IStartDInputCallback> callback); 60 static int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, 61 sptr<IStopDInputCallback> callback); 62 63 static int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, 64 const std::vector<std::string> &dhIds, sptr<IStartStopDInputsCallback> callback); 65 static int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId, 66 const std::vector<std::string> &dhIds, sptr<IStartStopDInputsCallback> callback); 67 68 static bool IsNeedFilterOut(const std::string &sinkId, const BusinessEvent &event); 69 static bool IsTouchEventNeedFilterOut(const TouchScreenEvent &event); 70 71 static DInputServerType IsStartDistributedInput(const uint32_t &inputType); 72 /* 73 * check is dhId sharing to other devices 74 * true: dhId sharing to other device 75 * false: dhId NOT sharing to other device 76 */ 77 static bool IsStartDistributedInput(const std::string &dhId); 78 79 static int32_t RegisterInputNodeListener(sptr<InputNodeListener> listener); 80 static int32_t UnregisterInputNodeListener(sptr<InputNodeListener> listener); 81 static int32_t RegisterSimulationEventListener(sptr<ISimulationEventListener> listener); 82 static int32_t UnregisterSimulationEventListener(sptr<ISimulationEventListener> listener); 83 }; 84 } // namespace DistributedInput 85 } // namespace DistributedHardware 86 } // namespace OHOS 87 88 #endif // DISTRIBUTED_INPUT_KIT_H 89