Pico Native XR SDK
PxrInput.h
Go to the documentation of this file.
1#ifndef PXR_INPUT_H
2#define PXR_INPUT_H
3
4#include "PxrTypes.h"
5#include "PxrEnums.h"
6
7typedef enum
8{
12
13typedef enum
14{
18
19typedef enum
20{
32
40
41typedef enum
42{
47 PXR_CONTROLLER_HAVE_ALL = 0xFFFFFFFF
48
50
51
52typedef enum {
60
61typedef struct PxrControllerTracking_ {
65
66typedef struct PxrVector2f_ {
67 float x; //0~255
68 float y; //0~255
70
73 int homeValue; // 0/1
74 int backValue; // 0/1
75 int touchpadValue; // 0/1
76 int volumeUp; // 0/1
77 int volumeDown; // 0/1
78 float triggerValue; // 0-255 --> 0-1
79 int batteryValue; // 0-5
80 int AXValue; // 0/1
81 int BYValue; // 0/1
82 int sideValue; // 0/1
83 float gripValue; // 0-255 --> 0-1
89
90 int AXTouchValue; // 0/1
91 int BYTouchValue; // 0/1
92 int rockerTouchValue; // 0/1
100
102
104
105 long home; // 0/1
106 long back; // 0/1
107 long touchpad; // 0/1
108 long volumeUp; // 0/1
109 long volumeDown; // 0/1
110 long AX; // 0/1
111 long BY; // 0/1
112 long side; // 0/1
113 long grip; // 0-255
119
120 long AXTouch; // 0/1
121 long BYTouch; // 0/1
122 long rockerTouch; // 0/1
123 long triggerTouch; // 0/1
124 long thumbrestTouch;// 0/1
130
132
133
134typedef struct PxrInputEvent_ {
135 union
136 {
139 };
140// int int_value;
141 bool up;
142 bool down;
146
161
172
174
175
180 u_int64_t Abilities;
182
183typedef struct PxrControllerInfo_ {
185 char* mac;
186 char* sn;
187 char* version;
189
190extern "C" {
191
192/*******************************************************************************************************************************************************************
193*
194* Main Controller Feature Function
195*
196*********************************************************************************************************************************************************************/
197
198/*
199 * get input connecte state,type,input dof,touch and mac addr.
200 */
210int Pxr_GetControllerCapabilities(uint32_t deviceID, PxrControllerCapability *capability);
211
212/*
213 * get input connecte state.
214 */
228int Pxr_GetControllerConnectStatus(uint32_t deviceID);
229
230//get input sensor data
231//attention: predictTime can be set 0 if user do not need predict. headSensorData can be set NULL too.
243int Pxr_GetControllerTrackingState(uint32_t deviceID, double predictTime, float headSensorData[],
244 PxrControllerTracking *tracking);
245
246//get input key state,please refer to PxrControllerInputState struct
257
258//get input key Event,please refer to PxrControllerInputEvent struct
269
270/******************************************************
271 * set input vibration
272 ******************************************************/
283int Pxr_SetControllerVibration(uint32_t deviceID, float strength, int time);
284
285
286/*******************************************************************************************************************************************************************
287*
288* Controller Manager Feature Function
289*
290*********************************************************************************************************************************************************************/
291
292//set app can get key value
303
304//set main input device
313int Pxr_SetControllerMainInputHandle(uint32_t deviceID);
314
315//get main input device
316int Pxr_GetControllerMainInputHandle(uint32_t *deviceID);
317
318//get main input device
319int Pxr_SetControllerUnbind(uint32_t deviceID);
320
321//get main input device
323
324//get main input device
325int Pxr_SetControllerStopPairing(uint32_t deviceID);
326
327//get main input device
328int Pxr_SetControllerUpgrade(uint32_t deviceID,int rule,char* station_path_by_char,char* controller_path_by_char);
329
330/*
331 * get input device type/mac/sn addr.
332 */
342int Pxr_GetControllerinfo(uint32_t deviceID, PxrControllerInfo *info);
343
344/*******************************************************************************************************************************************************************
345*
346* Main Hand Feature Function
347*
348*********************************************************************************************************************************************************************/
349
350/*
351 * there is some function about hand,so put hand function here.
352 */
353
354
355
356
357
358/*******************************************************************************************************************************************************************
359*
360* legacy Function don't use!
361*
362*********************************************************************************************************************************************************************/
363
364int *Pxr_GetControllerKeyEventExt(int controllerSerialNum, int devicetype);
365int Pxr_GetControllerTouchEvent(int controllerSerialNum, int length, int *value);
366int Pxr_SetInputEventCallback(bool enable_Input_callback);
367//reset input pose
368int Pxr_RecenterInputPose(uint32_t deviceID);
369//get head raw sensor data
370int Pxr_GetHeadSensorData(float *data);
371
372}
373#endif //PXR_INPUT_H
int Pxr_GetHeadSensorData(float *data)
int Pxr_GetControllerMainInputHandle(uint32_t *deviceID)
PxrControllerBond
Definition: PxrInput.h:14
@ PXR_CONTROLLER_BOND
Definition: PxrInput.h:15
@ PXR_CONTROLLER_UNBOND
Definition: PxrInput.h:16
struct PxrControllerCapability_ PxrControllerCapability
int Pxr_GetControllerTouchEvent(int controllerSerialNum, int length, int *value)
PxrControllerAbilities
Definition: PxrInput.h:42
@ PXR_CONTROLLER_HAVE_TOUCHPAD
Definition: PxrInput.h:46
@ PXR_CONTROLLER_HAVE_ALL
Definition: PxrInput.h:47
@ PXR_CONTROLLER_HAVE_GRIP
Definition: PxrInput.h:44
@ PXR_CONTROLLER_HAVE_ROCKER
Definition: PxrInput.h:45
@ PXR_CONTROLLER_HAVE_TOUCH
Definition: PxrInput.h:43
int Pxr_RecenterInputPose(uint32_t deviceID)
int Pxr_SetControllerVibration(uint32_t deviceID, float strength, int time)
Sets vibration for a specified controller.
int Pxr_GetControllerInputEvent(uint32_t deviceID, PxrControllerInputEvent *event)
Gets the key event for a specified controller.
PxrControllerType
Definition: PxrInput.h:52
@ PXR_CV_Controller
Definition: PxrInput.h:55
@ PXR_CV2_Controller
Definition: PxrInput.h:57
@ PXR_NO_DEVICE
Definition: PxrInput.h:53
@ PXR_HB_Controller
Definition: PxrInput.h:54
@ PXR_CV3_Optics_Controller
Definition: PxrInput.h:58
@ PXR_HB2_Controller
Definition: PxrInput.h:56
struct PxrControllerInputEvent_ PxrControllerInputEvent
struct PxrControllerTracking_ PxrControllerTracking
int Pxr_SetInputEventCallback(bool enable_Input_callback)
int Pxr_SetControllerEnterPairingSetControllerEnterPairing(uint32_t deviceID)
int Pxr_GetControllerConnectStatus(uint32_t deviceID)
Gets the connection status of a specified controller.
int Pxr_SetControllerEnableKey(bool isEnable, PxrControllerKeyMap Key)
Enables/disables the specified controller key.
struct PxrInputEvent_ PxrInputEvent
int Pxr_SetControllerMainInputHandle(uint32_t deviceID)
Sets the main controller.
int Pxr_GetControllerTrackingState(uint32_t deviceID, double predictTime, float headSensorData[], PxrControllerTracking *tracking)
Gets the pose data of a specified controller.
int Pxr_GetControllerinfo(uint32_t deviceID, PxrControllerInfo *info)
Gets the information about a specified controller.
struct PxrVector2f_ PxrVector2f
int * Pxr_GetControllerKeyEventExt(int controllerSerialNum, int devicetype)
struct PxrControllerInfo_ PxrControllerInfo
int Pxr_SetControllerStopPairing(uint32_t deviceID)
struct PxrControllerInputStateDowntimeStamp_ PxrControllerInputStateDowntimeStamp
int Pxr_SetControllerUnbind(uint32_t deviceID)
int Pxr_SetControllerUpgrade(uint32_t deviceID, int rule, char *station_path_by_char, char *controller_path_by_char)
int Pxr_GetControllerCapabilities(uint32_t deviceID, PxrControllerCapability *capability)
Gets controller capabilities.
struct PxrControllerInputState_ PxrControllerInputState
PxrControllerDof
Definition: PxrInput.h:8
@ PXR_CONTROLLER_3DOF
Definition: PxrInput.h:9
@ PXR_CONTROLLER_6DOF
Definition: PxrInput.h:10
PxrControllerKeyMap
Definition: PxrInput.h:20
@ PXR_CONTROLLER_KEY_AX
Definition: PxrInput.h:22
@ PXR_CONTROLLER_KEY_BACK
Definition: PxrInput.h:24
@ PXR_CONTROLLER_KEY_HOME
Definition: PxrInput.h:21
@ PXR_CONTROLLER_KEY_TRIGGER
Definition: PxrInput.h:25
@ PXR_CONTROLLER_TOUCH_TRIGGER
Definition: PxrInput.h:36
@ PXR_CONTROLLER_KEY_ROCKER
Definition: PxrInput.h:28
@ PXR_CONTROLLER_KEY_VOL_UP
Definition: PxrInput.h:26
@ PXR_CONTROLLER_KEY_TOUCHPAD
Definition: PxrInput.h:30
@ PXR_CONTROLLER_TOUCH_BY
Definition: PxrInput.h:34
@ PXR_CONTROLLER_KEY_GRIP
Definition: PxrInput.h:29
@ PXR_CONTROLLER_TOUCH_THUMB
Definition: PxrInput.h:37
@ PXR_CONTROLLER_KEY_VOL_DOWN
Definition: PxrInput.h:27
@ PXR_CONTROLLER_KEY_LASTONE
Definition: PxrInput.h:31
@ PXR_CONTROLLER_TOUCH_ROCKER
Definition: PxrInput.h:35
@ PXR_CONTROLLER_TOUCH_LASTONE
Definition: PxrInput.h:38
@ PXR_CONTROLLER_TOUCH_AX
Definition: PxrInput.h:33
@ PXR_CONTROLLER_KEY_BY
Definition: PxrInput.h:23
int Pxr_GetControllerInputState(uint32_t deviceID, PxrControllerInputState *state)
Gets the key status for a specified controller.
Definition: PxrInput.h:176
PxrControllerDof Dof
Definition: PxrInput.h:178
PxrControllerType type
Definition: PxrInput.h:177
PxrControllerBond inputBond
Definition: PxrInput.h:179
u_int64_t Abilities
Definition: PxrInput.h:180
Definition: PxrInput.h:183
char * version
Definition: PxrInput.h:187
char * mac
Definition: PxrInput.h:185
PxrControllerType type
Definition: PxrInput.h:184
char * sn
Definition: PxrInput.h:186
Definition: PxrInput.h:147
PxrInputEvent reserved_3_Key
Definition: PxrInput.h:159
PxrInputEvent touchpad
Definition: PxrInput.h:150
PxrInputEvent AXTouch
Definition: PxrInput.h:162
PxrInputEvent reserved_2_Key
Definition: PxrInput.h:158
PxrInputEvent reserved_0_Touch
Definition: PxrInput.h:167
PxrInputEvent rockerTouch
Definition: PxrInput.h:164
PxrInputEvent reserved_3_Touch
Definition: PxrInput.h:170
PxrInputEvent back
Definition: PxrInput.h:149
PxrInputEvent reserved_1_Key
Definition: PxrInput.h:157
PxrInputEvent volumeUp
Definition: PxrInput.h:151
PxrInputEvent volumeDown
Definition: PxrInput.h:152
PxrInputEvent reserved_1_Touch
Definition: PxrInput.h:168
PxrInputEvent home
Definition: PxrInput.h:148
PxrInputEvent reserved_0_Key
Definition: PxrInput.h:156
PxrInputEvent BYTouch
Definition: PxrInput.h:163
PxrInputEvent reserved_4_Key
Definition: PxrInput.h:160
PxrInputEvent AX
Definition: PxrInput.h:153
PxrInputEvent BY
Definition: PxrInput.h:154
PxrInputEvent reserved_4_Touch
Definition: PxrInput.h:171
PxrInputEvent side
Definition: PxrInput.h:155
PxrInputEvent thumbrestTouch
Definition: PxrInput.h:166
PxrInputEvent reserved_2_Touch
Definition: PxrInput.h:169
PxrInputEvent triggerTouch
Definition: PxrInput.h:165
Definition: PxrInput.h:71
int reserved_key_3
Definition: PxrInput.h:87
float gripValue
Definition: PxrInput.h:83
int AXTouchValue
Definition: PxrInput.h:90
float triggerValue
Definition: PxrInput.h:78
int BYValue
Definition: PxrInput.h:81
int reserved_key_0
Definition: PxrInput.h:84
int volumeDown
Definition: PxrInput.h:77
int reserved_touch_0
Definition: PxrInput.h:95
int volumeUp
Definition: PxrInput.h:76
int reserved_key_1
Definition: PxrInput.h:85
int batteryValue
Definition: PxrInput.h:79
PxrVector2f Joystick
Definition: PxrInput.h:72
int thumbrestTouchValue
Definition: PxrInput.h:94
int AXValue
Definition: PxrInput.h:80
int reserved_touch_3
Definition: PxrInput.h:98
int sideValue
Definition: PxrInput.h:82
int BYTouchValue
Definition: PxrInput.h:91
int reserved_key_2
Definition: PxrInput.h:86
int reserved_touch_2
Definition: PxrInput.h:97
int homeValue
Definition: PxrInput.h:73
int triggerTouchValue
Definition: PxrInput.h:93
int reserved_touch_1
Definition: PxrInput.h:96
int backValue
Definition: PxrInput.h:74
int reserved_touch_4
Definition: PxrInput.h:99
int rockerTouchValue
Definition: PxrInput.h:92
int touchpadValue
Definition: PxrInput.h:75
int reserved_key_4
Definition: PxrInput.h:88
Definition: PxrInput.h:103
long reserved_key_2
Definition: PxrInput.h:116
long side
Definition: PxrInput.h:112
long triggerTouch
Definition: PxrInput.h:123
long reserved_touch_0
Definition: PxrInput.h:125
long reserved_key_1
Definition: PxrInput.h:115
long reserved_touch_3
Definition: PxrInput.h:128
long touchpad
Definition: PxrInput.h:107
long volumeDown
Definition: PxrInput.h:109
long home
Definition: PxrInput.h:105
long reserved_key_3
Definition: PxrInput.h:117
long rockerTouch
Definition: PxrInput.h:122
long reserved_key_4
Definition: PxrInput.h:118
long thumbrestTouch
Definition: PxrInput.h:124
long reserved_key_0
Definition: PxrInput.h:114
long BY
Definition: PxrInput.h:111
long volumeUp
Definition: PxrInput.h:108
long reserved_touch_4
Definition: PxrInput.h:129
long AX
Definition: PxrInput.h:110
long reserved_touch_2
Definition: PxrInput.h:127
long back
Definition: PxrInput.h:106
long grip
Definition: PxrInput.h:113
long reserved_touch_1
Definition: PxrInput.h:126
long AXTouch
Definition: PxrInput.h:120
long BYTouch
Definition: PxrInput.h:121
Definition: PxrInput.h:61
PxrSensorState globalControllerPose
Definition: PxrInput.h:63
PxrSensorState localControllerPose
Definition: PxrInput.h:62
Definition: PxrInput.h:134
bool shortpress
Definition: PxrInput.h:143
int int_value
Definition: PxrInput.h:137
bool up
Definition: PxrInput.h:141
bool down
Definition: PxrInput.h:142
bool longpress
Definition: PxrInput.h:144
float float_value
Definition: PxrInput.h:138
Definition: PxrTypes.h:73
Definition: PxrInput.h:66
float y
Definition: PxrInput.h:68
float x
Definition: PxrInput.h:67