Kodi Development  20.0
for Binary and Script based Add-Ons

Detailed Description

Joystick operations to handle control about.


Joystick parts in interface:
Copy this to your project and extend with your parts or leave functions complete away where not used or supported.

Header parts:

PERIPHERAL_ERROR GetJoystickInfo(unsigned int index, kodi::addon::Joystick& info) override;
PERIPHERAL_ERROR GetFeatures(const kodi::addon::Joystick& joystick, const std::string& controller_id, std::vector<kodi::addon::JoystickFeature>& features) override;
PERIPHERAL_ERROR MapFeatures(const kodi::addon::Joystick& joystick, const std::string& controller_id, const std::vector<kodi::addon::JoystickFeature>& features) override;
PERIPHERAL_ERROR GetIgnoredPrimitives(const kodi::addon::Joystick& joystick, std::vector<kodi::addon::DriverPrimitive>& primitives) override;
PERIPHERAL_ERROR SetIgnoredPrimitives(const kodi::addon::Joystick& joystick, const std::vector<kodi::addon::DriverPrimitive>& primitives) override;
void SaveButtonMap(const kodi::addon::Joystick& joystick) override;
void RevertButtonMap(const kodi::addon::Joystick& joystick) override;
void ResetButtonMap(const kodi::addon::Joystick& joystick, const std::string& controller_id) override;
void PowerOffJoystick(unsigned int index) override;
Definition: PeripheralUtils.h:569
PERIPHERAL_ERROR
Definition: peripheral.h:36
virtual void RevertButtonMap(const kodi::addon::Joystick &joystick)
Revert the button map to the last time it was loaded or committed to disk.
Definition: Peripheral.h:507
virtual PERIPHERAL_ERROR MapFeatures(const kodi::addon::Joystick &joystick, const std::string &controller_id, const std::vector< kodi::addon::JoystickFeature > &features)
Add or update joystick features.
Definition: Peripheral.h:455
virtual PERIPHERAL_ERROR SetIgnoredPrimitives(const kodi::addon::Joystick &joystick, const std::vector< kodi::addon::DriverPrimitive > &primitives)
Set the list of driver primitives that are ignored for the device.
Definition: Peripheral.h:487
virtual void SaveButtonMap(const kodi::addon::Joystick &joystick)
Save the button map for the given joystick.
Definition: Peripheral.h:500
virtual void PowerOffJoystick(unsigned int index)
Powers off the given joystick if supported.
Definition: Peripheral.h:525
virtual void ResetButtonMap(const kodi::addon::Joystick &joystick, const std::string &controller_id)
Reset the button map for the given joystick and controller profile ID.
Definition: Peripheral.h:515
virtual PERIPHERAL_ERROR GetFeatures(const kodi::addon::Joystick &joystick, const std::string &controller_id, std::vector< kodi::addon::JoystickFeature > &features)
Get the features that allow translating the joystick into the controller profile.
Definition: Peripheral.h:438
virtual PERIPHERAL_ERROR GetIgnoredPrimitives(const kodi::addon::Joystick &joystick, std::vector< kodi::addon::DriverPrimitive > &primitives)
Get the driver primitives that should be ignored while mapping the device.
Definition: Peripheral.h:473
virtual PERIPHERAL_ERROR GetJoystickInfo(unsigned int index, kodi::addon::Joystick &info)
Get extended info about an attached joystick.
Definition: Peripheral.h:421

Source parts:

PERIPHERAL_ERROR CMyInstance::GetJoystickInfo(unsigned int index, kodi::addon::Joystick& info)
{
}
PERIPHERAL_ERROR CMyInstance::GetFeatures(const kodi::addon::Joystick& joystick, const std::string& controller_id, std::vector<kodi::addon::JoystickFeature>& features)
{
}
PERIPHERAL_ERROR CMyInstance::MapFeatures(const kodi::addon::Joystick& joystick, const std::string& controller_id, const std::vector<kodi::addon::JoystickFeature>& features)
{
}
PERIPHERAL_ERROR CMyInstance::GetIgnoredPrimitives(const kodi::addon::Joystick& joystick, std::vector<kodi::addon::DriverPrimitive>& primitives)
{
}
PERIPHERAL_ERROR CMyInstance::SetIgnoredPrimitives(const kodi::addon::Joystick& joystick, const std::vector<kodi::addon::DriverPrimitive>& primitives)
{
}
void CMyInstance::SaveButtonMap(const kodi::addon::Joystick& joystick)
{
}
void CMyInstance::RevertButtonMap(const kodi::addon::Joystick& joystick)
{
}
void CMyInstance::ResetButtonMap(const kodi::addon::Joystick& joystick, const std::string& controller_id)
{
}
void CMyInstance::PowerOffJoystick(unsigned int index)
{
}
@ PERIPHERAL_ERROR_NOT_IMPLEMENTED
-4 : The method that the frontend called is not implemented
Definition: peripheral.h:50

Modules

 Group header include
 
 Group source include
 

Function Documentation

◆ GetJoystickInfo()

virtual PERIPHERAL_ERROR GetJoystickInfo ( unsigned int  index,
kodi::addon::Joystick info 
)
inlinevirtual

Get extended info about an attached joystick.

Parameters
[in]indexThe joystick's driver index
[out]infoThe container for the allocated joystick info
Returns
PERIPHERAL_NO_ERROR if successful

The following table contains values that can be set with class Joystick :

Name Type Class Set call Get call
Joystick provider const std::string& Joystick SetProvider Provider
Joystick requested port int Joystick SetRequestedPort RequestedPort
Joystick button count unsigned int Joystick SetButtonCount ButtonCount
Joystick hat count unsigned int Joystick SetHatCount HatCount
Joystick axis count unsigned int Joystick SetAxisCount AxisCount
Joystick motor count unsigned int Joystick SetMotorCount MotorCount
Joystick support power off bool Joystick SetSupportsPowerOff SupportsPowerOff
Peripheral type PERIPHERAL_TYPE Peripheral SetType Type
Peripheral name const std::string& Peripheral SetName Name
Peripheral vendor id uint16_t Peripheral SetVendorID VendorID
Peripheral product id uint16_t Peripheral SetProductID ProductID
Peripheral index unsigned int Peripheral SetIndex Index

Further are following included:

◆ GetFeatures()

virtual PERIPHERAL_ERROR GetFeatures ( const kodi::addon::Joystick joystick,
const std::string &  controller_id,
std::vector< kodi::addon::JoystickFeature > &  features 
)
inlinevirtual

Get the features that allow translating the joystick into the controller profile.

Parameters
[in]joystickThe device's joystick properties; unknown values may be left at their default
[in]controller_idThe controller profile being requested, e.g. game.controller.default
[out]featuresThe array of allocated features
Returns
PERIPHERAL_NO_ERROR if successful

◆ MapFeatures()

virtual PERIPHERAL_ERROR MapFeatures ( const kodi::addon::Joystick joystick,
const std::string &  controller_id,
const std::vector< kodi::addon::JoystickFeature > &  features 
)
inlinevirtual

Add or update joystick features.

Parameters
[in]joystickThe device's joystick properties; unknown values may be left at their default
[in]controller_idThe game controller profile being updated
[in]featuresThe array of features
Returns
PERIPHERAL_NO_ERROR if successful

◆ GetIgnoredPrimitives()

virtual PERIPHERAL_ERROR GetIgnoredPrimitives ( const kodi::addon::Joystick joystick,
std::vector< kodi::addon::DriverPrimitive > &  primitives 
)
inlinevirtual

Get the driver primitives that should be ignored while mapping the device.

Parameters
[in]joystickThe device's joystick properties; unknown values may be left at their default
[out]primitivesThe array of allocated driver primitives to be ignored
Returns
PERIPHERAL_NO_ERROR if successful

◆ SetIgnoredPrimitives()

virtual PERIPHERAL_ERROR SetIgnoredPrimitives ( const kodi::addon::Joystick joystick,
const std::vector< kodi::addon::DriverPrimitive > &  primitives 
)
inlinevirtual

Set the list of driver primitives that are ignored for the device.

Parameters
[in]joystickThe device's joystick properties; unknown values may be left at their default
[in]primitivesThe array of driver primitives to ignore
Returns
PERIPHERAL_NO_ERROR if successful

◆ SaveButtonMap()

virtual void SaveButtonMap ( const kodi::addon::Joystick joystick)
inlinevirtual

Save the button map for the given joystick.

Parameters
[in]joystickThe device's joystick properties

◆ RevertButtonMap()

virtual void RevertButtonMap ( const kodi::addon::Joystick joystick)
inlinevirtual

Revert the button map to the last time it was loaded or committed to disk.

Parameters
[in]joystickThe device's joystick properties

◆ ResetButtonMap()

virtual void ResetButtonMap ( const kodi::addon::Joystick joystick,
const std::string &  controller_id 
)
inlinevirtual

Reset the button map for the given joystick and controller profile ID.

Parameters
[in]joystickThe device's joystick properties
[in]controller_idThe game controller profile being reset

◆ PowerOffJoystick()

virtual void PowerOffJoystick ( unsigned int  index)
inlinevirtual

Powers off the given joystick if supported.

Parameters
[in]indexThe joystick's driver index