openharmony 鸿蒙 capi-game-device-event

2026-08-25 浏览 (1)

game_device_event.h

Overview

Defines APIs for game device events.

File to include: <GameControllerKit/game_device_event.h>

Library: libohgame_controller.z.so

System capability: SystemCapability.Game.GameController

Since: 21

Related module: GameController

Summary

Types

NameDescription
typedef enum GameDevice_StatusChangedType GameDevice_StatusChangedTypeDefines status change types of devices.
typedef enum GameDevice_DeviceType GameDevice_DeviceTypeDefines device types.
typedef struct GameDevice_DeviceInfo GameDevice_DeviceInfoDefines the device information.
typedef struct GameDevice_DeviceEvent GameDevice_DeviceEventDefines device status change events.
typedef void(*GameDevice_DeviceMonitorCallback) (const struct GameDevice_DeviceEvent *deviceEvent)Defines the callback function used in OH_GameDevice_RegisterDeviceMonitor. The callback function is triggered when the device goes online or offline.

Enumeration

NameDescription
GameDevice_StatusChangedType {
OFFLINE = 0,
ONLINE = 1
}
Device status change types.
GameDevice_DeviceType {
UNKNOWN = 0,
GAME_PAD = 1
}
Device types.

Functions

NameDescription
GameController_ErrorCode OH_GameDevice_DeviceEvent_GetChangedType (const struct GameDevice_DeviceEvent *deviceEvent, GameDevice_StatusChangedType *statusChangedType)Obtains the status change type from a device status change event.
GameController_ErrorCode OH_GameDevice_DeviceEvent_GetDeviceInfo (const struct GameDevice_DeviceEvent *deviceEvent, GameDevice_DeviceInfo **deviceInfo)Obtains the device information from a device status change event.
GameController_ErrorCode OH_GameDevice_DestroyDeviceInfo (GameDevice_DeviceInfo **deviceInfo)Destroys a GameDevice_DeviceInfo instance when it is no longer used.
GameController_ErrorCode OH_GameDevice_DeviceInfo_GetDeviceId (const struct GameDevice_DeviceInfo *deviceInfo, char **deviceId)Obtains the device ID from GameDevice_DeviceInfo.
GameController_ErrorCode OH_GameDevice_DeviceInfo_GetName (const struct GameDevice_DeviceInfo *deviceInfo, char **name)Obtains the device name from GameDevice_DeviceInfo.
GameController_ErrorCode OH_GameDevice_DeviceInfo_GetProduct (const struct GameDevice_DeviceInfo *deviceInfo, int32_t *product)Obtains the product information from GameDevice_DeviceInfo.
GameController_ErrorCode OH_GameDevice_DeviceInfo_GetVersion (const struct GameDevice_DeviceInfo *deviceInfo, int32_t *version)Obtains the version information from GameDevice_DeviceInfo.
GameController_ErrorCode OH_GameDevice_DeviceInfo_GetPhysicalAddress (const struct GameDevice_DeviceInfo *deviceInfo, char **physicalAddress)Obtains the physical address from GameDevice_DeviceInfo.
GameController_ErrorCode OH_GameDevice_DeviceInfo_GetDeviceType (const struct GameDevice_DeviceInfo *deviceInfo, GameDevice_DeviceType *deviceType)Obtains the device type from GameDevice_DeviceInfo.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 capi-game-pad

openharmony 鸿蒙 Readme-EN

openharmony 鸿蒙 capi-game-device

openharmony 鸿蒙 capi-game-pad-event

openharmony 鸿蒙 capi-game-controller

openharmony 鸿蒙 capi-game-controller-type

openharmony 鸿蒙 gamecontroller-c-error-code

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/kA0KjFet