1094332d3Sopenharmony_ci/* 2094332d3Sopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3094332d3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4094332d3Sopenharmony_ci * you may not use this file except in compliance with the License. 5094332d3Sopenharmony_ci * You may obtain a copy of the License at 6094332d3Sopenharmony_ci * 7094332d3Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8094332d3Sopenharmony_ci * 9094332d3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10094332d3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11094332d3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12094332d3Sopenharmony_ci * See the License for the specific language governing permissions and 13094332d3Sopenharmony_ci * limitations under the License. 14094332d3Sopenharmony_ci */ 15094332d3Sopenharmony_ci 16094332d3Sopenharmony_ci/** 17094332d3Sopenharmony_ci * @addtogroup Input 18094332d3Sopenharmony_ci * @{ 19094332d3Sopenharmony_ci * 20094332d3Sopenharmony_ci * @brief Provides driver interfaces for the input service. 21094332d3Sopenharmony_ci * 22094332d3Sopenharmony_ci * These driver interfaces can be used to open and close input device files, get input events, query device information, 23094332d3Sopenharmony_ci * register callback functions, and control the feature status. 24094332d3Sopenharmony_ci * 25094332d3Sopenharmony_ci * @since 1.0 26094332d3Sopenharmony_ci * @version 1.0 27094332d3Sopenharmony_ci */ 28094332d3Sopenharmony_ci 29094332d3Sopenharmony_ci/** 30094332d3Sopenharmony_ci * @file input_reporter.h 31094332d3Sopenharmony_ci * 32094332d3Sopenharmony_ci * @brief Declares the driver interfaces for reporting data of input devices. 33094332d3Sopenharmony_ci * 34094332d3Sopenharmony_ci * @since 1.0 35094332d3Sopenharmony_ci * @version 1.0 36094332d3Sopenharmony_ci */ 37094332d3Sopenharmony_ci 38094332d3Sopenharmony_ci#ifndef INPUT_REPORTER_H 39094332d3Sopenharmony_ci#define INPUT_REPORTER_H 40094332d3Sopenharmony_ci 41094332d3Sopenharmony_ci#include "input_type.h" 42094332d3Sopenharmony_ci 43094332d3Sopenharmony_ci#ifdef __cplusplus 44094332d3Sopenharmony_ciextern "C" { 45094332d3Sopenharmony_ci#endif 46094332d3Sopenharmony_ci 47094332d3Sopenharmony_ci/** 48094332d3Sopenharmony_ci * @brief Provides interfaces for reporting event data of input devices. 49094332d3Sopenharmony_ci * 50094332d3Sopenharmony_ci * The interfaces include the registration and unregistration of callbacks for reporting subscribed data of specified 51094332d3Sopenharmony_ci * input devices. 52094332d3Sopenharmony_ci */ 53094332d3Sopenharmony_citypedef struct { 54094332d3Sopenharmony_ci /** 55094332d3Sopenharmony_ci * @brief Registers a callback for reporting subscribed data of specified input devices. 56094332d3Sopenharmony_ci * 57094332d3Sopenharmony_ci * After this callback is successfully registered, the driver can report the input event data to the input service 58094332d3Sopenharmony_ci * through this callback. 59094332d3Sopenharmony_ci * 60094332d3Sopenharmony_ci * @param devIndex Indicates the index of an input device. A maximum of 32 input devices are supported. 61094332d3Sopenharmony_ci * The value ranges from 0 to 31, and value <b>0</b> represents the first input device. 62094332d3Sopenharmony_ci * @param callback Indicates the pointer to the callback to register. 63094332d3Sopenharmony_ci * @return Returns <b>INPUT SUCCESS</b> if the operation is successful; returns an error code defined in 64094332d3Sopenharmony_ci * {@link RetStatus} otherwise. 65094332d3Sopenharmony_ci * @since 1.0 66094332d3Sopenharmony_ci * @version 1.0 67094332d3Sopenharmony_ci */ 68094332d3Sopenharmony_ci int32_t (*RegisterReportCallback)(uint32_t devIndex, InputEventCb *callback); 69094332d3Sopenharmony_ci 70094332d3Sopenharmony_ci /** 71094332d3Sopenharmony_ci * @brief Unregisters the callback for reporting subscribed data of specified input devices. 72094332d3Sopenharmony_ci * 73094332d3Sopenharmony_ci * @param devIndex Indicates the index of an input device. A maximum of 32 input devices are supported. 74094332d3Sopenharmony_ci * The value ranges from 0 to 31, and value <b>0</b> represents the first input device. 75094332d3Sopenharmony_ci * @return Returns <b>INPUT SUCCESS</b> if the operation is successful; returns an error code defined in 76094332d3Sopenharmony_ci * {@link RetStatus} otherwise. 77094332d3Sopenharmony_ci * @since 1.0 78094332d3Sopenharmony_ci * @version 1.0 79094332d3Sopenharmony_ci */ 80094332d3Sopenharmony_ci int32_t (*UnregisterReportCallback)(uint32_t devIndex); 81094332d3Sopenharmony_ci 82094332d3Sopenharmony_ci /** 83094332d3Sopenharmony_ci * @brief Registers a hot plug callback to the HDIs for input devices. 84094332d3Sopenharmony_ci * 85094332d3Sopenharmony_ci * All input devices can use this callback to report hot plug events. 86094332d3Sopenharmony_ci * 87094332d3Sopenharmony_ci * @param callback Indicates the pointer to the callback to register. 88094332d3Sopenharmony_ci * @return Returns <b>INPUT SUCCESS</b> if the operation is successful; returns an error code defined in 89094332d3Sopenharmony_ci * {@link RetStatus} otherwise. 90094332d3Sopenharmony_ci * @since 1.0 91094332d3Sopenharmony_ci * @version 1.0 92094332d3Sopenharmony_ci */ 93094332d3Sopenharmony_ci int32_t (*RegisterHotPlugCallback)(InputHostCb *callback); 94094332d3Sopenharmony_ci 95094332d3Sopenharmony_ci /** 96094332d3Sopenharmony_ci * @brief Unregisters the hot plug callback of input devices. 97094332d3Sopenharmony_ci * 98094332d3Sopenharmony_ci * @return Returns <b>INPUT SUCCESS</b> if the operation is successful; returns an error code defined in 99094332d3Sopenharmony_ci * {@link RetStatus} otherwise. 100094332d3Sopenharmony_ci * @since 1.0 101094332d3Sopenharmony_ci * @version 1.0 102094332d3Sopenharmony_ci */ 103094332d3Sopenharmony_ci int32_t (*UnregisterHotPlugCallback)(void); 104094332d3Sopenharmony_ci} InputReporter; 105094332d3Sopenharmony_ci 106094332d3Sopenharmony_ci#ifdef __cplusplus 107094332d3Sopenharmony_ci} 108094332d3Sopenharmony_ci#endif 109094332d3Sopenharmony_ci#endif 110094332d3Sopenharmony_ci/** @} */ 111