• StateType
  • StateType Class

    Describes the Type of a State from Device. More...

    Header: #include <StateType>

    Public Functions

    StateType(const StateTypeId & id)
    bool cached() const
    QVariant defaultValue() const
    QString displayName() const
    StateTypeId id() const
    int index() const
    QVariant maxValue() const
    QVariant minValue() const
    QString name() const
    QVariantList possibleValues() const
    void setCached(bool cached)
    void setDefaultValue(const QVariant & defaultValue)
    void setDisplayName(const QString & displayName)
    void setIndex(const int & index)
    void setMaxValue(const QVariant & maxValue)
    void setMinValue(const QVariant & minValue)
    void setName(const QString & name)
    void setPossibleValues(const QVariantList & possibleValues)
    void setType(const QVariant::Type & type)
    void setUnit(const Types::Unit & unit)
    QVariant::Type type() const
    Types::Unit unit() const

    Static Public Members

    QStringList mandatoryTypeProperties()
    QStringList typeProperties()

    Detailed Description

    Describes the Type of a State from Device.

    See also State and StateDescriptor.

    Member Function Documentation

    StateType::StateType(const StateTypeId & id)

    Constructs a StateType with the given id. When creating a DevicePlugin generate a new uuid for each StateType you define and hardcode it into the plugin json file.

    bool StateType::cached() const

    Returns true if this StateType is to be cached. This means, the last state value will be stored to disk upon shutdown and restored on reboot. If this is false, states will be initialized with the default value on each boot. By default all states are cached by the system.

    See also setCached().

    QVariant StateType::defaultValue() const

    Returns the default value of this StateType (e.g. 21.5).

    See also setDefaultValue().

    QString StateType::displayName() const

    Returns the displayName of the StateType. This is visible to the user (e.g. "Color temperature").

    See also setDisplayName().

    StateTypeId StateType::id() const

    Returns the id of the StateType.

    int StateType::index() const

    Returns the index of this StateType. The index of an StateType indicates the order in the DeviceClass. This guarantees that a Device will look always the same (State order).

    See also setIndex().

    [static] QStringList StateType::mandatoryTypeProperties()

    Returns a list of mandatory properties a DeviceClass definition must have.

    QVariant StateType::maxValue() const

    Returns the maximum value of this StateType. If this value is not set, the QVariant will be invalid.

    See also setMaxValue().

    QVariant StateType::minValue() const

    Returns the minimum value of this StateType. If this value is not set, the QVariant will be invalid.

    See also setMinValue().

    QString StateType::name() const

    Returns the name of the StateType. This is used internally, e.g. to match interfaces.

    See also setName().

    QVariantList StateType::possibleValues() const

    Returns the list of possible values of this StateType. If the list is empty or invalid the State value can take every value.

    See also setPossibleValues().

    void StateType::setCached(bool cached)

    Sets whether this StateType should be cached or not. If a state value gets cached, the state will be initialized with the cached value on start.

    See also cached().

    void StateType::setDefaultValue(const QVariant & defaultValue)

    Set the default value of this StateType to defaultValue (e.g. 21.5).

    See also defaultValue().

    void StateType::setDisplayName(const QString & displayName)

    Set the displayName of the StateType to displayName. This is visible to the user (e.g. "Color temperature").

    See also displayName().

    void StateType::setIndex(const int & index)

    Set the index of this StateType.

    See also index().

    void StateType::setMaxValue(const QVariant & maxValue)

    Set the maximum value of this StateType to maxValue. If this value is not set, there is now upper limit.

    See also maxValue().

    void StateType::setMinValue(const QVariant & minValue)

    Set the minimum value of this StateType to minValue. If this value is not set, there is now lower limit.

    See also minValue().

    void StateType::setName(const QString & name)

    Set the name of the StateType to name. This is used internally, e.g. to match interfaces.

    See also name().

    void StateType::setPossibleValues(const QVariantList & possibleValues)

    Set the list of possible values of this StateType to possibleValues.

    See also possibleValues().

    void StateType::setType(const QVariant::Type & type)

    Set the type fo the StateType to type (e.g. QVariant::Real).

    See also type().

    void StateType::setUnit(const Types::Unit & unit)

    Sets the unit of this StateType to the given unit.

    See also unit().

    QVariant::Type StateType::type() const

    Returns the Type of the StateType (e.g. QVariant::Real).

    See also setType().

    [static] QStringList StateType::typeProperties()

    Returns a list of all valid properties a DeviceClass definition can have.

    Types::Unit StateType::unit() const

    Returns the unit of this StateType.

    See also setUnit().