xbmc
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
PERIPHERALS::CPeripheral Class Reference
Inheritance diagram for PERIPHERALS::CPeripheral:
Inheritance graph
[legend]
Collaboration diagram for PERIPHERALS::CPeripheral:
Collaboration graph
[legend]

Public Member Functions

 CPeripheral (CPeripherals &manager, const PeripheralScanResult &scanResult, CPeripheralBus *bus)
 
bool operator== (const CPeripheral &right) const
 
bool operator!= (const CPeripheral &right) const
 
bool operator== (const PeripheralScanResult &right) const
 
bool operator!= (const PeripheralScanResult &right) const
 
const std::string & FileLocation (void) const
 
const std::string & Location (void) const
 
int VendorId (void) const
 
const char * VendorIdAsString (void) const
 
int ProductId (void) const
 
const char * ProductIdAsString (void) const
 
PeripheralType Type (void) const
 
PeripheralBusType GetBusType (void) const
 
const std::string & DeviceName (void) const
 
bool IsHidden (void) const
 
void SetHidden (bool bSetTo=true)
 
const std::string & GetVersionInfo (void) const
 
virtual std::string GetIcon () const
 Get an icon for this peripheral. More...
 
bool HasFeature (const PeripheralFeature feature) const
 Check whether this device has the given feature. More...
 
void GetFeatures (std::vector< PeripheralFeature > &features) const
 Get all features that are supported by this device. More...
 
bool Initialise (void)
 Initialises the peripheral. More...
 
virtual bool InitialiseFeature (const PeripheralFeature feature)
 Initialise one of the features of this peripheral. More...
 
virtual void OnUserNotification ()
 Briefly activate a feature to notify the user.
 
virtual bool TestFeature (PeripheralFeature feature)
 Briefly test one of the features of this peripheral. More...
 
virtual void OnSettingChanged (const std::string &strChangedSetting)
 Called when a setting changed. More...
 
virtual void OnDeviceRemoved (void)
 Called when this device is removed, before calling the destructor.
 
virtual void GetSubdevices (PeripheralVector &subDevices) const
 Get all subdevices if this device is multifunctional. More...
 
virtual bool IsMultiFunctional (void) const
 
virtual void AddSetting (const std::string &strKey, const std::shared_ptr< const CSetting > &setting, int order)
 Add a setting to this peripheral. This will overwrite a previous setting with the same key. More...
 
virtual bool HasSetting (const std::string &strKey) const
 Check whether a setting is known with the given key. More...
 
virtual bool HasSettings (void) const
 
virtual bool HasConfigurableSettings (void) const
 
virtual const std::string GetSettingString (const std::string &strKey) const
 Get the value of a setting. More...
 
virtual bool SetSetting (const std::string &strKey, const std::string &strValue)
 
virtual void SetSettingVisible (const std::string &strKey, bool bSetTo)
 
virtual bool IsSettingVisible (const std::string &strKey) const
 
virtual int GetSettingInt (const std::string &strKey) const
 
virtual bool SetSetting (const std::string &strKey, int iValue)
 
virtual bool GetSettingBool (const std::string &strKey) const
 
virtual bool SetSetting (const std::string &strKey, bool bValue)
 
virtual float GetSettingFloat (const std::string &strKey) const
 
virtual bool SetSetting (const std::string &strKey, float fValue)
 
virtual void PersistSettings (bool bExiting=false)
 
virtual void LoadPersistedSettings (void)
 
virtual void ResetDefaultSettings (void)
 
virtual std::vector< std::shared_ptr< CSetting > > GetSettings (void) const
 
virtual bool ErrorOccured (void) const
 
virtual void RegisterJoystickDriverHandler (KODI::JOYSTICK::IDriverHandler *handler, bool bPromiscuous)
 
virtual void UnregisterJoystickDriverHandler (KODI::JOYSTICK::IDriverHandler *handler)
 
virtual void RegisterKeyboardDriverHandler (KODI::KEYBOARD::IKeyboardDriverHandler *handler, bool bPromiscuous)
 
virtual void UnregisterKeyboardDriverHandler (KODI::KEYBOARD::IKeyboardDriverHandler *handler)
 
virtual void RegisterMouseDriverHandler (KODI::MOUSE::IMouseDriverHandler *handler, bool bPromiscuous)
 
virtual void UnregisterMouseDriverHandler (KODI::MOUSE::IMouseDriverHandler *handler)
 
void RegisterInputHandler (KODI::JOYSTICK::IInputHandler *handler, bool bPromiscuous) override
 Register a handler for the provided input. More...
 
void UnregisterInputHandler (KODI::JOYSTICK::IInputHandler *handler) override
 Unregister a handler. More...
 
void RegisterKeyboardHandler (KODI::KEYBOARD::IKeyboardInputHandler *handler, bool bPromiscuous) override
 Registers a handler to be called on keyboard input. More...
 
void UnregisterKeyboardHandler (KODI::KEYBOARD::IKeyboardInputHandler *handler) override
 Unregisters handler from keyboard input. More...
 
void RegisterMouseHandler (KODI::MOUSE::IMouseInputHandler *handler, bool bPromiscuous) override
 Registers a handler to be called on mouse input. More...
 
void UnregisterMouseHandler (KODI::MOUSE::IMouseInputHandler *handler) override
 Unregisters handler from mouse input. More...
 
virtual void RegisterJoystickButtonMapper (KODI::JOYSTICK::IButtonMapper *mapper)
 
virtual void UnregisterJoystickButtonMapper (KODI::JOYSTICK::IButtonMapper *mapper)
 
virtual KODI::JOYSTICK::IDriverReceiverGetDriverReceiver ()
 
virtual IKeymapGetKeymap (const std::string &controllerId)
 
virtual CDateTime LastActive ()
 Return the last time this peripheral was active. More...
 
virtual KODI::GAME::ControllerPtr ControllerProfile () const
 Get the controller profile that best represents this peripheral. More...
 

Protected Member Functions

virtual void ClearSettings (void)
 

Protected Attributes

CPeripheralsm_manager
 
PeripheralType m_type
 
PeripheralBusType m_busType
 
PeripheralBusType m_mappedBusType
 
std::string m_strLocation
 
std::string m_strDeviceName
 
std::string m_strSettingsFile
 
std::string m_strFileLocation
 
int m_iVendorId
 
std::string m_strVendorId
 
int m_iProductId
 
std::string m_strProductId
 
std::string m_strVersionInfo
 
bool m_bInitialised
 
bool m_bHidden
 
bool m_bError
 
std::vector< PeripheralFeature > m_features
 
PeripheralVector m_subDevices
 
std::map< std::string, PeripheralDeviceSettingm_settings
 
std::set< std::string > m_changedSettings
 
CPeripheralBusm_bus
 
std::map< KODI::JOYSTICK::IInputHandler *, std::unique_ptr< KODI::JOYSTICK::IDriverHandler > > m_inputHandlers
 
std::map< KODI::KEYBOARD::IKeyboardInputHandler *, std::unique_ptr< KODI::KEYBOARD::IKeyboardDriverHandler > > m_keyboardHandlers
 
std::map< KODI::MOUSE::IMouseInputHandler *, std::unique_ptr< KODI::MOUSE::IMouseDriverHandler > > m_mouseHandlers
 
std::map< KODI::JOYSTICK::IButtonMapper *, std::unique_ptr< CAddonButtonMapping > > m_buttonMappers
 

Friends

class CGUIDialogPeripheralSettings
 

Member Function Documentation

◆ AddSetting()

void CPeripheral::AddSetting ( const std::string &  strKey,
const std::shared_ptr< const CSetting > &  setting,
int  order 
)
virtual

Add a setting to this peripheral. This will overwrite a previous setting with the same key.

Parameters
strKeyThe key of the setting.
settingThe setting.
Todo:
add more types if needed

Reimplemented in PERIPHERALS::CPeripheralImon.

◆ ControllerProfile()

virtual KODI::GAME::ControllerPtr PERIPHERALS::CPeripheral::ControllerProfile ( ) const
inlinevirtual

Get the controller profile that best represents this peripheral.

Returns
The controller profile, or empty if unknown

Reimplemented in PERIPHERALS::CPeripheralJoystick, PERIPHERALS::CPeripheralKeyboard, and PERIPHERALS::CPeripheralMouse.

◆ GetFeatures()

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

Get all features that are supported by this device.

Parameters
featuresThe features.

◆ GetIcon()

std::string CPeripheral::GetIcon ( ) const
virtual

Get an icon for this peripheral.

Returns
Path to an icon, or skin icon file name

◆ GetSettingString()

const std::string CPeripheral::GetSettingString ( const std::string &  strKey) const
virtual

Get the value of a setting.

Parameters
strKeyThe key to search.
Returns
The value or an empty string if it wasn't found.

◆ GetSubdevices()

void CPeripheral::GetSubdevices ( PeripheralVector &  subDevices) const
virtual

Get all subdevices if this device is multifunctional.

Parameters
subDevicesThe subdevices.

◆ HasConfigurableSettings()

bool CPeripheral::HasConfigurableSettings ( void  ) const
virtual
Returns
True when this device has any configurable settings, false otherwise.

◆ HasFeature()

bool CPeripheral::HasFeature ( const PeripheralFeature  feature) const

Check whether this device has the given feature.

Parameters
featureThe feature to check for.
Returns
True when the device has the feature, false otherwise.

◆ HasSetting()

bool CPeripheral::HasSetting ( const std::string &  strKey) const
virtual

Check whether a setting is known with the given key.

Parameters
strKeyThe key to search.
Returns
True when found, false otherwise.

◆ HasSettings()

bool CPeripheral::HasSettings ( void  ) const
virtual
Returns
True when this device has any settings, false otherwise.

◆ Initialise()

bool CPeripheral::Initialise ( void  )

Initialises the peripheral.

Returns
True when the peripheral has been initialised successfully, false otherwise.

◆ InitialiseFeature()

virtual bool PERIPHERALS::CPeripheral::InitialiseFeature ( const PeripheralFeature  feature)
inlinevirtual

Initialise one of the features of this peripheral.

Parameters
featureThe feature to initialise.
Returns
True when the feature has been initialised successfully, false otherwise.

Reimplemented in PERIPHERALS::CPeripheralJoystick, PERIPHERALS::CPeripheralKeyboard, PERIPHERALS::CPeripheralMouse, PERIPHERALS::CPeripheralImon, and PERIPHERALS::CPeripheralHID.

◆ IsMultiFunctional()

bool CPeripheral::IsMultiFunctional ( void  ) const
virtual
Returns
True when this device is multifunctional, false otherwise.

◆ LastActive()

CDateTime CPeripheral::LastActive ( )
virtual

Return the last time this peripheral was active.

Returns
The time of last activation, or invalid if unknown/never active

Reimplemented in PERIPHERALS::CPeripheralJoystick, PERIPHERALS::CPeripheralKeyboard, and PERIPHERALS::CPeripheralMouse.

◆ OnSettingChanged()

virtual void PERIPHERALS::CPeripheral::OnSettingChanged ( const std::string &  strChangedSetting)
inlinevirtual

Called when a setting changed.

Parameters
strChangedSettingThe changed setting.

Reimplemented in PERIPHERALS::CPeripheralHID, and PERIPHERALS::CPeripheralImon.

◆ RegisterInputHandler()

void CPeripheral::RegisterInputHandler ( KODI::JOYSTICK::IInputHandler handler,
bool  bPromiscuous 
)
overridevirtual

Register a handler for the provided input.

Parameters
handlerThe handler to receive input provided by this class
bPromiscuousIf true, receives all input (including handled input) in the background

Implements KODI::JOYSTICK::IInputProvider.

◆ RegisterKeyboardHandler()

void CPeripheral::RegisterKeyboardHandler ( KODI::KEYBOARD::IKeyboardInputHandler handler,
bool  bPromiscuous 
)
overridevirtual

Registers a handler to be called on keyboard input.

Parameters
handlerThe handler to receive keyboard input provided by this class
bPromiscuousTrue to observe all events without affecting the input's destination

Implements KODI::KEYBOARD::IKeyboardInputProvider.

◆ RegisterMouseHandler()

void CPeripheral::RegisterMouseHandler ( KODI::MOUSE::IMouseInputHandler handler,
bool  bPromiscuous 
)
overridevirtual

Registers a handler to be called on mouse input.

Parameters
handlerThe handler to receive mouse input provided by this class
bPromiscuousTrue to observe all events without affecting subsequent handlers

Implements KODI::MOUSE::IMouseInputProvider.

◆ TestFeature()

virtual bool PERIPHERALS::CPeripheral::TestFeature ( PeripheralFeature  feature)
inlinevirtual

Briefly test one of the features of this peripheral.

Parameters
featureThe feature to test.
Returns
True if the test succeeded, false otherwise.

Reimplemented in PERIPHERALS::CPeripheralJoystick.

◆ UnregisterInputHandler()

void CPeripheral::UnregisterInputHandler ( KODI::JOYSTICK::IInputHandler handler)
overridevirtual

Unregister a handler.

Parameters
handlerThe handler that was receiving input

Implements KODI::JOYSTICK::IInputProvider.

◆ UnregisterKeyboardHandler()

void CPeripheral::UnregisterKeyboardHandler ( KODI::KEYBOARD::IKeyboardInputHandler handler)
overridevirtual

Unregisters handler from keyboard input.

Parameters
handlerThe handler that was receiving keyboard input

Implements KODI::KEYBOARD::IKeyboardInputProvider.

◆ UnregisterMouseHandler()

void CPeripheral::UnregisterMouseHandler ( KODI::MOUSE::IMouseInputHandler handler)
overridevirtual

Unregisters handler from mouse input.

Parameters
handlerThe handler that was receiving mouse input

Implements KODI::MOUSE::IMouseInputProvider.


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