Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches

Detailed Description

Peripheral operations to handle control about.


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

Function Documentation

◆ GetCapabilities()

virtual void GetCapabilities ( kodi::addon::PeripheralCapabilities & capabilities)
inlinevirtual

Get the list of features that this add-on provides.

Called by the frontend to query the add-on's capabilities and supported peripherals. All capabilities that the add-on supports should be set to true.

Parameters
[out]capabilitiesThe add-on's capabilities
Remarks
Valid implementation required.

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

Name Type Set call Get call
Provides joysticks boolean SetProvidesJoysticks GetProvidesJoysticks
Provides joystick rumble boolean SetProvidesJoystickRumble GetProvidesJoystickRumble
Provides joystick power off boolean SetProvidesJoystickPowerOff GetProvidesJoystickPowerOff
Provides button maps boolean SetProvidesButtonmaps GetProvidesButtonmaps

Example:

void CMyPeripheralAddon::GetCapabilities(kodi::addon::PeripheralCapabilities& capabilities)
{
capabilities.SetProvidesJoysticks(true);
capabilities.SetProvidesButtonmaps(true);
}
Definition PeripheralUtils.h:133
void SetProvidesButtonmaps(bool providesButtonmaps)
Set true if the add-on provides button maps.
Definition PeripheralUtils.h:194
void SetProvidesJoysticks(bool providesJoysticks)
Set true if the add-on provides joysticks.
Definition PeripheralUtils.h:167

◆ PerformDeviceScan()

virtual PERIPHERAL_ERROR PerformDeviceScan ( std::vector< std::shared_ptr< kodi::addon::Peripheral > > & scan_results)
inlinevirtual

Perform a scan for joysticks.

The frontend calls this when a hardware change is detected. If an add-on detects a hardware change, it can trigger this function using the TriggerScan() callback.

Parameters
[in]scan_resultsAssigned to allocated memory
Returns
PERIPHERAL_NO_ERROR if successful

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

Name Type Set call Get call
Peripheral type PERIPHERAL_TYPE SetType Type
Peripheral name const std::string& SetName Name
Peripheral vendor id uint16_t SetVendorID VendorID
Peripheral product id uint16_t SetProductID ProductID
Peripheral index unsigned int SetIndex Index

Further are following included:

◆ GetEvents()

virtual PERIPHERAL_ERROR GetEvents ( std::vector< kodi::addon::PeripheralEvent > & events)
inlinevirtual

Get all events that have occurred since the last call to GetEvents().

Parameters
[out]eventsList of available events within addon
Returns
PERIPHERAL_NO_ERROR if successful

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

Name Type Set call Get call
Peripheral event type PERIPHERAL_EVENT_TYPE SetType Type
Peripheral index unsigned int SetPeripheralIndex PeripheralIndex
Peripheral event driver index unsigned int SetDriverIndex DriverIndex
Peripheral event button state JOYSTICK_STATE_BUTTON SetButtonState ButtonState
Peripheral event hat state JOYSTICK_STATE_HAT SetHatState HatState
Peripheral event axis state JOYSTICK_STATE_AXIS (float) SetAxisState AxisState
Peripheral event motor state JOYSTICK_STATE_MOTOR (float) SetMotorState MotorState

Further are several class constructors with values included.

◆ SendEvent()

virtual bool SendEvent ( const kodi::addon::PeripheralEvent & event)
inlinevirtual

Send an input event to the peripheral.

Parameters
[in]eventThe input event
Returns
true if the event was handled, false otherwise