1 /* 2 * Copyright (c) 2021-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 16 /** 17 * @addtogroup Input 18 * @{ 19 * 20 * @brief Provides driver interfaces for the input service. 21 * 22 * These driver interfaces can be used to open and close input device files, get input events, query device information, 23 * register callback functions, and control the feature status. 24 * 25 * @since 1.0 26 * @version 1.0 27 */ 28 29 /** 30 * @file input_reporter.h 31 * 32 * @brief Declares the driver interfaces for reporting data of input devices. 33 * 34 * @since 1.0 35 * @version 1.0 36 */ 37 38 #ifndef INPUT_REPORTER_H 39 #define INPUT_REPORTER_H 40 41 #include "input_type.h" 42 43 #ifdef __cplusplus 44 extern "C" { 45 #endif 46 47 /** 48 * @brief Provides interfaces for reporting event data of input devices. 49 * 50 * The interfaces include the registration and unregistration of callbacks for reporting subscribed data of specified 51 * input devices. 52 */ 53 typedef struct { 54 /** 55 * @brief Registers a callback for reporting subscribed data of specified input devices. 56 * 57 * After this callback is successfully registered, the driver can report the input event data to the input service 58 * through this callback. 59 * 60 * @param devIndex Indicates the index of an input device. A maximum of 32 input devices are supported. 61 * The value ranges from 0 to 31, and value <b>0</b> represents the first input device. 62 * @param callback Indicates the pointer to the callback to register. 63 * @return Returns <b>INPUT SUCCESS</b> if the operation is successful; returns an error code defined in 64 * {@link RetStatus} otherwise. 65 * @since 1.0 66 * @version 1.0 67 */ 68 int32_t (*RegisterReportCallback)(uint32_t devIndex, InputEventCb *callback); 69 70 /** 71 * @brief Unregisters the callback for reporting subscribed data of specified input devices. 72 * 73 * @param devIndex Indicates the index of an input device. A maximum of 32 input devices are supported. 74 * The value ranges from 0 to 31, and value <b>0</b> represents the first input device. 75 * @return Returns <b>INPUT SUCCESS</b> if the operation is successful; returns an error code defined in 76 * {@link RetStatus} otherwise. 77 * @since 1.0 78 * @version 1.0 79 */ 80 int32_t (*UnregisterReportCallback)(uint32_t devIndex); 81 82 /** 83 * @brief Registers a hot plug callback to the HDIs for input devices. 84 * 85 * All input devices can use this callback to report hot plug events. 86 * 87 * @param callback Indicates the pointer to the callback to register. 88 * @return Returns <b>INPUT SUCCESS</b> if the operation is successful; returns an error code defined in 89 * {@link RetStatus} otherwise. 90 * @since 1.0 91 * @version 1.0 92 */ 93 int32_t (*RegisterHotPlugCallback)(InputHostCb *callback); 94 95 /** 96 * @brief Unregisters the hot plug callback of input devices. 97 * 98 * @return Returns <b>INPUT SUCCESS</b> if the operation is successful; returns an error code defined in 99 * {@link RetStatus} otherwise. 100 * @since 1.0 101 * @version 1.0 102 */ 103 int32_t (*UnregisterHotPlugCallback)(void); 104 } InputReporter; 105 106 #ifdef __cplusplus 107 } 108 #endif 109 #endif 110 /** @} */ 111