Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
#include <PeripheralBus.h>
Public Member Functions | |
CPeripheralBus (const std::string &threadname, CPeripherals &manager, PeripheralBusType type) | |
~CPeripheralBus (void) override | |
PeripheralBusType | Type (void) const |
bool | NeedsPolling (void) const |
virtual bool | InitializeProperties (CPeripheral &peripheral) |
Initialize the properties of a peripheral with a known location. | |
virtual bool | InitializeButtonMap (const CPeripheral &peripheral, KODI::JOYSTICK::IButtonMap &buttonMap) const |
Initialize a joystick buttonmap, if possible. | |
virtual PeripheralPtr | GetPeripheral (const std::string &strLocation) const |
Get the instance of the peripheral at the given location. | |
virtual bool | HasPeripheral (const std::string &strLocation) const |
Check whether a peripheral is present at the given location. | |
virtual bool | SupportsFeature (PeripheralFeature feature) const |
Check if the bus supports the given feature. | |
virtual unsigned int | GetPeripheralsWithFeature (PeripheralVector &results, const PeripheralFeature feature) const |
Get all peripheral instances that have the given feature. | |
virtual unsigned int | GetNumberOfPeripherals () const |
virtual unsigned int | GetNumberOfPeripheralsWithId (const int iVendorId, const int iProductId) const |
virtual void | GetFeatures (std::vector< PeripheralFeature > &features) const |
Get all features that are supported by devices on this bus. | |
virtual bool | HasFeature (const PeripheralFeature feature) const |
Check whether there is at least one device present with the given feature. | |
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 void | GetDirectory (const std::string &strPath, CFileItemList &items) const |
Get all fileitems for a path. | |
virtual PeripheralPtr | GetByPath (const std::string &strPath) const |
Get the instance of a peripheral given it's path. | |
virtual void | Register (const PeripheralPtr &peripheral) |
Register a new peripheral on this bus. | |
virtual bool | FindComPort (std::string &strLocation) |
virtual void | ProcessEvents (void) |
Poll for events. | |
virtual void | EnableButtonMapping () |
Initialize button mapping. | |
virtual void | PowerOff (const std::string &strLocation) |
Power off the specified device. | |
Protected Member Functions | |
void | Process (void) override |
virtual bool | ScanForDevices (void) |
virtual void | UnregisterRemovedDevices (const PeripheralScanResults &results) |
virtual void | RegisterNewDevices (const PeripheralScanResults &results) |
virtual bool | PerformDeviceScan (PeripheralScanResults &results)=0 |
Scan for devices on this bus and add them to the results list. This will have to be implemented for each bus. | |
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 () |
Protected Attributes | |
PeripheralVector | m_peripherals |
std::chrono::milliseconds | m_iRescanTime |
bool | m_bNeedsPolling |
CPeripherals & | m_manager |
const PeripheralBusType | m_type |
CCriticalSection | m_critSection |
CEvent | m_triggerEvent |
Protected Attributes inherited from CThread | |
std::atomic< bool > | m_bStop |
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 CThread * | GetCurrentThread () |
This represents a bus on the system. By default, this bus instance will scan for changes every 5 seconds. If this bus only has to be updated after a notification sent by the system, set m_bNeedsPolling to false in the constructor, and implement the OnDeviceAdded(), OnDeviceChanged() and OnDeviceRemoved() methods.
The PerformDeviceScan() method has to be implemented by each specific bus implementation.
CPeripheralBus::CPeripheralBus | ( | const std::string & | threadname, |
CPeripherals & | manager, | ||
PeripheralBusType | type ) |
|
inlineoverride |
Stop the polling thread and clear all known devices on this bus.
Reimplemented in PERIPHERALS::CPeripheralBusUSB.
|
inlinevirtual |
Initialize button mapping.
Reimplemented in PERIPHERALS::CPeripheralBusAddon.
|
inlinevirtual |
|
virtual |
Get the instance of a peripheral given it's path.
strPath | The path to the peripheral. |
Reimplemented in PERIPHERALS::CPeripheralBusAddon.
|
virtual |
Get all fileitems for a path.
strPath | The path to the directory to get the items from. |
items | The item list. |
Reimplemented in PERIPHERALS::CPeripheralBusAddon, and PERIPHERALS::CPeripheralBusApplication.
|
virtual |
Get all features that are supported by devices on this bus.
features | All features. |
Reimplemented in PERIPHERALS::CPeripheralBusAddon.
Reimplemented in PERIPHERALS::CPeripheralBusAddon.
|
virtual |
Reimplemented in PERIPHERALS::CPeripheralBusAddon.
|
virtual |
Get the instance of the peripheral at the given location.
strLocation | The location. |
Reimplemented in PERIPHERALS::CPeripheralBusAddon.
|
virtual |
Get all peripheral instances that have the given feature.
results | The list of results. |
feature | The feature to search for. |
Reimplemented in PERIPHERALS::CPeripheralBusAddon.
|
virtual |
Check whether there is at least one device present with the given feature.
feature | The feature to check for. |
Reimplemented in PERIPHERALS::CPeripheralBusAddon.
|
virtual |
Check whether a peripheral is present at the given location.
strLocation | The location. |
Initialise this bus and start a polling thread if this bus needs polling.
Reimplemented in PERIPHERALS::CPeripheralBusAndroid, PERIPHERALS::CPeripheralBusApplication, and PERIPHERALS::CPeripheralBusGCController.
|
inlinevirtual |
Initialize a joystick buttonmap, if possible.
Reimplemented in PERIPHERALS::CPeripheralBusAndroid.
|
virtual |
Initialize the properties of a peripheral with a known location.
Reimplemented in PERIPHERALS::CPeripheralBusAddon, PERIPHERALS::CPeripheralBusAndroid, and PERIPHERALS::CPeripheralBusGCController.
|
virtual |
Callback method for when a device has been added. Will perform a device scan.
strLocation | The location of the device that has been added. |
|
virtual |
Callback method for when a device has been changed. Will perform a device scan.
strLocation | The location of the device that has been changed. |
|
virtual |
Callback method for when a device has been removed. Will perform a device scan.
strLocation | The location of the device that has been removed. |
|
protectedpure virtual |
Scan for devices on this bus and add them to the results list. This will have to be implemented for each bus.
results | The result list. |
Implemented in PERIPHERALS::CPeripheralBusAddon, PERIPHERALS::CPeripheralBusAndroid, PERIPHERALS::CPeripheralBusApplication, PERIPHERALS::CPeripheralBusCEC, PERIPHERALS::CPeripheralBusGCController, PERIPHERALS::CPeripheralBusUSB, PERIPHERALS::CPeripheralBusUSB, PERIPHERALS::CPeripheralBusUSB, PERIPHERALS::CPeripheralBusUSB, and PERIPHERALS::CPeripheralBusUSB.
|
inlinevirtual |
Power off the specified device.
strLocation | The device's location |
Reimplemented in PERIPHERALS::CPeripheralBusAddon.
Reimplemented from CThread.
Reimplemented in PERIPHERALS::CPeripheralBusUSB.
Poll for events.
Reimplemented in PERIPHERALS::CPeripheralBusAddon, PERIPHERALS::CPeripheralBusAndroid, and PERIPHERALS::CPeripheralBusGCController.
|
virtual |
Register a new peripheral on this bus.
peripheral | The peripheral to register. |
Reimplemented in PERIPHERALS::CPeripheralBusAddon.
|
protectedvirtual |
|
inlinevirtual |
Check if the bus supports the given feature.
feature | The feature to check for |
Reimplemented in PERIPHERALS::CPeripheralBusAddon.
|
inline |
|
protectedvirtual |
Reimplemented in PERIPHERALS::CPeripheralBusAddon.
|
protected |
true when this bus needs to be polled for new devices, false when it uses callbacks to notify this bus of changed
|
mutableprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |