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

#include <PeripheralBusAddon.h>

Inheritance diagram for PERIPHERALS::CPeripheralBusAddon:
PERIPHERALS::CPeripheralBus CThread

Public Member Functions

 CPeripheralBusAddon (CPeripherals &manager)
 
 ~CPeripheralBusAddon (void) override
 
void UpdateAddons (void)
 
bool GetAddonWithButtonMap (PeripheralAddonPtr &addon) const
 Get peripheral add-on that can provide button maps.
 
bool GetAddonWithButtonMap (const CPeripheral *device, PeripheralAddonPtr &addon) const
 Get peripheral add-on that can provide button maps for the given device.
 
bool SendRumbleEvent (const std::string &strLocation, unsigned int motorIndex, float magnitude)
 Set the rumble state of a rumble motor.
 
bool InitializeProperties (CPeripheral &peripheral) override
 Initialize the properties of a peripheral with a known location.
 
void Register (const PeripheralPtr &peripheral) override
 Register a new peripheral on this bus.
 
void GetFeatures (std::vector< PeripheralFeature > &features) const override
 Get all features that are supported by devices on this bus.
 
bool HasFeature (const PeripheralFeature feature) const override
 Check whether there is at least one device present with the given feature.
 
PeripheralPtr GetPeripheral (const std::string &strLocation) const override
 Get the instance of the peripheral at the given location.
 
PeripheralPtr GetByPath (const std::string &strPath) const override
 Get the instance of a peripheral given it's path.
 
bool SupportsFeature (PeripheralFeature feature) const override
 Check if the bus supports the given feature.
 
unsigned int GetPeripheralsWithFeature (PeripheralVector &results, const PeripheralFeature feature) const override
 Get all peripheral instances that have the given feature.
 
unsigned int GetNumberOfPeripherals (void) const override
 
unsigned int GetNumberOfPeripheralsWithId (const int iVendorId, const int iProductId) const override
 
void GetDirectory (const std::string &strPath, CFileItemList &items) const override
 Get all fileitems for a path.
 
void ProcessEvents (void) override
 Poll for events.
 
void EnableButtonMapping () override
 Initialize button mapping.
 
void PowerOff (const std::string &strLocation) override
 Power off the specified device.
 
bool SplitLocation (const std::string &strLocation, PeripheralAddonPtr &addon, unsigned int &peripheralIndex) const
 
- Public Member Functions inherited from PERIPHERALS::CPeripheralBus
 CPeripheralBus (const std::string &threadname, CPeripherals &manager, PeripheralBusType type)
 
 ~CPeripheralBus (void) override
 
PeripheralBusType Type (void) const
 
bool NeedsPolling (void) const
 
virtual bool InitializeButtonMap (const CPeripheral &peripheral, KODI::JOYSTICK::IButtonMap &buttonMap) const
 Initialize a joystick buttonmap, if possible.
 
virtual bool HasPeripheral (const std::string &strLocation) const
 Check whether a peripheral is present at the given location.
 
virtual void OnDeviceAdded (const std::string &strLocation)
 Callback method for when a device has been added. Will perform a device scan.
 
virtual void OnDeviceChanged (const std::string &strLocation)
 Callback method for when a device has been changed. Will perform a device scan.
 
virtual void OnDeviceRemoved (const std::string &strLocation)
 Callback method for when a device has been removed. Will perform a device scan.
 
virtual void Initialise (void)
 Initialise this bus and start a polling thread if this bus needs polling.
 
virtual void Clear (void)
 Stop the polling thread and clear all known devices on this bus.
 
virtual void TriggerDeviceScan (void)
 Scan for devices.
 
virtual bool FindComPort (std::string &strLocation)
 

Protected Member Functions

bool PerformDeviceScan (PeripheralScanResults &results) override
 Scan for devices on this bus and add them to the results list. This will have to be implemented for each bus.
 
void UnregisterRemovedDevices (const PeripheralScanResults &results) override
 
- Protected Member Functions inherited from PERIPHERALS::CPeripheralBus
void Process (void) override
 
virtual bool ScanForDevices (void)
 
virtual void RegisterNewDevices (const PeripheralScanResults &results)
 
- 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 PERIPHERALS::CPeripheralBus
PeripheralVector m_peripherals
 
std::chrono::milliseconds m_iRescanTime
 
bool m_bNeedsPolling
 
CPeripheralsm_manager
 
const PeripheralBusType m_type
 
CCriticalSection m_critSection
 
CEvent m_triggerEvent
 
- Protected Attributes inherited from CThread
std::atomic< boolm_bStop
 

Constructor & Destructor Documentation

◆ CPeripheralBusAddon()

CPeripheralBusAddon::CPeripheralBusAddon ( CPeripherals & manager)
explicit

◆ ~CPeripheralBusAddon()

CPeripheralBusAddon::~CPeripheralBusAddon ( void )
override

Member Function Documentation

◆ EnableButtonMapping()

void CPeripheralBusAddon::EnableButtonMapping ( )
overridevirtual

Initialize button mapping.

Returns
True if button mapping is enabled for this bus

Reimplemented from PERIPHERALS::CPeripheralBus.

◆ GetAddonWithButtonMap() [1/2]

bool CPeripheralBusAddon::GetAddonWithButtonMap ( const CPeripheral * device,
PeripheralAddonPtr & addon ) const

Get peripheral add-on that can provide button maps for the given device.

◆ GetAddonWithButtonMap() [2/2]

bool CPeripheralBusAddon::GetAddonWithButtonMap ( PeripheralAddonPtr & addon) const

Get peripheral add-on that can provide button maps.

◆ GetByPath()

PeripheralPtr CPeripheralBusAddon::GetByPath ( const std::string & strPath) const
overridevirtual

Get the instance of a peripheral given it's path.

Parameters
strPathThe path to the peripheral.
Returns
The peripheral or NULL if it wasn't found.

Reimplemented from PERIPHERALS::CPeripheralBus.

◆ GetDirectory()

void CPeripheralBusAddon::GetDirectory ( const std::string & strPath,
CFileItemList & items ) const
overridevirtual

Get all fileitems for a path.

Parameters
strPathThe path to the directory to get the items from.
itemsThe item list.

Reimplemented from PERIPHERALS::CPeripheralBus.

◆ GetFeatures()

void CPeripheralBusAddon::GetFeatures ( std::vector< PeripheralFeature > & features) const
overridevirtual

Get all features that are supported by devices on this bus.

Parameters
featuresAll features.

Reimplemented from PERIPHERALS::CPeripheralBus.

◆ GetNumberOfPeripherals()

unsigned int CPeripheralBusAddon::GetNumberOfPeripherals ( void ) const
overridevirtual

Reimplemented from PERIPHERALS::CPeripheralBus.

◆ GetNumberOfPeripheralsWithId()

unsigned int CPeripheralBusAddon::GetNumberOfPeripheralsWithId ( const int iVendorId,
const int iProductId ) const
overridevirtual

Reimplemented from PERIPHERALS::CPeripheralBus.

◆ GetPeripheral()

PeripheralPtr CPeripheralBusAddon::GetPeripheral ( const std::string & strLocation) const
overridevirtual

Get the instance of the peripheral at the given location.

Parameters
strLocationThe location.
Returns
The peripheral or NULL if it wasn't found.

Reimplemented from PERIPHERALS::CPeripheralBus.

◆ GetPeripheralsWithFeature()

unsigned int CPeripheralBusAddon::GetPeripheralsWithFeature ( PeripheralVector & results,
const PeripheralFeature feature ) const
overridevirtual

Get all peripheral instances that have the given feature.

Parameters
resultsThe list of results.
featureThe feature to search for.
Returns
The number of devices that have been found.

Reimplemented from PERIPHERALS::CPeripheralBus.

◆ HasFeature()

bool CPeripheralBusAddon::HasFeature ( const PeripheralFeature feature) const
overridevirtual

Check whether there is at least one device present with the given feature.

Parameters
featureThe feature to check for.
Returns
True when at least one device was found with this feature, false otherwise.

Reimplemented from PERIPHERALS::CPeripheralBus.

◆ InitializeProperties()

bool CPeripheralBusAddon::InitializeProperties ( CPeripheral & peripheral)
overridevirtual

Initialize the properties of a peripheral with a known location.

Reimplemented from PERIPHERALS::CPeripheralBus.

◆ PerformDeviceScan()

bool CPeripheralBusAddon::PerformDeviceScan ( PeripheralScanResults & results)
overrideprotectedvirtual

Scan for devices on this bus and add them to the results list. This will have to be implemented for each bus.

Parameters
resultsThe result list.
Returns
True when the scan was successful, false otherwise.

Implements PERIPHERALS::CPeripheralBus.

◆ PowerOff()

void CPeripheralBusAddon::PowerOff ( const std::string & strLocation)
overridevirtual

Power off the specified device.

Parameters
strLocationThe device's location

Reimplemented from PERIPHERALS::CPeripheralBus.

◆ ProcessEvents()

void CPeripheralBusAddon::ProcessEvents ( void )
overridevirtual

Poll for events.

Reimplemented from PERIPHERALS::CPeripheralBus.

◆ Register()

void CPeripheralBusAddon::Register ( const PeripheralPtr & peripheral)
overridevirtual

Register a new peripheral on this bus.

Parameters
peripheralThe peripheral to register.

Reimplemented from PERIPHERALS::CPeripheralBus.

◆ SendRumbleEvent()

bool CPeripheralBusAddon::SendRumbleEvent ( const std::string & strLocation,
unsigned int motorIndex,
float magnitude )

Set the rumble state of a rumble motor.

Parameters
strLocationThe location of the peripheral with the motor
motorIndexThe index of the motor being rumbled
magnitudeThe amount of vibration in the closed interval [0.0, 1.0]
Returns
true if the rumble motor's state is set, false otherwise

TODO: Move declaration to parent class

◆ SplitLocation()

bool CPeripheralBusAddon::SplitLocation ( const std::string & strLocation,
PeripheralAddonPtr & addon,
unsigned int & peripheralIndex ) const

◆ SupportsFeature()

bool CPeripheralBusAddon::SupportsFeature ( PeripheralFeature feature) const
overridevirtual

Check if the bus supports the given feature.

Parameters
featureThe feature to check for
Returns
True if the bus supports the feature, false otherwise

Reimplemented from PERIPHERALS::CPeripheralBus.

◆ UnregisterRemovedDevices()

void CPeripheralBusAddon::UnregisterRemovedDevices ( const PeripheralScanResults & results)
overrideprotectedvirtual

Reimplemented from PERIPHERALS::CPeripheralBus.

◆ UpdateAddons()

void CPeripheralBusAddon::UpdateAddons ( void )

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