moar docs

This commit is contained in:
Michael Zanetti 2014-01-26 03:54:30 +01:00
parent 9fd2a4c1b4
commit a7bbba1999
25 changed files with 957 additions and 40 deletions

View File

@ -6,5 +6,5 @@ server.depends = libhive plugins
plugins.depends = libhive
docs.depends = libhive server
docs.commands = cd doc; qdoc config.qdocconf
docs.commands = cd ${PWD}; qdoc config.qdocconf
QMAKE_EXTRA_TARGETS += docs

6
doc/allclasses.qdoc Normal file
View File

@ -0,0 +1,6 @@
/*!
\page classes.html
\title All Hive Classes
\generatelist classes
*/

11
doc/deviceplugins.qdoc Normal file
View File

@ -0,0 +1,11 @@
/*!
\page deviceplugins.html
\title Device Plugins
\brief This is the API for implementing Hive device plugins.
When creating a device plugin, start by subclassing \l{DevicePlugin} and filling
in information for the pure virtual methods.
\annotatedlist devices
*/

View File

@ -1,22 +1,27 @@
/*!
\page index.html
\title Hive
\title Hive Developer Documentation
\section1 Summary
The hive backend service consists of three main modules:
The Hive backend service consists of three main modules:
\list
\li libhive
\list
\li \l{Types} used in the hive system
\li Defines plugin API and plugin loading mechanism
\li \l{Types}{Types used in the hive system}
\li \l{Device Plugins}{The Device Plugin API}
\endlist
\li Hive server
\list
\li Hive core
\li \l{JSONRPC Interface}
\li Rules engine
\li \l{Rules}
\endlist
\li Device plugins. A collection of officially supported device plugins.
\endlist
\section2 Quicklinks
\list
\li \l{All Hive Classes}
\endlist
*/

View File

@ -7,18 +7,6 @@ HTML.templatedir = .
HTML.stylesheets = style.css
HTML.scripts =
# Files not referenced in any qdoc file (last four needed by qtdemo)
# See also qhp.Qt.extraFiles
extraimages.HTML = qt-logo.png \
arrow_down.png \
breadcrumb.png \
bullet_gt.png \
bullet_dn.png \
bullet_sq.png \
bullet_up.png \
horBar.png \
sprites-combined.png
# Include the style sheets and scripts used.

View File

@ -3,7 +3,7 @@ include(html-styles.qdocconf)
HTML.postheader = \
"<div class=\"header\" id=\"qtdocheader\">\n" \
" <div class=\"content\"> \n" \
" <a href=\"index.html\" class=\"qtref\"><span>Hive Documentation</span></a>\n" \
" <a href=\"index.html\" class=\"qtref\"><span>Hive Developer Documentation</span></a>\n" \
" </div>\n" \
" <div class=\"breadcrumb toolblock\">\n" \
" <ul>\n" \

7
doc/rules.qdoc Normal file
View File

@ -0,0 +1,7 @@
/*!
\page rules.html
\title Rules
\annotatedlist rules
*/

673
doc/style.css Normal file
View File

@ -0,0 +1,673 @@
@media screen
{
/* basic elements */
html
{
color: #000000;
background: #ffed5d;
}
table
{
border-collapse: collapse;
border-spacing: 0;
}
fieldset, img
{
border: 0;
max-width:100%;
}
address, caption, cite, code, dfn, em, strong, th, var, optgroup
{
font-style: inherit;
font-weight: inherit;
}
del, ins
{
text-decoration: none;
}
li
{
list-style: none;
}
ol li
{
list-style: decimal;
}
caption, th
{
text-align: left;
}
h1, h2, h3, h4, h5, h6
{
font-size: 100%;
}
q:before, q:after
{
content: '';
}
abbr, acronym
{
border: 0;
font-variant: normal;
}
sup, sub
{
vertical-align: baseline;
}
tt, .qmlreadonly span, .qmldefault span
{
word-spacing:0.5em;
}
legend
{
color: #000000;
}
strong
{
font-weight: bold;
}
em
{
font-style: italic;
}
body
{
margin-left: 0.5em;
margin-right: 0.5em;
}
a
{
color: #00732F;
text-decoration: none;
}
hr
{
background-color: #E6E6E6;
border: 1px solid #E6E6E6;
height: 1px;
width: 100%;
text-align: left;
margin: 1.5em 0 1.5em 0;
}
pre
{
border: 1px solid #DDDDDD;
-moz-border-radius: 0.7em 0.7em 0.7em 0.7em;
-webkit-border-radius: 0.7em 0.7em 0.7em 0.7em;
border-radius: 0.7em 0.7em 0.7em 0.7em;
margin: 0 1.5em 1em 1em;
padding: 1em 1em 1em 1em;
overflow-x: auto;
}
table, pre
{
-moz-border-radius: 0.7em 0.7em 0.7em 0.7em;
-webkit-border-radius: 0.7em 0.7em 0.7em 0.7em;
border-radius: 0.7em 0.7em 0.7em 0.7em;
background-color: #F6F6F6;
border: 1px solid #E6E6E6;
border-collapse: separate;
margin-bottom: 2.5em;
}
pre {
font-size: 90%;
display: block;
overflow:hidden;
}
thead
{
margin-top: 0.5em;
font-weight: bold
}
th
{
padding: 0.5em 1.5em 0.5em 1.5em;
background-color: #E1E1E1;
border-left: 1px solid #E6E6E6;
}
td
{
padding: 0.25em 1.5em 0.25em 2em;
}
td.rightAlign
{
padding: 0.25em 0.5em 0.25em 1em;
}
table tr.odd
{
border-left: 1px solid #E6E6E6;
background-color: #F6F6F6;
color: #66666E;
}
table tr.even
{
border-left: 1px solid #E6E6E6;
background-color: #ffffff;
color: #66666E;
}
div.float-left
{
float: left; margin-right: 2em
}
div.float-right
{
float: right; margin-left: 2em
}
span.comment
{
color: #008B00;
font-style: italic
}
span.string, span.char
{
color: #000084;
}
span.number
{
color: #a46200;
}
span.operator
{
color: #202020;
}
span.keyword
{
color: #840000;
}
span.name
{
color: black
}
span.type
{
font-weight: bold
}
span.type a:visited
{
color: #0F5300;
}
span.preprocessor
{
color: #404040
}
/* end basic elements */
/* font style elements */
.heading
{
font-weight: bold;
font-size: 125%;
}
.subtitle
{
font-size: 110%
}
.small-subtitle
{
font-size: 100%
}
.red
{
color:red;
}
/* end font style elements */
/* global settings*/
.header, .footer
{
display: block;
clear: both;
overflow: hidden;
}
/* end global settings*/
/* header elements */
.header .qtref
{
color: #00732F;
font-weight: bold;
font-size: 130%;
}
.header .content
{
margin-bottom: 0.5em
}
.naviNextPrevious
{
display: none
}
.header .breadcrumb
{
font-size: 90%;
padding: 0.5em 0 0.5em 1em;
margin: 0;
background-color: #fafafa;
height: 1.35em;
border-bottom: 1px solid #d1d1d1;
}
.header .breadcrumb ul
{
margin: 0;
padding: 0;
}
.header .content
{
word-wrap: break-word;
}
.header .breadcrumb ul li
{
float: left;
background: url(../images/breadcrumb.png) no-repeat 0 3px;
padding-left: 1.5em;
margin-left: 1.5em;
}
.header .breadcrumb ul li.last
{
font-weight: normal;
}
.header .breadcrumb ul li a
{
color: #00732F;
}
.header .breadcrumb ul li.first
{
background-image: none;
padding-left: 0;
margin-left: 0;
}
.header .content ol li {
background: none;
margin-bottom: 1.0em;
margin-left: 1.2em;
padding-left: 0
}
.header .content li
{
background: url(../images/bullet_sq.png) no-repeat 0 5px;
margin-bottom: 1em;
padding-left: 1.2em;
}
/* end header elements */
/* content elements */
.content h1
{
font-weight: bold;
font-size: 150%
}
.content h2
{
font-weight: bold;
font-size: 135%;
width: 100%;
}
.content h3
{
font-weight: bold;
font-size: 120%;
width: 100%;
}
.content table p
{
margin: 0
}
.content ul
{
padding-left: 2.5em;
}
.content li
{
padding-top: 0.25em;
padding-bottom: 0.25em;
}
.content ul img {
vertical-align: middle;
}
.content a:visited
{
color: #4c0033;
text-decoration: none;
}
.content a:visited:hover
{
color: #4c0033;
text-decoration: underline;
}
a:hover
{
color: #4c0033;
text-decoration: underline;
}
descr p a
{
text-decoration: underline;
}
.descr p a:visited
{
text-decoration: underline;
}
.alphaChar{
width:95%;
background-color:#F6F6F6;
border:1px solid #E6E6E6;
-moz-border-radius: 7px 7px 7px 7px;
border-radius: 7px 7px 7px 7px;
-webkit-border-radius: 7px 7px 7px 7px;
font-size:12pt;
padding-left:10px;
margin-top:10px;
margin-bottom:10px;
}
.flowList{
/*vertical-align:top;*/
/*margin:20px auto;*/
column-count:3;
-webkit-column-count:3;
-moz-column-count:3;
/*
column-width:100%;
-webkit-column-width:200px;
-col-column-width:200px;
*/
column-gap:41px;
-webkit-column-gap:41px;
-moz-column-gap:41px;
column-rule: 1px dashed #ccc;
-webkit-column-rule: 1px dashed #ccc;
-moz-column-rule: 1px dashed #ccc;
}
.flowList dl{
}
.flowList dd{
/*display:inline-block;*/
margin-left:10px;
min-width:250px;
line-height: 1.5;
min-width:100%;
min-height:15px;
}
.flowList dd a{
}
.content .flowList p{
padding:0px;
}
.content .alignedsummary
{
margin: 15px;
}
.qmltype
{
text-align: center;
font-size: 120%;
}
.qmlreadonly
{
padding-left: 5px;
float: right;
color: #254117;
}
.qmldefault
{
padding-left: 5px;
float: right;
color: red;
}
.qmldoc
{
}
.generic .alphaChar{
margin-top:5px;
}
.generic .odd .alphaChar{
background-color: #F6F6F6;
}
.generic .even .alphaChar{
background-color: #FFFFFF;
}
.memItemRight{
padding: 0.25em 1.5em 0.25em 0;
}
.highlightedCode
{
margin: 1.0em;
}
.annotated td {
padding: 0.25em 0.5em 0.25em 0.5em;
}
.header .content .toc ul
{
padding-left: 0px;
}
.content .toc h3 {
border-bottom: 0px;
margin-top: 0px;
}
.content .toc h3 a:hover {
color: #00732F;
text-decoration: none;
}
.content .toc .level2
{
margin-left: 1.5em;
}
.content .toc .level3
{
margin-left: 3.0em;
}
.content ul li
{
background: url(../images/bullet_sq.png) no-repeat 0 0.7em;
padding-left: 1em
}
.content .toc li
{
background: url(../images/bullet_dn.png) no-repeat 0 5px;
padding-left: 1em
}
.relpage
{
-moz-border-radius: 7px 7px 7px 7px;
-webkit-border-radius: 7px 7px 7px 7px;
border-radius: 7px 7px 7px 7px;
border: 1px solid #DDDDDD;
padding: 25px 25px;
clear: both;
}
.relpage ul
{
float: none;
padding: 1.5em;
}
h3.fn, span.fn
{
-moz-border-radius:7px 7px 7px 7px;
-webkit-border-radius:7px 7px 7px 7px;
border-radius:7px 7px 7px 7px;
background-color: #F6F6F6;
border-width: 1px;
border-style: solid;
border-color: #E6E6E6;
font-weight: bold;
word-spacing:3px;
padding:3px 5px;
}
.functionIndex {
font-size:12pt;
word-spacing:10px;
margin-bottom:10px;
background-color: #F6F6F6;
border-width: 1px;
border-style: solid;
border-color: #E6E6E6;
-moz-border-radius: 7px 7px 7px 7px;
-webkit-border-radius: 7px 7px 7px 7px;
border-radius: 7px 7px 7px 7px;
width:100%;
}
.centerAlign
{
text-align:center;
}
.rightAlign
{
text-align:right;
}
.leftAlign
{
text-align:left;
}
.topAlign{
vertical-align:top
}
.functionIndex a{
display:inline-block;
}
/* end content elements */
/* footer elements */
.footer
{
color: #393735;
font-size: 0.75em;
text-align: center;
padding-top: 1.5em;
padding-bottom: 1em;
background-color: #E6E7E8;
margin: 0;
}
.footer p
{
margin: 0.25em
}
.small
{
font-size: 0.5em;
}
/* end footer elements */
.item {
float: left;
position: relative;
width: 100%;
overflow: hidden;
}
.item .primary {
margin-right: 220px;
position: relative;
}
.item hr {
margin-left: -220px;
}
.item .secondary {
float: right;
width: 200px;
position: relative;
}
.item .cols {
clear: both;
display: block;
}
.item .cols .col {
float: left;
margin-left: 1.5%;
}
.item .cols .col.first {
margin-left: 0;
}
.item .cols.two .col {
width: 45%;
}
.item .box {
margin: 0 0 10px 0;
}
.item .box h3 {
margin: 0 0 10px 0;
}
.cols.unclear {
clear:none;
}
}
/* end of screen media */
/* start of print media */
@media print
{
input, textarea, .header, .footer, .toolbar, .feedback, .wrapper .hd, .wrapper .bd .sidebar, .wrapper .ft, #feedbackBox, #blurpage, .toc, .breadcrumb, .toolbar, .floatingResult
{
display: none;
background: none;
}
.content
{
background: none;
display: block;
width: 100%; margin: 0; float: none;
}
}
/* end of print media */

View File

@ -1,3 +1,17 @@
/*!
\class Action
\brief Holds information required to execute an action described by a \l{ActionType}.
\ingroup types
\inmodule libhive
It is bound to a \l{Device} and an \l{ActionType} and holds the parameters
for the execution of the action.
The params must match the template as described in \l{ActionType}.
\sa Device, ActionType
*/
#include "action.h"
Action::Action(const QUuid &deviceId, const QUuid &actionTypeId) :
@ -6,6 +20,7 @@ Action::Action(const QUuid &deviceId, const QUuid &actionTypeId) :
{
}
/*! An Action is valid if \l{actionTypeId} and \l{deviceId} are valid uuids. */
bool Action::isValid() const
{
return !m_actionTypeId.isNull() && !m_deviceId.isNull();

View File

@ -1,3 +1,12 @@
/*!
\class ActionType
\brief Describes an \l{Action} for a \l{Device}.
\ingroup types
\sa Action
*/
#include "actiontype.h"
ActionType::ActionType(const QUuid &id):

View File

@ -1,3 +1,16 @@
/*!
\class Device
\brief A Device represents a installed and configured hardware device.
\ingroup devices
\inmodule libhive
This class holds the values for configured devices. It is associated with a \{DeviceClass} which
can be used to get more details about the device.
\sa DeviceClass
*/
#include "device.h"
#include <QDebug>

View File

@ -1,3 +1,19 @@
/*!
\class DeviceClass
\brief Describes \l{Device}{Devices}.
\ingroup devices
\inmodule libhive
It holds information general information about devices and their vendors and
describes what actions, triggers and states a device supports. As this is
just a description of device and does not represent actual \l{Device}{Devices},
the actions, triggers and states are described in form of \l{TriggerType},
\l{StateType} and \l{ActionType}
\sa Device
*/
#include "deviceclass.h"
DeviceClass::DeviceClass(const QUuid &pluginId, const QUuid &id):

View File

@ -1,3 +1,17 @@
/*!
\class DeviceManager
\brief The main entry point when interacting with \l{Device}{Devices}
\ingroup devices
\inmodule libhive
The DeviceManager holds all information about supported and configured Devices in the system.
It is also responsible for loading Plugins and managing common hardware resources between
\l{DevicePlugin}{device plugins}.
*/
#include "devicemanager.h"
#include "radio433.h"

View File

@ -1,3 +1,15 @@
/*!
\class DevicePlugin
\brief This is the base class interface for device plugins.
\ingroup devices
\inmodule libhive
When implementing a new plugin, start by subclassing this and implementing the following
pure virtual methods: \l{DevicePlugin::pluginName()}, \l{DevicePlugin::pluginId()},
\l{DevicePlugin::supportedDevices()} and \l{DevicePlugin::requiredHardware()}
*/
#include "deviceplugin.h"
#include "devicemanager.h"
@ -5,6 +17,54 @@
#include <QDebug>
/*!
\fn QString DevicePlugin::pluginName() const
Return the name of the plugin. A String presented to the user.
*/
/*!
\fn QUuid DevicePlugin::pluginId() const
When implementing a plugin, generate a new uuid and return it here. Always return the
same uuid and don't change it or configurations can't be matched any more.
*/
/*!
\fn QList<DeviceClass> DevicePlugin::supportedDevices() const
Return a list of \l{DeviceClass}{DeviceClasses} describing all the devices supported by this plugin.
*/
/*!
\fn DeviceManager::HardwareResources DevicePlugin::requiredHardware() const
Return flags describing the common hardware resources required by this plugin.
\sa DevicePlugin::transmitData(), DevicePlugin::radioData(), DevicePlugin::hiveTimer()
*/
/*!
\fn void DevicePlugin::radioData(QList<int> rawData)
If the plugin has requested any radio device using \l{DevicePlugin::requiredHardware()}, this slot will
be called when there is \a rawData available from that device.
*/
/*!
\fn void DevicePlugin::hiveTimer()
If the plugin has requested the timer using \l{DevicePlugin::requiredHardware()}, this slot will be called
on timer events.
*/
/*!
\fn void DevicePlugin::executeAction(Device *device, const Action &action)
This will be called to actually execute actions on the hardware. The \{Device} and
the \{Action} are contained in the \a device and \a action parameters.
*/
/*!
\fn void DevicePlugin::emitTrigger(const Trigger &trigger)
Emit this to produce a \l{Trigger} in the system. Usually in response to incoming data,
such as \l{DevicePlugin::radioData()} or \l{DevicePlugin::hiveTimer()}. Find a
configured \l{Device} from the \l{DeviceManager} and get its \l{TriggerTypes}, then
create a \l{Trigger} complying to that \l{TriggerType} and emit it here.
*/
DevicePlugin::DevicePlugin():
m_deviceManager(0)
{
@ -22,22 +82,44 @@ void DevicePlugin::initPlugin(DeviceManager *deviceManager)
init();
}
/*!
Returns a map containing the plugin configuration.
When implementing a new plugin, override this and fill in the empty configuration if your plugin requires any.
*/
QVariantMap DevicePlugin::configuration() const
{
return QVariantMap();
}
/*!
Will be called by the DeviceManager to set a plugin's config.
When implementing a new plugin, override this and react to configuration changes.
TODO: Still need to define a common format for the config.
*/
void DevicePlugin::setConfiguration(const QVariantMap &configuration)
{
Q_UNUSED(configuration)
qWarning() << "Plugin" << pluginName() << pluginId() << "does not support any configuration";
}
/*!
Returns a pointer to the \l{DeviceManager}.
When implementing a plugin, use this to find the \l{Device}{Devices} you need.
*/
DeviceManager *DevicePlugin::deviceManager() const
{
return m_deviceManager;
}
/*!
Transmits data on the Radio433 or Radio868 devices, depending on the hardware requested by this plugin.
\sa DevicePlugin::requiredHardware()
*/
void DevicePlugin::transmitData(QList<int> rawData)
{
switch (requiredHardware()) {

View File

@ -18,8 +18,6 @@ public:
DevicePlugin();
virtual ~DevicePlugin();
void initPlugin(DeviceManager *deviceManager);
virtual void init() {}
virtual QString pluginName() const = 0;
@ -48,7 +46,11 @@ protected:
void transmitData(QList<int> rawData);
private:
void initPlugin(DeviceManager *deviceManager);
DeviceManager *m_deviceManager;
friend class DeviceManager;
};
Q_DECLARE_INTERFACE(DevicePlugin, "org.hiveyourhome.DevicePlugin")

View File

@ -1,11 +1,14 @@
/*!
\class State
\brief The container class for States.
\inmodule Types
\brief Holds the parameters of a State of a \l{Device}.
\ingroup types
\inmodule libhive
Lorem ipsum
States hold the state values for devices. A State is associated to a \l{Device} by
the \l{Device::deviceId} {deviceId} and represents the value of a state described in a \l{StateType}
\sa StateType
*/
#include "state.h"
@ -16,11 +19,13 @@ State::State(const QUuid &stateTypeId, const QUuid &deviceId):
{
}
/*! Returns the id of the StateType describing this State. */
QUuid State::stateTypeId() const
{
return m_stateTypeId;
}
/*! Returns the id of the StateType describing this State. */
QUuid State::deviceId() const
{
return m_deviceId;

View File

@ -1,3 +1,13 @@
/*!
\class StateType
\brief Describes a \l{State} for a \l{Device}.
\ingroup types
\inmodule libhive
\sa State
*/
#include "statetype.h"
StateType::StateType(const QUuid &id):

View File

@ -1,3 +1,18 @@
/*!
\class Trigger
\brief Holds information required to emit a trigger described by a \l{TriggerType}.
\ingroup types
\inmodule libhive
It is bound to a \l{Device} and a \l{TriggerType} and holds the parameters
for the event that happened.
The params must match the template as described in \l{TriggerType}.
\sa Device TriggerType
*/
#include "trigger.h"
Trigger::Trigger(const QUuid &triggerTypeId, const QUuid &deviceId, const QVariantMap &params):

View File

@ -1,30 +1,52 @@
/*!
\class TriggerType
\brief Describes a \l{Trigger} for a \l{Device}.
\ingroup types
\inmodule libhive
\sa Trigger
*/
#include "triggertype.h"
/*! Constructs a TriggerType object with the given id. */
TriggerType::TriggerType(const QUuid &id):
m_id(id)
{
}
/*! Returns the id. */
QUuid TriggerType::id() const
{
return m_id;
}
/*! Returns the name of this TriggerType, e.g. "Temperature changed" */
QString TriggerType::name() const
{
return m_name;
}
/*! Set a name for this TriggerType, e.g. "Temperature changed" */
void TriggerType::setName(const QString &name)
{
m_name = name;
}
/*!
Holds a map describing possible parameters for a \l{Trigger} of this TriggerType.
e.g. QVariantList(QVariantMap(("name", "temperature"), ("type": QVariant::Real)))
*/
QVariantList TriggerType::parameters() const
{
return m_parameters;
}
/*!
Set the parameter description for this TriggerType,
e.g. QVariantList(QVariantMap(("name", "temperature"), ("type": QVariant::Real)))
*/
void TriggerType::setParameters(const QVariantList &parameters)
{
m_parameters = parameters;

View File

@ -1,12 +1,6 @@
/*!
\page types.html
\title Types
\nextpage
libhive types:
\list
\li \c State
\li \c Trigger
\li \c Action
\endlist
\annotatedlist types
*/

View File

@ -12,20 +12,20 @@
The JSON message protocol communicates by exchanging JSON Objects with the following properties:
\list
\li \c "id": \c integer
\li \code "id": integer \endcode
The id should be a unique identifier for the message. Any server response will contain the
same id allowing to match responses to requests/commands. This parameter is mandatory.
\li "method": string
\li \code "method": string \endcode
The method field holds the method to be executed. Methods are grouped into namespaces. The
method string consists of two parts, the namespace and the method name, separated by a dot.
This parameter is mandatory.
(Example: "JSONRPC.Introspect")
\li "params": Object
(Example: \c"JSONRPC.Introspect")
\li \code "params": object \endcode
The params contains any JSON object. This parameter is optional and differs according to
the requested method.
\endlist
The JSONRPC API is self documenting and can be introspected by calling JSONRPC.Introspect.
The JSONRPC API is self documenting and can be introspected by calling \c"JSONRPC.Introspect".
\section1 Communicating with the server
The server listens on TCP port 1234 for incoming TCP connections. It will respond to incoming

View File

@ -1,8 +1,24 @@
/*!
\class Rule
\brief This class represents a rule.
\ingroup rules
\inmodule server
A \l{Rule} is always triggered by a \l{Trigger}, has \l{State}{States}
to be compared and \l{Action}{Actions} to be executed. Additionally a
Rule is either of type \l{Rule::RuleTypeAll} or \l{Rule::RuleTypeAny}
which determines if all or any of the \l{State}{States} must be matching
in order for the \l{Action}{Actions} to be executed.
\sa Trigger, State, Action
*/
#include "rule.h"
#include <QDebug>
Rule::Rule(const QUuid &id, const Trigger &trigger, const QList<State> states, const QList<Action> &actions):
Rule::Rule(const QUuid &id, const Trigger &trigger, const QList<State> &states, const QList<Action> &actions):
m_id(id),
m_trigger(trigger),
m_states(states),

View File

@ -15,7 +15,7 @@ public:
RuleTypeAny
};
Rule(const QUuid &id, const Trigger &trigger, const QList<State> states, const QList<Action> &actions);
Rule(const QUuid &id, const Trigger &trigger, const QList<State> &states, const QList<Action> &actions);
QUuid id() const;
Trigger trigger() const;

View File

@ -1,3 +1,17 @@
/*!
\class RuleEngine
\brief The Engine that evaluates \l{Rule}{Rules} and finds
\l{Action}{Actions} to be executed.
\ingroup rules
\inmodule server
You can add, remove and update rules and query the engine for actions to be executed
for a given \l{Trigger}.
\sa Trigger, Rule, Action
*/
#include "ruleengine.h"
#include "hivecore.h"
@ -88,7 +102,7 @@ RuleEngine::RuleError RuleEngine::addRule(const Trigger &trigger, const QList<Ac
return addRule(trigger, QList<State>(), actions);
}
RuleEngine::RuleError RuleEngine::addRule(const Trigger &trigger, const QList<State> states, const QList<Action> &actions)
RuleEngine::RuleError RuleEngine::addRule(const Trigger &trigger, const QList<State> &states, const QList<Action> &actions)
{
qDebug() << "adding rule: Trigger:" << trigger.triggerTypeId() << "with" << actions.count() << "actions";
DeviceClass triggerDeviceClass = HiveCore::instance()->deviceManager()->findDeviceClassforTrigger(trigger.triggerTypeId());

View File

@ -24,7 +24,7 @@ public:
QList<Action> evaluateTrigger(const Trigger &trigger);
RuleError addRule(const Trigger &trigger, const QList<Action> &actions);
RuleError addRule(const Trigger &trigger, const QList<State> states, const QList<Action> &actions);
RuleError addRule(const Trigger &trigger, const QList<State> &states, const QList<Action> &actions);
QList<Rule> rules() const;
RuleError removeRule(const QUuid &ruleId);