11 #include "peripherals/PeripheralTypes.h" 12 #include "threads/Thread.h" 43 PeripheralBusType
Type(
void)
const {
return m_type; }
51 std::unique_lock<CCriticalSection> lock(m_critSection);
65 virtual PeripheralPtr
GetPeripheral(
const std::string& strLocation)
const;
72 virtual bool HasPeripheral(
const std::string& strLocation)
const;
88 const PeripheralFeature feature)
const;
90 virtual unsigned int GetNumberOfPeripherals()
const;
91 virtual unsigned int GetNumberOfPeripheralsWithId(
const int iVendorId,
92 const int iProductId)
const;
98 virtual void GetFeatures(std::vector<PeripheralFeature>& features)
const;
105 virtual bool HasFeature(
const PeripheralFeature feature)
const;
133 virtual void Clear(
void);
152 virtual PeripheralPtr
GetByPath(
const std::string& strPath)
const;
158 virtual void Register(
const PeripheralPtr& peripheral);
160 virtual bool FindComPort(std::string& strLocation) {
return false; }
177 virtual void PowerOff(
const std::string& strLocation) {}
180 void Process(
void)
override;
181 virtual bool ScanForDevices(
void);
193 PeripheralVector m_peripherals;
194 std::chrono::milliseconds m_iRescanTime;
199 const PeripheralBusType m_type;
200 mutable CCriticalSection m_critSection;
203 using PeripheralBusPtr = std::shared_ptr<CPeripheralBus>;
204 using PeripheralBusVector = std::vector<PeripheralBusPtr>;
Definition: PeripheralTypes.h:348
This is an Event class built from a ConditionVariable.
Definition: Event.h:35
virtual void Initialise(void)
Initialise this bus and start a polling thread if this bus needs polling.
Definition: PeripheralBus.cpp:230
bool NeedsPolling(void) const
Definition: PeripheralBus.h:49
virtual void OnDeviceChanged(const std::string &strLocation)
Callback method for when a device has been changed. Will perform a device scan.
Definition: PeripheralBus.cpp:50
virtual bool HasPeripheral(const std::string &strLocation) const
Check whether a peripheral is present at the given location.
Definition: PeripheralBus.cpp:290
virtual void Clear(void)
Stop the polling thread and clear all known devices on this bus.
Definition: PeripheralBus.cpp:60
virtual void TriggerDeviceScan(void)
Scan for devices.
Definition: PeripheralBus.cpp:275
virtual void PowerOff(const std::string &strLocation)
Power off the specified device.
Definition: PeripheralBus.h:177
virtual PeripheralPtr GetByPath(const std::string &strPath) const
Get the instance of a peripheral given it's path.
Definition: PeripheralBus.cpp:329
Definition: RetroPlayerInput.h:15
Represents a list of files.
Definition: FileItem.h:721
virtual void OnDeviceAdded(const std::string &strLocation)
Callback method for when a device has been added. Will perform a device scan.
Definition: PeripheralBus.cpp:45
virtual bool HasFeature(const PeripheralFeature feature) const
Check whether there is at least one device present with the given feature.
Definition: PeripheralBus.cpp:141
PeripheralBusType Type(void) const
Definition: PeripheralBus.h:43
virtual bool SupportsFeature(PeripheralFeature feature) const
Check if the bus supports the given feature.
Definition: PeripheralBus.h:79
bool m_bNeedsPolling
Definition: PeripheralBus.h:195
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 e...
virtual PeripheralPtr GetPeripheral(const std::string &strLocation) const
Get the instance of the peripheral at the given location.
Definition: PeripheralBus.cpp:163
virtual unsigned int GetPeripheralsWithFeature(PeripheralVector &results, const PeripheralFeature feature) const
Get all peripheral instances that have the given feature.
Definition: PeripheralBus.cpp:178
virtual void ProcessEvents(void)
Poll for events.
Definition: PeripheralBus.h:165
virtual bool InitializeProperties(CPeripheral &peripheral)
Initialize the properties of a peripheral with a known location.
Definition: PeripheralBus.cpp:40
virtual void Register(const PeripheralPtr &peripheral)
Register a new peripheral on this bus.
Definition: PeripheralBus.cpp:248
virtual void EnableButtonMapping()
Initialize button mapping.
Definition: PeripheralBus.h:171
virtual void OnDeviceRemoved(const std::string &strLocation)
Callback method for when a device has been removed. Will perform a device scan.
Definition: PeripheralBus.cpp:55
Definition: PeripheralBus.h:34
virtual void GetFeatures(std::vector< PeripheralFeature > &features) const
Get all features that are supported by devices on this bus.
Definition: PeripheralBus.cpp:156
Definition: Peripheral.h:61
virtual void GetDirectory(const std::string &strPath, CFileItemList &items) const
Get all fileitems for a path.
Definition: PeripheralBus.cpp:295
Definition: Peripherals.h:53