forked from donaloconnor/automon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrule.h
63 lines (53 loc) · 2.39 KB
/
rule.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef RULE_H
#define RULE_H
#include <QString>
#include <QObject>
#include <QtScript>
/*
==================================================================================================
| rule.h |
| Part of the Automon application. |
| |
| Final Year Project - "An Embedded Automotive Monitoring Device" |
| |
| By Donal O' Connor for completion of B.Sc (Hons) Software Development and Computer Networking |
| Email: [email protected] |
| Website/Blog: http://automon.killarneyonline.eu |
| |
| Cork Institute of Technology, Cork, Ireland - http://www.cit.ie/ |
| |
| Copyright © 2009 Donal O'Connor <[email protected]> |
==================================================================================================
This class, Rule is used to create a rule in which if sensor values match the rule description,
it emits a signal to handle the rule satisfied condition.
It uses the QtScript module and a QtScriptEngine.
*/
#include "sensor.h"
namespace AutomonKernel
{
class Rule : public QObject
{
Q_OBJECT
public:
Rule();
void setRule(QString rule);
void setRuleName(QString ruleName);
QString getRule();
QString getRuleName();
bool checkIfSatisfied();
bool addSensor(Sensor * sensor);
bool activate();
signals:
void sendAlert(QString);
public slots:
void updateRule(double value);
private:
bool validateRule();
QScriptEngine * m_scriptEngine;
QString m_rule;
QString m_ruleName;
bool m_satisfied;
QList<Sensor*> m_sensors;
};
}
#endif // RULE_H