• Thing
  • Thing Class

    The class that represents devices and services in nymea. More...

    Header: #include <Thing>
    Inherits:

    Public Types

    enum ThingError { ThingErrorNoError, ThingErrorPluginNotFound, ThingErrorVendorNotFound, ThingErrorThingNotFound, ..., ThingErrorParameterNotWritable }
    enum ThingSetupStatus { ThingSetupStatusNone, ThingSetupStatusInProgress, ThingSetupStatusComplete, ThingSetupStatusFailed }

    Properties

    Public Functions

    bool autoCreated() const
    bool hasParam(const ParamTypeId & paramTypeId) const
    bool hasSetting(const ParamTypeId & paramTypeId) const
    bool hasState(const StateTypeId & stateTypeId) const
    ThingId id() const
    QString name() const
    QVariant paramValue(const ParamTypeId & paramTypeId) const
    ParamList params() const
    ThingId parentId() const
    PluginId pluginId() const
    void setName(const QString & name)
    void setParamValue(const ParamTypeId & paramTypeId, const QVariant & value)
    void setParams(const ParamList & params)
    void setParentId(const ThingId & parentId)
    void setSettingValue(const ParamTypeId & paramTypeId, const QVariant & value)
    void setSettings(const ParamList & settings)
    void setStateValue(const StateTypeId & stateTypeId, const QVariant & value)
    void setStates(const States & states)
    QVariant setting(const ParamTypeId & paramTypeId) const
    ParamList settings() const
    bool setupComplete() const
    QString setupDisplayMessage() const
    ThingError setupError() const
    ThingSetupStatus setupStatus() const
    State state(const StateTypeId & stateTypeId) const
    QVariant stateValue(const StateTypeId & stateTypeId) const
    States states() const
    ThingClass thingClass() const
    ThingClassId thingClassId() const

    Signals

    void nameChanged()
    void settingChanged(const ParamTypeId & paramTypeId, const QVariant & value)
    void setupStatusChanged()
    void stateValueChanged(const StateTypeId & stateTypeId, const QVariant & value)

    Detailed Description

    The class that represents devices and services in nymea.

    This class holds the values for configured things. It is associated with a {ThingClass} which can be used to get more details about the thing.

    See also ThingClass and ThingDescriptor.

    Member Type Documentation

    enum Thing::ThingError

    This enum type specifies the errors that can happen when working with Things.

    ConstantValueDescription
    Thing::ThingErrorNoError0No Error. Everything went fine.
    Thing::ThingErrorPluginNotFound1Couldn't find the Plugin for the given id.
    Thing::ThingErrorVendorNotFound2Couldn't find the Vendor for the given id.
    Thing::ThingErrorThingNotFound3Couldn't find a Thing for the given id.
    Thing::ThingErrorThingClassNotFound4Couldn't find a ThingClass for the given id.
    Thing::ThingErrorActionTypeNotFound5Couldn't find the ActionType for the given id.
    Thing::ThingErrorStateTypeNotFound6Couldn't find the StateType for the given id.
    Thing::ThingErrorEventTypeNotFound7Couldn't find the EventType for the given id.
    Thing::ThingErrorThingDescriptorNotFound8Couldn't find the ThingDescriptor for the given id.
    Thing::ThingErrorMissingParameter9Parameters do not comply to the template.
    Thing::ThingErrorInvalidParameter10One of the given parameter is not valid.
    Thing::ThingErrorSetupFailed11Error setting up the Thing. It will not be functional.
    Thing::ThingErrorDuplicateUuid12Error setting up the Thing. The given ThingId already exists.
    Thing::ThingErrorCreationMethodNotSupported13Error setting up the Thing. This CreateMethod is not supported for this Thing.
    Thing::ThingErrorSetupMethodNotSupported14Error setting up the Thing. This SetupMethod is not supported for this Thing.
    Thing::ThingErrorHardwareNotAvailable15The Hardware of the Thing is not available.
    Thing::ThingErrorHardwareFailure16The Hardware of the Thing has an error.
    Thing::ThingErrorAsync?The response of the Thing will be asynchronously.
    Thing::ThingErrorThingInUse18The Thing is currently bussy.
    Thing::ThingErrorPairingTransactionIdNotFound21Couldn't find the PairingTransactionId for the given id.
    Thing::ThingErrorAuthentificationFailure?The authentication failed when communicating with the device or service.
    Thing::ThingErrorThingIsChild20The thing is a child and can not be used in this way.
    Thing::ThingErrorThingInRule19The thing is in a rule and can not be deleted withou nymeaserver::RuleEngine::RemovePolicy.
    Thing::ThingErrorParameterNotWritable22One of the given thing params is not writable.

    enum Thing::ThingSetupStatus

    This enum type specifies the setup status of a Thing.

    ConstantValueDescription
    Thing::ThingSetupStatusNone0The thing has not been set up yet.
    Thing::ThingSetupStatusInProgress1The setup for this thing is currently in progress.
    Thing::ThingSetupStatusComplete2The setup for this thing has been completed.
    Thing::ThingSetupStatusFailed3The setup for this thing failed.

    Property Documentation

    id : const QUuid

    Access functions:

    ThingId id() const

    name : QString

    Access functions:

    QString name() const
    void setName(const QString & name)

    Notifier signal:

    void nameChanged()

    params : const ParamList

    Access functions:

    ParamList params() const

    parentId : const QUuid

    Access functions:

    ThingId parentId() const

    settings : ParamList

    Access functions:

    ParamList settings() const
    void setSettings(const ParamList & settings)

    setupComplete : const bool

    Access functions:

    bool setupComplete() const

    Notifier signal:

    setupDisplayMessage : const QString

    Access functions:

    QString setupDisplayMessage() const

    Notifier signal:

    setupError : const ThingError

    Access functions:

    ThingError setupError() const

    Notifier signal:

    void setupStatusChanged()

    setupStatus : const ThingSetupStatus

    Access functions:

    ThingSetupStatus setupStatus() const

    Notifier signal:

    states : const States

    Access functions:

    States states() const

    thingClassId : const QUuid

    Access functions:

    ThingClassId thingClassId() const

    Member Function Documentation

    bool Thing::autoCreated() const

    Returns true if this thing has been auto-created (not created by the user)

    bool Thing::hasParam(const ParamTypeId & paramTypeId) const

    Returns true, a Param with the given paramTypeId exists for this thing.

    bool Thing::hasSetting(const ParamTypeId & paramTypeId) const

    bool Thing::hasState(const StateTypeId & stateTypeId) const

    Returns true, a State with the given stateTypeId exists for this thing.

    QVariant Thing::paramValue(const ParamTypeId & paramTypeId) const

    Returns the value of the Param of this thing with the given paramTypeId.

    See also setParamValue().

    PluginId Thing::pluginId() const

    Returns the id of the ThingPlugin this thing is managed by.

    void Thing::setParamValue(const ParamTypeId & paramTypeId, const QVariant & value)

    Sets the value of the Param with the given paramTypeId.

    See also paramValue().

    void Thing::setParams(const ParamList & params)

    Sets the params of this thing. It must match the parameter description in the associated ThingClass.

    See also params().

    void Thing::setParentId(const ThingId & parentId)

    Sets the parentId of this thing. If the parentId is not set, this thing does not have a parent.

    See also parentId().

    void Thing::setSettingValue(const ParamTypeId & paramTypeId, const QVariant & value)

    void Thing::setStateValue(const StateTypeId & stateTypeId, const QVariant & value)

    For convenience, this finds the State matching the given stateTypeId in this thing and sets the current value to value.

    See also stateValue().

    void Thing::setStates(const States & states)

    Set the States of this Thing to the given states.

    See also states().

    QVariant Thing::setting(const ParamTypeId & paramTypeId) const

    [signal] void Thing::settingChanged(const ParamTypeId & paramTypeId, const QVariant & value)

    This signal is emitted whenever a setting is changed.

    State Thing::state(const StateTypeId & stateTypeId) const

    Returns the State with the given stateTypeId of this thing.

    QVariant Thing::stateValue(const StateTypeId & stateTypeId) const

    For convenience, this finds the State matching the given stateTypeId and returns the current valie in this thing.

    See also setStateValue().

    [signal] void Thing::stateValueChanged(const StateTypeId & stateTypeId, const QVariant & value)

    This signal is emitted when the State with the given stateTypeId changed. The value parameter describes the new value of the State.

    ThingClass Thing::thingClass() const

    Returns the ThingClass of this thing.