From 9d016313a00c018740633fab55fee9fd5a67de29 Mon Sep 17 00:00:00 2001 From: jinsitao Date: Wed, 9 Jul 2025 10:54:22 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=96=B0=E5=A2=9EGameControllerKit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: jinsitao --- GameControllerKit/BUILD.gn | 41 ++ GameControllerKit/game_controller_type.h | 73 +++ GameControllerKit/game_device.h | 122 +++++ GameControllerKit/game_device_event.h | 210 +++++++++ GameControllerKit/game_pad.h | 445 ++++++++++++++++++ GameControllerKit/game_pad_event.h | 382 +++++++++++++++ .../libohgame_controller.ndk.json | 322 +++++++++++++ ndk_targets.gni | 2 + 8 files changed, 1597 insertions(+) create mode 100644 GameControllerKit/BUILD.gn create mode 100644 GameControllerKit/game_controller_type.h create mode 100644 GameControllerKit/game_device.h create mode 100644 GameControllerKit/game_device_event.h create mode 100644 GameControllerKit/game_pad.h create mode 100644 GameControllerKit/game_pad_event.h create mode 100644 GameControllerKit/libohgame_controller.ndk.json diff --git a/GameControllerKit/BUILD.gn b/GameControllerKit/BUILD.gn new file mode 100644 index 00000000000..32a654ff926 --- /dev/null +++ b/GameControllerKit/BUILD.gn @@ -0,0 +1,41 @@ +# Copyright (c) 2025 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. + +import("//build/ohos.gni") +import("//build/ohos_var.gni") + +ohos_ndk_headers("ohgame_controller_header") { + dest_dir = "$ndk_headers_out_dir/GameControllerKit/" + sources = [ + "game_controller_type.h", + "game_device.h", + "game_device_event.h", + "game_pad.h", + "game_pad_event.h", + ] +} + +ohos_ndk_library("libohgame_controller") { + output_name = "ohgame_controller" + output_extension = "z.so" + system_capability = "SystemCapability.Game.GameController" + ndk_description_file = "libohgame_controller.ndk.json" + min_compact_version = "18" + system_capability_headers = [ + "game_controller_type.h", + "game_device_event.h", + "game_device.h", + "game_pad_event.h", + "game_pad.h", + ] +} diff --git a/GameControllerKit/game_controller_type.h b/GameControllerKit/game_controller_type.h new file mode 100644 index 00000000000..6b08531098c --- /dev/null +++ b/GameControllerKit/game_controller_type.h @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2025 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. + */ + +/** + * @addtogroup GameController + * @{ + * + * @brief Provides APIs for game controller capability. + * + * @since 20 + */ + +/** + * @file game_controller_type.h + * @brief Defines the common types for the native module. + * @kit GameControllerKit + * @library libohgame_controller.z.so + * @syscap SystemCapability.Game.GameController + * @since 20 + */ + +#ifndef GAME_CONTROLLER_TYPE_H +#define GAME_CONTROLLER_TYPE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif +/** + * @brief Defines an enum for the error codes of GameController. + * @since 20 + */ +typedef enum GameController_ErrorCode { + /** + * Success. + */ + GAME_CONTROLLER_SUCCESS = 0, + + /** + * @error Invalid parameter. + */ + GAME_CONTROLLER_PARAM_ERROR = 401, + + /** + * @error The multimodal input is abnormal. + */ + GAME_CONTROLLER_MULTIMODAL_INPUT_ERROR = 32200001, + + /** + * @error There is no sufficient memory. + */ + GAME_CONTROLLER_NO_MEMORY = 32200002, +} GameController_ErrorCode; + +#ifdef __cplusplus +} +#endif + +#endif //GAME_CONTROLLER_TYPE_H +/** @} */ diff --git a/GameControllerKit/game_device.h b/GameControllerKit/game_device.h new file mode 100644 index 00000000000..2db268d1e82 --- /dev/null +++ b/GameControllerKit/game_device.h @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2025 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. + */ + +/** + * @addtogroup GameController + * @{ + * + * @brief Provides APIs for game controller capability. + * + * @since 20 + */ + +/** + * @file game_device.h + * @brief Defines game device capabilities APIs for game app. + * @kit GameControllerKit + * @library libohgame_controller.z.so + * @syscap SystemCapability.Game.GameController + * @since 20 + */ + +#ifndef GAME_DEVICE_H +#define GAME_DEVICE_H + +#include +#include "game_device_event.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Defines a struct for the calling result of {@link OH_GameDevice_GetAllDeviceInfos}. + * @since 20 + */ +typedef struct GameDevice_AllDeviceInfos GameDevice_AllDeviceInfos; + +/** + * @brief Obtains all online devices. + * @param allDeviceInfos Double pointer to the {@link GameDevice_AllDeviceInfos} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_MULTIMODAL_INPUT_ERROR} if the multimodal input is abnormal. + * @since 20 + */ +GameController_ErrorCode OH_GameDevice_GetAllDeviceInfos(GameDevice_AllDeviceInfos** allDeviceInfos); + +/** + * @brief Registers a monitor for the game device. + * @param deviceMonitorCallback Callback function, which is {@link GameDevice_DeviceMonitorCallback}. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of deviceMonitorCallback is null. + * @since 20 + */ +GameController_ErrorCode OH_GameDevice_RegisterDeviceMonitor( + GameDevice_DeviceMonitorCallback deviceMonitorCallback); + +/** + * @brief Unregisters the monitor for the game device. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * @since 20 + */ +GameController_ErrorCode OH_GameDevice_UnregisterDeviceMonitor(void); + +/** + * @brief Destroys an {@link GameDevice_AllDeviceInfos} instance when it is no longer used. + * @param allDeviceInfos Double pointer to the {@link GameDevice_AllDeviceInfos} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of allDeviceInfos is null. + * @since 20 + */ +GameController_ErrorCode OH_GameDevice_DestroyAllDeviceInfos(GameDevice_AllDeviceInfos** allDeviceInfos); + +/** + * @brief Obtains the number of devices. + * @param allDeviceInfos Pointer to the {@link GameDevice_AllDeviceInfos} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param count Pointer to the number of devices. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of allDeviceInfos is null. + * @since 20 + */ +GameController_ErrorCode OH_GameDevice_AllDeviceInfos_GetCount( + const struct GameDevice_AllDeviceInfos* allDeviceInfos, + int32_t* count); + +/** + * @brief Obtains information about a device with a specified index. + * @param allDeviceInfos Pointer to the {@link GameDevice_AllDeviceInfos} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param index Specified device index. + * @param deviceInfo Double pointer to the device information. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of allDeviceInfos is null, + * or the value of index is less than 0 or greater than or equal to the total number of devices. + * @since 20 + */ +GameController_ErrorCode OH_GameDevice_AllDeviceInfos_GetDeviceInfo( + const struct GameDevice_AllDeviceInfos* allDeviceInfos, + const int32_t index, + GameDevice_DeviceInfo** deviceInfo); + +#ifdef __cplusplus +} +#endif + +#endif //GAME_DEVICE_H +/** @} */ diff --git a/GameControllerKit/game_device_event.h b/GameControllerKit/game_device_event.h new file mode 100644 index 00000000000..229951e6e3e --- /dev/null +++ b/GameControllerKit/game_device_event.h @@ -0,0 +1,210 @@ +/* + * Copyright (c) 2025 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. + */ + +/** + * @addtogroup GameController + * @{ + * + * @brief Provides APIs for game controller capability. + * + * @since 20 + */ + +/** + * @file game_device_event.h + * @brief Defines game device event APIs for game app. + * @kit GameControllerKit + * @library libohgame_controller.z.so + * @syscap SystemCapability.Game.GameController + * @since 20 + */ + +#ifndef GAME_DEVICE_EVENT_H +#define GAME_DEVICE_EVENT_H + +#include +#include "game_controller_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Defines an enum for the device status change types. + * @since 20 + */ +typedef enum GameDevice_StatusChangedType { + /** + * Indicates that the device is offline. + */ + OFFLINE = 0, + + /** + * Indicates that the device is online. + */ + ONLINE = 1, +} GameDevice_StatusChangedType; + +/** + * @brief Defines an enum for the device types. + * @since 20 + */ +typedef enum GameDevice_DeviceType { + /** + * unknown + */ + UNKNOWN = 0, + + /** + * GamePad + */ + GAME_PAD = 1, +} GameDevice_DeviceType; + +/** + * @brief Defines a struct for the device information. + * @since 20 + */ +typedef struct GameDevice_DeviceInfo GameDevice_DeviceInfo; + +/** + * @brief Defines a struct for the device event. + * @since 20 + */ +typedef struct GameDevice_DeviceEvent GameDevice_DeviceEvent; + +/** + * @brief Defines a callback used in {@link OH_GameDevice_RegisterDeviceMonitor}. + * This function is called when a device goes online or offline. + * @param deviceEvent Pointer to the {@link GameDevice_DeviceEvent} instance. + * @since 20 + */ +typedef void(* GameDevice_DeviceMonitorCallback)(const struct GameDevice_DeviceEvent* deviceEvent); + +/** + * @brief Obtains the device event change type. + * @param deviceEvent Pointer to the {@link GameDevice_DeviceEvent} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param statusChangedType Pointer to the device event change type. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} of the value of deviceEvent is null. + * @since 20 + */ +GameController_ErrorCode OH_GameDevice_DeviceEvent_GetChangedType( + const struct GameDevice_DeviceEvent* deviceEvent, + GameDevice_StatusChangedType* statusChangedType); + +/** + * @brief Obtains device information from a device event. + * @param deviceEvent Pointer to the {@link GameDevice_DeviceEvent} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param deviceInfo Double pointer to the device information. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} of the value of deviceEvent is null. + * @since 20 + */ +GameController_ErrorCode OH_GameDevice_DeviceEvent_GetDeviceInfo( + const struct GameDevice_DeviceEvent* deviceEvent, + GameDevice_DeviceInfo** deviceInfo); + +/** + * @brief Destroys a {@link GameDevice_DeviceInfo} instance when it is no longer used. + * @param deviceInfo Double pointer to the {@link GameDevice_DeviceInfo} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of deviceInfo is null. + * @since 20 + */ +GameController_ErrorCode OH_GameDevice_DestroyDeviceInfo(GameDevice_DeviceInfo** deviceInfo); + +/** + * @brief Obtains the device ID from {@link GameDevice_DeviceInfo}. + * @param deviceInfo Pointer to the {@link GameDevice_DeviceInfo} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param deviceId Double pointer to the device ID. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of deviceInfo or deviceId is null. + * Returns {@link GAME_CONTROLLER_NO_MEMORY} if there is no sufficient memory. + * @since 20 + */ +GameController_ErrorCode OH_GameDevice_DeviceInfo_GetDeviceId(const struct GameDevice_DeviceInfo* deviceInfo, + char** deviceId); +/** + * @brief Obtains the device name from {@link GameDevice_DeviceInfo}. + * @param deviceInfo Pointer to the {@link GameDevice_DeviceInfo} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param name Double pointer to the device name. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of deviceInfo or name is null. + * Returns {@link GAME_CONTROLLER_NO_MEMORY} if there is no sufficient memory. + * @since 20 + */ +GameController_ErrorCode OH_GameDevice_DeviceInfo_GetName(const struct GameDevice_DeviceInfo* deviceInfo, + char** name); +/** + * @brief Obtains product information from {@link GameDevice_DeviceInfo}. + * @param deviceInfo Pointer to the {@link GameDevice_DeviceInfo} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param product Pointer to the product information. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of deviceInfo is null. + * @since 20 + */ +GameController_ErrorCode OH_GameDevice_DeviceInfo_GetProduct(const struct GameDevice_DeviceInfo* deviceInfo, + int32_t* product); + +/** + * @brief Obtains the version information from {@link GameDevice_DeviceInfo}. + * @param deviceInfo Pointer to the {@link GameDevice_DeviceInfo} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param version Pointer to the version information. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of deviceInfo is null. + * @since 20 + */ +GameController_ErrorCode OH_GameDevice_DeviceInfo_GetVersion(const struct GameDevice_DeviceInfo* deviceInfo, + int32_t* version); + +/** + * @brief Obtains the physical address from {@link GameDevice_DeviceInfo}. + * @param deviceInfo Pointer to the {@link GameDevice_DeviceInfo} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param physicalAddress Double pointer to the physical address. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of deviceInfo or physicalAddress is null. + * Returns {@link GAME_CONTROLLER_NO_MEMORY} if there is no sufficient memory. + * @since 20 + */ +GameController_ErrorCode OH_GameDevice_DeviceInfo_GetPhysicalAddress(const struct GameDevice_DeviceInfo* deviceInfo, + char** physicalAddress); + +/** + * @brief Obtains the device type from {@link GameDevice_DeviceInfo}. + * @param deviceInfo Pointer to the {@link GameDevice_DeviceInfo} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param deviceType Pointer to the device type. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of deviceInfo is null. + * @since 20 + */ +GameController_ErrorCode OH_GameDevice_DeviceInfo_GetDeviceType(const struct GameDevice_DeviceInfo* deviceInfo, + GameDevice_DeviceType* deviceType); + +#ifdef __cplusplus +} +#endif + +#endif //GAME_DEVICE_EVENT_H +/** @} */ diff --git a/GameControllerKit/game_pad.h b/GameControllerKit/game_pad.h new file mode 100644 index 00000000000..a04e5968bdf --- /dev/null +++ b/GameControllerKit/game_pad.h @@ -0,0 +1,445 @@ +/* + * Copyright (c) 2025 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. + */ + +/** + * @addtogroup GameController + * @{ + * + * @brief Provides APIs for game controller capability. + * + * @since 20 + */ + +/** + * @file game_pad.h + * @brief Defines game pad capabilities APIs for game app. + * @kit GameControllerKit + * @library libohgame_controller.z.so + * @syscap SystemCapability.Game.GameController + * @since 20 + */ + +#ifndef GAME_PAD_H +#define GAME_PAD_H + +#include +#include "game_pad_event.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Registers a monitor for the left shoulder. + * @param inputMonitorCallback Callback function, which is {@link GamePad_ButtonInputMonitorCallback}. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_LeftShoulder_RegisterButtonInputMonitor( + GamePad_ButtonInputMonitorCallback inputMonitorCallback); + +/** + * @brief Unregisters the monitor for the left shoulder. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_LeftShoulder_UnregisterButtonInputMonitor(void); + +/** + * @brief Registers a monitor for the right shoulder. + * @param inputMonitorCallback Callback function, which is {@link GamePad_ButtonInputMonitorCallback}. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_RightShoulder_RegisterButtonInputMonitor( + GamePad_ButtonInputMonitorCallback inputMonitorCallback); + +/** + * @brief Unregisters the monitor for the right shoulder. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_RightShoulder_UnregisterButtonInputMonitor(void); + +/** + * @brief Registers a monitor for the left trigger. + * @param inputMonitorCallback Callback function, which is {@link GamePad_ButtonInputMonitorCallback}. + * The value cannot be null. Otherwise, an error code is returned. + * @return {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_LeftTrigger_RegisterButtonInputMonitor( + GamePad_ButtonInputMonitorCallback inputMonitorCallback); + +/** + * @brief Unregisters the monitor for the left trigger. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_LeftTrigger_UnregisterButtonInputMonitor(void); + +/** + * @brief Registers a monitor for the axis events of the left trigger. + * @param inputMonitorCallback Callback function, which is {@link GamePad_AxisInputMonitorCallback}. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_LeftTrigger_RegisterAxisInputMonitor( + GamePad_AxisInputMonitorCallback inputMonitorCallback); + +/** + * @brief Unregisters the monitor for the axis events of the left trigger. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_LeftTrigger_UnregisterAxisInputMonitor(void); + +/** + * @brief Registers a monitor for the right trigger. + * @param inputMonitorCallback Callback function, which is {@link GamePad_ButtonInputMonitorCallback}. + * * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_RightTrigger_RegisterButtonInputMonitor( + GamePad_ButtonInputMonitorCallback inputMonitorCallback); + +/** + * @brief Unregisters the monitor for the right trigger. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_RightTrigger_UnregisterButtonInputMonitor(void); + +/** + * @brief Registers a monitor for the axis events of the right trigger. + * @param inputMonitorCallback Callback function, which is {@link GamePad_AxisInputMonitorCallback}. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_RightTrigger_RegisterAxisInputMonitor( + GamePad_AxisInputMonitorCallback inputMonitorCallback); + +/** + * @brief Unregisters the monitor for the axis events of the right trigger. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_RightTrigger_UnregisterAxisInputMonitor(void); + +/** + * @brief Registers a monitor for the menu button. + * @param inputMonitorCallback Callback function, which is {@link GamePad_ButtonInputMonitorCallback}. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_ButtonMenu_RegisterButtonInputMonitor( + GamePad_ButtonInputMonitorCallback inputMonitorCallback); + +/** + * @brief Unregisters the monitor for the menu button. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_ButtonMenu_UnregisterButtonInputMonitor(void); + +/** + * @brief Registers a monitor for the Home button. + * @param inputMonitorCallback Callback function, which is {@link GamePad_ButtonInputMonitorCallback}. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_ButtonHome_RegisterButtonInputMonitor( + GamePad_ButtonInputMonitorCallback inputMonitorCallback); + +/** + * @brief Unregisters the monitor for the Home button. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_ButtonHome_UnregisterButtonInputMonitor(void); + +/** + * @brief Registers a monitor for the A button. + * @param inputMonitorCallback Callback function, which is {@link GamePad_ButtonInputMonitorCallback}. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_ButtonA_RegisterButtonInputMonitor( + GamePad_ButtonInputMonitorCallback inputMonitorCallback); + +/** + * @brief Unregisters the monitor for the A button. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_ButtonA_UnregisterButtonInputMonitor(void); + +/** + * @brief Registers a monitor for the B button. + * @param inputMonitorCallback Callback function, which is {@link GamePad_ButtonInputMonitorCallback}. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_ButtonB_RegisterButtonInputMonitor( + GamePad_ButtonInputMonitorCallback inputMonitorCallback); + +/** + * @brief Unregisters the monitor for the B button. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_ButtonB_UnregisterButtonInputMonitor(void); + +/** + * @brief Registers a monitor for the X button. + * @param inputMonitorCallback Callback function, which is {@link GamePad_ButtonInputMonitorCallback}. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_ButtonX_RegisterButtonInputMonitor( + GamePad_ButtonInputMonitorCallback inputMonitorCallback); + +/** + * @brief Unregisters the monitor for the X button. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_ButtonX_UnregisterButtonInputMonitor(void); + +/** + * @brief Registers a monitor for the Y button. + * @param inputMonitorCallback Callback function, which is {@link GamePad_ButtonInputMonitorCallback}. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_ButtonY_RegisterButtonInputMonitor( + GamePad_ButtonInputMonitorCallback inputMonitorCallback); + +/** + * @brief Unregisters the monitor for the Y button. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_ButtonY_UnregisterButtonInputMonitor(void); + +/** + * @brief Registers a monitor for the C button. + * @param inputMonitorCallback Callback function, which is {@link GamePad_ButtonInputMonitorCallback}. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_ButtonC_RegisterButtonInputMonitor( + GamePad_ButtonInputMonitorCallback inputMonitorCallback); + +/** + * @brief Unregisters the monitor for the C button. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_ButtonC_UnregisterButtonInputMonitor(void); + +/** + * @brief Registers a monitor for the left button. + * @param inputMonitorCallback Callback function, which is {@link GamePad_ButtonInputMonitorCallback}. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_Dpad_LeftButton_RegisterButtonInputMonitor( + GamePad_ButtonInputMonitorCallback inputMonitorCallback); + +/** + * @brief Unregisters the monitor for the left button. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_Dpad_LeftButton_UnregisterButtonInputMonitor(void); + +/** + * @brief Registers a monitor for the right button. + * @param inputMonitorCallback Callback function, which is {@link GamePad_ButtonInputMonitorCallback}. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_Dpad_RightButton_RegisterButtonInputMonitor( + GamePad_ButtonInputMonitorCallback inputMonitorCallback); + +/** + * @brief Unregisters the monitor for the right button. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_Dpad_RightButton_UnregisterButtonInputMonitor(void); + +/** + * @brief Registers a monitor for the up button. + * @param inputMonitorCallback Callback function, which is {@link GamePad_ButtonInputMonitorCallback}. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_Dpad_UpButton_RegisterButtonInputMonitor( + GamePad_ButtonInputMonitorCallback inputMonitorCallback); + +/** + * @brief Unregisters the monitor for the up button. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_Dpad_UpButton_UnregisterButtonInputMonitor(void); + +/** + * @brief Registers a monitor for the down button. + * @param inputMonitorCallback Callback function, which is {@link GamePad_ButtonInputMonitorCallback}. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_Dpad_DownButton_RegisterButtonInputMonitor( + GamePad_ButtonInputMonitorCallback inputMonitorCallback); + +/** + * @brief Unregisters the monitor for the down button. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_Dpad_DownButton_UnregisterButtonInputMonitor(void); + +/** + * @brief Registers a monitor for the axis events of directional buttons. + * @param inputMonitorCallback Callback function, which is {@link GamePad_AxisInputMonitorCallback}. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_Dpad_RegisterAxisInputMonitor( + GamePad_AxisInputMonitorCallback inputMonitorCallback); + +/** + * @brief Unregisters the monitor for the axis events of directional buttons. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_Dpad_UnregisterAxisInputMonitor(void); + +/** + * @brief Registers a monitor for the button event of the left thumbstick. + * @param inputMonitorCallback Callback function, which is {@link GamePad_ButtonInputMonitorCallback}. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_LeftThumbstick_RegisterButtonInputMonitor( + GamePad_ButtonInputMonitorCallback inputMonitorCallback); + +/** + * @brief Unregisters the monitor for the button event of the left thumbstick. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_LeftThumbstick_UnregisterButtonInputMonitor(void); + +/** + * @brief Registers a monitor for the axis events of the left thumbstick. + * @param inputMonitorCallback Callback function, which is {@link GamePad_AxisInputMonitorCallback}. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_LeftThumbstick_RegisterAxisInputMonitor( + GamePad_AxisInputMonitorCallback inputMonitorCallback); + +/** + * @brief Unregisters the monitor for the axis events of the left thumbstick. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_LeftThumbstick_UnregisterAxisInputMonitor(void); + +/** + * @brief Registers a monitor for the button event of the right thumbstick. + * @param inputMonitorCallback Callback function, which is {@link GamePad_ButtonInputMonitorCallback}. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_RightThumbstick_RegisterButtonInputMonitor( + GamePad_ButtonInputMonitorCallback inputMonitorCallback); + +/** + * @brief Unregisters the monitor for the button event of the right thumbstick. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_RightThumbstick_UnregisterButtonInputMonitor(void); + +/** + * @brief Registers a monitor for the axis events of the right thumbstick. + * @param inputMonitorCallback Callback function, which is {@link GamePad_AxisInputMonitorCallback}. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_RightThumbstick_RegisterAxisInputMonitor( + GamePad_AxisInputMonitorCallback inputMonitorCallback); + +/** + * @brief Unregisters the monitor for the axis events of the right thumbstick. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_RightThumbstick_UnregisterAxisInputMonitor(void); + +#ifdef __cplusplus +} +#endif + +#endif //GAME_PAD_H +/** @} */ diff --git a/GameControllerKit/game_pad_event.h b/GameControllerKit/game_pad_event.h new file mode 100644 index 00000000000..af950c0d5d9 --- /dev/null +++ b/GameControllerKit/game_pad_event.h @@ -0,0 +1,382 @@ +/* + * Copyright (c) 2025 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. + */ + +/** + * @addtogroup GameController + * @{ + * + * @brief Provides APIs for game controller capability. + * + * @since 20 + */ + +/** + * @file game_pad_event.h + * @brief Defines game pad event APIs for game app. + * @kit GameControllerKit + * @library libohgame_controller.z.so + * @syscap SystemCapability.Game.GameController + * @since 20 + */ + +#ifndef GAME_PAD_EVENT_H +#define GAME_PAD_EVENT_H + +#include +#include "game_controller_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Defines an enum for the axis events sources. + * @since 20 + */ +typedef enum GamePad_AxisSourceType { + /** + * Indicates the axis event from directional pad. + */ + DPAD = 0, + + /** + * Indicates the axis event from left thumbstick. + */ + LEFT_THUMBSTICK = 1, + + /** + * Indicates the axis event from right thumbstick. + */ + RIGHT_THUMBSTICK = 2, + + /** + * Indicates the axis event from left trigger. + */ + LEFT_TRIGGER = 3, + + /** + * Indicates the axis event from right trigger.. + */ + RIGHT_TRIGGER = 4, +} GamePad_AxisSourceType; + +/** + * @brief Defines an enum for the button action types. + * @since 20 + */ +typedef enum GamePad_Button_ActionType { + /** + * Pressing of a key + */ + DOWN = 0, + + /** + * Release of a key + */ + UP = 1, +} GamePad_Button_ActionType; + +/** + * @brief Defines a struct for the button event of a game pad. + * @since 20 + */ +typedef struct GamePad_ButtonEvent GamePad_ButtonEvent; + +/** + * @brief Defines a struct for the axis events of a game pad. + * @since 20 + */ +typedef struct GamePad_AxisEvent GamePad_AxisEvent; + +/** + * @brief Defines a struct for the pressed button of a game pad. + * @since 20 + */ +typedef struct GamePad_PressedButton GamePad_PressedButton; + +/** + * @brief Defines a callback used in the monitor for the game pad button event. + * This function is called when a game pad button is pressed. + * @param buttonEvent Pointer to the {@link GamePad_ButtonEvent} instance. + * @since 20 + */ +typedef void(* GamePad_ButtonInputMonitorCallback)(const struct GamePad_ButtonEvent* buttonEvent); + +/** + * @brief Defines a callback used in {@link OH_GamePad_AddAxisInputMonitor}. + * This function is called when the game pad axis is operated. + * @param axisEvent Pointer to the {@link GamePad_AxisEvent} instance. + * @since 20 + */ +typedef void(* GamePad_AxisInputMonitorCallback)(const struct GamePad_AxisEvent* axisEvent); + +/** + * @brief Obtains the device ID from {@link GamePad_ButtonEvent}. + * @param buttonEvent Pointer to the {@link GamePad_ButtonEvent} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param deviceId Double pointer to the device ID. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of buttonEvent or deviceId is null. + * Returns {@link GAME_CONTROLLER_NO_MEMORY} if there is no sufficient memory. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_ButtonEvent_GetDeviceId(const struct GamePad_ButtonEvent* buttonEvent, + char** deviceId); + +/** + * @brief Obtains the button action type from {@link GamePad_ButtonEvent}. + * @param buttonEvent Pointer to the {@link GamePad_ButtonEvent} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param actionType Pointer to the action type. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of buttonEvent is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_ButtonEvent_GetButtonAction(const struct GamePad_ButtonEvent* buttonEvent, + GamePad_Button_ActionType* actionType); +/** + * @brief Obtains the button code from {@link GamePad_ButtonEvent}. + * @param buttonEvent Pointer to the {@link GamePad_ButtonEvent} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param code Pointer to the button code. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of buttonEvent is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_ButtonEvent_GetButtonCode(const struct GamePad_ButtonEvent* buttonEvent, + int32_t* code); +/** + * @brief Obtains the button name from {@link GamePad_ButtonEvent}. + * @param buttonEvent Pointer to the {@link GamePad_ButtonEvent} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param codeName Double pointer to the button name. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of buttonEvent or codeName is null. + * Returns {@link GAME_CONTROLLER_NO_MEMORY} if there is no sufficient memory. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_ButtonEvent_GetButtonCodeName(const struct GamePad_ButtonEvent* buttonEvent, + char** codeName); + +/** + * @brief Obtains the number of pressed buttons from {@link GamePad_ButtonEvent}. + * @param buttonEvent Pointer to the {@link GamePad_ButtonEvent} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param count Pointer to the number of pressed buttons. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of buttonEvent is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_PressedButtons_GetCount(const struct GamePad_ButtonEvent* buttonEvent, + int32_t* count); + +/** + * @brief Obtains the button with a specified index from {@link GamePad_ButtonEvent}. + * @param buttonEvent Pointer to the {@link GamePad_ButtonEvent} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param index Specified button index. + * @param pressedButton Double pointer to the pressed button. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of buttonEvent is null, + * or if the value of index is less than 0 or greater than or equal to the total number of buttons. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_PressedButtons_GetButtonInfo(const struct GamePad_ButtonEvent* buttonEvent, + const int32_t index, + GamePad_PressedButton** pressedButton); + +/** + * @brief Destroys a {@link GamePad_PressedButton} instance when it is no longer used. + * @param pressedButton Double pointer to the {@link GamePad_PressedButton} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of pressedButton is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_DestroyPressedButton(GamePad_PressedButton** pressedButton); + +/** + * @brief Obtains the button code from {@link GamePad_PressedButton}. + * @param pressedButton Pointer to the {@link GamePad_PressedButton} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param code Pointer to the button code. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of pressedButton is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_PressedButton_GetButtonCode(const struct GamePad_PressedButton* pressedButton, + int32_t* code); + +/** + * @brief Obtains the button name from {@link GamePad_PressedButton}. + * @param pressedButton Pointer to the {@link GamePad_PressedButton} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param codeName Double pointer to the button name. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of pressedButton or codeName is null. + * Returns {@link GAME_CONTROLLER_NO_MEMORY} if there is no sufficient memory. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_PressedButton_GetButtonCodeName(const struct GamePad_PressedButton* pressedButton, + char** codeName); +/** + * @brief Obtains the action time from {@link GamePad_ButtonEvent}. + * @param buttonEvent Pointer to the {@link GamePad_ButtonEvent} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param actionTime Pointer to the action time. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of buttonEvent is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_ButtonEvent_GetActionTime(const struct GamePad_ButtonEvent* buttonEvent, + int64_t* actionTime); + +/** + * @brief Obtains the device ID from {@link GamePad_AxisEvent}. + * @param axisEvent Pointer to the {@link GamePad_AxisEvent} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param deviceId Double pointer to the device ID. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of axisEvent or deviceId is null. + * Returns {@link GAME_CONTROLLER_NO_MEMORY} if there is no sufficient memory. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_AxisEvent_GetDeviceId(const struct GamePad_AxisEvent* axisEvent, + char** deviceId); + +/** + * @brief Obtains the axis type from {@link GamePad_AxisEvent}. + * @param axisEvent Pointer to the {@link GamePad_AxisEvent} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param axisSourceType Pointer to the {@link GamePad_AxisSourceType} instance. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of axisEvent is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_AxisEvent_GetAxisSourceType(const struct GamePad_AxisEvent* axisEvent, + GamePad_AxisSourceType* axisSourceType); + +/** + * @brief Obtains the value of the X axis from {@link GamePad_AxisEvent}. + * @param axisEvent Pointer to the {@link GamePad_AxisEvent} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param axisValue Pointer to the axis value. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of axisEvent is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_AxisEvent_GetXAxisValue(const struct GamePad_AxisEvent* axisEvent, + double* axisValue); +/** + * @brief Obtains the value of the Y axis from {@link GamePad_AxisEvent}. + * @param axisEvent Pointer to the {@link GamePad_AxisEvent} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param axisValue Pointer to the axis value. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of axisEvent is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_AxisEvent_GetYAxisValue(const struct GamePad_AxisEvent* axisEvent, + double* axisValue); + +/** + * @brief Obtains the value of the Z axis from {@link GamePad_AxisEvent}. + * @param axisEvent Pointer to the {@link GamePad_AxisEvent} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param axisValue Pointer to the axis value. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of axisEvent is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_AxisEvent_GetZAxisValue(const struct GamePad_AxisEvent* axisEvent, + double* axisValue); + +/** + * @brief Obtains the value of the RZ axis from {@link GamePad_AxisEvent}. + * @param axisEvent Pointer to the {@link GamePad_AxisEvent} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param axisValue Pointer to the axis value. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of axisEvent is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_AxisEvent_GetRZAxisValue(const struct GamePad_AxisEvent* axisEvent, + double* axisValue); + +/** + * @brief Obtains the value of the HatX axis from {@link GamePad_AxisEvent}. + * @param axisEvent Pointer to the {@link GamePad_AxisEvent} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param axisValue Pointer to the axis value. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of axisEvent is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_AxisEvent_GetHatXAxisValue(const struct GamePad_AxisEvent* axisEvent, + double* axisValue); + +/** + * @brief Obtains the value of the HatY axis from {@link GamePad_AxisEvent}. + * @param axisEvent Pointer to the {@link GamePad_AxisEvent} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param axisValue Pointer to the axis value. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of axisEvent is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_AxisEvent_GetHatYAxisValue(const struct GamePad_AxisEvent* axisEvent, + double* axisValue); + +/** + * @brief Obtains the value of the Brake axis from {@link GamePad_AxisEvent}. + * @param axisEvent Pointer to the {@link GamePad_AxisEvent} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param axisValue Pointer to the axis value. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of axisEvent is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_AxisEvent_GetBrakeAxisValue(const struct GamePad_AxisEvent* axisEvent, + double* axisValue); + +/** + * @brief Obtains the value of the Gas axis from {@link GamePad_AxisEvent}. + * @param axisEvent Pointer to the {@link GamePad_AxisEvent} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param axisValue Pointer to the axis value. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of axisEvent is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_AxisEvent_GetGasAxisValue(const struct GamePad_AxisEvent* axisEvent, + double* axisValue); +/** + * @brief Obtains the action time from {@link GamePad_AxisEvent}. + * @param axisEvent Pointer to the {@link GamePad_AxisEvent} instance. + * The value cannot be null. Otherwise, an error code is returned. + * @param actionTime Pointer to the action time. + * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. + * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of axisEvent is null. + * @since 20 + */ +GameController_ErrorCode OH_GamePad_AxisEvent_GetActionTime(const struct GamePad_AxisEvent* axisEvent, + int64_t* actionTime); + +#ifdef __cplusplus +} +#endif + +#endif //GAME_PAD_EVENT_H +/** @} */ diff --git a/GameControllerKit/libohgame_controller.ndk.json b/GameControllerKit/libohgame_controller.ndk.json new file mode 100644 index 00000000000..0d2a2f11e89 --- /dev/null +++ b/GameControllerKit/libohgame_controller.ndk.json @@ -0,0 +1,322 @@ +[ + { + "first_introduced": "20", + "name": "OH_GamePad_ButtonEvent_GetDeviceId" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_ButtonEvent_GetButtonAction" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_ButtonEvent_GetButtonCode" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_ButtonEvent_GetButtonCodeName" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_PressedButtons_GetCount" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_PressedButtons_GetButtonInfo" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_DestroyPressedButton" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_PressedButton_GetButtonCode" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_PressedButton_GetButtonCodeName" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_ButtonEvent_GetActionTime" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_AxisEvent_GetDeviceId" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_AxisEvent_GetAxisSourceType" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_AxisEvent_GetXAxisValue" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_AxisEvent_GetYAxisValue" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_AxisEvent_GetZAxisValue" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_AxisEvent_GetRZAxisValue" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_AxisEvent_GetHatXAxisValue" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_AxisEvent_GetHatYAxisValue" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_AxisEvent_GetBrakeAxisValue" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_AxisEvent_GetGasAxisValue" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_AxisEvent_GetActionTime" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_LeftShoulder_RegisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_LeftShoulder_UnregisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_RightShoulder_RegisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_RightShoulder_UnregisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_LeftTrigger_RegisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_LeftTrigger_UnregisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_LeftTrigger_RegisterAxisInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_LeftTrigger_UnregisterAxisInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_RightTrigger_RegisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_RightTrigger_UnregisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_RightTrigger_RegisterAxisInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_RightTrigger_UnregisterAxisInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_ButtonMenu_RegisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_ButtonMenu_UnregisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_ButtonHome_RegisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_ButtonHome_UnregisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_ButtonA_RegisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_ButtonA_UnregisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_ButtonB_RegisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_ButtonB_UnregisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_ButtonC_RegisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_ButtonC_UnregisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_ButtonX_RegisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_ButtonX_UnregisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_ButtonY_RegisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_ButtonY_UnregisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_Dpad_LeftButton_RegisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_Dpad_LeftButton_UnregisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_Dpad_RightButton_RegisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_Dpad_RightButton_UnregisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_Dpad_UpButton_RegisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_Dpad_UpButton_UnregisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_Dpad_DownButton_RegisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_Dpad_DownButton_UnregisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_Dpad_RegisterAxisInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_Dpad_UnregisterAxisInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_LeftThumbstick_RegisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_LeftThumbstick_UnregisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_LeftThumbstick_RegisterAxisInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_LeftThumbstick_UnregisterAxisInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_RightThumbstick_RegisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_RightThumbstick_UnregisterButtonInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_RightThumbstick_RegisterAxisInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GamePad_RightThumbstick_UnregisterAxisInputMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GameDevice_GetAllDeviceInfos" + }, + { + "first_introduced": "20", + "name": "OH_GameDevice_RegisterDeviceMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GameDevice_UnregisterDeviceMonitor" + }, + { + "first_introduced": "20", + "name": "OH_GameDevice_DestroyAllDeviceInfos" + }, + { + "first_introduced": "20", + "name": "OH_GameDevice_AllDeviceInfos_GetCount" + }, + { + "first_introduced": "20", + "name": "OH_GameDevice_AllDeviceInfos_GetDeviceInfo" + }, + { + "first_introduced": "20", + "name": "OH_GameDevice_DeviceEvent_GetChangedType" + }, + { + "first_introduced": "20", + "name": "OH_GameDevice_DeviceEvent_GetDeviceInfo" + }, + { + "first_introduced": "20", + "name": "OH_GameDevice_DestroyDeviceInfo" + }, + { + "first_introduced": "20", + "name": "OH_GameDevice_DeviceInfo_GetDeviceId" + }, + { + "first_introduced": "20", + "name": "OH_GameDevice_DeviceInfo_GetName" + }, + { + "first_introduced": "20", + "name": "OH_GameDevice_DeviceInfo_GetProduct" + }, + { + "first_introduced": "20", + "name": "OH_GameDevice_DeviceInfo_GetVersion" + }, + { + "first_introduced": "20", + "name": "OH_GameDevice_DeviceInfo_GetPhysicalAddress" + }, + { + "first_introduced": "20", + "name": "OH_GameDevice_DeviceInfo_GetDeviceType" + } +] \ No newline at end of file diff --git a/ndk_targets.gni b/ndk_targets.gni index 18b88960dc9..66466c94b6b 100644 --- a/ndk_targets.gni +++ b/ndk_targets.gni @@ -266,6 +266,8 @@ _ndk_library_targets = [ "//interface/sdk_c/telephony/core_service:telephony_radio_header", "//interface/sdk_c/ConnectivityKit/wifi:libwifi_ndk", "//interface/sdk_c/ConnectivityKit/wifi:wifi_ndk_header", + "//interface/sdk_c/GameControllerKit/game_controller:ohgame_controller_header", + "//interface/sdk_c/GameControllerKit/game_controller:libohgame_controller", ] _ndk_base_libs = [ -- Gitee From 230e062bc003cdb375ae62500345ed22ff4c993f Mon Sep 17 00:00:00 2001 From: jinsitao Date: Wed, 20 Aug 2025 16:08:15 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=96=B0=E5=A2=9EGameControllerKit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: jinsitao --- ndk_targets.gni | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ndk_targets.gni b/ndk_targets.gni index 66466c94b6b..1a13e04fa74 100644 --- a/ndk_targets.gni +++ b/ndk_targets.gni @@ -62,6 +62,7 @@ _ndk_library_targets = [ "//interface/sdk_c/arkui/ace_engine/native:ace_header", "//interface/sdk_c/arkui/ace_engine/native:arkui_header", "//interface/sdk_c/arkui/ace_engine/native:libace_ndk", + "//interface/sdk_c/ani:ani_header", "//interface/sdk_c/arkui/napi:libnapi_ndk", "//interface/sdk_c/arkui/napi:napi_header", "//interface/sdk_c/arkui/window_manager:window_manager_header", @@ -268,6 +269,8 @@ _ndk_library_targets = [ "//interface/sdk_c/ConnectivityKit/wifi:wifi_ndk_header", "//interface/sdk_c/GameControllerKit/game_controller:ohgame_controller_header", "//interface/sdk_c/GameControllerKit/game_controller:libohgame_controller", + "//interface/sdk_c/TEEKit:libteec", + "//interface/sdk_c/TEEKit:tee_ndk_header", ] _ndk_base_libs = [ @@ -311,8 +314,12 @@ if (host_os == "mac") { ] } -all_ndk_targets_list = _ndk_library_targets + _ndk_base_libs + - _ndk_sysroot_uapi + _ndk_cmake + _ndk_ninja +_ndk_tee_build_tool = + [ "//base/tee/tee_dev_kit/sdk/build:tee_ndk_ta_linux_compile" ] + +all_ndk_targets_list = + _ndk_library_targets + _ndk_base_libs + _ndk_sysroot_uapi + _ndk_cmake + + _ndk_ninja + _ndk_tee_build_tool if (build_windows_ndk_target) { all_ndk_targets_list += -- Gitee From 11c30ae747cb03b6957b910430803f45be7b6da4 Mon Sep 17 00:00:00 2001 From: jinsitao Date: Wed, 20 Aug 2025 16:10:29 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=96=B0=E5=A2=9EGameControllerKit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: jinsitao --- ndk_targets.gni | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ndk_targets.gni b/ndk_targets.gni index 1a13e04fa74..05992fa0e4e 100644 --- a/ndk_targets.gni +++ b/ndk_targets.gni @@ -267,10 +267,10 @@ _ndk_library_targets = [ "//interface/sdk_c/telephony/core_service:telephony_radio_header", "//interface/sdk_c/ConnectivityKit/wifi:libwifi_ndk", "//interface/sdk_c/ConnectivityKit/wifi:wifi_ndk_header", - "//interface/sdk_c/GameControllerKit/game_controller:ohgame_controller_header", - "//interface/sdk_c/GameControllerKit/game_controller:libohgame_controller", "//interface/sdk_c/TEEKit:libteec", "//interface/sdk_c/TEEKit:tee_ndk_header", + "//interface/sdk_c/GameControllerKit/game_controller:ohgame_controller_header", + "//interface/sdk_c/GameControllerKit/game_controller:libohgame_controller", ] _ndk_base_libs = [ -- Gitee From d6519b6c1e26bb7a511d09c87842ca342e151f62 Mon Sep 17 00:00:00 2001 From: jinsitao Date: Fri, 29 Aug 2025 15:43:25 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=96=B0=E5=A2=9EGameControllerKit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: jinsitao --- GameControllerKit/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GameControllerKit/BUILD.gn b/GameControllerKit/BUILD.gn index 32a654ff926..1912f939206 100644 --- a/GameControllerKit/BUILD.gn +++ b/GameControllerKit/BUILD.gn @@ -30,7 +30,7 @@ ohos_ndk_library("libohgame_controller") { output_extension = "z.so" system_capability = "SystemCapability.Game.GameController" ndk_description_file = "libohgame_controller.ndk.json" - min_compact_version = "18" + min_compact_version = "20" system_capability_headers = [ "game_controller_type.h", "game_device_event.h", -- Gitee From 31652ff2b860acc404589ca7c0c0efa77f00e86f Mon Sep 17 00:00:00 2001 From: jinsitao Date: Thu, 4 Sep 2025 17:31:14 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E6=96=B0=E5=A2=9EGameControllerKit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: jinsitao --- GameControllerKit/BUILD.gn | 2 +- GameControllerKit/game_controller_type.h | 6 +- GameControllerKit/game_device.h | 18 +- GameControllerKit/game_device_event.h | 32 ++-- GameControllerKit/game_pad.h | 92 +++++----- GameControllerKit/game_pad_event.h | 60 +++---- .../libohgame_controller.ndk.json | 160 +++++++++--------- 7 files changed, 185 insertions(+), 185 deletions(-) diff --git a/GameControllerKit/BUILD.gn b/GameControllerKit/BUILD.gn index 1912f939206..d0c9b51974f 100644 --- a/GameControllerKit/BUILD.gn +++ b/GameControllerKit/BUILD.gn @@ -30,7 +30,7 @@ ohos_ndk_library("libohgame_controller") { output_extension = "z.so" system_capability = "SystemCapability.Game.GameController" ndk_description_file = "libohgame_controller.ndk.json" - min_compact_version = "20" + min_compact_version = "21" system_capability_headers = [ "game_controller_type.h", "game_device_event.h", diff --git a/GameControllerKit/game_controller_type.h b/GameControllerKit/game_controller_type.h index 6b08531098c..ce15d0fc860 100644 --- a/GameControllerKit/game_controller_type.h +++ b/GameControllerKit/game_controller_type.h @@ -19,7 +19,7 @@ * * @brief Provides APIs for game controller capability. * - * @since 20 + * @since 21 */ /** @@ -28,7 +28,7 @@ * @kit GameControllerKit * @library libohgame_controller.z.so * @syscap SystemCapability.Game.GameController - * @since 20 + * @since 21 */ #ifndef GAME_CONTROLLER_TYPE_H @@ -41,7 +41,7 @@ extern "C" { #endif /** * @brief Defines an enum for the error codes of GameController. - * @since 20 + * @since 21 */ typedef enum GameController_ErrorCode { /** diff --git a/GameControllerKit/game_device.h b/GameControllerKit/game_device.h index 2db268d1e82..49b81c9d91f 100644 --- a/GameControllerKit/game_device.h +++ b/GameControllerKit/game_device.h @@ -19,7 +19,7 @@ * * @brief Provides APIs for game controller capability. * - * @since 20 + * @since 21 */ /** @@ -28,7 +28,7 @@ * @kit GameControllerKit * @library libohgame_controller.z.so * @syscap SystemCapability.Game.GameController - * @since 20 + * @since 21 */ #ifndef GAME_DEVICE_H @@ -43,7 +43,7 @@ extern "C" { /** * @brief Defines a struct for the calling result of {@link OH_GameDevice_GetAllDeviceInfos}. - * @since 20 + * @since 21 */ typedef struct GameDevice_AllDeviceInfos GameDevice_AllDeviceInfos; @@ -53,7 +53,7 @@ typedef struct GameDevice_AllDeviceInfos GameDevice_AllDeviceInfos; * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_MULTIMODAL_INPUT_ERROR} if the multimodal input is abnormal. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GameDevice_GetAllDeviceInfos(GameDevice_AllDeviceInfos** allDeviceInfos); @@ -63,7 +63,7 @@ GameController_ErrorCode OH_GameDevice_GetAllDeviceInfos(GameDevice_AllDeviceInf * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of deviceMonitorCallback is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GameDevice_RegisterDeviceMonitor( GameDevice_DeviceMonitorCallback deviceMonitorCallback); @@ -71,7 +71,7 @@ GameController_ErrorCode OH_GameDevice_RegisterDeviceMonitor( /** * @brief Unregisters the monitor for the game device. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GameDevice_UnregisterDeviceMonitor(void); @@ -81,7 +81,7 @@ GameController_ErrorCode OH_GameDevice_UnregisterDeviceMonitor(void); * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of allDeviceInfos is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GameDevice_DestroyAllDeviceInfos(GameDevice_AllDeviceInfos** allDeviceInfos); @@ -92,7 +92,7 @@ GameController_ErrorCode OH_GameDevice_DestroyAllDeviceInfos(GameDevice_AllDevic * @param count Pointer to the number of devices. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of allDeviceInfos is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GameDevice_AllDeviceInfos_GetCount( const struct GameDevice_AllDeviceInfos* allDeviceInfos, @@ -107,7 +107,7 @@ GameController_ErrorCode OH_GameDevice_AllDeviceInfos_GetCount( * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of allDeviceInfos is null, * or the value of index is less than 0 or greater than or equal to the total number of devices. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GameDevice_AllDeviceInfos_GetDeviceInfo( const struct GameDevice_AllDeviceInfos* allDeviceInfos, diff --git a/GameControllerKit/game_device_event.h b/GameControllerKit/game_device_event.h index 229951e6e3e..3f4618b4136 100644 --- a/GameControllerKit/game_device_event.h +++ b/GameControllerKit/game_device_event.h @@ -19,7 +19,7 @@ * * @brief Provides APIs for game controller capability. * - * @since 20 + * @since 21 */ /** @@ -28,7 +28,7 @@ * @kit GameControllerKit * @library libohgame_controller.z.so * @syscap SystemCapability.Game.GameController - * @since 20 + * @since 21 */ #ifndef GAME_DEVICE_EVENT_H @@ -43,7 +43,7 @@ extern "C" { /** * @brief Defines an enum for the device status change types. - * @since 20 + * @since 21 */ typedef enum GameDevice_StatusChangedType { /** @@ -59,7 +59,7 @@ typedef enum GameDevice_StatusChangedType { /** * @brief Defines an enum for the device types. - * @since 20 + * @since 21 */ typedef enum GameDevice_DeviceType { /** @@ -75,13 +75,13 @@ typedef enum GameDevice_DeviceType { /** * @brief Defines a struct for the device information. - * @since 20 + * @since 21 */ typedef struct GameDevice_DeviceInfo GameDevice_DeviceInfo; /** * @brief Defines a struct for the device event. - * @since 20 + * @since 21 */ typedef struct GameDevice_DeviceEvent GameDevice_DeviceEvent; @@ -89,7 +89,7 @@ typedef struct GameDevice_DeviceEvent GameDevice_DeviceEvent; * @brief Defines a callback used in {@link OH_GameDevice_RegisterDeviceMonitor}. * This function is called when a device goes online or offline. * @param deviceEvent Pointer to the {@link GameDevice_DeviceEvent} instance. - * @since 20 + * @since 21 */ typedef void(* GameDevice_DeviceMonitorCallback)(const struct GameDevice_DeviceEvent* deviceEvent); @@ -100,7 +100,7 @@ typedef void(* GameDevice_DeviceMonitorCallback)(const struct GameDevice_DeviceE * @param statusChangedType Pointer to the device event change type. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} of the value of deviceEvent is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GameDevice_DeviceEvent_GetChangedType( const struct GameDevice_DeviceEvent* deviceEvent, @@ -113,7 +113,7 @@ GameController_ErrorCode OH_GameDevice_DeviceEvent_GetChangedType( * @param deviceInfo Double pointer to the device information. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} of the value of deviceEvent is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GameDevice_DeviceEvent_GetDeviceInfo( const struct GameDevice_DeviceEvent* deviceEvent, @@ -125,7 +125,7 @@ GameController_ErrorCode OH_GameDevice_DeviceEvent_GetDeviceInfo( * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of deviceInfo is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GameDevice_DestroyDeviceInfo(GameDevice_DeviceInfo** deviceInfo); @@ -137,7 +137,7 @@ GameController_ErrorCode OH_GameDevice_DestroyDeviceInfo(GameDevice_DeviceInfo** * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of deviceInfo or deviceId is null. * Returns {@link GAME_CONTROLLER_NO_MEMORY} if there is no sufficient memory. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GameDevice_DeviceInfo_GetDeviceId(const struct GameDevice_DeviceInfo* deviceInfo, char** deviceId); @@ -149,7 +149,7 @@ GameController_ErrorCode OH_GameDevice_DeviceInfo_GetDeviceId(const struct GameD * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of deviceInfo or name is null. * Returns {@link GAME_CONTROLLER_NO_MEMORY} if there is no sufficient memory. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GameDevice_DeviceInfo_GetName(const struct GameDevice_DeviceInfo* deviceInfo, char** name); @@ -160,7 +160,7 @@ GameController_ErrorCode OH_GameDevice_DeviceInfo_GetName(const struct GameDevic * @param product Pointer to the product information. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of deviceInfo is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GameDevice_DeviceInfo_GetProduct(const struct GameDevice_DeviceInfo* deviceInfo, int32_t* product); @@ -172,7 +172,7 @@ GameController_ErrorCode OH_GameDevice_DeviceInfo_GetProduct(const struct GameDe * @param version Pointer to the version information. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of deviceInfo is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GameDevice_DeviceInfo_GetVersion(const struct GameDevice_DeviceInfo* deviceInfo, int32_t* version); @@ -185,7 +185,7 @@ GameController_ErrorCode OH_GameDevice_DeviceInfo_GetVersion(const struct GameDe * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of deviceInfo or physicalAddress is null. * Returns {@link GAME_CONTROLLER_NO_MEMORY} if there is no sufficient memory. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GameDevice_DeviceInfo_GetPhysicalAddress(const struct GameDevice_DeviceInfo* deviceInfo, char** physicalAddress); @@ -197,7 +197,7 @@ GameController_ErrorCode OH_GameDevice_DeviceInfo_GetPhysicalAddress(const struc * @param deviceType Pointer to the device type. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of deviceInfo is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GameDevice_DeviceInfo_GetDeviceType(const struct GameDevice_DeviceInfo* deviceInfo, GameDevice_DeviceType* deviceType); diff --git a/GameControllerKit/game_pad.h b/GameControllerKit/game_pad.h index a04e5968bdf..239a91f726d 100644 --- a/GameControllerKit/game_pad.h +++ b/GameControllerKit/game_pad.h @@ -19,7 +19,7 @@ * * @brief Provides APIs for game controller capability. * - * @since 20 + * @since 21 */ /** @@ -28,7 +28,7 @@ * @kit GameControllerKit * @library libohgame_controller.z.so * @syscap SystemCapability.Game.GameController - * @since 20 + * @since 21 */ #ifndef GAME_PAD_H @@ -47,7 +47,7 @@ extern "C" { * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_LeftShoulder_RegisterButtonInputMonitor( GamePad_ButtonInputMonitorCallback inputMonitorCallback); @@ -55,7 +55,7 @@ GameController_ErrorCode OH_GamePad_LeftShoulder_RegisterButtonInputMonitor( /** * @brief Unregisters the monitor for the left shoulder. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_LeftShoulder_UnregisterButtonInputMonitor(void); @@ -65,7 +65,7 @@ GameController_ErrorCode OH_GamePad_LeftShoulder_UnregisterButtonInputMonitor(vo * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_RightShoulder_RegisterButtonInputMonitor( GamePad_ButtonInputMonitorCallback inputMonitorCallback); @@ -73,7 +73,7 @@ GameController_ErrorCode OH_GamePad_RightShoulder_RegisterButtonInputMonitor( /** * @brief Unregisters the monitor for the right shoulder. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_RightShoulder_UnregisterButtonInputMonitor(void); @@ -83,7 +83,7 @@ GameController_ErrorCode OH_GamePad_RightShoulder_UnregisterButtonInputMonitor(v * The value cannot be null. Otherwise, an error code is returned. * @return {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_LeftTrigger_RegisterButtonInputMonitor( GamePad_ButtonInputMonitorCallback inputMonitorCallback); @@ -91,7 +91,7 @@ GameController_ErrorCode OH_GamePad_LeftTrigger_RegisterButtonInputMonitor( /** * @brief Unregisters the monitor for the left trigger. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_LeftTrigger_UnregisterButtonInputMonitor(void); @@ -101,7 +101,7 @@ GameController_ErrorCode OH_GamePad_LeftTrigger_UnregisterButtonInputMonitor(voi * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_LeftTrigger_RegisterAxisInputMonitor( GamePad_AxisInputMonitorCallback inputMonitorCallback); @@ -109,7 +109,7 @@ GameController_ErrorCode OH_GamePad_LeftTrigger_RegisterAxisInputMonitor( /** * @brief Unregisters the monitor for the axis events of the left trigger. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_LeftTrigger_UnregisterAxisInputMonitor(void); @@ -119,7 +119,7 @@ GameController_ErrorCode OH_GamePad_LeftTrigger_UnregisterAxisInputMonitor(void) * * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_RightTrigger_RegisterButtonInputMonitor( GamePad_ButtonInputMonitorCallback inputMonitorCallback); @@ -127,7 +127,7 @@ GameController_ErrorCode OH_GamePad_RightTrigger_RegisterButtonInputMonitor( /** * @brief Unregisters the monitor for the right trigger. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_RightTrigger_UnregisterButtonInputMonitor(void); @@ -137,7 +137,7 @@ GameController_ErrorCode OH_GamePad_RightTrigger_UnregisterButtonInputMonitor(vo * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_RightTrigger_RegisterAxisInputMonitor( GamePad_AxisInputMonitorCallback inputMonitorCallback); @@ -145,7 +145,7 @@ GameController_ErrorCode OH_GamePad_RightTrigger_RegisterAxisInputMonitor( /** * @brief Unregisters the monitor for the axis events of the right trigger. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_RightTrigger_UnregisterAxisInputMonitor(void); @@ -155,7 +155,7 @@ GameController_ErrorCode OH_GamePad_RightTrigger_UnregisterAxisInputMonitor(void * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_ButtonMenu_RegisterButtonInputMonitor( GamePad_ButtonInputMonitorCallback inputMonitorCallback); @@ -163,7 +163,7 @@ GameController_ErrorCode OH_GamePad_ButtonMenu_RegisterButtonInputMonitor( /** * @brief Unregisters the monitor for the menu button. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_ButtonMenu_UnregisterButtonInputMonitor(void); @@ -173,7 +173,7 @@ GameController_ErrorCode OH_GamePad_ButtonMenu_UnregisterButtonInputMonitor(void * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_ButtonHome_RegisterButtonInputMonitor( GamePad_ButtonInputMonitorCallback inputMonitorCallback); @@ -181,7 +181,7 @@ GameController_ErrorCode OH_GamePad_ButtonHome_RegisterButtonInputMonitor( /** * @brief Unregisters the monitor for the Home button. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_ButtonHome_UnregisterButtonInputMonitor(void); @@ -191,7 +191,7 @@ GameController_ErrorCode OH_GamePad_ButtonHome_UnregisterButtonInputMonitor(void * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_ButtonA_RegisterButtonInputMonitor( GamePad_ButtonInputMonitorCallback inputMonitorCallback); @@ -199,7 +199,7 @@ GameController_ErrorCode OH_GamePad_ButtonA_RegisterButtonInputMonitor( /** * @brief Unregisters the monitor for the A button. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_ButtonA_UnregisterButtonInputMonitor(void); @@ -209,7 +209,7 @@ GameController_ErrorCode OH_GamePad_ButtonA_UnregisterButtonInputMonitor(void); * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_ButtonB_RegisterButtonInputMonitor( GamePad_ButtonInputMonitorCallback inputMonitorCallback); @@ -217,7 +217,7 @@ GameController_ErrorCode OH_GamePad_ButtonB_RegisterButtonInputMonitor( /** * @brief Unregisters the monitor for the B button. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_ButtonB_UnregisterButtonInputMonitor(void); @@ -227,7 +227,7 @@ GameController_ErrorCode OH_GamePad_ButtonB_UnregisterButtonInputMonitor(void); * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_ButtonX_RegisterButtonInputMonitor( GamePad_ButtonInputMonitorCallback inputMonitorCallback); @@ -235,7 +235,7 @@ GameController_ErrorCode OH_GamePad_ButtonX_RegisterButtonInputMonitor( /** * @brief Unregisters the monitor for the X button. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_ButtonX_UnregisterButtonInputMonitor(void); @@ -245,7 +245,7 @@ GameController_ErrorCode OH_GamePad_ButtonX_UnregisterButtonInputMonitor(void); * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_ButtonY_RegisterButtonInputMonitor( GamePad_ButtonInputMonitorCallback inputMonitorCallback); @@ -253,7 +253,7 @@ GameController_ErrorCode OH_GamePad_ButtonY_RegisterButtonInputMonitor( /** * @brief Unregisters the monitor for the Y button. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_ButtonY_UnregisterButtonInputMonitor(void); @@ -263,7 +263,7 @@ GameController_ErrorCode OH_GamePad_ButtonY_UnregisterButtonInputMonitor(void); * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_ButtonC_RegisterButtonInputMonitor( GamePad_ButtonInputMonitorCallback inputMonitorCallback); @@ -271,7 +271,7 @@ GameController_ErrorCode OH_GamePad_ButtonC_RegisterButtonInputMonitor( /** * @brief Unregisters the monitor for the C button. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_ButtonC_UnregisterButtonInputMonitor(void); @@ -281,7 +281,7 @@ GameController_ErrorCode OH_GamePad_ButtonC_UnregisterButtonInputMonitor(void); * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_Dpad_LeftButton_RegisterButtonInputMonitor( GamePad_ButtonInputMonitorCallback inputMonitorCallback); @@ -289,7 +289,7 @@ GameController_ErrorCode OH_GamePad_Dpad_LeftButton_RegisterButtonInputMonitor( /** * @brief Unregisters the monitor for the left button. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_Dpad_LeftButton_UnregisterButtonInputMonitor(void); @@ -299,7 +299,7 @@ GameController_ErrorCode OH_GamePad_Dpad_LeftButton_UnregisterButtonInputMonitor * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_Dpad_RightButton_RegisterButtonInputMonitor( GamePad_ButtonInputMonitorCallback inputMonitorCallback); @@ -307,7 +307,7 @@ GameController_ErrorCode OH_GamePad_Dpad_RightButton_RegisterButtonInputMonitor( /** * @brief Unregisters the monitor for the right button. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_Dpad_RightButton_UnregisterButtonInputMonitor(void); @@ -317,7 +317,7 @@ GameController_ErrorCode OH_GamePad_Dpad_RightButton_UnregisterButtonInputMonito * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_Dpad_UpButton_RegisterButtonInputMonitor( GamePad_ButtonInputMonitorCallback inputMonitorCallback); @@ -325,7 +325,7 @@ GameController_ErrorCode OH_GamePad_Dpad_UpButton_RegisterButtonInputMonitor( /** * @brief Unregisters the monitor for the up button. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_Dpad_UpButton_UnregisterButtonInputMonitor(void); @@ -335,7 +335,7 @@ GameController_ErrorCode OH_GamePad_Dpad_UpButton_UnregisterButtonInputMonitor(v * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_Dpad_DownButton_RegisterButtonInputMonitor( GamePad_ButtonInputMonitorCallback inputMonitorCallback); @@ -343,7 +343,7 @@ GameController_ErrorCode OH_GamePad_Dpad_DownButton_RegisterButtonInputMonitor( /** * @brief Unregisters the monitor for the down button. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_Dpad_DownButton_UnregisterButtonInputMonitor(void); @@ -353,7 +353,7 @@ GameController_ErrorCode OH_GamePad_Dpad_DownButton_UnregisterButtonInputMonitor * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_Dpad_RegisterAxisInputMonitor( GamePad_AxisInputMonitorCallback inputMonitorCallback); @@ -361,7 +361,7 @@ GameController_ErrorCode OH_GamePad_Dpad_RegisterAxisInputMonitor( /** * @brief Unregisters the monitor for the axis events of directional buttons. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_Dpad_UnregisterAxisInputMonitor(void); @@ -371,7 +371,7 @@ GameController_ErrorCode OH_GamePad_Dpad_UnregisterAxisInputMonitor(void); * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_LeftThumbstick_RegisterButtonInputMonitor( GamePad_ButtonInputMonitorCallback inputMonitorCallback); @@ -379,7 +379,7 @@ GameController_ErrorCode OH_GamePad_LeftThumbstick_RegisterButtonInputMonitor( /** * @brief Unregisters the monitor for the button event of the left thumbstick. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_LeftThumbstick_UnregisterButtonInputMonitor(void); @@ -389,7 +389,7 @@ GameController_ErrorCode OH_GamePad_LeftThumbstick_UnregisterButtonInputMonitor( * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_LeftThumbstick_RegisterAxisInputMonitor( GamePad_AxisInputMonitorCallback inputMonitorCallback); @@ -397,7 +397,7 @@ GameController_ErrorCode OH_GamePad_LeftThumbstick_RegisterAxisInputMonitor( /** * @brief Unregisters the monitor for the axis events of the left thumbstick. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_LeftThumbstick_UnregisterAxisInputMonitor(void); @@ -407,7 +407,7 @@ GameController_ErrorCode OH_GamePad_LeftThumbstick_UnregisterAxisInputMonitor(vo * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_RightThumbstick_RegisterButtonInputMonitor( GamePad_ButtonInputMonitorCallback inputMonitorCallback); @@ -415,7 +415,7 @@ GameController_ErrorCode OH_GamePad_RightThumbstick_RegisterButtonInputMonitor( /** * @brief Unregisters the monitor for the button event of the right thumbstick. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_RightThumbstick_UnregisterButtonInputMonitor(void); @@ -425,7 +425,7 @@ GameController_ErrorCode OH_GamePad_RightThumbstick_UnregisterButtonInputMonitor * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of inputMonitorCallback is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_RightThumbstick_RegisterAxisInputMonitor( GamePad_AxisInputMonitorCallback inputMonitorCallback); @@ -433,7 +433,7 @@ GameController_ErrorCode OH_GamePad_RightThumbstick_RegisterAxisInputMonitor( /** * @brief Unregisters the monitor for the axis events of the right thumbstick. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_RightThumbstick_UnregisterAxisInputMonitor(void); diff --git a/GameControllerKit/game_pad_event.h b/GameControllerKit/game_pad_event.h index af950c0d5d9..c0b66065ddf 100644 --- a/GameControllerKit/game_pad_event.h +++ b/GameControllerKit/game_pad_event.h @@ -19,7 +19,7 @@ * * @brief Provides APIs for game controller capability. * - * @since 20 + * @since 21 */ /** @@ -28,7 +28,7 @@ * @kit GameControllerKit * @library libohgame_controller.z.so * @syscap SystemCapability.Game.GameController - * @since 20 + * @since 21 */ #ifndef GAME_PAD_EVENT_H @@ -43,7 +43,7 @@ extern "C" { /** * @brief Defines an enum for the axis events sources. - * @since 20 + * @since 21 */ typedef enum GamePad_AxisSourceType { /** @@ -74,7 +74,7 @@ typedef enum GamePad_AxisSourceType { /** * @brief Defines an enum for the button action types. - * @since 20 + * @since 21 */ typedef enum GamePad_Button_ActionType { /** @@ -90,19 +90,19 @@ typedef enum GamePad_Button_ActionType { /** * @brief Defines a struct for the button event of a game pad. - * @since 20 + * @since 21 */ typedef struct GamePad_ButtonEvent GamePad_ButtonEvent; /** * @brief Defines a struct for the axis events of a game pad. - * @since 20 + * @since 21 */ typedef struct GamePad_AxisEvent GamePad_AxisEvent; /** * @brief Defines a struct for the pressed button of a game pad. - * @since 20 + * @since 21 */ typedef struct GamePad_PressedButton GamePad_PressedButton; @@ -110,7 +110,7 @@ typedef struct GamePad_PressedButton GamePad_PressedButton; * @brief Defines a callback used in the monitor for the game pad button event. * This function is called when a game pad button is pressed. * @param buttonEvent Pointer to the {@link GamePad_ButtonEvent} instance. - * @since 20 + * @since 21 */ typedef void(* GamePad_ButtonInputMonitorCallback)(const struct GamePad_ButtonEvent* buttonEvent); @@ -118,7 +118,7 @@ typedef void(* GamePad_ButtonInputMonitorCallback)(const struct GamePad_ButtonEv * @brief Defines a callback used in {@link OH_GamePad_AddAxisInputMonitor}. * This function is called when the game pad axis is operated. * @param axisEvent Pointer to the {@link GamePad_AxisEvent} instance. - * @since 20 + * @since 21 */ typedef void(* GamePad_AxisInputMonitorCallback)(const struct GamePad_AxisEvent* axisEvent); @@ -130,7 +130,7 @@ typedef void(* GamePad_AxisInputMonitorCallback)(const struct GamePad_AxisEvent* * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of buttonEvent or deviceId is null. * Returns {@link GAME_CONTROLLER_NO_MEMORY} if there is no sufficient memory. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_ButtonEvent_GetDeviceId(const struct GamePad_ButtonEvent* buttonEvent, char** deviceId); @@ -142,7 +142,7 @@ GameController_ErrorCode OH_GamePad_ButtonEvent_GetDeviceId(const struct GamePad * @param actionType Pointer to the action type. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of buttonEvent is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_ButtonEvent_GetButtonAction(const struct GamePad_ButtonEvent* buttonEvent, GamePad_Button_ActionType* actionType); @@ -153,7 +153,7 @@ GameController_ErrorCode OH_GamePad_ButtonEvent_GetButtonAction(const struct Gam * @param code Pointer to the button code. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of buttonEvent is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_ButtonEvent_GetButtonCode(const struct GamePad_ButtonEvent* buttonEvent, int32_t* code); @@ -165,7 +165,7 @@ GameController_ErrorCode OH_GamePad_ButtonEvent_GetButtonCode(const struct GameP * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of buttonEvent or codeName is null. * Returns {@link GAME_CONTROLLER_NO_MEMORY} if there is no sufficient memory. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_ButtonEvent_GetButtonCodeName(const struct GamePad_ButtonEvent* buttonEvent, char** codeName); @@ -177,7 +177,7 @@ GameController_ErrorCode OH_GamePad_ButtonEvent_GetButtonCodeName(const struct G * @param count Pointer to the number of pressed buttons. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of buttonEvent is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_PressedButtons_GetCount(const struct GamePad_ButtonEvent* buttonEvent, int32_t* count); @@ -191,7 +191,7 @@ GameController_ErrorCode OH_GamePad_PressedButtons_GetCount(const struct GamePad * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of buttonEvent is null, * or if the value of index is less than 0 or greater than or equal to the total number of buttons. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_PressedButtons_GetButtonInfo(const struct GamePad_ButtonEvent* buttonEvent, const int32_t index, @@ -203,7 +203,7 @@ GameController_ErrorCode OH_GamePad_PressedButtons_GetButtonInfo(const struct Ga * The value cannot be null. Otherwise, an error code is returned. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of pressedButton is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_DestroyPressedButton(GamePad_PressedButton** pressedButton); @@ -214,7 +214,7 @@ GameController_ErrorCode OH_GamePad_DestroyPressedButton(GamePad_PressedButton** * @param code Pointer to the button code. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of pressedButton is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_PressedButton_GetButtonCode(const struct GamePad_PressedButton* pressedButton, int32_t* code); @@ -227,7 +227,7 @@ GameController_ErrorCode OH_GamePad_PressedButton_GetButtonCode(const struct Gam * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of pressedButton or codeName is null. * Returns {@link GAME_CONTROLLER_NO_MEMORY} if there is no sufficient memory. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_PressedButton_GetButtonCodeName(const struct GamePad_PressedButton* pressedButton, char** codeName); @@ -238,7 +238,7 @@ GameController_ErrorCode OH_GamePad_PressedButton_GetButtonCodeName(const struct * @param actionTime Pointer to the action time. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of buttonEvent is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_ButtonEvent_GetActionTime(const struct GamePad_ButtonEvent* buttonEvent, int64_t* actionTime); @@ -251,7 +251,7 @@ GameController_ErrorCode OH_GamePad_ButtonEvent_GetActionTime(const struct GameP * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of axisEvent or deviceId is null. * Returns {@link GAME_CONTROLLER_NO_MEMORY} if there is no sufficient memory. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_AxisEvent_GetDeviceId(const struct GamePad_AxisEvent* axisEvent, char** deviceId); @@ -263,7 +263,7 @@ GameController_ErrorCode OH_GamePad_AxisEvent_GetDeviceId(const struct GamePad_A * @param axisSourceType Pointer to the {@link GamePad_AxisSourceType} instance. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of axisEvent is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_AxisEvent_GetAxisSourceType(const struct GamePad_AxisEvent* axisEvent, GamePad_AxisSourceType* axisSourceType); @@ -275,7 +275,7 @@ GameController_ErrorCode OH_GamePad_AxisEvent_GetAxisSourceType(const struct Gam * @param axisValue Pointer to the axis value. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of axisEvent is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_AxisEvent_GetXAxisValue(const struct GamePad_AxisEvent* axisEvent, double* axisValue); @@ -286,7 +286,7 @@ GameController_ErrorCode OH_GamePad_AxisEvent_GetXAxisValue(const struct GamePad * @param axisValue Pointer to the axis value. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of axisEvent is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_AxisEvent_GetYAxisValue(const struct GamePad_AxisEvent* axisEvent, double* axisValue); @@ -298,7 +298,7 @@ GameController_ErrorCode OH_GamePad_AxisEvent_GetYAxisValue(const struct GamePad * @param axisValue Pointer to the axis value. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of axisEvent is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_AxisEvent_GetZAxisValue(const struct GamePad_AxisEvent* axisEvent, double* axisValue); @@ -310,7 +310,7 @@ GameController_ErrorCode OH_GamePad_AxisEvent_GetZAxisValue(const struct GamePad * @param axisValue Pointer to the axis value. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of axisEvent is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_AxisEvent_GetRZAxisValue(const struct GamePad_AxisEvent* axisEvent, double* axisValue); @@ -322,7 +322,7 @@ GameController_ErrorCode OH_GamePad_AxisEvent_GetRZAxisValue(const struct GamePa * @param axisValue Pointer to the axis value. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of axisEvent is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_AxisEvent_GetHatXAxisValue(const struct GamePad_AxisEvent* axisEvent, double* axisValue); @@ -334,7 +334,7 @@ GameController_ErrorCode OH_GamePad_AxisEvent_GetHatXAxisValue(const struct Game * @param axisValue Pointer to the axis value. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of axisEvent is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_AxisEvent_GetHatYAxisValue(const struct GamePad_AxisEvent* axisEvent, double* axisValue); @@ -346,7 +346,7 @@ GameController_ErrorCode OH_GamePad_AxisEvent_GetHatYAxisValue(const struct Game * @param axisValue Pointer to the axis value. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of axisEvent is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_AxisEvent_GetBrakeAxisValue(const struct GamePad_AxisEvent* axisEvent, double* axisValue); @@ -358,7 +358,7 @@ GameController_ErrorCode OH_GamePad_AxisEvent_GetBrakeAxisValue(const struct Gam * @param axisValue Pointer to the axis value. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of axisEvent is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_AxisEvent_GetGasAxisValue(const struct GamePad_AxisEvent* axisEvent, double* axisValue); @@ -369,7 +369,7 @@ GameController_ErrorCode OH_GamePad_AxisEvent_GetGasAxisValue(const struct GameP * @param actionTime Pointer to the action time. * @return Returns {@link GAME_CONTROLLER_SUCCESS} if the operation is successful. * Returns {@link GAME_CONTROLLER_PARAM_ERROR} if the value of axisEvent is null. - * @since 20 + * @since 21 */ GameController_ErrorCode OH_GamePad_AxisEvent_GetActionTime(const struct GamePad_AxisEvent* axisEvent, int64_t* actionTime); diff --git a/GameControllerKit/libohgame_controller.ndk.json b/GameControllerKit/libohgame_controller.ndk.json index 0d2a2f11e89..fc86c755907 100644 --- a/GameControllerKit/libohgame_controller.ndk.json +++ b/GameControllerKit/libohgame_controller.ndk.json @@ -1,322 +1,322 @@ [ { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_ButtonEvent_GetDeviceId" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_ButtonEvent_GetButtonAction" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_ButtonEvent_GetButtonCode" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_ButtonEvent_GetButtonCodeName" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_PressedButtons_GetCount" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_PressedButtons_GetButtonInfo" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_DestroyPressedButton" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_PressedButton_GetButtonCode" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_PressedButton_GetButtonCodeName" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_ButtonEvent_GetActionTime" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_AxisEvent_GetDeviceId" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_AxisEvent_GetAxisSourceType" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_AxisEvent_GetXAxisValue" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_AxisEvent_GetYAxisValue" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_AxisEvent_GetZAxisValue" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_AxisEvent_GetRZAxisValue" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_AxisEvent_GetHatXAxisValue" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_AxisEvent_GetHatYAxisValue" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_AxisEvent_GetBrakeAxisValue" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_AxisEvent_GetGasAxisValue" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_AxisEvent_GetActionTime" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_LeftShoulder_RegisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_LeftShoulder_UnregisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_RightShoulder_RegisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_RightShoulder_UnregisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_LeftTrigger_RegisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_LeftTrigger_UnregisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_LeftTrigger_RegisterAxisInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_LeftTrigger_UnregisterAxisInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_RightTrigger_RegisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_RightTrigger_UnregisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_RightTrigger_RegisterAxisInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_RightTrigger_UnregisterAxisInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_ButtonMenu_RegisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_ButtonMenu_UnregisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_ButtonHome_RegisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_ButtonHome_UnregisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_ButtonA_RegisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_ButtonA_UnregisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_ButtonB_RegisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_ButtonB_UnregisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_ButtonC_RegisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_ButtonC_UnregisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_ButtonX_RegisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_ButtonX_UnregisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_ButtonY_RegisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_ButtonY_UnregisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_Dpad_LeftButton_RegisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_Dpad_LeftButton_UnregisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_Dpad_RightButton_RegisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_Dpad_RightButton_UnregisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_Dpad_UpButton_RegisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_Dpad_UpButton_UnregisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_Dpad_DownButton_RegisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_Dpad_DownButton_UnregisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_Dpad_RegisterAxisInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_Dpad_UnregisterAxisInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_LeftThumbstick_RegisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_LeftThumbstick_UnregisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_LeftThumbstick_RegisterAxisInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_LeftThumbstick_UnregisterAxisInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_RightThumbstick_RegisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_RightThumbstick_UnregisterButtonInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_RightThumbstick_RegisterAxisInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GamePad_RightThumbstick_UnregisterAxisInputMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GameDevice_GetAllDeviceInfos" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GameDevice_RegisterDeviceMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GameDevice_UnregisterDeviceMonitor" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GameDevice_DestroyAllDeviceInfos" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GameDevice_AllDeviceInfos_GetCount" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GameDevice_AllDeviceInfos_GetDeviceInfo" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GameDevice_DeviceEvent_GetChangedType" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GameDevice_DeviceEvent_GetDeviceInfo" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GameDevice_DestroyDeviceInfo" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GameDevice_DeviceInfo_GetDeviceId" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GameDevice_DeviceInfo_GetName" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GameDevice_DeviceInfo_GetProduct" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GameDevice_DeviceInfo_GetVersion" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GameDevice_DeviceInfo_GetPhysicalAddress" }, { - "first_introduced": "20", + "first_introduced": "21", "name": "OH_GameDevice_DeviceInfo_GetDeviceType" } ] \ No newline at end of file -- Gitee From bcaac124b181533be8cec75e32d38900e4c38135 Mon Sep 17 00:00:00 2001 From: jinsitao Date: Thu, 4 Sep 2025 18:38:25 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E6=96=B0=E5=A2=9EGameControllerKit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: jinsitao --- ndk_targets.gni | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ndk_targets.gni b/ndk_targets.gni index 05992fa0e4e..59ac470dc1f 100644 --- a/ndk_targets.gni +++ b/ndk_targets.gni @@ -269,8 +269,8 @@ _ndk_library_targets = [ "//interface/sdk_c/ConnectivityKit/wifi:wifi_ndk_header", "//interface/sdk_c/TEEKit:libteec", "//interface/sdk_c/TEEKit:tee_ndk_header", - "//interface/sdk_c/GameControllerKit/game_controller:ohgame_controller_header", - "//interface/sdk_c/GameControllerKit/game_controller:libohgame_controller", + "//interface/sdk_c/GameControllerKit:ohgame_controller_header", + "//interface/sdk_c/GameControllerKit:libohgame_controller", ] _ndk_base_libs = [ -- Gitee