Torc  0.1
Public Slots | Public Member Functions | Protected Member Functions | List of all members
TorcTriggerNotification Class Referencefinal

#include <torctriggernotification.h>

Inheritance diagram for TorcTriggerNotification:
[legend]

Public Slots

void InputValueChanged (double Value)
 
- Public Slots inherited from TorcDevice
virtual void SetValue (double Value)
 
virtual void SetValid (bool Valid)
 
bool GetValid (void)
 
double GetValue (void)
 
double GetDefaultValue (void)
 
QString GetModelId (void)
 
QString GetUniqueId (void)
 
QString GetUserName (void)
 
QString GetUserDescription (void)
 

Public Member Functions

 TorcTriggerNotification (const QVariantMap &Details)
 
 ~TorcTriggerNotification ()=default
 
bool IsKnownInput (const QString &UniqueId) override
 
QStringList GetDescription (void) override
 
void Graph (QByteArray *Data) override
 
- Public Member Functions inherited from TorcNotification
 TorcNotification (const QVariantMap &Details)
 
- Public Member Functions inherited from TorcReferenceCounter
 TorcReferenceCounter (void)
 
virtual ~TorcReferenceCounter (void)=default
 
void UpRef (void)
 
virtual bool DownRef (void)
 
bool IsShared (void)
 

Protected Member Functions

virtual bool Setup (void) override
 Finalise the notification. More...
 
- Protected Member Functions inherited from TorcNotification
virtual ~TorcNotification ()=default
 
- Protected Member Functions inherited from TorcDevice
virtual ~TorcDevice ()
 

Additional Inherited Members

- Signals inherited from TorcNotification
void Notify (const QVariantMap &Message)
 
- Signals inherited from TorcDevice
void ValidChanged (bool Valid)
 
void ValueChanged (double Value)
 
- Static Public Member Functions inherited from TorcReferenceCounter
static void EventLoopEnding (bool Ending)
 
- Protected Attributes inherited from TorcNotification
QStringList m_notifierNames
 
QList< TorcNotifier * > m_notifiers
 
QString m_title
 
QString m_body
 
- Protected Attributes inherited from TorcDevice
double value
 
double defaultValue
 
QString modelId
 
QString uniqueId
 
QString userName
 
QString userDescription
 
QMutex lock
 
bool wasInvalid
 
- Protected Attributes inherited from TorcReferenceCounter
QAtomicInt m_refCount
 
- Static Protected Attributes inherited from TorcDevice
static QHash< QString, TorcDevice * > * gDeviceList = new QHash<QString,TorcDevice*>()
 
static QMutex * gDeviceListLock = new QMutex(QMutex::Recursive)
 
- Static Protected Attributes inherited from TorcReferenceCounter
static bool m_eventLoopEnding = false
 
- Properties inherited from TorcDevice
bool valid
 

Detailed Description

A notification class for sending messages when the input value switches from low to high or high to low.

A single notification is sent when the trigger occurs. If the input remains unchanged, no further notifications are sent. A notification is not sent when the input changes back - this should be handled by a matching, configured trigger notification. Consider some form of hysteresis for non-binary or frequently changing inputs to avoid frequent notifications.

<torc>
<notify>
<notifications>
<trigger>
<name>test</name>
<inputs><device>mytrigger</device></inputs> <-- an input or control
<outputs><device>mynotifier></device></outputs> <- a notifier
<references><device>myinterestingdevice</device></references> <-- devices whose values we want to notify
<message>
<title>%applicationname% ALERT</title>
<body>Interesting value %myinterestingdevice% at %datatime%</body>
</message>
</trigger>
</notifications>
</notify>
</torc>

To trigger the output when the input transitions from high to low (the default is low to high) add a <triggerlow> member.

<torc>
<notify>
<notifications>
<trigger>
<name>test</name>
<triggerlow>yes</triggerlow> <-- !!!!
<inputs><device>mytrigger</device></inputs> <-- an input or control
<outputs><device>mynotifier></device></outputs> <- a notifier
<references><device>myinterestingdevice</device></references> <-- devices whose values we want to notify
<message>
<title>%applicationname% ALERT</title>
<body>Interesting value %myinterestingdevice% at %datatime%</body>
</message>
</trigger>
</notifications>
</notify>
</torc>
See also
TorcNotify
TorcNotification
TorcNotifier
TorcSystemNotification

Definition at line 9 of file torctriggernotification.h.

Constructor & Destructor Documentation

TorcTriggerNotification::TorcTriggerNotification ( const QVariantMap &  Details)
explicit

Definition at line 85 of file torctriggernotification.cpp.

TorcTriggerNotification::~TorcTriggerNotification ( )
default

Member Function Documentation

QStringList TorcTriggerNotification::GetDescription ( void  )
overridevirtual

Implements TorcNotification.

Definition at line 138 of file torctriggernotification.cpp.

void TorcTriggerNotification::Graph ( QByteArray *  Data)
overridevirtual

Implements TorcNotification.

Definition at line 145 of file torctriggernotification.cpp.

void TorcTriggerNotification::InputValueChanged ( double  Value)
slot

Definition at line 160 of file torctriggernotification.cpp.

bool TorcTriggerNotification::IsKnownInput ( const QString &  UniqueId)
overridevirtual

Reimplemented from TorcNotification.

Definition at line 132 of file torctriggernotification.cpp.

bool TorcTriggerNotification::Setup ( void  )
overrideprotectedvirtual

Finalise the notification.

Check for the existence of input and connect ValueChanged signal to InputValueChanged slot.

Reimplemented from TorcNotification.

Definition at line 189 of file torctriggernotification.cpp.


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