Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
KODI::JOYSTICK::CJoystickTranslator Class Reference

Joystick translation utilities. More...

#include <JoystickTranslator.h>

Static Public Member Functions

static const char * HatStateToString (HAT_STATE state)
 Translate a hat state to a string representation.
 
static const char * TranslateAnalogStickDirection (ANALOG_STICK_DIRECTION dir)
 Translate an analog stick direction to a lower-case string.
 
static ANALOG_STICK_DIRECTION TranslateAnalogStickDirection (const std::string &dir)
 Translate an analog stick direction string to an enum value.
 
static const char * TranslateWheelDirection (WHEEL_DIRECTION dir)
 Translate a wheel direction to a lower-case string.
 
static WHEEL_DIRECTION TranslateWheelDirection (const std::string &dir)
 Translate a wheel direction string to an enum value.
 
static const char * TranslateThrottleDirection (THROTTLE_DIRECTION dir)
 Translate a throttle direction to a lower-case string.
 
static THROTTLE_DIRECTION TranslateThrottleDirection (const std::string &dir)
 Translate a throttle direction string to an enum value.
 
static SEMIAXIS_DIRECTION PositionToSemiAxisDirection (float position)
 Get the semi-axis direction containing the specified position.
 
static WHEEL_DIRECTION PositionToWheelDirection (float position)
 Get the wheel direction containing the specified position.
 
static THROTTLE_DIRECTION PositionToThrottleDirection (float position)
 Get the throttle direction containing the specified position.
 
static std::string GetPrimitiveName (const CDriverPrimitive &primitive)
 Get the localized name of the primitive.
 

Detailed Description

Joystick translation utilities.

Member Function Documentation

◆ GetPrimitiveName()

std::string CJoystickTranslator::GetPrimitiveName ( const CDriverPrimitive & primitive)
static

Get the localized name of the primitive.

Parameters
primitiveThe primitive, currently only buttons and axes are supported
Returns
A title for the primitive, e.g. "Button 0" or "Axis 1"

◆ HatStateToString()

const char * CJoystickTranslator::HatStateToString ( HAT_STATE state)
static

Translate a hat state to a string representation.

Parameters
stateThe hat state
Returns
A capitalized string representation, or "RELEASED" if the hat is centered.

◆ PositionToSemiAxisDirection()

SEMIAXIS_DIRECTION CJoystickTranslator::PositionToSemiAxisDirection ( float position)
static

Get the semi-axis direction containing the specified position.

Parameters
positionThe position of the axis
Returns
POSITIVE, NEGATIVE, or UNKNOWN if position is 0

◆ PositionToThrottleDirection()

THROTTLE_DIRECTION CJoystickTranslator::PositionToThrottleDirection ( float position)
static

Get the throttle direction containing the specified position.

Parameters
positionThe position of the axis
Returns
UP, DOWN, or UNKNOWN if position is 0

◆ PositionToWheelDirection()

WHEEL_DIRECTION CJoystickTranslator::PositionToWheelDirection ( float position)
static

Get the wheel direction containing the specified position.

Parameters
positionThe position of the axis
Returns
LEFT, RIGHT, or UNKNOWN if position is 0

◆ TranslateAnalogStickDirection() [1/2]

const char * CJoystickTranslator::TranslateAnalogStickDirection ( ANALOG_STICK_DIRECTION dir)
static

Translate an analog stick direction to a lower-case string.

Parameters
dirThe analog stick direction
Returns
A lower-case string representation, or "" if the direction is invalid

◆ TranslateAnalogStickDirection() [2/2]

ANALOG_STICK_DIRECTION CJoystickTranslator::TranslateAnalogStickDirection ( const std::string & dir)
static

Translate an analog stick direction string to an enum value.

Parameters
dirThe analog stick direction
Returns
The translated direction, or ANALOG_STICK_DIRECTION::UNKNOWN if unknown

◆ TranslateThrottleDirection() [1/2]

THROTTLE_DIRECTION CJoystickTranslator::TranslateThrottleDirection ( const std::string & dir)
static

Translate a throttle direction string to an enum value.

Parameters
dirThe throttle direction
Returns
The translated direction, or THROTTLE_DIRECTION::UNKNOWN if unknown

◆ TranslateThrottleDirection() [2/2]

const char * CJoystickTranslator::TranslateThrottleDirection ( THROTTLE_DIRECTION dir)
static

Translate a throttle direction to a lower-case string.

Parameters
dirThe analog stick direction
Returns
A lower-case string representation, or "" if the direction is invalid

◆ TranslateWheelDirection() [1/2]

WHEEL_DIRECTION CJoystickTranslator::TranslateWheelDirection ( const std::string & dir)
static

Translate a wheel direction string to an enum value.

Parameters
dirThe wheel direction
Returns
The translated direction, or WHEEL_DIRECTION::UNKNOWN if unknown

◆ TranslateWheelDirection() [2/2]

const char * CJoystickTranslator::TranslateWheelDirection ( WHEEL_DIRECTION dir)
static

Translate a wheel direction to a lower-case string.

Parameters
dirThe wheel direction
Returns
A lower-case string representation, or "" if the direction is invalid

The documentation for this class was generated from the following files: