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 * 26094332d3Sopenharmony_ci * @since 1.0 27094332d3Sopenharmony_ci * @version 1.0 28094332d3Sopenharmony_ci */ 29094332d3Sopenharmony_ci 30094332d3Sopenharmony_ci/** 31094332d3Sopenharmony_ci * @file input_controller.h 32094332d3Sopenharmony_ci * 33094332d3Sopenharmony_ci * @brief Declares the driver interfaces for controlling the business process of input devices. 34094332d3Sopenharmony_ci * 35094332d3Sopenharmony_ci * @since 1.0 36094332d3Sopenharmony_ci * @version 1.0 37094332d3Sopenharmony_ci */ 38094332d3Sopenharmony_ci 39094332d3Sopenharmony_ci#ifndef INPUT_CONTROLLER_H 40094332d3Sopenharmony_ci#define INPUT_CONTROLLER_H 41094332d3Sopenharmony_ci 42094332d3Sopenharmony_ci#include "input_type.h" 43094332d3Sopenharmony_ci 44094332d3Sopenharmony_ci#ifdef __cplusplus 45094332d3Sopenharmony_ciextern "C" { 46094332d3Sopenharmony_ci#endif 47094332d3Sopenharmony_ci 48094332d3Sopenharmony_ci/** 49094332d3Sopenharmony_ci * @brief Provides interfaces for controlling the business process of input devices. 50094332d3Sopenharmony_ci * 51094332d3Sopenharmony_ci * The interfaces can be called to set the power status, enable or disable a feature, get driver chip information, 52094332d3Sopenharmony_ci * and control the production test. 53094332d3Sopenharmony_ci */ 54094332d3Sopenharmony_citypedef struct { 55094332d3Sopenharmony_ci /** 56094332d3Sopenharmony_ci * @brief Sets the power status. 57094332d3Sopenharmony_ci * 58094332d3Sopenharmony_ci * This function is called only when the power status of the OS is changed. \n 59094332d3Sopenharmony_ci * The input service or the power management module can call this function to set the power status 60094332d3Sopenharmony_ci * for the input device when the OS is in the Resume or Suspend status, so that the driver integrated circuit (IC) 61094332d3Sopenharmony_ci * of the device can normally enter the specified status. 62094332d3Sopenharmony_ci * 63094332d3Sopenharmony_ci * @param devIndex Indicates the index of an input device. A maximum of 32 input devices are supported. 64094332d3Sopenharmony_ci * The value ranges from 0 to 31, and value <b>0</b> represents the first input device. 65094332d3Sopenharmony_ci * @param status Indicates the power status to set. The input service will notify the input device of entering the 66094332d3Sopenharmony_ci * Resume or Suspend state specified by {@link PowerStatus}. 67094332d3Sopenharmony_ci * @return Returns <b>INPUT SUCCESS</b> if the operation is successful; returns an error code defined in 68094332d3Sopenharmony_ci * {@link RetStatus} otherwise. 69094332d3Sopenharmony_ci * @since 1.0 70094332d3Sopenharmony_ci * @version 1.0 71094332d3Sopenharmony_ci */ 72094332d3Sopenharmony_ci int32_t (*SetPowerStatus)(uint32_t devIndex, uint32_t status); 73094332d3Sopenharmony_ci 74094332d3Sopenharmony_ci /** 75094332d3Sopenharmony_ci * @brief Gets the power status. 76094332d3Sopenharmony_ci * 77094332d3Sopenharmony_ci * The input service or the power management module can get the power status for the input device when the OS 78094332d3Sopenharmony_ci * is in the Resume or Suspend status, so that the driver IC of the device can normally enter the specified status. 79094332d3Sopenharmony_ci * You can call this function to obtain the power status. 80094332d3Sopenharmony_ci * 81094332d3Sopenharmony_ci * @param devIndex Indicates the index of an input device. A maximum of 32 input devices are supported. 82094332d3Sopenharmony_ci * The value ranges from 0 to 31, and value <b>0</b> represents the first input device. 83094332d3Sopenharmony_ci * @param status Indicates the pointer to the power status of the device. For details, see {@link PowerStatus}. 84094332d3Sopenharmony_ci * @return Returns <b>INPUT SUCCESS</b> if the operation is successful; returns an error code defined in 85094332d3Sopenharmony_ci * {@link RetStatus} otherwise. 86094332d3Sopenharmony_ci * @since 1.0 87094332d3Sopenharmony_ci * @version 1.0 88094332d3Sopenharmony_ci */ 89094332d3Sopenharmony_ci int32_t (*GetPowerStatus)(uint32_t devIndex, uint32_t *status); 90094332d3Sopenharmony_ci 91094332d3Sopenharmony_ci /** 92094332d3Sopenharmony_ci * @brief Gets the type of the input device based on the specified device index. 93094332d3Sopenharmony_ci * 94094332d3Sopenharmony_ci * @param devIndex Indicates the index of an input device. A maximum of 32 input devices are supported. 95094332d3Sopenharmony_ci * The value ranges from 0 to 31, and value <b>0</b> represents the first input device. 96094332d3Sopenharmony_ci * @param deviceType Indicates the pointer to the device type. For details, see {@link InputDevType}. 97094332d3Sopenharmony_ci * @return Returns <b>INPUT SUCCESS</b> if the operation is successful; returns an error code defined 98094332d3Sopenharmony_ci * in {@link RetStatus} otherwise. 99094332d3Sopenharmony_ci * @since 1.0 100094332d3Sopenharmony_ci * @version 1.0 101094332d3Sopenharmony_ci */ 102094332d3Sopenharmony_ci int32_t (*GetDeviceType)(uint32_t devIndex, uint32_t *deviceType); 103094332d3Sopenharmony_ci 104094332d3Sopenharmony_ci /** 105094332d3Sopenharmony_ci * @brief Gets the chip information of the specified device. 106094332d3Sopenharmony_ci * 107094332d3Sopenharmony_ci * A product is usually equipped with modules and driver ICs provided by multiple vendors. An input service 108094332d3Sopenharmony_ci * can call this function to get the specific information if needed. 109094332d3Sopenharmony_ci * 110094332d3Sopenharmony_ci * @param devIndex Indicates the index of an input device. A maximum of 32 input devices are supported. 111094332d3Sopenharmony_ci * The value ranges from 0 to 31, and value <b>0</b> represents the first input device. 112094332d3Sopenharmony_ci * @param chipInfo Indicates the pointer to the chip information. 113094332d3Sopenharmony_ci * @param length Indicates the length of the chip information. The minimum value of length is 10. 114094332d3Sopenharmony_ci * @return Returns <b>INPUT SUCCESS</b> if the operation is successful; returns an error code defined 115094332d3Sopenharmony_ci * in {@link RetStatus} otherwise. 116094332d3Sopenharmony_ci * @since 1.0 117094332d3Sopenharmony_ci * @version 1.0 118094332d3Sopenharmony_ci */ 119094332d3Sopenharmony_ci int32_t (*GetChipInfo)(uint32_t devIndex, char *chipInfo, uint32_t length); 120094332d3Sopenharmony_ci 121094332d3Sopenharmony_ci /** 122094332d3Sopenharmony_ci * @brief Gets the module vendor name of the specified device. 123094332d3Sopenharmony_ci * 124094332d3Sopenharmony_ci * @param devIndex Indicates the index of an input device. A maximum of 32 input devices are supported. 125094332d3Sopenharmony_ci * The value ranges from 0 to 31, and value <b>0</b> represents the first input device. 126094332d3Sopenharmony_ci * @param vendorName Indicates the pointer to the module vendor name. 127094332d3Sopenharmony_ci * @param length Indicates the length of the module vendor name. The minimum value of length is 10. 128094332d3Sopenharmony_ci * @return Returns <b>INPUT SUCCESS</b> if the operation is successful; returns an error code defined 129094332d3Sopenharmony_ci * in {@link RetStatus} otherwise. 130094332d3Sopenharmony_ci * @since 1.0 131094332d3Sopenharmony_ci * @version 1.0 132094332d3Sopenharmony_ci */ 133094332d3Sopenharmony_ci int32_t (*GetVendorName)(uint32_t devIndex, char *vendorName, uint32_t length); 134094332d3Sopenharmony_ci 135094332d3Sopenharmony_ci /** 136094332d3Sopenharmony_ci * @brief Gets the driver chip name of the specified device. 137094332d3Sopenharmony_ci * 138094332d3Sopenharmony_ci * @param devIndex Indicates the index of an input device. A maximum of 32 input devices are supported. 139094332d3Sopenharmony_ci * The value ranges from 0 to 31, and value <b>0</b> represents the first input device. 140094332d3Sopenharmony_ci * @param chipName Indicates the pointer to the driver chip name. 141094332d3Sopenharmony_ci * @param length Indicates the length of the driver chip name. The minimum value of length is 10. 142094332d3Sopenharmony_ci * @return Returns <b>INPUT SUCCESS</b> if the operation is successful; returns an error code defined 143094332d3Sopenharmony_ci * in {@link RetStatus} otherwise. 144094332d3Sopenharmony_ci * @since 1.0 145094332d3Sopenharmony_ci * @version 1.0 146094332d3Sopenharmony_ci */ 147094332d3Sopenharmony_ci int32_t (*GetChipName)(uint32_t devIndex, char *chipName, uint32_t length); 148094332d3Sopenharmony_ci 149094332d3Sopenharmony_ci /** 150094332d3Sopenharmony_ci * @brief Sets the gesture mode. 151094332d3Sopenharmony_ci * 152094332d3Sopenharmony_ci * The input service can use this function to enable or disable the gesture mode by setting <b>EnableBit</b> 153094332d3Sopenharmony_ci * of the gesture mode. 154094332d3Sopenharmony_ci * 155094332d3Sopenharmony_ci * @param devIndex Indicates the index of an input device. A maximum of 32 input devices are supported. 156094332d3Sopenharmony_ci * The value ranges from 0 to 31, and value <b>0</b> represents the first input device. 157094332d3Sopenharmony_ci * @param gestureMode Indicates the gesture mode to set. 158094332d3Sopenharmony_ci * @return Returns <b>INPUT SUCCESS</b> if the operation is successful; returns an error code defined 159094332d3Sopenharmony_ci * in {@link RetStatus} otherwise. 160094332d3Sopenharmony_ci * @since 1.0 161094332d3Sopenharmony_ci * @version 1.0 162094332d3Sopenharmony_ci */ 163094332d3Sopenharmony_ci int32_t (*SetGestureMode)(uint32_t devIndex, uint32_t gestureMode); 164094332d3Sopenharmony_ci 165094332d3Sopenharmony_ci /** 166094332d3Sopenharmony_ci * @brief Conducts a capacitance self-test. 167094332d3Sopenharmony_ci * 168094332d3Sopenharmony_ci * The capacitance self-test items are defined by the component vendor, such as the tests on the raw data, 169094332d3Sopenharmony_ci * short circuit, open circuit, interference, and row/column difference. 170094332d3Sopenharmony_ci * 171094332d3Sopenharmony_ci * @param devIndex Indicates the index of an input device. A maximum of 32 input devices are supported. 172094332d3Sopenharmony_ci * The value ranges from 0 to 31, and value <b>0</b> represents the first input device. 173094332d3Sopenharmony_ci * @param testType Indicates the capacitance test type. For details, see {@link CapacitanceTest}. 174094332d3Sopenharmony_ci * @param result Indicates the pointer to the capacitance test result. The value is <b>SUCC</b> for a successful 175094332d3Sopenharmony_ci * operation and is an error code for a failed operation. 176094332d3Sopenharmony_ci * @param length Indicates the length of the test result. The minimum value of length is 20. 177094332d3Sopenharmony_ci * @return Returns <b>INPUT SUCCESS</b> if the operation is successful; returns an error code defined 178094332d3Sopenharmony_ci * in {@link RetStatus} otherwise. 179094332d3Sopenharmony_ci * @since 1.0 180094332d3Sopenharmony_ci * @version 1.0 181094332d3Sopenharmony_ci */ 182094332d3Sopenharmony_ci int32_t (*RunCapacitanceTest)(uint32_t devIndex, uint32_t testType, char *result, uint32_t length); 183094332d3Sopenharmony_ci 184094332d3Sopenharmony_ci /** 185094332d3Sopenharmony_ci * @brief Executes the extra command. 186094332d3Sopenharmony_ci * 187094332d3Sopenharmony_ci * @param devIndex Indicates the index of an input device. A maximum of 32 input devices are supported. 188094332d3Sopenharmony_ci * The value ranges from 0 to 31, and value <b>0</b> represents the first input device. 189094332d3Sopenharmony_ci * @param cmd Indicates the pointer to the extra command data packet, including the command codes and parameters. 190094332d3Sopenharmony_ci * For details, see {@link InputExtraCmd}. 191094332d3Sopenharmony_ci * @return Returns <b>INPUT SUCCESS</b> if the operation is successful; returns an error code defined 192094332d3Sopenharmony_ci * in {@link RetStatus} otherwise. 193094332d3Sopenharmony_ci * @since 1.0 194094332d3Sopenharmony_ci * @version 1.0 195094332d3Sopenharmony_ci */ 196094332d3Sopenharmony_ci int32_t (*RunExtraCommand)(uint32_t devIndex, InputExtraCmd *cmd); 197094332d3Sopenharmony_ci} InputController; 198094332d3Sopenharmony_ci 199094332d3Sopenharmony_ci#ifdef __cplusplus 200094332d3Sopenharmony_ci} 201094332d3Sopenharmony_ci#endif 202094332d3Sopenharmony_ci#endif 203094332d3Sopenharmony_ci/** @} */ 204