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

#include <FeatureHandling.h>

Inheritance diagram for KODI::JOYSTICK::CAccelerometer:
KODI::JOYSTICK::CJoystickFeature

Public Member Functions

 CAccelerometer (const FeatureName &name, IInputHandler *handler, IButtonMap *buttonMap)
 
 ~CAccelerometer () override=default
 
bool OnDigitalMotion (const CDriverPrimitive &source, bool bPressed) override
 A digital motion has occurred.
 
bool OnAnalogMotion (const CDriverPrimitive &source, float magnitude) override
 An analog motion has occurred.
 
void ProcessMotions () override
 Process the motions that have occurred since the last invocation.
 
- Public Member Functions inherited from KODI::JOYSTICK::CJoystickFeature
 CJoystickFeature (const FeatureName &name, IInputHandler *handler, IButtonMap *buttonMap)
 
virtual ~CJoystickFeature ()=default
 
bool AcceptsInput (bool bActivation)
 Check if the input handler is accepting input.
 

Protected Attributes

CFeatureAxis m_xAxis
 
CFeatureAxis m_yAxis
 
CFeatureAxis m_zAxis
 
float m_xAxisState = 0.0f
 
float m_yAxisState = 0.0f
 
float m_zAxisState = 0.0f
 
- Protected Attributes inherited from KODI::JOYSTICK::CJoystickFeature
const FeatureName m_name
 
IInputHandler *const m_handler
 
IButtonMap *const m_buttonMap
 
const bool m_bEnabled
 

Additional Inherited Members

- Protected Member Functions inherited from KODI::JOYSTICK::CJoystickFeature
void ResetMotion ()
 Reset motion timer.
 
void StartMotion ()
 Start the motion timer.
 
bool InMotion () const
 Check if the feature is in motion.
 
unsigned int MotionTimeMs () const
 Get the time for which the feature has been in motion.
 

Constructor & Destructor Documentation

◆ CAccelerometer()

CAccelerometer::CAccelerometer ( const FeatureName & name,
IInputHandler * handler,
IButtonMap * buttonMap )

◆ ~CAccelerometer()

KODI::JOYSTICK::CAccelerometer::~CAccelerometer ( )
overridedefault

Member Function Documentation

◆ OnAnalogMotion()

bool CAccelerometer::OnAnalogMotion ( const CDriverPrimitive & source,
float magnitude )
overridevirtual

An analog motion has occurred.

Parameters
sourceThe source of the motion. Must be a semiaxis
magnitudeThe magnitude of the press or motion in the interval [0.0, 1.0]

For semiaxes, the magnitude is the force or travel distance in the direction of the semiaxis. If the value is in the opposite direction, the magnitude is 0.0.

For example, if the analog stick goes left, the negative semiaxis will have a value of 1.0 and the positive semiaxis will have a value of 0.0.

Implements KODI::JOYSTICK::CJoystickFeature.

◆ OnDigitalMotion()

bool CAccelerometer::OnDigitalMotion ( const CDriverPrimitive & source,
bool bPressed )
overridevirtual

A digital motion has occurred.

Parameters
sourceThe source of the motion. Must be digital (button or hat)
bPressedTrue for press motion, false for release motion
Returns
true if the motion was handled, false otherwise

Implements KODI::JOYSTICK::CJoystickFeature.

◆ ProcessMotions()

void CAccelerometer::ProcessMotions ( )
overridevirtual

Process the motions that have occurred since the last invocation.

This allows features with motion on multiple driver primitives to call their handler once all driver primitives are accounted for.

Implements KODI::JOYSTICK::CJoystickFeature.

Member Data Documentation

◆ m_xAxis

CFeatureAxis KODI::JOYSTICK::CAccelerometer::m_xAxis
protected

◆ m_xAxisState

float KODI::JOYSTICK::CAccelerometer::m_xAxisState = 0.0f
protected

◆ m_yAxis

CFeatureAxis KODI::JOYSTICK::CAccelerometer::m_yAxis
protected

◆ m_yAxisState

float KODI::JOYSTICK::CAccelerometer::m_yAxisState = 0.0f
protected

◆ m_zAxis

CFeatureAxis KODI::JOYSTICK::CAccelerometer::m_zAxis
protected

◆ m_zAxisState

float KODI::JOYSTICK::CAccelerometer::m_zAxisState = 0.0f
protected

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