API Reference
This section describes functions, data structures and operations of Titan One device API.
Device API Functions:
Device API Data:
1. Device Report Type
The GCAPI_REPORT structure is defined in gcapi.h. This data structure is intended to inform the plugin or the application about the current state of the device input and output ports, about the parameters set by the console (LED, rumble, battery) and, as well as, about the current values of the buttons, sticks and sensors. Check out gcapi_Read function for see an usage example.
Read-only data structure
• console: Device output port state, indicating the output protocol in use and not necessarily the console model in which the device is plugged.
• controller: Device input port state. The four highest bits defines the controller connected into the device, and the lower bits defines the controller extension, if applicable.
High Bits
Low Bits
• led: Controller LED state. Each player LED of the controller can be in one of four states: off, on, blinking rapidly or blinking slowly. These states are consistent with what is expected for the PS3. The Titan One does not reproduce all the possible states for XBox 360 system. When using the Dualshock 4 controller the LED states are translated to colors and light intensity of the light bar.
• rumble: Currently rumble speed, can range from 0% to 100%.
• battery_level: Battery level, can range from 0 to 10, where 0 is empty and 10 is full.
• value: Current input value - Range: [-100 ~ 100] %.
• prev_value: Previous value - Range: [-100 ~ 100] %.
• press_time: Time marker for the button press event.
• input: Input structure (for controller entries).
2. gcapi_IsConnected
Check if the device is connected.
Prototype:
uint8_t _stdcall gcapi_IsConnected ( )
Parameters:
None
Return:
1 if the device is connected, 0 if not
Example:
3. gcapi_GetFWVer
Get device firmware version.
Prototype:
uint16_t _stdcall gcapi_GetFWVer ( )
Parameters:
None
Return:
The firmware version. If the device is not connected this function returns 0x0000
Example:
4. gcapi_Read
Reads the current state of device and of the connected controller and console.
Prototype:
uint8_t _stdcall gcapi_Read ( GCAPI_REPORT *report )
Parameters:
<GCAPI_REPORT *> : pointer to GCAPI_REPORT data structure
Return:
1 for success and 0 for error
Example:
5. gcapi_Write
Writes the output[GCAPI_OUTPUT_TOTAL] states. In other words: send it to console.
Prototype:
uint8_t _stdcall gcapi_Write ( int8_t *output )
Parameters:
<int8_t *> : pointer to output data structure
Return:
1 for success and 0 for error
Example:
6. gcapi_GetTimeVal
Get the current time value.
Prototype:
uint32_t _stdcall gcapi_GetTimeVal ( )
Parameters:
None
Return:
The current time value
Example:
7. gcapi_CalcPressTime
Calculates the pressing time of a entry.
Prototype:
uint32_t _stdcall gcapi_CalcPressTime ( uint32_t press_tv )
Parameters:
<uint32_t> : the entry time reference
Return:
The amount of time, in milliseconds, that an entry is out of its rest position
Example:
12. Identifiers
|