![]() |
Kodi Documentation 18.0
Kodi is an open source media player and entertainment hub.
|
#include <Peripheral.h>
Public Member Functions | |
CInstancePeripheral () | |
CInstancePeripheral (KODI_HANDLE instance) | |
~CInstancePeripheral () override=default | |
Peripheral operations | |
{ | |
virtual void | GetCapabilities (PERIPHERAL_CAPABILITIES &capabilities) |
Get the list of features that this add-on provides. More... | |
virtual PERIPHERAL_ERROR | PerformDeviceScan (unsigned int *peripheral_count, PERIPHERAL_INFO **scan_results) |
Perform a scan for joysticks. More... | |
virtual void | FreeScanResults (unsigned int peripheral_count, PERIPHERAL_INFO *scan_results) |
Free the memory allocated in PerformDeviceScan() More... | |
virtual PERIPHERAL_ERROR | GetEvents (unsigned int *event_count, PERIPHERAL_EVENT **events) |
Get all events that have occurred since the last call to GetEvents() More... | |
virtual void | FreeEvents (unsigned int event_count, PERIPHERAL_EVENT *events) |
Free the memory allocated in GetEvents() More... | |
virtual bool | SendEvent (const PERIPHERAL_EVENT *event) |
Send an input event to the peripheral. More... | |
![]() | |
IAddonInstance (ADDON_TYPE type) | |
virtual | ~IAddonInstance ()=default |
virtual ADDON_STATUS | CreateInstance (int instanceType, std::string instanceID, KODI_HANDLE instance, KODI_HANDLE &addonInstance) |
virtual ADDON_STATUS | CreateInstanceEx (int instanceType, std::string instanceID, KODI_HANDLE instance, KODI_HANDLE &addonInstance, const std::string &version) |
Joystick operations | |
virtual PERIPHERAL_ERROR | GetJoystickInfo (unsigned int index, JOYSTICK_INFO *info) |
{ More... | |
virtual void | FreeJoystickInfo (JOYSTICK_INFO *info) |
Free the memory allocated in GetJoystickInfo() More... | |
virtual PERIPHERAL_ERROR | GetFeatures (const JOYSTICK_INFO *joystick, const char *controller_id, unsigned int *feature_count, JOYSTICK_FEATURE **features) |
Get the features that allow translating the joystick into the controller profile. More... | |
virtual void | FreeFeatures (unsigned int feature_count, JOYSTICK_FEATURE *features) |
Free the memory allocated in GetFeatures() More... | |
virtual PERIPHERAL_ERROR | MapFeatures (const JOYSTICK_INFO *joystick, const char *controller_id, unsigned int feature_count, const JOYSTICK_FEATURE *features) |
Add or update joystick features. More... | |
virtual PERIPHERAL_ERROR | GetIgnoredPrimitives (const JOYSTICK_INFO *joystick, unsigned int *primitive_count, JOYSTICK_DRIVER_PRIMITIVE **primitives) |
Get the driver primitives that should be ignored while mapping the device. More... | |
virtual void | FreePrimitives (unsigned int primitive_count, JOYSTICK_DRIVER_PRIMITIVE *primitives) |
Free the memory allocated in GetIgnoredPrimitives() More... | |
virtual PERIPHERAL_ERROR | SetIgnoredPrimitives (const JOYSTICK_INFO *joystick, unsigned int primitive_count, const JOYSTICK_DRIVER_PRIMITIVE *primitives) |
Set the list of driver primitives that are ignored for the device. More... | |
virtual void | SaveButtonMap (const JOYSTICK_INFO *joystick) |
Save the button map for the given joystick. More... | |
virtual void | RevertButtonMap (const JOYSTICK_INFO *joystick) |
Revert the button map to the last time it was loaded or committed to disk. More... | |
virtual void | ResetButtonMap (const JOYSTICK_INFO *joystick, const char *controller_id) |
Reset the button map for the given joystick and controller profile ID. More... | |
virtual void | PowerOffJoystick (unsigned int index) |
Powers off the given joystick if supported. More... | |
const std::string | AddonPath () const |
const std::string | UserPath () const |
void | TriggerScan (void) |
Trigger a scan for peripherals. More... | |
void | RefreshButtonMaps (const std::string &deviceName="", const std::string &controllerId="") |
Notify the frontend that button maps have changed. More... | |
unsigned int | FeatureCount (const std::string &controllerId, JOYSTICK_FEATURE_TYPE type=JOYSTICK_FEATURE_TYPE_UNKNOWN) |
Return the number of features belonging to the specified controller. More... | |
JOYSTICK_FEATURE_TYPE | FeatureType (const std::string &controllerId, const std::string &featureName) |
Return the type of the feature. More... | |
Additional Inherited Members | |
![]() | |
const ADDON_TYPE | m_type |
|
inline |
|
inlineexplicit |
|
overridedefault |
|
inline |
|
inline |
Return the number of features belonging to the specified controller.
controllerId | The controller ID to enumerate |
type[optional] | Type to filter by, or JOYSTICK_FEATURE_TYPE_UNKNOWN for all features |
|
inline |
Return the type of the feature.
controllerId | The controller ID to check |
featureName | The feature to check |
|
inlinevirtual |
Free the memory allocated in GetEvents()
Must be called if GetEvents() returns PERIPHERAL_NO_ERROR.
event_count | The number of events allocated for the events array |
events | The array of allocated events |
|
inlinevirtual |
Free the memory allocated in GetFeatures()
Must be called if GetFeatures() returns PERIPHERAL_NO_ERROR.
feature_count | The number of features allocated for the features array |
features | The array of allocated features |
|
inlinevirtual |
Free the memory allocated in GetJoystickInfo()
|
inlinevirtual |
Free the memory allocated in GetIgnoredPrimitives()
Must be called if GetIgnoredPrimitives() returns PERIPHERAL_NO_ERROR.
primitive_count | The number of driver primitives allocated for the primitives array |
primitives | The array of allocated driver primitives |
|
inlinevirtual |
Free the memory allocated in PerformDeviceScan()
Must be called if PerformDeviceScan() returns PERIPHERAL_NO_ERROR.
peripheral_count | The number of events allocated for the events array |
scan_results | The array of allocated peripherals |
|
inlinevirtual |
Get the list of features that this add-on provides.
capabilities | The add-on's capabilities. |
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.
|
inlinevirtual |
Get all events that have occurred since the last call to GetEvents()
|
inlinevirtual |
Get the features that allow translating the joystick into the controller profile.
joystick | The device's joystick properties; unknown values may be left at their default |
controller_id | The controller profile being requested, e.g. game.controller.default |
feature_count | The number of features allocated for the features array |
features | The array of allocated features |
|
inlinevirtual |
Get the driver primitives that should be ignored while mapping the device.
joystick | The device's joystick properties; unknown values may be left at their default |
primitive_count | The number of features allocated for the primitives array |
primitives | The array of allocated driver primitives to be ignored |
|
inlinevirtual |
{
Get extended info about an attached joystick
index | The joystick's driver index |
info | The container for the allocated joystick info |
|
inlinevirtual |
Add or update joystick features.
joystick | The device's joystick properties; unknown values may be left at their default |
controller_id | The game controller profile being updated |
feature_count | The number of features in the features array |
features | The array of features |
|
inlinevirtual |
Perform a scan for joysticks.
peripheral_count | Assigned to the number of peripherals allocated |
scan_results | Assigned to allocated memory |
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.
|
inlinevirtual |
Powers off the given joystick if supported.
index | The joystick's driver index |
|
inline |
Notify the frontend that button maps have changed.
[optional] | deviceName The name of the device to refresh, or empty/null for all devices |
[optional] | controllerId The controller ID to refresh, or empty/null for all controllers |
|
inlinevirtual |
Reset the button map for the given joystick and controller profile ID.
joystick | The device's joystick properties |
controller_id | The game controller profile being reset |
|
inlinevirtual |
Revert the button map to the last time it was loaded or committed to disk.
joystick | The device's joystick properties |
|
inlinevirtual |
Save the button map for the given joystick.
joystick | The device's joystick properties |
|
inlinevirtual |
Send an input event to the peripheral.
event | The input event |
|
inlinevirtual |
Set the list of driver primitives that are ignored for the device.
joystick | The device's joystick properties; unknown values may be left at their default |
primitive_count | The number of driver features in the primitives array |
primitives | The array of driver primitives to ignore |
Trigger a scan for peripherals.
The add-on calls this if a change in hardware is detected.
|
inline |