• RuleActionParam
  • RuleActionParam Class

    Holds the parameters for a RuleAction. More...

    Header: #include <RuleActionParam>

    Public Functions

    RuleActionParam(const Param & param = Param())
    RuleActionParam(const ParamTypeId & paramTypeId, const QVariant & value = QVariant())
    RuleActionParam(const ParamTypeId & paramTypeId, const EventTypeId & eventTypeId, const ParamTypeId & eventParamTypeId)
    RuleActionParam(const ParamTypeId & paramTypeId, const DeviceId & stateDeviceId, const StateTypeId & stateTypeId)
    RuleActionParam(const QString & paramName, const QVariant & value = QVariant())
    RuleActionParam(const QString & paramName, const EventTypeId & eventTypeId, const ParamTypeId & eventParamTypeId)
    RuleActionParam(const QString & paramName, const DeviceId & stateDeviceId, const StateTypeId & stateTypeId)
    ParamTypeId eventParamTypeId() const
    EventTypeId eventTypeId() const
    bool isEventBased() const
    bool isStateBased() const
    bool isValid() const
    bool isValueBased() const
    QString paramName() const
    ParamTypeId paramTypeId() const
    void setEventParamTypeId(const ParamTypeId & eventParamTypeId)
    void setEventTypeId(const EventTypeId & eventTypeId)
    void setStateDeviceId(const DeviceId & stateDeviceId)
    void setStateTypeId(const StateTypeId & stateTypeId)
    void setValue(const QVariant & value)
    DeviceId stateDeviceId() const
    StateTypeId stateTypeId() const
    QVariant value() const

    Detailed Description

    Holds the parameters for a RuleAction.

    A RuleActionParam allows rules to take over an Event parameter into a rule RuleAction.

    RuleActionParams are identified by either paramTypeId or paramName (for interface based actions).

    The parameter value can either be a static value, a pair of EventTypeId and ParamTypeId or a pair of DeviceId and StateTypeId.

    When composing the actual Param for the executeAction() call the value is generated as follows: - Static value params are filled with RuleActionParam::paramTypeId() and the RuleActionParam::value() - Event based actions are filled with RuleActionParam::paramTypeId() and the param value of the event that triggered this rule, identified by RuleActionParam::eventTypeId() and RuleActionParam::eventParamTypeId() - State based actions are filled with RuleActionParam::paramTypeId() and the current value of the state identified by RuleActionParam::deviceId() and RuleActionParam::stateTypeId()

    If the param types are not matching, nymea will do a best effort to cast the values. E.g. a RuleActionParam for a param of type "string" and a state of type "int" would cast the integer to a string which would always work. However, the other way round, having a parameter requiring an "int" value, and reading the value from a state of type "string" might work, if the string does only hold numbers but would fail.

    See also nymeaserver::Rule and RuleAction.

    Member Function Documentation

    RuleActionParam::RuleActionParam(const Param & param = Param())

    Constructs a RuleActionParam with the given param.

    See also Param.

    RuleActionParam::RuleActionParam(const ParamTypeId & paramTypeId, const QVariant & value = QVariant())

    Constructs a RuleActionParam with the given paramTypeId and value.

    See also Param and Event.

    RuleActionParam::RuleActionParam(const ParamTypeId & paramTypeId, const EventTypeId & eventTypeId, const ParamTypeId & eventParamTypeId)

    Constructs a RuleActionParam with the given paramTypeId, eventTypeId and eventParamTypeId.

    See also Param and Event.

    RuleActionParam::RuleActionParam(const ParamTypeId & paramTypeId, const DeviceId & stateDeviceId, const StateTypeId & stateTypeId)

    Constructs a RuleActionParam with the given paramTypeId, stateDeviceId and stateTypeId.

    See also Param and Event.

    RuleActionParam::RuleActionParam(const QString & paramName, const QVariant & value = QVariant())

    Constructs a RuleActionParam with the given paramName and value.

    See also Param and Event.

    RuleActionParam::RuleActionParam(const QString & paramName, const EventTypeId & eventTypeId, const ParamTypeId & eventParamTypeId)

    Constructs a RuleActionParam with the given paramName, eventTypeId and eventParamTypeId.

    See also Param and Event.

    RuleActionParam::RuleActionParam(const QString & paramName, const DeviceId & stateDeviceId, const StateTypeId & stateTypeId)

    Constructs a RuleActionParam with the given paramName, stateDeviceId and stateTypeId.

    See also Param and Event.

    ParamTypeId RuleActionParam::eventParamTypeId() const

    Returns the eventParamTypeId of this RuleActionParam.

    See also setEventParamTypeId().

    EventTypeId RuleActionParam::eventTypeId() const

    Return the EventTypeId of the Event with the Param which will be taken over in the RuleAction.

    See also setEventTypeId().

    bool RuleActionParam::isEventBased() const

    bool RuleActionParam::isStateBased() const

    bool RuleActionParam::isValid() const

    Returns true if the (paramTypeId AND value) XOR (paramTypeId AND eventTypeId AND eventParamName) of this RuleActionParam are set.

    bool RuleActionParam::isValueBased() const

    QString RuleActionParam::paramName() const

    Returns the name of this RuleActionParam.

    ParamTypeId RuleActionParam::paramTypeId() const

    Returns the ParamTypeId of this RuleActionParam.

    void RuleActionParam::setEventParamTypeId(const ParamTypeId & eventParamTypeId)

    Sets the eventParamTypeId of this RuleActionParam.

    See also eventParamTypeId().

    void RuleActionParam::setEventTypeId(const EventTypeId & eventTypeId)

    Sets the eventTypeId of the Event with the Param which will be taken over in the RuleAction.

    See also eventTypeId().

    void RuleActionParam::setStateDeviceId(const DeviceId & stateDeviceId)

    Sets the deviceId identifying the device to use a state value from.

    See also stateDeviceId().

    void RuleActionParam::setStateTypeId(const StateTypeId & stateTypeId)

    Sets the stateTypeId identifying the state to use the value from.

    See also stateTypeId().

    void RuleActionParam::setValue(const QVariant & value)

    Sets the value of this RuleActionParam.

    See also value().

    DeviceId RuleActionParam::stateDeviceId() const

    Returns the deviceId identifying the device to use a state value from.

    See also setStateDeviceId().

    StateTypeId RuleActionParam::stateTypeId() const

    Returns the stateTypeId identifying the state to use the value.

    See also setStateTypeId().

    QVariant RuleActionParam::value() const

    Returns the value of this RuleActionParam.

    See also setValue().