• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 I_DINPUT_ADAPTER_H
17 #define I_DINPUT_ADAPTER_H
18 
19 #include <functional>
20 #include <map>
21 #include <memory>
22 #include <string>
23 #include <vector>
24 
25 namespace OHOS {
26 namespace Msdp {
27 namespace DeviceStatus {
28 class IDInputAdapter {
29 public:
30     struct BusinessEvent {
31         int32_t keyCode;
32         int32_t keyAction;
33         std::vector<int32_t> pressedKeys;
34     };
35 
36     using DInputCallback = std::function<void(bool)>;
37 
38     IDInputAdapter() = default;
39     virtual ~IDInputAdapter() = default;
40 
41     virtual bool IsNeedFilterOut(const std::string &networkId, BusinessEvent &&event) = 0;
42 
43     virtual int32_t StartRemoteInput(const std::string &remoteNetworkId, const std::string &originNetworkId,
44         const std::vector<std::string> &inputDeviceDhids, DInputCallback callback) = 0;
45     virtual int32_t StopRemoteInput(const std::string &remoteNetworkId, const std::string &originNetworkId,
46         const std::vector<std::string> &inputDeviceDhids, DInputCallback callback) = 0;
47 
48     virtual int32_t StopRemoteInput(const std::string &originNetworkId,
49         const std::vector<std::string> &inputDeviceDhids, DInputCallback callback) = 0;
50 
51     virtual int32_t PrepareRemoteInput(const std::string &remoteNetworkId,
52         const std::string &originNetworkId, DInputCallback callback) = 0;
53     virtual int32_t UnPrepareRemoteInput(const std::string &remoteNetworkId,
54         const std::string &originNetworkId, DInputCallback callback) = 0;
55 
56     virtual int32_t PrepareRemoteInput(const std::string &networkId, DInputCallback callback) = 0;
57     virtual int32_t UnPrepareRemoteInput(const std::string &networkId, DInputCallback callback) = 0;
58     virtual int32_t RegisterSessionStateCb(std::function<void(uint32_t)> callback) = 0;
59     virtual int32_t UnregisterSessionStateCb() = 0;
60 };
61 } // namespace DeviceStatus
62 } // namespace Msdp
63 } // namespace OHOS
64 #endif // I_DINPUT_ADAPTER_H
65