diff --git a/guh.pri b/guh.pri index ddb3f427..6d40200d 100644 --- a/guh.pri +++ b/guh.pri @@ -13,6 +13,7 @@ QT+= network QMAKE_CXXFLAGS += -Werror -std=c++11 -g QMAKE_LFLAGS += -std=c++11 +QMAKE_CXX = ccache g++ top_srcdir=$$PWD top_builddir=$$shadowed($$PWD) diff --git a/libguh/plugin/deviceclass.cpp b/libguh/plugin/deviceclass.cpp index 46ce7864..8d3c7d1e 100644 --- a/libguh/plugin/deviceclass.cpp +++ b/libguh/plugin/deviceclass.cpp @@ -161,15 +161,19 @@ /*! Constructs a DeviceClass with the give \a pluginId ,\a vendorId and \a id . When implementing a plugin, create a DeviceClass for each device you support. Generate a new uuid (e.g. uuidgen) and hardode it into the plugin. The id - should never change or it will appear as a new DeviceClass in the system.*/ + should never change or it will appear as a new DeviceClass in the system. */ DeviceClass::DeviceClass(const PluginId &pluginId, const VendorId &vendorId, const DeviceClassId &id): m_id(id), m_vendorId(vendorId), m_pluginId(pluginId), + m_criticalStateTypeId(StateTypeId()), + m_primaryStateTypeId(StateTypeId()), + m_primaryActionTypeId(ActionTypeId()), m_deviceIcon(DeviceIconPower), m_createMethods(CreateMethodUser), m_setupMethod(SetupMethodJustAdd) { + } /*! Returns the id of this \l{DeviceClass}. */ @@ -190,31 +194,68 @@ PluginId DeviceClass::pluginId() const return m_pluginId; } -/*! Returns true if this \l{DeviceClass}'s id, vendorId and pluginId are valid uuids. */ +/*! Returns true if this \l{DeviceClass} id, vendorId and pluginId are valid uuids. */ bool DeviceClass::isValid() const { return !m_id.isNull() && !m_vendorId.isNull() && !m_pluginId.isNull(); } -/*! Returns the name of this \l{DeviceClass}'s. This is visible to the user. */ +/*! Returns the name of this \l{DeviceClass}. This is visible to the user. */ QString DeviceClass::name() const { return m_name; } -/*! Set the \a name of this DeviceClass's. This is visible to the user. */ +/*! Set the \a name of this \l{DeviceClass}. This is visible to the user. */ void DeviceClass::setName(const QString &name) { m_name = name; } -/*! Returns the default \l{DeviceIcon} of this \l{DeviceClass}'s. */ +/*! Returns the critical \l{StateTypeId} of this \l{DeviceClass}. + * A critical \l{State} describes the state which disables the whole device (i.e. connected, available or reachable). */ +StateTypeId DeviceClass::criticalStateTypeId() const +{ + return m_criticalStateTypeId; +} + +/*! Set the \a criticalStateTypeId of this \l{DeviceClass}. */ +void DeviceClass::setCriticalStateTypeId(const StateTypeId &criticalStateTypeId) +{ + m_criticalStateTypeId = criticalStateTypeId; +} + +/*! Returns the primary \l{StateTypeId} of this \l{DeviceClass}. */ +StateTypeId DeviceClass::primaryStateTypeId() const +{ + return m_primaryStateTypeId; +} + +/*! Set the \a primaryStateTypeId of this \l{DeviceClass}. */ +void DeviceClass::setPrimaryStateTypeId(const StateTypeId &primaryStateTypeId) +{ + m_primaryStateTypeId = primaryStateTypeId; +} + +/*! Returns the primary \l{ActionTypeId} of this \l{DeviceClass}. */ +ActionTypeId DeviceClass::primaryActionTypeId() const +{ + return m_primaryActionTypeId; +} + +/*! Set the \a primaryActionTypeId of this \l{DeviceClass}. */ +void DeviceClass::setPrimaryActionTypeId(const ActionTypeId &primaryActionTypeId) +{ + m_primaryActionTypeId = primaryActionTypeId; +} + +/*! Returns the default \l{DeviceIcon} of this \l{DeviceClass}. */ DeviceClass::DeviceIcon DeviceClass::deviceIcon() const { return m_deviceIcon; } -/*! Set the \a deviceIcon of this DeviceClass. +/*! Set the \a deviceIcon of this \l{DeviceClass}. \sa DeviceClass::DeviceIcon */ diff --git a/libguh/plugin/deviceclass.h b/libguh/plugin/deviceclass.h index 410911b7..76f84b73 100644 --- a/libguh/plugin/deviceclass.h +++ b/libguh/plugin/deviceclass.h @@ -125,6 +125,15 @@ public: QString name() const; void setName(const QString &name); + StateTypeId criticalStateTypeId() const; + void setCriticalStateTypeId(const StateTypeId &criticalStateTypeId); + + StateTypeId primaryStateTypeId() const; + void setPrimaryStateTypeId(const StateTypeId &primaryStateTypeId); + + ActionTypeId primaryActionTypeId() const; + void setPrimaryActionTypeId(const ActionTypeId &primaryActionTypeId); + DeviceIcon deviceIcon() const; void setDeviceIcon(const DeviceIcon &deviceIcon); @@ -165,6 +174,9 @@ private: VendorId m_vendorId; PluginId m_pluginId; QString m_name; + StateTypeId m_criticalStateTypeId; + StateTypeId m_primaryStateTypeId; + ActionTypeId m_primaryActionTypeId; DeviceIcon m_deviceIcon; QList m_basicTags; QList m_stateTypes;