From 6524e127f8f4b196145c992e78b38f2658096f9a Mon Sep 17 00:00:00 2001 From: Annie_wang Date: Mon, 23 Oct 2023 18:03:13 +0800 Subject: [PATCH 1/2] update docs Signed-off-by: Annie_wang --- en/native_sdk/database/rdb/oh_cursor.h | 2 +- en/native_sdk/database/rdb/oh_predicates.h | 2 +- en/native_sdk/database/rdb/oh_value_object.h | 12 ++- en/native_sdk/database/rdb/oh_values_bucket.h | 2 +- en/native_sdk/database/rdb/relational_store.h | 4 +- .../rdb/relational_store_error_code.h | 100 +++++++++--------- 6 files changed, 63 insertions(+), 59 deletions(-) diff --git a/en/native_sdk/database/rdb/oh_cursor.h b/en/native_sdk/database/rdb/oh_cursor.h index ead52a92..7eeb8d68 100644 --- a/en/native_sdk/database/rdb/oh_cursor.h +++ b/en/native_sdk/database/rdb/oh_cursor.h @@ -35,7 +35,7 @@ * @brief Provides methods to access the result set obtained by querying an RDB store. * * A result set is a set of results returned by query(). - * + * @library native_rdb_ndk_header.so * @since 10 */ diff --git a/en/native_sdk/database/rdb/oh_predicates.h b/en/native_sdk/database/rdb/oh_predicates.h index 243461ef..ed900b1b 100644 --- a/en/native_sdk/database/rdb/oh_predicates.h +++ b/en/native_sdk/database/rdb/oh_predicates.h @@ -33,7 +33,7 @@ * @file oh_predicates.h * * @brief Represents a predicate for a relational database (RDB). - * + * @library native_rdb_ndk_header.so * @since 10 */ diff --git a/en/native_sdk/database/rdb/oh_value_object.h b/en/native_sdk/database/rdb/oh_value_object.h index 5c9f6e74..621ef04b 100644 --- a/en/native_sdk/database/rdb/oh_value_object.h +++ b/en/native_sdk/database/rdb/oh_value_object.h @@ -56,8 +56,9 @@ typedef struct OH_VObject { * * @param valueObject Indicates the pointer to the {@link OH_VObject} instance. * @param value Indicates the pointer to the value or array to convert. - * @param count Indicates the number or length of the parameters to convert. If value points to a single - * parameter, count is 1. If value points to an array, count specifies the array length. + * @param count Indicates the number or length of the parameters to convert. + * If value points to a single parameter, count is 1. + * If value points to an array, count specifies the length of the array. * @return Returns the operation result. If the operation fails, an error code is returned. * @see OH_VObject. * @since 10 @@ -69,8 +70,9 @@ typedef struct OH_VObject { * * @param valueObject Indicates the pointer to the {@link OH_VObject} instance. * @param value Indicates the pointer to the double value or array to convert. - * @param count Indicates the number or length of the parameters to convert. If value points to a single - * parameter, count is 1. If value points to an array, count specifies the array length. + * @param count Indicates the number or length of the parameters to convert. + * If value points to a single parameter, count is 1. + * If value points to an array, count specifies the length of the array. * @return Returns the operation result. If the operation fails, an error code is returned. * @see OH_VObject. * @since 10 @@ -108,7 +110,7 @@ typedef struct OH_VObject { * @see OH_VObject. * @since 10 */ - int (*destroy)(OH_VObject *valueObject); + int (*destroyValueObject)(OH_VObject *valueObject); } OH_VObject; #ifdef __cplusplus diff --git a/en/native_sdk/database/rdb/oh_values_bucket.h b/en/native_sdk/database/rdb/oh_values_bucket.h index 2b056383..67486b26 100644 --- a/en/native_sdk/database/rdb/oh_values_bucket.h +++ b/en/native_sdk/database/rdb/oh_values_bucket.h @@ -33,7 +33,7 @@ * @file oh_values_bucket.h * * @brief Defines the types of the key and value in a key-value (KV) pair. - * + * @library native_rdb_ndk_header.so * @since 10 */ diff --git a/en/native_sdk/database/rdb/relational_store.h b/en/native_sdk/database/rdb/relational_store.h index f0d22418..bd3873ce 100644 --- a/en/native_sdk/database/rdb/relational_store.h +++ b/en/native_sdk/database/rdb/relational_store.h @@ -34,7 +34,7 @@ * @file relational_store.h * * @brief Provides methods for managing relational database (RDB) stores. - * + * @library native_rdb_ndk_header.so * @since 10 */ @@ -90,6 +90,8 @@ typedef struct { int selfSize; /** Database file path. */ const char *dataBaseDir; + /** RDB store name. */ + const char *storeName; /** Application bundle name. */ const char *bundleName; /** Application module name. */ diff --git a/en/native_sdk/database/rdb/relational_store_error_code.h b/en/native_sdk/database/rdb/relational_store_error_code.h index 71d32aa4..8f26a7b2 100644 --- a/en/native_sdk/database/rdb/relational_store_error_code.h +++ b/en/native_sdk/database/rdb/relational_store_error_code.h @@ -34,7 +34,7 @@ * @file relational_store_error_code.h * * @brief Declares the error code information about a relational database (RDB) store. - * + * @library native_rdb_ndk_header.so * @since 10 */ @@ -59,22 +59,22 @@ typedef enum OH_Rdb_ErrCode { RDB_OK = 0, /** - * Error code base. + * @brief Error code base. */ E_BASE = 14800000, /** - * Capability not supported. + * @brief Capability not supported. */ RDB_E_NOT_SUPPORTED = 801, /** - * Error codes for common exceptions. + * @brief Error codes for common exceptions. */ RDB_E_ERROR = E_BASE, /** - * Invalid parameter. + * @brief Invalid parameter. */ RDB_E_INVALID_ARGS = (E_BASE + 1), @@ -84,227 +84,227 @@ typedef enum OH_Rdb_ErrCode { RDB_E_CANNOT_UPDATE_READONLY = (E_BASE + 2), /** - * Failed to delete the file. + * @brief Failed to delete the file. */ RDB_E_REMOVE_FILE = (E_BASE + 3), /** - * The table name is empty. + * @brief The table name is empty. */ RDB_E_EMPTY_TABLE_NAME = (E_BASE + 5), /** - * The KV pair is empty. + * @brief The KV pair is empty. */ RDB_E_EMPTY_VALUES_BUCKET = (E_BASE + 6), /** - * Failed to execute the SQL statement for query. + * @brief Failed to execute the SQL statement for query. */ RDB_E_EXECUTE_IN_STEP_QUERY = (E_BASE + 7), /** - * Invalid column index. + * @brief Invalid column index. */ RDB_E_INVALID_COLUMN_INDEX = (E_BASE + 8), /** - * Invalid column type. + * @brief Invalid column type. */ RDB_E_INVALID_COLUMN_TYPE = (E_BASE + 9), /** - * The file name is empty. + * @brief The file name is empty. */ RDB_E_EMPTY_FILE_NAME = (E_BASE + 10), /** - * Invalid file path. + * @brief Invalid file path. */ RDB_E_INVALID_FILE_PATH = (E_BASE + 11), /** - * Failed to start the transaction. + * @brief Failed to start the transaction. */ RDB_E_TRANSACTION_IN_EXECUTE = (E_BASE + 12), /** - * Failed to precompile the SQL statement. + * @brief Failed to precompile the SQL statement. */ RDB_E_INVALID_STATEMENT = (E_BASE + 13), /** - * Failed to write data in a read connection. + * @brief Failed to write data in a read connection. */ RDB_E_EXECUTE_WRITE_IN_READ_CONNECTION = (E_BASE + 14), /** - * Failed to start the transaction in a read connection. + * @brief Failed to start the transaction in a read connection. */ RDB_E_BEGIN_TRANSACTION_IN_READ_CONNECTION = (E_BASE + 15), /** - * The transaction to start does not exist in the database session. + * @brief The transaction to start does not exist in the database session. */ RDB_E_NO_TRANSACTION_IN_SESSION = (E_BASE + 16), /** - * Failed to execute multiple queries a database session. + * @brief Failed to execute multiple queries a database session. */ RDB_E_MORE_STEP_QUERY_IN_ONE_SESSION = (E_BASE + 17), /** - * The result set does not contain any record. + * @brief The result set does not contain any record. */ RDB_E_NO_ROW_IN_QUERY = (E_BASE + 18), /** - * The number of bound parameters in the SQL statement is invalid. + * @brief The number of bound parameters in the SQL statement is invalid. */ RDB_E_INVALID_BIND_ARGS_COUNT = (E_BASE + 19), /** - * Invalid object type. + * @brief Invalid object type. */ RDB_E_INVALID_OBJECT_TYPE = (E_BASE + 20), /** - * Invalid conflict resolution type. + * @brief Invalid conflict resolution type. */ RDB_E_INVALID_CONFLICT_FLAG = (E_BASE + 21), /** - * The HAVING keyword can be used only after GROUP BY. + * @brief The HAVING keyword can be used only after GROUP BY. */ RDB_E_HAVING_CLAUSE_NOT_IN_GROUP_BY = (E_BASE + 22), /** - * The result set in step format is not supported. + * @brief The result set in step format is not supported. */ RDB_E_NOT_SUPPORTED_BY_STEP_RESULT_SET = (E_BASE + 23), /** - * Failed to query the result set. + * @brief Failed to query the result set. */ RDB_E_STEP_RESULT_SET_CROSS_THREADS = (E_BASE + 24), /** - * The result set query statement is not executed. + * @brief The result set query statement is not executed. */ RDB_E_STEP_RESULT_QUERY_NOT_EXECUTED = (E_BASE + 25), /** - * The cursor is already in the last row of the result set. + * @brief The cursor is already in the last row of the result set. */ RDB_E_STEP_RESULT_IS_AFTER_LAST = (E_BASE + 26), /** - * The number of result set query times exceeds the limit. + * @brief The number of result set query times exceeds the limit. */ RDB_E_STEP_RESULT_QUERY_EXCEEDED = (E_BASE + 27), /** - * The SQL statement is not precompiled. + * @brief The SQL statement is not precompiled. */ RDB_E_STATEMENT_NOT_PREPARED = (E_BASE + 28), /** - * Incorrect database execution result. + * @brief Incorrect database execution result. */ RDB_E_EXECUTE_RESULT_INCORRECT = (E_BASE + 29), /** - * The result set is closed. + * @brief The result set is closed. */ RDB_E_STEP_RESULT_CLOSED = (E_BASE + 30), /** - * Relative path. + * @brief Relative path. */ RDB_E_RELATIVE_PATH = (E_BASE + 31), /** - * The new encrypt key file is empty. + * @brief The new encrypt key file is empty. */ RDB_E_EMPTY_NEW_ENCRYPT_KEY = (E_BASE + 32), /** - * The RDB store is non-encrypted, which is cannot be changed. + * @brief The RDB store is non-encrypted, which is cannot be changed. */ RDB_E_CHANGE_UNENCRYPTED_TO_ENCRYPTED = (E_BASE + 33), /** - * The database does not respond when the database key is updated. + * @brief The database does not respond when the database key is updated. */ RDB_E_CHANGE_ENCRYPT_KEY_IN_BUSY = (E_BASE + 34), /** - * The precompiled SQL statement is not initialized. + * @brief The precompiled SQL statement is not initialized. */ RDB_E_STEP_STATEMENT_NOT_INIT = (E_BASE + 35), /** - * The WAL mode does not support the ATTACH operation. + * @brief The WAL mode does not support the ATTACH operation. */ RDB_E_NOT_SUPPORTED_ATTACH_IN_WAL_MODE = (E_BASE + 36), /** - * Failed to create the folder. + * @brief Failed to create the folder. */ RDB_E_CREATE_FOLDER_FAIL = (E_BASE + 37), /** - * Failed to build the SQL statements. + * @brief Failed to build the SQL statements. */ RDB_E_SQLITE_SQL_BUILDER_NORMALIZE_FAIL = (E_BASE + 38), /** - * The database session does not provide a connection. + * @brief The database session does not provide a connection. */ RDB_E_STORE_SESSION_NOT_GIVE_CONNECTION_TEMPORARILY = (E_BASE + 39), /** - * The transaction does not exist in the database session. + * @brief The transaction does not exist in the database session. */ RDB_E_STORE_SESSION_NO_CURRENT_TRANSACTION = (E_BASE + 40), /** - * The current operation is not supported. + * @brief The current operation is not supported. */ RDB_E_NOT_SUPPORT = (E_BASE + 41), /** - * Invalid PARCEL. + * @brief Invalid PARCEL. */ RDB_E_INVALID_PARCEL = (E_BASE + 42), /** - * Failed to execute query. + * @brief Failed to execute query. */ RDB_E_QUERY_IN_EXECUTE = (E_BASE + 43), /** - * Failed to set the persistence of the database file in WAL mode. + * @brief Failed to set the persistence of the database file in WAL mode. */ RDB_E_SET_PERSIST_WAL = (E_BASE + 44), /** - * The database does not exist. + * @brief The database does not exist. */ RDB_E_DB_NOT_EXIST = (E_BASE + 45), /** - * The number of read connections to set is greater than the limit. + * @brief The number of read connections to set is greater than the limit. */ RDB_E_ARGS_READ_CON_OVERLOAD = (E_BASE + 46), /** - * The WAL log file size exceeds the default value. + * @brief The WAL log file size exceeds the default value. */ RDB_E_WAL_SIZE_OVER_LIMIT = (E_BASE + 47), /** - * The number of database connections has reached the limit. + * @brief The number of database connections has reached the limit. */ RDB_E_CON_OVER_LIMIT = (E_BASE + 48) } OH_Rdb_ErrCode; -- Gitee From f08fa11f17f58c4d689fb9086f4a37295ce76bd1 Mon Sep 17 00:00:00 2001 From: Annie_wang Date: Wed, 15 Nov 2023 16:34:56 +0800 Subject: [PATCH 2/2] update docs Signed-off-by: Annie_wang --- en/native_sdk/hid/hid_ddk_api.h | 92 +++++ en/native_sdk/hid/hid_ddk_types.h | 590 ++++++++++++++++++++++++++++++ 2 files changed, 682 insertions(+) create mode 100644 en/native_sdk/hid/hid_ddk_api.h create mode 100644 en/native_sdk/hid/hid_ddk_types.h diff --git a/en/native_sdk/hid/hid_ddk_api.h b/en/native_sdk/hid/hid_ddk_api.h new file mode 100644 index 00000000..83e830b5 --- /dev/null +++ b/en/native_sdk/hid/hid_ddk_api.h @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef HID_DDK_API_H +#define HID_DDK_API_H + +/** + * @addtogroup HidDdk + * @{ + * + * @brief Provides HID DDK interfaces, including creating a device, sending an event, and destroying a device. + * + * @syscap SystemCapability.Driver.HID.Extension + * @since 11 + * @version 1.0 + */ + +/** + * @file hid_ddk_api.h + * + * @brief Declares the HID DDK interfaces for the host to access an input device. + * + * File to include: + * @since 11 + * @version 1.0 + */ + +#include +#include "hid_ddk_types.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * @brief Creates a device. + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param hidDevice Pointer to the basic information required for creating a device, including the device name, + * vendor ID, and product ID. + * @param hidEventProperties Pointer to the events of the device to be observed, including the event type and + * properties of the key event, absolute coordinate event, and relative coordinate event. + * @return Returns the device ID (a non-negative number) if the operation is successful; + * returns a negative number otherwise. + * @since 11 + * @version 1.0 + */ +int32_t OH_Hid_CreateDevice(HidDevice *hidDevice, HidEventProperties *hidEventProperties); + +/** + * @brief Sends an event list to a device. + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param deviceId ID of the device, to which the event list is sent. + * @param items List of events to sent. The event information includes the event type (HidEventType), + * event code (HidSynEvent for a synchronization event code, HidKeyCode for a key code, HidBtnCode + * for a button code, HidAbsAxes for an absolute coordinate code, HidRelAxes + * for a relative coordinate event, and HidMscEvent for other input event code), and value input by the device. + * @param length Length of the event list (number of events sent at a time). + * @return Returns 0 if the operation is successful; returns a negative number otherwise. + * @since 11 + * @version 1.0 + */ +int32_t OH_Hid_EmitEvent(int32_t deviceId, const EmitItem items[], uint16_t length); + +/** + * @brief Destroys a device. + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param deviceId ID of the device to destroy. + * @return Returns 0 if the operation is successful; returns a negative number otherwise. + * @since 11 + * @version 1.0 + */ +int32_t OH_Hid_DestroyDevice(int32_t deviceId); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif // HID_DDK_API_H diff --git a/en/native_sdk/hid/hid_ddk_types.h b/en/native_sdk/hid/hid_ddk_types.h new file mode 100644 index 00000000..766b3721 --- /dev/null +++ b/en/native_sdk/hid/hid_ddk_types.h @@ -0,0 +1,590 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef HID_DDK_TYPES_H +#define HID_DDK_TYPES_H +/** + * @addtogroup HidDdk + * @{ + * + * @brief Provides HID DDK interfaces, including creating a device, sending an event, and destroying a device. + * + * @syscap SystemCapability.Driver.HID.Extension + * @since 11 + * @version 1.0 + */ + +/** + * @file hid_ddk_types.h + * + * @brief Provides definitions of enum variables and structs in the HID DDK. + * + * File to include: + * @since 11 + * @version 1.0 + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * @brief Defines event information. + * + * @since 11 + * @version 1.0 + */ +typedef struct EmitItem { + /** Event type */ + uint16_t type; + /** Event code */ + uint16_t code; + /** Event value */ + uint32_t value; +} EmitItem; + +/** + * @brief Enumerates the input devices. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Pointer device */ + HID_PROP_POINTER = 0x00, + /** Direct input device */ + HID_PROP_DIRECT = 0x01, + /** Touch device with bottom keys */ + HID_PROP_BUTTONPAD = 0x02, + /** Full multi-touch device */ + HID_PROP_SEMI_MT = 0x03, + /** Touch device with top soft keys */ + HID_PROP_TOPBUTTONPAD = 0x04, + /** Pointing stick */ + HID_PROP_POINTING_STICK = 0x05, + /** Accelerometer */ + HID_PROP_ACCELEROMETER = 0x06 +} HidDeviceProp; + +/** + * @brief Defines the basic device information. + * + * @since 11 + * @version 1.0 + */ +typedef struct HidDevice { + /** Device name */ + const char *deviceName; + /** Vendor ID */ + uint16_t vendorId; + /** Product ID */ + uint16_t productId; + /** Version */ + uint16_t version; + /** Bus type */ + uint16_t bustype; + /** Device properties */ + HidDeviceProp *properties; + /** Number of device properties */ + uint16_t propLength; +} HidDevice; + +/** + * @brief Enumerates the event types. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Synchronization event */ + HID_EV_SYN = 0x00, + /** Key event */ + HID_EV_KEY = 0x01, + /** Relative coordinate event */ + HID_EV_REL = 0x02, + /** Absolute coordinate event */ + HID_EV_ABS = 0x03, + /** Other special event */ + HID_EV_MSC = 0x04 +} HidEventType; + +/** + * @brief Enumerates the synchronization event codes. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Indicates the end of an event. */ + HID_SYN_REPORT = 0, + /** Indicates configuration synchronization. */ + HID_SYN_CONFIG = 1, + /** Indicates the end of a multi-touch ABS data packet. */ + HID_SYN_MT_REPORT = 2, + /** Indicates that the event is discarded. */ + HID_SYN_DROPPED = 3 +} HidSynEvent; + +/** + * @brief Enumerates the key value codes. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Key A */ + HID_KEY_A = 30, + /** Key B */ + HID_KEY_B = 48, + /** Key C */ + HID_KEY_C = 46, + /** Key D */ + HID_KEY_D = 32, + /** Key E */ + HID_KEY_E = 18, + /** Key F */ + HID_KEY_F = 33, + /** Key G */ + HID_KEY_G = 34, + /** Key H */ + HID_KEY_H = 35, + /** Key I */ + HID_KEY_I = 23, + /** Key J */ + HID_KEY_J = 36, + /** Key K */ + HID_KEY_K = 37, + /** Key L */ + HID_KEY_L = 38, + /** Key M */ + HID_KEY_M = 50, + /** Key N */ + HID_KEY_N = 49, + /** Key O */ + HID_KEY_O = 24, + /** Key P */ + HID_KEY_P = 25, + /** Key Q */ + HID_KEY_Q = 16, + /** Key R */ + HID_KEY_R = 19, + /** Key S */ + HID_KEY_S = 31, + /** Key T */ + HID_KEY_T = 20, + /** Key U */ + HID_KEY_U = 22, + /** Key V */ + HID_KEY_V = 47, + /** Key W */ + HID_KEY_W = 17, + /** Key X */ + HID_KEY_X = 45, + /** Key Y */ + HID_KEY_Y = 21, + /** Key Z */ + HID_KEY_Z = 44, + /** Key 0 */ + HID_KEY_0 = 11, + /** Key 1 */ + HID_KEY_1 = 2, + /** Key 2 */ + HID_KEY_2 = 3, + /** Key 3 */ + HID_KEY_3 = 4, + /** Key 4 */ + HID_KEY_4 = 5, + /** Key 5 */ + HID_KEY_5 = 6, + /** Key 6 */ + HID_KEY_6 = 7, + /** Key 7 */ + HID_KEY_7 = 8, + /** Key 8 */ + HID_KEY_8 = 9, + /** Key 9 */ + HID_KEY_9 = 10, + /** Key grave (`) */ + HID_KEY_GRAVE = 41, + /** Key minum (-) */ + HID_KEY_MINUS = 12, + /** Key equals (=) */ + HID_KEY_EQUALS = 13, + /** Key left bracket ([) */ + HID_KEY_LEFT_BRACKET = 26, + /** Key right bracket (]) */ + HID_KEY_RIGHT_BRACKET = 27, + /** Key backslash (\) */ + HID_KEY_BACKSLASH = 43, + /** Key semicolon (;) */ + HID_KEY_SEMICOLON = 39, + /** Key apostrophe (') */ + HID_KEY_APOSTROPHE = 40, + /** Key slash (/) */ + HID_KEY_SLASH = 53, + /** Key comma (,) */ + HID_KEY_COMMA = 51, + /** Key period (.) */ + HID_KEY_PERIOD = 52, + /** Numeral 0 on the numeric keypad */ + HID_KEY_NUMPAD_0 = 82, + /** Numeral 1 on the numeric keypad */ + HID_KEY_NUMPAD_1 = 79, + /** Numeral 2 on the numeric keypad */ + HID_KEY_NUMPAD_2 = 80, + /** Numeral 3 on the numeric keypad */ + HID_KEY_NUMPAD_3 = 81, + /** Numeral 4 on the numeric keypad */ + HID_KEY_NUMPAD_4 = 75, + /** Numeral 5 on the numeric keypad */ + HID_KEY_NUMPAD_5 = 76, + /** Numeral 6 on the numeric keypad*/ + HID_KEY_NUMPAD_6 = 77, + /** Numeral 7 on the numeric keypad */ + HID_KEY_NUMPAD_7 = 71, + /** Numeral 8 on the numeric keypad */ + HID_KEY_NUMPAD_8 = 72, + /** Numeral 9 on the numeric keypad */ + HID_KEY_NUMPAD_9 = 73, + /** Arithmetic operator / (division) on the numeric keypad */ + HID_KEY_NUMPAD_DIVIDE = 70, + /** Arithmetic operator * (multiplication) on the numeric keypad */ + HID_KEY_NUMPAD_MULTIPLY = 55, + /** Arithmetic operator - (subtraction) on the numeric keypad */ + HID_KEY_NUMPAD_SUBTRACT = 74, + /** Arithmetic operator + (addition) on the numeric keypad */ + HID_KEY_NUMPAD_ADD = 78, + /** Decimal point (.) on the numeric keypad */ + HID_KEY_NUMPAD_DOT = 83 +} HidKeyCode; + +/** + * @brief Enumerates the button codes. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Button 0 */ + HID_BTN_0 = 0x100, + /** Button 1 */ + HID_BTN_1 = 0x101, + /** Button 2 */ + HID_BTN_2 = 0x102, + /** Button 3 */ + HID_BTN_3 = 0x103, + /** Button 4 */ + HID_BTN_4 = 0x104, + /** Button 5 */ + HID_BTN_5 = 0x105, + /** Button 6 */ + HID_BTN_6 = 0x106, + /** Button 7 */ + HID_BTN_7 = 0x107, + /** Button 8 */ + HID_BTN_8 = 0x108, + /** Button 9 */ + HID_BTN_9 = 0x109, + /** Left mouse button */ + HID_BTN_LEFT = 0x110, + /** Right mouse button */ + HID_BTN_RIGHT = 0x111, + /** Middle mouse button */ + HID_BTN_MIDDLE = 0x112, + /** Side mouse button */ + HID_BTN_SIDE = 0x113, + /** Extra mouse button */ + HID_BTN_EXTRA = 0x114, + /** Mouse forward button */ + HID_BTN_FORWARD = 0x115, + /** Mouse backward button */ + HID_BTN_BACK = 0x116, + /** Mouse task button */ + HID_BTN_TASK = 0x117, + /** Pen */ + HID_BTN_TOOL_PEN = 0x140 + /** Rubber */ + HID_BTN_TOOL_RUBBER = 0x141 + /** Brush */ + HID_BTN_TOOL_BRUSH = 0x142 + /** Pencil */ + HID_BTN_TOOL_PENCIL = 0x143 + /** Air brush */ + HID_BTN_TOOL_AIRBRUSH = 0x144 + /** Finger */ + HID_BTN_TOOL_FINGER = 0x145 + /** Mouse */ + HID_BTN_TOOL_MOUSE = 0x146 + /** Lens */ + HID_BTN_TOOL_LENS = 0x147 + /** Five-finger touch */ + HID_BTN_TOOL_QUINTTAP = 0x148 + /** Stylus 3 */ + HID_BTN_STYLUS3 = 0x149 + /** Touch */ + HID_BTN_TOUCH = 0x14a + /** Stylus */ + HID_BTN_STYLUS = 0x14b + /** Stylus 2 */ + HID_BTN_STYLUS2 = 0x14c + /** Two-finger touch */ + HID_BTN_TOOL_DOUBLETAP = 0x14d + /** Three-finger touch */ + HID_BTN_TOOL_TRIPLETAP = 0x14e + /** Four-finger touch */ + HID_BTN_TOOL_QUADTAP = 0x14f + /** Scroll wheel */ + HID_BTN_WHEEL = 0x150 +} HidBtnCode; + +/** + * @brief Enumerates the absolute coordinate codes. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** X axis */ + HID_ABS_X = 0x00, + /** Y axis */ + HID_ABS_Y = 0x01, + /** Z axis */ + HID_ABS_Z = 0x02, + /** X axis of the right analog stick */ + HID_ABS_RX = 0x03, + /** Y axis of the right analog stick */ + HID_ABS_RY = 0x04, + /** Z axis of the right analog stick */ + HID_ABS_RZ = 0x05, + /** Throttle */ + HID_ABS_THROTTLE = 0x06, + /** Rudder */ + HID_ABS_RUDDER = 0x07, + /** Scroll wheel */ + HID_ABS_WHEEL = 0x08, + /** Gas */ + HID_ABS_GAS = 0x09, + /** Brake */ + HID_ABS_BRAKE = 0x0a, + /** HAT0X */ + HID_ABS_HAT0X = 0x10, + /** HAT0Y */ + HID_ABS_HAT0Y = 0x11, + /** HAT1X */ + HID_ABS_HAT1X = 0x12, + /** HAT1Y */ + HID_ABS_HAT1Y = 0x13, + /** HAT2X */ + HID_ABS_HAT2X = 0x14, + /** HAT2Y */ + HID_ABS_HAT2Y = 0x15, + /** HAT3X */ + HID_ABS_HAT3X = 0x16, + /** HAT3Y */ + HID_ABS_HAT3Y = 0x17, + /** Pressure */ + HID_ABS_PRESSURE = 0x18, + /** Distance */ + HID_ABS_DISTANCE = 0x19, + /** Inclination of X axis */ + HID_ABS_TILT_X = 0x1a, + /** Inclination of Y axis */ + HID_ABS_TILT_Y = 0x1b, + /** Width of the touch tool */ + HID_ABS_TOOL_WIDTH = 0x1c, + /** Volume */ + HID_ABS_VOLUME = 0x20, + /** Others */ + HID_ABS_MISC = 0x28 +} HidAbsAxes; + +/** + * @brief Enumerates the relative coordinate codes. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** X axis */ + HID_REL_X = 0x00, + /** Y axis */ + HID_REL_Y = 0x01, + /** Z axis */ + HID_REL_Z = 0x02, + /** X axis of the right analog stick */ + HID_REL_RX = 0x03, + /** Y axis of the right analog stick */ + HID_REL_RY = 0x04, + /** Z axis of the right analog stick */ + HID_REL_RZ = 0x05, + /** Horizontal scroll wheel */ + HID_REL_HWHEEL = 0x06, + /** Scale */ + HID_REL_DIAL = 0x07, + /** Scroll wheel */ + HID_REL_WHEEL = 0x08, + /** Others */ + HID_REL_MISC = 0x09, + /* Reserved */ + HID_REL_RESERVED = 0x0a, + /** High-resolution scroll wheel */ + HID_REL_WHEEL_HI_RES = 0x0b, + /** High-resolution horizontal scroll wheel */ + HID_REL_HWHEEL_HI_RES = 0x0c +} HidRelAxes; + +/** + * @brief Enumerates the codes of other input events. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Serial number */ + HID_MSC_SERIAL = 0x00, + /** Pulse */ + HID_MSC_PULSELED = 0x01, + /** Gesture */ + HID_MSC_GESTURE = 0x02, + /** Start event */ + HID_MSC_RAW = 0x03, + /** Scan */ + HID_MSC_SCAN = 0x04, + /** Timestamp */ + HID_MSC_TIMESTAMP = 0x05 +} HidMscEvent; + +/** + * @brief Defines an array of the event type codes. + * + * @since 11 + * @version 1.0 + */ +typedef struct HidEventTypeArray { + /** Event type code */ + HidEventType *hidEventType; + /** Length of the array */ + uint16_t length; +} HidEventTypeArray; + +/** + * @brief Defines an array of key value properties. + * + * @since 11 + * @version 1.0 + */ +typedef struct HidKeyCodeArray { + /** Key value code */ + HidKeyCode *hidKeyCode; + /** Length of the array */ + uint16_t length; +} HidKeyCodeArray; + +/** + * @brief Defines an array of absolute coordinate properties. + * + * @since 11 + * @version 1.0 + */ +typedef struct HidAbsAxesArray { + /** Absolute coordinate property code */ + HidAbsAxes *hidAbsAxes; + /** Length of the array */ + uint16_t length; +} HidAbsAxesArray; + +/** + * @brief Defines an array of relative coordinate properties. + * + * @since 11 + * @version 1.0 + */ +typedef struct HidRelAxesArray { + /** Relative coordinate property code */ + HidRelAxes *hidRelAxes; + /** Length of the array */ + uint16_t length; +} HidRelAxesArray; + +/** + * @brief Defines an array of other special event properties. + * + * @since 11 + * @version 1.0 + */ +typedef struct HidMscEventArray { + /** Code of the event property */ + HidMscEvent *hidMscEvent; + /** Length of the array */ + uint16_t length; +} HidMscEventArray; + +/** + * @brief Defines the event properties of a device to be observed. + * + * @since 11 + * @version 1.0 + */ +typedef struct HidEventProperties { + /** Array of event type codes */ + struct HidEventTypeArray hidEventTypes; + /** Array of key value codes */ + struct HidKeyCodeArray hidKeys; + /** Array of absolute coordinate property codes */ + struct HidAbsAxesArray hidAbs; + /** Array of relative coordinate property codes */ + struct HidRelAxesArray hidRelBits; + /** Array of other event property codes */ + struct HidMscEventArray hidMiscellaneous; + + /** Maximum values of the absolute coordinates */ + int32_t hidAbsMax[64]; + /** Minimum values of the absolute coordinates */ + int32_t hidAbsMin[64]; + /** Fuzzy values of the absolute coordinates */ + int32_t hidAbsFuzz[64]; + /** Fixed values of the absolute coordinates */ + int32_t hidAbsFlat[64]; +} HidEventProperties; + +/** + * @brief Defines the error codes used in the HID DDK. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Operation successful */ + HID_DDK_SUCCESS = 0, + /** Operation failed */ + HID_DDK_FAILED = -1, + /** Invalid parameter */ + HID_DDK_INVALID_PARAMETER = -2, + /** Invalid operation */ + HID_DDK_INVALID_OPERATION = -3, + /** Null pointer exception */ + HID_DDK_NULL_PTR = -4, + /** Timeout */ + HID_DDK_TIMEOUT = -5, + /** Permission denied */ + HID_DDK_NO_PERM = -6 +} HidDdkErrCode; +#ifdef __cplusplus +} +/** @} */ +#endif /* __cplusplus */ +#endif // HID_DDK_TYPES_H -- Gitee