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_STUB_H 16 #define INPUT_SERVICE_STUB_H 17 18 #include <functional> 19 #include <message_parcel.h> 20 #include <message_option.h> 21 #include <map> 22 #include <refbase.h> 23 #include <string> 24 25 #include "iinput_host.h" 26 #include "input_server.h" 27 #include "input_type.h" 28 29 namespace OHOS { 30 namespace Input { 31 class InputServerStub { 32 public: 33 InputServerStub(); ~InputServerStub()34 virtual ~InputServerStub() {} 35 int32_t InputServerStubOnRemoteRequest(int32_t cmdId, 36 MessageParcel& data, 37 MessageParcel& reply, 38 MessageOption& option); 39 int32_t InputServerStubScanInputDevice(MessageParcel& data, MessageParcel& reply, MessageOption& option) const; 40 int32_t InputServerStubOpenInputDevice(MessageParcel& data, MessageParcel& reply, MessageOption& option) const; 41 int32_t InputServerStubCloseInputDevice(MessageParcel& data, MessageParcel& reply, MessageOption& option) const; 42 int32_t InputServerStubGetInputDevice(MessageParcel& data, MessageParcel& reply, MessageOption& option) const; 43 int32_t InputServerStubGetInputDeviceList(MessageParcel& data, 44 MessageParcel& reply, 45 MessageOption& option) const; 46 int32_t InputServerStubSetPowerStatus(MessageParcel& data, MessageParcel& reply, MessageOption& option) const; 47 int32_t InputServerStubGetPowerStatus(MessageParcel& data, MessageParcel& reply, MessageOption& option) const; 48 int32_t InputServerStubGetDeviceType(MessageParcel& data, MessageParcel& reply, MessageOption& option) const; 49 int32_t InputServerStubGetChipInfo(MessageParcel& data, MessageParcel& reply, MessageOption& option) const; 50 int32_t InputServerStubGetVendorName(MessageParcel& data, MessageParcel& reply, MessageOption& option) const; 51 int32_t InputServerStubGetChipName(MessageParcel& data, MessageParcel& reply, MessageOption& option) const; 52 int32_t InputServerStubSetGestureMode(MessageParcel& data, MessageParcel& reply, MessageOption& option) const; 53 int32_t InputServerStubRunCapacitanceTest(MessageParcel& data, 54 MessageParcel& reply, 55 MessageOption& option) const; 56 int32_t InputServerStubRunExtraCommand(MessageParcel& data, MessageParcel& reply, MessageOption& option) const; 57 int32_t InputServerStubRegisterReportCallback(MessageParcel &data, 58 MessageParcel &reply, 59 MessageOption &option) const; 60 int32_t InputServerStubUnregisterReportCallback(MessageParcel &data, 61 MessageParcel &reply, 62 MessageOption &option) const; 63 int32_t InputServerStubRegisterHotPlugCallback(MessageParcel &data, 64 MessageParcel &reply, 65 MessageOption &option) const; 66 int32_t InputServerStubUnregisterHotPlugCallback(MessageParcel &data, 67 MessageParcel &reply, 68 MessageOption &option) const; GetDescriptor()69 static inline const std::u16string &GetDescriptor() 70 { 71 return metaDescriptor_; 72 } 73 private: 74 static inline const std::u16string metaDescriptor_ = u"HDI.INPUT.V1_0"; 75 std::shared_ptr<InputServer> mService_ = std::make_shared<InputServer>(); 76 }; 77 } // namespace Input 78 } // namespace OHOS 79 80 void *InputStubInstance(); 81 void InputStubRelease(void *obj); 82 int32_t InputServiceOnRemoteRequest(void *stub, int32_t cmdId, struct HdfSBuf& data, struct HdfSBuf& reply); 83 #endif // INPUT_SERVICE_STUB_H 84