11 #include "peripherals/PeripheralTypes.h" 12 #include "threads/Thread.h" 45 PeripheralBusType
Type(
void)
const {
return m_type; }
53 std::unique_lock<CCriticalSection> lock(m_critSection);
67 virtual PeripheralPtr
GetPeripheral(
const std::string& strLocation)
const;
74 virtual bool HasPeripheral(
const std::string& strLocation)
const;
90 const PeripheralFeature feature)
const;
92 virtual unsigned int GetNumberOfPeripherals()
const;
93 virtual unsigned int GetNumberOfPeripheralsWithId(
const int iVendorId,
94 const int iProductId)
const;
100 virtual void GetFeatures(std::vector<PeripheralFeature>& features)
const;
107 virtual bool HasFeature(
const PeripheralFeature feature)
const;
135 virtual void Clear(
void);
154 virtual PeripheralPtr
GetByPath(
const std::string& strPath)
const;
160 virtual void Register(
const PeripheralPtr& peripheral);
162 virtual bool FindComPort(std::string& strLocation) {
return false; }
179 virtual void PowerOff(
const std::string& strLocation) {}
182 void Process(
void)
override;
183 virtual bool ScanForDevices(
void);
195 PeripheralVector m_peripherals;
196 std::chrono::milliseconds m_iRescanTime;
201 const PeripheralBusType m_type;
202 mutable CCriticalSection m_critSection;
205 using PeripheralBusPtr = std::shared_ptr<CPeripheralBus>;
206 using PeripheralBusVector = std::vector<PeripheralBusPtr>;
Definition: PeripheralTypes.h:356
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:51
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:179
virtual PeripheralPtr GetByPath(const std::string &strPath) const
Get the instance of a peripheral given it's path.
Definition: PeripheralBus.cpp:330
Definition: RetroPlayerInput.h:15
Represents a list of files.
Definition: FileItem.h:702
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:45
virtual bool SupportsFeature(PeripheralFeature feature) const
Check if the bus supports the given feature.
Definition: PeripheralBus.h:81
bool m_bNeedsPolling
Definition: PeripheralBus.h:197
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:167
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:173
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:36
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:71
virtual void GetDirectory(const std::string &strPath, CFileItemList &items) const
Get all fileitems for a path.
Definition: PeripheralBus.cpp:295
Definition: Peripherals.h:56