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_SERVICE_H 16 #define INPUT_SERVICE_H 17 18 #include "iinput_host.h" 19 #include "input_device_manager.h" 20 21 namespace OHOS { 22 namespace Input { 23 class InputServer : public IInputHost { 24 public: 25 InputServer(); ~InputServer()26 virtual ~InputServer() override {} 27 virtual int32_t ScanInputDevice(DevDesc *staArr, uint32_t arrLen) override; 28 virtual int32_t OpenInputDevice(uint32_t devIndex) override; 29 virtual int32_t CloseInputDevice(uint32_t devIndex) override; 30 virtual int32_t GetInputDevice(uint32_t devIndex, DeviceInfo **devInfo) override; 31 virtual int32_t GetInputDeviceList(uint32_t *devNum, DeviceInfo **devList, uint32_t size) override; 32 virtual int32_t SetPowerStatus(uint32_t devIndex, uint32_t status) override; 33 virtual int32_t GetPowerStatus(uint32_t devIndex, uint32_t *status) override; 34 virtual int32_t GetDeviceType(uint32_t devIndex, uint32_t *status) override; 35 virtual int32_t GetChipInfo(uint32_t devIndex, char *chipInfo, uint32_t length) override; 36 virtual int32_t GetVendorName(uint32_t devIndex, char *vendorName, uint32_t length) override; 37 virtual int32_t GetChipName(uint32_t devIndex, char *chipName, uint32_t length) override; 38 virtual int32_t SetGestureMode(uint32_t devIndex, uint32_t gestureMode) override; 39 virtual int32_t RunCapacitanceTest(uint32_t devIndex, uint32_t testType, char *result, uint32_t length) override; 40 virtual int32_t RunExtraCommand(uint32_t devIndex, InputExtraCmd *cmd) override; 41 virtual int32_t RegisterReportCallback(uint32_t devIndex, OHOS::sptr<InputReportEventCb> callback) override; 42 virtual int32_t UnregisterReportCallback(uint32_t devIndex) override; 43 virtual int32_t RegisterHotPlugCallback(sptr<InputReportHostCb> callback) override; 44 virtual int32_t UnregisterHotPlugCallback(void) override; 45 static std::map<int32_t, OHOS::sptr<InputReportEventCb>> reportEventPkgCallback_; 46 OHOS::sptr<InputReportHostCb> reportHotPlugEventCallback_; 47 std::shared_ptr<InputDeviceManager> inputDeviceManager_; 48 }; 49 } // namespace Input 50 } // namespace OHOS 51 #endif // INPUT_SERVICE_H 52