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

#include <GUIConfigurationWizard.h>

Inheritance diagram for KODI::GAME::CGUIConfigurationWizard:
KODI::GAME::IConfigurationWizard KODI::JOYSTICK::IButtonMapper KODI::KEYBOARD::IKeyboardDriverHandler Observer CThread

Public Member Functions

 CGUIConfigurationWizard ()
 
 ~CGUIConfigurationWizard () override
 
void Run (const std::string &strControllerId, const std::vector< IFeatureButton * > &buttons) override
 Start the wizard for the specified buttons.
 
void OnUnfocus (IFeatureButton *button) override
 Callback for feature losing focus.
 
bool Abort (bool bWait=true) override
 Abort a running wizard.
 
void RegisterKey (const CPhysicalFeature &key) override
 Register a key by its keycode.
 
void UnregisterKeys () override
 Unregister all registered keys.
 
std::string ControllerID () const override
 The add-on ID of the game controller associated with this button mapper.
 
bool NeedsCooldown () const override
 Return true if the button mapper wants a cooldown between button mapping commands.
 
bool AcceptsPrimitive (JOYSTICK::PRIMITIVE_TYPE type) const override
 Return true if the button mapper accepts primitives of the given type.
 
bool MapPrimitive (JOYSTICK::IButtonMap *buttonMap, KEYMAP::IKeymap *keymap, const JOYSTICK::CDriverPrimitive &primitive) override
 Handle button/hat press or axis threshold.
 
void OnEventFrame (const JOYSTICK::IButtonMap *buttonMap, bool bMotion) override
 Called once per event frame to notify the implementation of motion status.
 
void OnLateAxis (const JOYSTICK::IButtonMap *buttonMap, unsigned int axisIndex) override
 Called when an axis has been detected after mapping began.
 
bool OnKeyPress (const CKey &key) override
 A key has been pressed.
 
void OnKeyRelease (const CKey &key) override
 A key has been released.
 
void Notify (const Observable &obs, const ObservableMessage msg) override
 Process a message from an observable.
 
- Public Member Functions inherited from KODI::GAME::IConfigurationWizard
virtual ~IConfigurationWizard ()=default
 
- Public Member Functions inherited from KODI::JOYSTICK::IButtonMapper
 IButtonMapper ()=default
 
virtual ~IButtonMapper ()=default
 
void SetButtonMapCallback (const std::string &deviceLocation, IButtonMapCallback *callback)
 
void ResetButtonMapCallbacks (void)
 
std::map< std::string, IButtonMapCallback * > & ButtonMapCallbacks (void)
 
- Public Member Functions inherited from KODI::KEYBOARD::IKeyboardDriverHandler
virtual ~IKeyboardDriverHandler ()=default
 
- Public Member Functions inherited from Observer
 Observer ()=default
 
virtual ~Observer ()=default
 

Protected Member Functions

void Process () override
 
- Protected Member Functions inherited from CThread
 CThread (const char *ThreadName)
 
virtual void OnStartup ()
 
virtual void OnExit ()
 
WaitResponse AbortableWait (CEvent &event, std::chrono::milliseconds duration=std::chrono::milliseconds(-1))
 
 CThread (IRunnable *pRunnable, const char *ThreadName)
 
virtual ~CThread ()
 
void Create (bool bAutoDelete=false)
 
template<typename Rep , typename Period >
void Sleep (std::chrono::duration< Rep, Period > duration)
 
bool IsAutoDelete () const
 
virtual void StopThread (bool bWait=true)
 
bool IsRunning () const
 
bool IsCurrentThread () const
 
bool Join (std::chrono::milliseconds duration)
 
bool SetPriority (const ThreadPriority &priority)
 Set the threads priority. This uses the platforms native threading library to do so.
 
virtual void OnException ()
 

Additional Inherited Members

- Protected Types inherited from CThread
enum  WaitResponse { WAIT_INTERRUPTED = -1 , WAIT_SIGNALED = 0 , WAIT_TIMEDOUT = 1 }
 
- Static Protected Member Functions inherited from CThread
static const std::thread::id GetCurrentThreadId ()
 
static CThreadGetCurrentThread ()
 
- Protected Attributes inherited from CThread
std::atomic< boolm_bStop
 

Constructor & Destructor Documentation

◆ CGUIConfigurationWizard()

CGUIConfigurationWizard::CGUIConfigurationWizard ( )

◆ ~CGUIConfigurationWizard()

CGUIConfigurationWizard::~CGUIConfigurationWizard ( )
overridedefault

Member Function Documentation

◆ Abort()

bool CGUIConfigurationWizard::Abort ( bool bWait = true)
overridevirtual

Abort a running wizard.

Parameters
bWaitTrue if the call should block until the wizard is fully aborted
Returns
true if aborted, or false if the wizard wasn't running

Implements KODI::GAME::IConfigurationWizard.

◆ AcceptsPrimitive()

bool KODI::GAME::CGUIConfigurationWizard::AcceptsPrimitive ( JOYSTICK::PRIMITIVE_TYPE type) const
inlineoverridevirtual

Return true if the button mapper accepts primitives of the given type.

Parameters
typeThe primitive type
Returns
True if the button mapper can map the primitive type, false otherwise

Implements KODI::JOYSTICK::IButtonMapper.

◆ ControllerID()

std::string KODI::GAME::CGUIConfigurationWizard::ControllerID ( ) const
inlineoverridevirtual

The add-on ID of the game controller associated with this button mapper.

Returns
The ID of the add-on extending kodi.game.controller

Implements KODI::JOYSTICK::IButtonMapper.

◆ MapPrimitive()

bool CGUIConfigurationWizard::MapPrimitive ( JOYSTICK::IButtonMap * buttonMap,
KEYMAP::IKeymap * keyMap,
const JOYSTICK::CDriverPrimitive & primitive )
overridevirtual

Handle button/hat press or axis threshold.

Parameters
buttonMapThe button map being manipulated
keymapAn interface capable of translating features to Kodi actions
primitiveThe driver primitive

Called in the same thread as IButtonMapper::OnFrame.

Returns
True if driver primitive was mapped to a feature
Todo
This only succeeds for game.controller.default; no actions are
Todo
Handle multiple actions mapped to the same key
Todo
Check if primitive is a cancel or motion action

Implements KODI::JOYSTICK::IButtonMapper.

◆ NeedsCooldown()

bool KODI::GAME::CGUIConfigurationWizard::NeedsCooldown ( ) const
inlineoverridevirtual

Return true if the button mapper wants a cooldown between button mapping commands.

Returns
True to only send button mapping commands that occur after a small timeout from the previous command.

Implements KODI::JOYSTICK::IButtonMapper.

◆ Notify()

void CGUIConfigurationWizard::Notify ( const Observable & obs,
const ObservableMessage msg )
overridevirtual

Process a message from an observable.

Parameters
obsThe observable that sends the message.
msgThe message.

Implements Observer.

◆ OnEventFrame()

void CGUIConfigurationWizard::OnEventFrame ( const JOYSTICK::IButtonMap * buttonMap,
bool bMotion )
overridevirtual

Called once per event frame to notify the implementation of motion status.

Parameters
buttonMapThe button map passed to MapPrimitive() (shall not be modified)
bMotionTrue if a previously-mapped axis is still in motion

This allows the implementer to wait for an axis to be centered before allowing it to be used as Kodi input.

If mapping finishes on an axis, then the axis will still be pressed and sending input every frame when the mapping ends. For example, when the right analog stick is the last feature to be mapped, it is still pressed when mapping ends and immediately sends Volume Down actions.

The fix is to allow implementers to wait until all axes are motionless before detaching themselves.

Called in the same thread as IButtonMapper::MapPrimitive.

Implements KODI::JOYSTICK::IButtonMapper.

◆ OnKeyPress()

bool CGUIConfigurationWizard::OnKeyPress ( const CKey & key)
overridevirtual

A key has been pressed.

Parameters
keyThe pressed key
Returns
True if the event was handled, false otherwise

Implements KODI::KEYBOARD::IKeyboardDriverHandler.

◆ OnKeyRelease()

void KODI::GAME::CGUIConfigurationWizard::OnKeyRelease ( const CKey & key)
inlineoverridevirtual

A key has been released.

Parameters
keyThe released key

Implements KODI::KEYBOARD::IKeyboardDriverHandler.

◆ OnLateAxis()

void CGUIConfigurationWizard::OnLateAxis ( const JOYSTICK::IButtonMap * buttonMap,
unsigned int axisIndex )
overridevirtual

Called when an axis has been detected after mapping began.

Parameters
axisIndexThe index of the axis being discovered

Some joystick drivers don't report an initial value for analog axes.

Called in the same thread as IButtonMapper::MapPrimitive.

Implements KODI::JOYSTICK::IButtonMapper.

◆ OnUnfocus()

void CGUIConfigurationWizard::OnUnfocus ( IFeatureButton * button)
overridevirtual

Callback for feature losing focus.

Parameters
buttonThe feature button losing focus

Implements KODI::GAME::IConfigurationWizard.

◆ Process()

void CGUIConfigurationWizard::Process ( void )
overrideprotectedvirtual

Reimplemented from CThread.

◆ RegisterKey()

void CGUIConfigurationWizard::RegisterKey ( const CPhysicalFeature & key)
overridevirtual

Register a key by its keycode.

Parameters
keyA key with a valid keycode

This should be called before Run(). It allows the user to choose a key to map instead of scrolling through a long list.

Implements KODI::GAME::IConfigurationWizard.

◆ Run()

void CGUIConfigurationWizard::Run ( const std::string & strControllerId,
const std::vector< IFeatureButton * > & buttons )
overridevirtual

Start the wizard for the specified buttons.

Parameters
controllerIdThe controller ID being mapped
buttonsThe buttons to map

Implements KODI::GAME::IConfigurationWizard.

◆ UnregisterKeys()

void CGUIConfigurationWizard::UnregisterKeys ( )
overridevirtual

Unregister all registered keys.

Implements KODI::GAME::IConfigurationWizard.


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