• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 #ifndef INPUT_PROXY_H
16 #define INPUT_PROXY_H
17 
18 #include <iremote_proxy.h>
19 #include <thread>
20 #include "iinput_host.h"
21 #include "iinput_host_callbck.h"
22 
23 namespace OHOS {
24 namespace Input {
25 class InputProxy : public IRemoteProxy<IInputHost> {
26 public:
InputProxy(const sptr<IRemoteObject> & impl)27     explicit InputProxy(const sptr<IRemoteObject>& impl) : IRemoteProxy<IInputHost>(impl) {}
~InputProxy()28     virtual ~InputProxy() override {}
29     virtual int32_t ScanInputDevice(DevDesc *staArr, uint32_t arrLen) override;
30     virtual int32_t OpenInputDevice(uint32_t devIndex) override;
31     virtual int32_t CloseInputDevice(uint32_t devIndex) override;
32     virtual int32_t GetInputDevice(uint32_t devIndex, DeviceInfo **devInfo) override;
33     virtual int32_t GetInputDeviceList(uint32_t *devNum, DeviceInfo **devList, uint32_t size) override;
34     virtual int32_t SetPowerStatus(uint32_t devIndex, uint32_t status) override;
35     virtual int32_t GetPowerStatus(uint32_t devIndex, uint32_t *status) override;
36     virtual int32_t GetDeviceType(uint32_t devIndex, uint32_t *status) override;
37     virtual int32_t GetChipInfo(uint32_t devIndex, char *chipInfo, uint32_t length) override;
38     virtual int32_t GetVendorName(uint32_t devIndex, char *vendorName, uint32_t length) override;
39     virtual int32_t GetChipName(uint32_t devIndex, char *chipName, uint32_t length) override;
40     virtual int32_t SetGestureMode(uint32_t devIndex, uint32_t gestureMode) override;
41     virtual int32_t RunCapacitanceTest(uint32_t devIndex, uint32_t testType, char *result, uint32_t length) override;
42     virtual int32_t RunExtraCommand(uint32_t devIndex, InputExtraCmd *cmd) override;
43     virtual int32_t RegisterReportCallback(uint32_t devIndex, OHOS::sptr<InputReportEventCb> callback) override;
44     virtual int32_t UnregisterReportCallback(uint32_t devIndex) override;
45     virtual int32_t RegisterHotPlugCallback(OHOS::sptr<InputReportHostCb> callback) override;
46     virtual int32_t UnregisterHotPlugCallback(void) override;
47 private:
48     static constexpr int32_t CMD_INPUT_SCAN_DEVICE_PROXY = 0;
49     static constexpr int32_t CMD_INPUT_OPNE_DEVICE_PROXY = 1;
50     static constexpr int32_t CMD_INPUT_CLOSE_DEVICE_PROXY = 2;
51     static constexpr int32_t CMD_INPUT_GET_DEVICE_PROXY = 3;
52     static constexpr int32_t CMD_INPUT_GET_DEVICE_LIST_PROXY = 4;
53     static constexpr int32_t CMD_INPUT_SET_POWER_STATUS_PROXY = 5;
54     static constexpr int32_t CMD_INPUT_GET_POWER_STATUS_PROXY = 6;
55     static constexpr int32_t CMD_INPUT_GET_DEVICE_TYPE_PROXY = 7;
56     static constexpr int32_t CMD_INPUT_GET_CHIP_INFO_PROXY = 8;
57     static constexpr int32_t CMD_INPUT_GET_VENDOR_NAME_PROXY = 9;
58     static constexpr int32_t CMD_INPUT_GET_CHIP_NAME_PROXY = 10;
59     static constexpr int32_t CMD_INPUT_SET_GESTURE_MODE_PROXY = 11;
60     static constexpr int32_t CMD_INPUT_RUN_CAPACITANCE_TEST_PROXY = 12;
61     static constexpr int32_t CMD_INPUT_RUN_EXTRA_COMMAND_PROXY = 13;
62     static constexpr int32_t CMD_INPUT_REGISTER_DEVICE_PROXY = 14;
63     static constexpr int32_t CMD_INPUT_UNREGISTER_DEVICE_PROXY = 15;
64     static constexpr int32_t CMD_INPUT_REGISTER_HOT_PLAUS_DEVICE_PROXY = 16;
65     static constexpr int32_t CMD_INPUT_UNREGISTER_HOT_PLAUS_DEVICE_PROXY = 17;
66     static inline BrokerDelegator<InputProxy> delegator_;
67     std::thread thread_;
68 };
69 }  // namespace Input
70 }  // namespace OHOS
71 
72 #endif // INPUT_PROXY_H