diff --git a/libguh/coap/coapoption.cpp b/libguh/coap/coapoption.cpp index 735320ee..7eb41480 100644 --- a/libguh/coap/coapoption.cpp +++ b/libguh/coap/coapoption.cpp @@ -34,31 +34,20 @@ Represents the known CoAP options according to \l{https://tools.ietf.org/html/rfc7252#section-3.1}{RFC7252}. \value IfMatch - \value UriHost - \value ETag - \value IfNoneMatch - \value Observe \l{https://tools.ietf.org/html/rfc7641} + \value UriPort - \value LocationPath - \value UriPath - \value ContentFormat - \value MaxAge - \value UriQuery - \value Accept - \value LocationQuery - \value Block2 \l{https://tools.ietf.org/html/draft-ietf-core-block-18} @@ -66,24 +55,33 @@ \l{https://tools.ietf.org/html/draft-ietf-core-block-18} \value ProxyUri - \value ProxyScheme - \value Size1 */ +/*! \fn CoapOption::CoapOption(); + Constructs a \l{CoapOption}. +*/ + +/*! \fn CoapOption::CoapOption(const Option &option, const QByteArray &data); + Constructs a \l{CoapOption} with the given \a option and option \a data. +*/ + +/*! \fn void CoapOption::setOption(const Option &option); + Sets the \l{CoapOption::Option} of this CoapOption to the given \a option. +*/ + + #include "coapoption.h" #include -/*! Constructs a CoapOption. */ CoapOption::CoapOption() { } -/*! Constructs a CoapOption with the given \a option and option \a data. */ CoapOption::CoapOption(const CoapOption::Option &option, const QByteArray &data) : m_option(option), m_data(data) @@ -91,7 +89,6 @@ CoapOption::CoapOption(const CoapOption::Option &option, const QByteArray &data) } -/*! Sets the \l{CoapOption::Option} of this CoapOption to the given \a option. */ void CoapOption::setOption(const CoapOption::Option &option) { m_option = option; diff --git a/libguh/coap/coappdu.cpp b/libguh/coap/coappdu.cpp index 7930552b..778a233e 100644 --- a/libguh/coap/coappdu.cpp +++ b/libguh/coap/coappdu.cpp @@ -123,9 +123,31 @@ \value InvalidOptionDeltaError \value InvalidOptionLengthError \value UnknownOptionError -}; - */ + + +/*! \fn void CoapPdu::getStatusCodeString(const StatusCode &statusCode); + Returns the human readable status code for the given \a statusCode. +*/ + +/*! \fn void CoapPdu::setContentType(const ContentType &contentType); + Sets the content type of this \l{CoapPdu} to the given \a contentType. + + \sa CoapPdu::ContentType +*/ + +/*! \fn void CoapPdu::setMessageType(const MessageType &messageType); + Sets the message type of this \l{CoapPdu} to the given \a messageType. + + \sa CoapPdu::MessageType +*/ + +/*! \fn void CoapPdu::setStatusCode(const StatusCode &statusCode); + Sets the message type of this \l{CoapPdu} to the given \a statusCode. + + \sa CoapPdu::StatusCode +*/ + #include "coappdu.h" #include "coapoption.h" diff --git a/libguh/devicemanager.cpp b/libguh/devicemanager.cpp index 5b67979a..ced21cb5 100644 --- a/libguh/devicemanager.cpp +++ b/libguh/devicemanager.cpp @@ -99,6 +99,10 @@ Couldn't find the PairingTransactionId for the given id. \value DeviceErrorAuthentificationFailure The device could not authentificate with something. + \value DeviceErrorDeviceIsChild + The device is a child device and can not be deleted directly. + \value DeviceErrorDeviceInRule + The device is in a rule and can not be deleted withou \l{guhserver::RuleEngine::RemovePolicy}. \value DeviceErrorParameterNotWritable One of the given device params is not writable. */ @@ -368,7 +372,7 @@ DeviceManager::DeviceError DeviceManager::discoverDevices(const DeviceClassId &d return ret; } -/*! Add a new configured device for the given \l{DeviceClass}, the given parameters and \a id. +/*! Add a new configured device for the given \l{DeviceClass}, the given parameters, \a name and \a id. * \a deviceClassId must refer to an existing \{DeviceClass} and \a params must match the parameter description in the \l{DeviceClass}. * Optionally you can supply an id yourself if you must keep track of the added device. If you don't supply it, a new one will * be generated. Only devices with \l{DeviceClass}{CreateMethodUser} can be created using this method. @@ -387,7 +391,7 @@ DeviceManager::DeviceError DeviceManager::addConfiguredDevice(const DeviceClassI /*! Add a new configured device for the given \l{DeviceClass} the given DeviceDescriptorId and \a deviceId. Only devices with \l{DeviceClass}{CreateMethodDiscovery} * can be created using this method. The \a deviceClassId must refer to an existing \l{DeviceClass} and the \a deviceDescriptorId must refer to an existing DeviceDescriptorId - * from the discovery. + * from the discovery. The \a name parameter should contain the device name. * Returns \l{DeviceError} to inform about the result. */ DeviceManager::DeviceError DeviceManager::addConfiguredDevice(const DeviceClassId &deviceClassId, const QString &name, const DeviceDescriptorId &deviceDescriptorId, const DeviceId &deviceId) { @@ -512,6 +516,9 @@ DeviceManager::DeviceError DeviceManager::reconfigureDevice(const DeviceId &devi return reconfigureDevice(deviceId, descriptor.params(), true); } +/*! Edit the \a name of the \l{Device} with the given \a deviceId. + Returns \l{DeviceManager::DeviceError}{DeviceError} to inform about the result. +*/ DeviceManager::DeviceError DeviceManager::editDevice(const DeviceId &deviceId, const QString &name) { Device *device = findConfiguredDevice(deviceId); @@ -525,7 +532,7 @@ DeviceManager::DeviceError DeviceManager::editDevice(const DeviceId &deviceId, c return DeviceErrorNoError; } -/*! Initiates a pairing with a \l{DeviceClass}{Device} with the given \a pairingTransactionId, \a deviceClassId and \a params. +/*! Initiates a pairing with a \l{DeviceClass}{Device} with the given \a pairingTransactionId, \a deviceClassId, \a name and \a params. * Returns \l{DeviceManager::DeviceError}{DeviceError} to inform about the result. */ DeviceManager::DeviceError DeviceManager::pairDevice(const PairingTransactionId &pairingTransactionId, const DeviceClassId &deviceClassId, const QString &name, const ParamList ¶ms) { @@ -556,7 +563,7 @@ DeviceManager::DeviceError DeviceManager::pairDevice(const PairingTransactionId return DeviceErrorNoError; } -/*! Initiates a pairing with a \l{DeviceClass}{Device} with the given \a pairingTransactionId, \a deviceClassId and \a deviceDescriptorId. +/*! Initiates a pairing with a \l{DeviceClass}{Device} with the given \a pairingTransactionId, \a deviceClassId, \a name and \a deviceDescriptorId. * Returns \l{DeviceManager::DeviceError}{DeviceError} to inform about the result. */ DeviceManager::DeviceError DeviceManager::pairDevice(const PairingTransactionId &pairingTransactionId, const DeviceClassId &deviceClassId, const QString &name, const DeviceDescriptorId &deviceDescriptorId) { @@ -787,6 +794,8 @@ DeviceClass DeviceManager::findDeviceClass(const DeviceClassId &deviceClassId) c return DeviceClass(); } +/*! Verify if the given \a params matche the given \a paramTypes. Ith \a requireAll + * is true, all \l{ParamList}{Params} has to be valid. Returns \l{DeviceError} to inform about the result.*/ DeviceManager::DeviceError DeviceManager::verifyParams(const QList paramTypes, ParamList ¶ms, bool requireAll) { foreach (const Param ¶m, params) { @@ -820,6 +829,7 @@ DeviceManager::DeviceError DeviceManager::verifyParams(const QList pa return DeviceErrorNoError; } +/*! Verify if the given \a param matches one of the given \a paramTypes. Returns \l{DeviceError} to inform about the result.*/ DeviceManager::DeviceError DeviceManager::verifyParam(const QList paramTypes, const Param ¶m) { foreach (const ParamType ¶mType, paramTypes) { @@ -831,6 +841,7 @@ DeviceManager::DeviceError DeviceManager::verifyParam(const QList par return DeviceErrorInvalidParameter; } +/*! Verify if the given \a param matches the given \a paramType. Returns \l{DeviceError} to inform about the result.*/ DeviceManager::DeviceError DeviceManager::verifyParam(const ParamType ¶mType, const Param ¶m) { if (paramType.name() == param.name()) { diff --git a/libguh/guhsettings.cpp b/libguh/guhsettings.cpp index 3615f12d..db326861 100644 --- a/libguh/guhsettings.cpp +++ b/libguh/guhsettings.cpp @@ -169,6 +169,7 @@ QString GuhSettings::logPath() return logPath; } +/*! Returns the path to the folder where the GuhSettings will be saved. */ QString GuhSettings::settingsPath() { QString path; diff --git a/libguh/network/upnpdiscovery/upnpdiscovery.cpp b/libguh/network/upnpdiscovery/upnpdiscovery.cpp index 3f80e09d..c9762b6e 100644 --- a/libguh/network/upnpdiscovery/upnpdiscovery.cpp +++ b/libguh/network/upnpdiscovery/upnpdiscovery.cpp @@ -95,6 +95,7 @@ UpnpDiscovery::UpnpDiscovery(QObject *parent) : sendAliveMessage(); } +/*! Destruct this \l{UpnpDiscovery} object. */ UpnpDiscovery::~UpnpDiscovery() { qCDebug(dcApplication) << "Shutting down \"UPnP Server\""; diff --git a/libguh/plugin/device.cpp b/libguh/plugin/device.cpp index 1ea574e6..d79fa246 100644 --- a/libguh/plugin/device.cpp +++ b/libguh/plugin/device.cpp @@ -153,7 +153,7 @@ bool Device::hasParam(const QString ¶mName) const return false; } -DeviceId m_id; +/*! Set the \l{State}{States} of this \l{Device} to the given \a states.*/ void Device::setStates(const QList &states) { m_states = states; diff --git a/libguh/plugin/deviceclass.cpp b/libguh/plugin/deviceclass.cpp index 0daa745c..758fcf10 100644 --- a/libguh/plugin/deviceclass.cpp +++ b/libguh/plugin/deviceclass.cpp @@ -112,6 +112,7 @@ he can bring it's own icon for a special DeviceClassId. If there is no special icon defined, he can fallback to the default icon. + \value DeviceIconNone \value DeviceIconBed \value DeviceIconBlinds \value DeviceIconCeilingLamp @@ -147,6 +148,13 @@ \value DeviceIconCloud */ +/*! \fn void DeviceClass::setBasicTags(const QList &basicTags); + Set the list of \a basicTags of this DeviceClass. +*/ + +/*! \fn void DeviceClass::setDeviceIcon(const DeviceIcon &deviceIcon); + Set the \a deviceIcon of this DeviceClass. +*/ #include "deviceclass.h" diff --git a/server/guhapplication.cpp b/server/guhapplication.cpp index deb40f3e..5c4ea91d 100644 --- a/server/guhapplication.cpp +++ b/server/guhapplication.cpp @@ -18,6 +18,21 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/*! + \class guhserver::GuhApplication + \brief Application class of the guh server. + + \ingroup core + \inmodule server + + The \l{GuhApplication} is a subclass of the \{http://doc.qt.io/qt-5/qcoreapplication.html}{QCoreApplication} + and is responsable to catch system signals like SIGQUIT, SIGINT, SIGTERM, SIGHUP, SIGSEGV. This class + will provide a backtrace on a segmentation fault (SIGSEGV). + + + \sa GuhService +*/ + #include "guhapplication.h" #include "loggingcategories.h" #include "guhcore.h" @@ -150,6 +165,7 @@ static void catchUnixSignals(const std::vector& quitSignals, const std::vec +/*! Constructs a GuhApplication with the given argument count \a argc and argument vector \a argv. */ GuhApplication::GuhApplication(int &argc, char **argv) : QCoreApplication(argc, argv) { diff --git a/server/guhcore.cpp b/server/guhcore.cpp index 025a7bc2..a0045401 100644 --- a/server/guhcore.cpp +++ b/server/guhcore.cpp @@ -58,7 +58,7 @@ /*! \fn void guhserver::GuhCore::devicesDiscovered(const DeviceClassId &deviceClassId, const QList deviceDescriptors); This signal is emitted when the discovery of a \a deviceClassId is finished. The \a deviceDescriptors parameter describes the list of \l{DeviceDescriptor}{DeviceDescriptors} of all discovered \l{Device}{Devices}. - \sa discoverDevices() + \sa DeviceManager::discoverDevices() */ /*! \fn void guhserver::GuhCore::deviceSetupFinished(Device *device, DeviceManager::DeviceError status); @@ -222,6 +222,8 @@ QPair > GuhCore::removeConfiguredDevic return QPair > (DeviceManager::DeviceErrorNoError, QList()); } + +/*! Removes a configured \l{Device} with the given \a deviceId and \a removePolicy. */ DeviceManager::DeviceError GuhCore::removeConfiguredDevice(const DeviceId &deviceId, const RuleEngine::RemovePolicy &removePolicy) { // Check if this is a child device @@ -303,6 +305,7 @@ DeviceManager::DeviceError GuhCore::executeAction(const Action &action) return ret; } +/*! Execute the given \a ruleActions. */ void GuhCore::executeRuleActions(const QList ruleActions) { foreach (const RuleAction &ruleAction, ruleActions) { diff --git a/server/httpreply.cpp b/server/httpreply.cpp index f40d9546..7f99d464 100644 --- a/server/httpreply.cpp +++ b/server/httpreply.cpp @@ -111,10 +111,24 @@ This signal is emitted when this async \l{HttpReply} is finished. */ +/*! \fn guhserver::HttpReply::HttpReply(QObject *parent); + Construct an empty \l{HttpReply} with the given \a parent. +*/ + +/*! \fn guhserver::HttpReply::HttpReply(const HttpStatusCode &statusCode, const Type &type, QObject *parent); + Construct a \l{HttpReply} with the given \a statusCode, \a type and \a parent. +*/ + +/*! \fn void guhserver::HttpReply::setHttpStatusCode(const HttpStatusCode &statusCode); + Set the \l{HttpStatusCode} of this \l{HttpReply} to the given \a statusCode. +*/ + /*! \fn QDebug guhserver::operator<< (QDebug debug, const HttpReply &httpReply); Writes the given \l{HttpReply} \a httpReply to the given \a debug. This method gets used just for debugging. */ + + #include "httpreply.h" #include @@ -123,7 +137,6 @@ namespace guhserver { -/*! Construct an empty \l{HttpReply} with the given \a parent. */ HttpReply::HttpReply(QObject *parent) : QObject(parent), m_statusCode(HttpReply::Ok), @@ -148,7 +161,6 @@ HttpReply::HttpReply(QObject *parent) : packReply(); } -/*! Construct a \l{HttpReply} with the given \a statusCode, \a type and \a parent. */ HttpReply::HttpReply(const HttpReply::HttpStatusCode &statusCode, const HttpReply::Type &type, QObject *parent): QObject(parent), m_statusCode(statusCode), @@ -172,9 +184,6 @@ HttpReply::HttpReply(const HttpReply::HttpStatusCode &statusCode, const HttpRepl packReply(); } -/*! Set the \l{HttpStatusCode} of this \l{HttpReply} to the given \a statusCode. - \sa httpStatusCode() -*/ void HttpReply::setHttpStatusCode(const HttpReply::HttpStatusCode &statusCode) { m_statusCode = statusCode; diff --git a/server/jsonrpc/actionhandler.cpp b/server/jsonrpc/actionhandler.cpp index d530da95..1e62b3c1 100644 --- a/server/jsonrpc/actionhandler.cpp +++ b/server/jsonrpc/actionhandler.cpp @@ -43,6 +43,7 @@ namespace guhserver { +/*! Constructs a new \l ActionHandler with the given \a parent. */ ActionHandler::ActionHandler(QObject *parent) : JsonHandler(parent) { @@ -66,6 +67,7 @@ ActionHandler::ActionHandler(QObject *parent) : connect(GuhCore::instance(), &GuhCore::actionExecuted, this, &ActionHandler::actionExecuted); } +/*! Returns the name of the \l{ActionHandler}. In this case \b Actions.*/ QString ActionHandler::name() const { return "Actions"; diff --git a/server/jsonrpc/devicehandler.cpp b/server/jsonrpc/devicehandler.cpp index c9c9ee20..c5eb3d8a 100644 --- a/server/jsonrpc/devicehandler.cpp +++ b/server/jsonrpc/devicehandler.cpp @@ -33,6 +33,26 @@ */ +/*! \fn void guhserver::DeviceHandler::StateChanged(const QVariantMap ¶ms); + This signal is emitted to the API notifications when a \l{State} has changed. + The \a params contain the map for the notification. +*/ + +/*! \fn void guhserver::DeviceHandler::DeviceRemoved(const QVariantMap ¶ms); + This signal is emitted to the API notifications when a \l{Device} has been removed. + The \a params contain the map for the notification. +*/ + +/*! \fn void guhserver::DeviceHandler::DeviceAdded(const QVariantMap ¶ms); + This signal is emitted to the API notifications when a \l{Device} has been added. + The \a params contain the map for the notification. +*/ + +/*! \fn void guhserver::DeviceHandler::DeviceChanged(const QVariantMap ¶ms); + This signal is emitted to the API notifications when a \l{Device} has been changed or reconfigured. + The \a params contain the map for the notification. +*/ + #include "devicehandler.h" #include "guhcore.h" #include "devicemanager.h" @@ -45,6 +65,7 @@ namespace guhserver { +/*! Constructs a new \l DeviceHandler with the given \a parent. */ DeviceHandler::DeviceHandler(QObject *parent) : JsonHandler(parent) { @@ -280,6 +301,7 @@ DeviceHandler::DeviceHandler(QObject *parent) : connect(GuhCore::instance(), &GuhCore::pairingFinished, this, &DeviceHandler::pairingFinished); } +/*! Returns the name of the \l{DeviceHandler}. In this case \b Devices.*/ QString DeviceHandler::name() const { return "Devices"; diff --git a/server/jsonrpc/eventhandler.cpp b/server/jsonrpc/eventhandler.cpp index f6667064..c18bbfa9 100644 --- a/server/jsonrpc/eventhandler.cpp +++ b/server/jsonrpc/eventhandler.cpp @@ -32,12 +32,18 @@ \sa Event, JsonHandler, JsonRPCServer */ +/*! \fn void guhserver::EventHandler::EventTriggered(const QVariantMap ¶ms); + This signal is emitted to the API notifications when an \l{Event} triggered. + The \a params contain the map for the notification. +*/ + #include "eventhandler.h" #include "guhcore.h" #include "loggingcategories.h" namespace guhserver { +/*! Constructs a new \l EventHandler with the given \a parent. */ EventHandler::EventHandler(QObject *parent) : JsonHandler(parent) { @@ -61,6 +67,7 @@ EventHandler::EventHandler(QObject *parent) : connect(GuhCore::instance(), &GuhCore::eventTriggered, this, &EventHandler::eventTriggered); } +/*! Returns the name of the \l{EventHandler}. In this case \b Events.*/ QString EventHandler::name() const { return "Events"; diff --git a/server/jsonrpc/jsonhandler.cpp b/server/jsonrpc/jsonhandler.cpp index 257c4e59..6405036c 100644 --- a/server/jsonrpc/jsonhandler.cpp +++ b/server/jsonrpc/jsonhandler.cpp @@ -29,6 +29,15 @@ \sa JsonRPCServer, JsonReply */ +/*! \fn QString guhserver::JsonHandler::name() const; + Pure virtual method for a JSON RPC handler. Returns the namespace of the handler. +*/ + +/*! \fn void guhserver::JsonHandler::asyncReply(int id, const QVariantMap ¶ms); + This signal will be emitted when a reply with the given \a id and \a params is finished. +*/ + + #include "jsonhandler.h" #include "loggingcategories.h" @@ -94,18 +103,24 @@ bool JsonHandler::hasMethod(const QString &methodName) return m_descriptions.contains(methodName) && m_params.contains(methodName) && m_returns.contains(methodName); } +/*! Validates the given \a params for the given \a methodName. Returns the error string and false if + the params are not valid. */ QPair JsonHandler::validateParams(const QString &methodName, const QVariantMap ¶ms) { QVariantMap paramTemplate = m_params.value(methodName); return JsonTypes::validateMap(paramTemplate, params); } +/*! Validates the given \a returns for the given \a methodName. Returns the error string and false if + the params are not valid. */ QPair JsonHandler::validateReturns(const QString &methodName, const QVariantMap &returns) { QVariantMap returnsTemplate = m_returns.value(methodName); return JsonTypes::validateMap(returnsTemplate, returns); } + +/*! Sets the \a description of the method with the given \a methodName. */ void JsonHandler::setDescription(const QString &methodName, const QString &description) { for(int i = 0; i < metaObject()->methodCount(); ++i) { @@ -118,6 +133,7 @@ void JsonHandler::setDescription(const QString &methodName, const QString &descr qCWarning(dcJsonRpc) << "Cannot set description. No such method:" << methodName; } +/*! Sets the \a params of the method with the given \a methodName. */ void JsonHandler::setParams(const QString &methodName, const QVariantMap ¶ms) { for(int i = 0; i < metaObject()->methodCount(); ++i) { @@ -130,6 +146,7 @@ void JsonHandler::setParams(const QString &methodName, const QVariantMap ¶ms qCWarning(dcJsonRpc) << "Cannot set params. No such method:" << methodName; } +/*! Sets the \a returns of the method with the given \a methodName. */ void JsonHandler::setReturns(const QString &methodName, const QVariantMap &returns) { for(int i = 0; i < metaObject()->methodCount(); ++i) { @@ -142,16 +159,22 @@ void JsonHandler::setReturns(const QString &methodName, const QVariantMap &retur qCWarning(dcJsonRpc) << "Cannot set returns. No such method:" << methodName; } +/*! Returns the pointer to a new \l{JsonReply} with the given \a data. */ JsonReply *JsonHandler::createReply(const QVariantMap &data) const { return JsonReply::createReply(const_cast(this), data); } +/*! Returns the pointer to an asynchronous new \l{JsonReply} with the given \a method. */ JsonReply* JsonHandler::createAsyncReply(const QString &method) const { return JsonReply::createAsyncReply(const_cast(this), method); } +/*! Returns the formated error map for the given \a status. + * + * \sa DeviceManager::DeviceError + */ QVariantMap JsonHandler::statusToReply(DeviceManager::DeviceError status) const { QVariantMap returns; @@ -159,6 +182,10 @@ QVariantMap JsonHandler::statusToReply(DeviceManager::DeviceError status) const return returns; } +/*! Returns the formated error map for the given \a status. + * + * \sa RuleEngine::RuleError + */ QVariantMap JsonHandler::statusToReply(RuleEngine::RuleError status) const { QVariantMap returns; @@ -166,6 +193,10 @@ QVariantMap JsonHandler::statusToReply(RuleEngine::RuleError status) const return returns; } +/*! Returns the formated error map for the given \a status. + * + * \sa Logging::LoggingError + */ QVariantMap JsonHandler::statusToReply(Logging::LoggingError status) const { QVariantMap returns; @@ -184,8 +215,24 @@ QVariantMap JsonHandler::statusToReply(Logging::LoggingError status) const \sa JsonHandler, JsonRPCServer */ +/*! \enum guhserver::JsonReply::Type + + This enum type specifies the type of a JsonReply. + + \value TypeSync + The response is synchronous. + \value TypeAsync + The response is asynchronous. +*/ + +/*! \fn void guhserver::JsonReply::finished(); + This signal will be emitted when a JsonReply is finished. A JsonReply is finished when + the response is ready or then the reply timed out. +*/ + +/*! Constructs a new \l JsonReply with the given \a type, \a handler, \a method and \a data. */ JsonReply::JsonReply(Type type, JsonHandler *handler, const QString &method, const QVariantMap &data): m_type(type), m_data(data), @@ -196,61 +243,73 @@ JsonReply::JsonReply(Type type, JsonHandler *handler, const QString &method, con connect(&m_timeout, &QTimer::timeout, this, &JsonReply::timeout); } +/*! Returns the pointer to a new \l{JsonReply} for the given \a handler and \a data. */ JsonReply *JsonReply::createReply(JsonHandler *handler, const QVariantMap &data) { return new JsonReply(TypeSync, handler, QString(), data); } +/*! Returns the pointer to a new asynchronous \l{JsonReply} for the given \a handler and \a method. */ JsonReply *JsonReply::createAsyncReply(JsonHandler *handler, const QString &method) { return new JsonReply(TypeAsync, handler, method); } +/*! Returns the type of this \l{JsonReply}.*/ JsonReply::Type JsonReply::type() const { return m_type; } +/*! Returns the data of this \l{JsonReply}.*/ QVariantMap JsonReply::data() const { return m_data; } +/*! Sets the \a data of this \l{JsonReply}.*/ void JsonReply::setData(const QVariantMap &data) { m_data = data; } +/*! Returns the handler of this \l{JsonReply}.*/ JsonHandler *JsonReply::handler() const { return m_handler; } +/*! Returns the method of this \l{JsonReply}.*/ QString JsonReply::method() const { return m_method; } +/*! Returns the client ID of this \l{JsonReply}.*/ QUuid JsonReply::clientId() const { return m_clientId; } +/*! Sets the \a clientId of this \l{JsonReply}.*/ void JsonReply::setClientId(const QUuid &clientId) { m_clientId = clientId; } +/*! Returns the command ID of this \l{JsonReply}.*/ int JsonReply::commandId() const { return m_commandId; } +/*! Returns the \a commandId of this \l{JsonReply}.*/ void JsonReply::setCommandId(int commandId) { m_commandId = commandId; } +/*! Start the timeout timer for this \l{JsonReply}. The default timeout is 10 seconds. */ void JsonReply::startWait() { m_timeout.start(10000); @@ -262,6 +321,7 @@ void JsonReply::timeout() emit finished(); } +/*! Returns true if this \l{JsonReply} timed out.*/ bool JsonReply::timedOut() const { return m_timedOut; diff --git a/server/jsonrpc/jsontypes.cpp b/server/jsonrpc/jsontypes.cpp index 23600c4c..0bfdb300 100644 --- a/server/jsonrpc/jsontypes.cpp +++ b/server/jsonrpc/jsontypes.cpp @@ -19,6 +19,33 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/*! + \class guhserver::JsonTypes + \brief This class represents the types for the JSON-RPC API. + + \ingroup json + \inmodule core + + This class represents all JSON-RPC API types and allowes to transform Json + objects into c++ objects and vers visa. + +*/ + +/*! \enum guhserver::JsonTypes::BasicType + + This enum type specifies the basic types of a JSON RPC API. + + \value Uuid + \value String + \value Int + \value Uint + \value Double + \value Bool + \value Variant + \value Color + \value Object +*/ + #include "jsontypes.h" #include "plugin/device.h" @@ -270,6 +297,7 @@ QVariantList JsonTypes::enumToStrings(const QMetaObject &metaObject, const QStri return enumStrings; } +/*! Returns a map containing all API types. */ QVariantMap JsonTypes::allTypes() { QVariantMap allTypes; @@ -315,6 +343,7 @@ QVariantMap JsonTypes::allTypes() return allTypes; } +/*! Returns a variant map of the given \a eventType. */ QVariantMap JsonTypes::packEventType(const EventType &eventType) { QVariantMap variant; @@ -328,6 +357,7 @@ QVariantMap JsonTypes::packEventType(const EventType &eventType) return variant; } +/*! Returns a variant map of the given \a event. */ QVariantMap JsonTypes::packEvent(const Event &event) { QVariantMap variant; @@ -341,6 +371,7 @@ QVariantMap JsonTypes::packEvent(const Event &event) return variant; } +/*! Returns a variant map of the given \a eventDescriptor. */ QVariantMap JsonTypes::packEventDescriptor(const EventDescriptor &eventDescriptor) { QVariantMap variant; @@ -354,6 +385,7 @@ QVariantMap JsonTypes::packEventDescriptor(const EventDescriptor &eventDescripto return variant; } +/*! Returns a variant map of the given \a actionType. */ QVariantMap JsonTypes::packActionType(const ActionType &actionType) { QVariantMap variantMap; @@ -367,6 +399,7 @@ QVariantMap JsonTypes::packActionType(const ActionType &actionType) return variantMap; } +/*! Returns a variant map of the given \a action. */ QVariantMap JsonTypes::packAction(const Action &action) { QVariantMap variant; @@ -380,6 +413,7 @@ QVariantMap JsonTypes::packAction(const Action &action) return variant; } +/*! Returns a variant map of the given \a ruleAction. */ QVariantMap JsonTypes::packRuleAction(const RuleAction &ruleAction) { QVariantMap variant; @@ -393,6 +427,7 @@ QVariantMap JsonTypes::packRuleAction(const RuleAction &ruleAction) return variant; } +/*! Returns a variant map of the given \a ruleActionParam. */ QVariantMap JsonTypes::packRuleActionParam(const RuleActionParam &ruleActionParam) { QVariantMap variantMap; @@ -407,6 +442,7 @@ QVariantMap JsonTypes::packRuleActionParam(const RuleActionParam &ruleActionPara return variantMap; } +/*! Returns a variant map of the given \a state. */ QVariantMap JsonTypes::packState(const State &state) { QVariantMap stateMap; @@ -415,6 +451,7 @@ QVariantMap JsonTypes::packState(const State &state) return stateMap; } +/*! Returns a variant map of the given \a stateType. */ QVariantMap JsonTypes::packStateType(const StateType &stateType) { QVariantMap variantMap; @@ -438,6 +475,7 @@ QVariantMap JsonTypes::packStateType(const StateType &stateType) return variantMap; } +/*! Returns a variant map of the given \a stateDescriptor. */ QVariantMap JsonTypes::packStateDescriptor(const StateDescriptor &stateDescriptor) { QVariantMap variantMap; @@ -448,6 +486,7 @@ QVariantMap JsonTypes::packStateDescriptor(const StateDescriptor &stateDescripto return variantMap; } +/*! Returns a variant map of the given \a stateEvaluator. */ QVariantMap JsonTypes::packStateEvaluator(const StateEvaluator &stateEvaluator) { QVariantMap variantMap; @@ -467,6 +506,7 @@ QVariantMap JsonTypes::packStateEvaluator(const StateEvaluator &stateEvaluator) return variantMap; } +/*! Returns a variant map of the given \a param. */ QVariantMap JsonTypes::packParam(const Param ¶m) { QVariantMap variantMap; @@ -475,6 +515,7 @@ QVariantMap JsonTypes::packParam(const Param ¶m) return variantMap; } +/*! Returns a variant map of the given \a paramDescriptor. */ QVariantMap JsonTypes::packParamDescriptor(const ParamDescriptor ¶mDescriptor) { QVariantMap variantMap; @@ -484,6 +525,7 @@ QVariantMap JsonTypes::packParamDescriptor(const ParamDescriptor ¶mDescripto return variantMap; } +/*! Returns a variant map of the given \a paramType. */ QVariantMap JsonTypes::packParamType(const ParamType ¶mType) { QVariantMap variantMap; @@ -515,6 +557,7 @@ QVariantMap JsonTypes::packParamType(const ParamType ¶mType) return variantMap; } +/*! Returns a variant map of the given \a vendor. */ QVariantMap JsonTypes::packVendor(const Vendor &vendor) { QVariantMap variantMap; @@ -523,6 +566,7 @@ QVariantMap JsonTypes::packVendor(const Vendor &vendor) return variantMap; } +/*! Returns a variant map of the given \a deviceClass. */ QVariantMap JsonTypes::packDeviceClass(const DeviceClass &deviceClass) { QVariantMap variant; @@ -568,6 +612,7 @@ QVariantMap JsonTypes::packDeviceClass(const DeviceClass &deviceClass) return variant; } +/*! Returns a variant map of the given \a plugin. */ QVariantMap JsonTypes::packPlugin(DevicePlugin *plugin) { QVariantMap pluginMap; @@ -583,6 +628,7 @@ QVariantMap JsonTypes::packPlugin(DevicePlugin *plugin) return pluginMap; } +/*! Returns a variant map of the given \a device. */ QVariantMap JsonTypes::packDevice(Device *device) { QVariantMap variant; @@ -603,6 +649,7 @@ QVariantMap JsonTypes::packDevice(Device *device) return variant; } +/*! Returns a variant map of the given \a descriptor. */ QVariantMap JsonTypes::packDeviceDescriptor(const DeviceDescriptor &descriptor) { QVariantMap variant; @@ -612,6 +659,7 @@ QVariantMap JsonTypes::packDeviceDescriptor(const DeviceDescriptor &descriptor) return variant; } +/*! Returns a variant map of the given \a rule. */ QVariantMap JsonTypes::packRule(const Rule &rule) { QVariantMap ruleMap; @@ -642,6 +690,7 @@ QVariantMap JsonTypes::packRule(const Rule &rule) return ruleMap; } +/*! Returns a variant map of the given \a rules. */ QVariantList JsonTypes::packRules(const QList rules) { QVariantList rulesList; @@ -651,6 +700,7 @@ QVariantList JsonTypes::packRules(const QList rules) return rulesList; } +/*! Returns a variant map of the given \a rule. */ QVariantMap JsonTypes::packRuleDescription(const Rule &rule) { QVariantMap ruleDescriptionMap; @@ -662,6 +712,7 @@ QVariantMap JsonTypes::packRuleDescription(const Rule &rule) return ruleDescriptionMap; } +/*! Returns a variant map of the given \a logEntry. */ QVariantMap JsonTypes::packLogEntry(const LogEntry &logEntry) { QVariantMap logEntryMap; @@ -710,6 +761,7 @@ QVariantMap JsonTypes::packLogEntry(const LogEntry &logEntry) return logEntryMap; } +/*! Returns a variant list of the given \a createMethods. */ QVariantList JsonTypes::packCreateMethods(DeviceClass::CreateMethods createMethods) { QVariantList ret; @@ -725,6 +777,7 @@ QVariantList JsonTypes::packCreateMethods(DeviceClass::CreateMethods createMetho return ret; } +/*! Returns a variant list of the supported vendors. */ QVariantList JsonTypes::packSupportedVendors() { QVariantList supportedVendors; @@ -734,6 +787,7 @@ QVariantList JsonTypes::packSupportedVendors() return supportedVendors; } +/*! Returns a variant list of the supported devices with the given \a vendorId. */ QVariantList JsonTypes::packSupportedDevices(const VendorId &vendorId) { QVariantList supportedDeviceList; @@ -743,6 +797,7 @@ QVariantList JsonTypes::packSupportedDevices(const VendorId &vendorId) return supportedDeviceList; } +/*! Returns a variant list of configured devices. */ QVariantList JsonTypes::packConfiguredDevices() { QVariantList configuredDeviceList; @@ -752,6 +807,7 @@ QVariantList JsonTypes::packConfiguredDevices() return configuredDeviceList; } +/*! Returns a variant list of States from the given \a device. */ QVariantList JsonTypes::packDeviceStates(Device *device) { DeviceClass deviceClass = GuhCore::instance()->deviceManager()->findDeviceClass(device->deviceClassId()); @@ -765,6 +821,7 @@ QVariantList JsonTypes::packDeviceStates(Device *device) return stateValues; } +/*! Returns a variant list of the given \a deviceDescriptors. */ QVariantList JsonTypes::packDeviceDescriptors(const QList deviceDescriptors) { QVariantList deviceDescriptorList; @@ -774,6 +831,7 @@ QVariantList JsonTypes::packDeviceDescriptors(const QList devi return deviceDescriptorList; } +/*! Returns a variant list containing all rule descriptions. */ QVariantList JsonTypes::packRuleDescriptions() { QVariantList rulesList; @@ -783,6 +841,7 @@ QVariantList JsonTypes::packRuleDescriptions() return rulesList; } +/*! Returns a variant list of the given \a rules. */ QVariantList JsonTypes::packRuleDescriptions(const QList &rules) { QVariantList rulesList; @@ -792,6 +851,7 @@ QVariantList JsonTypes::packRuleDescriptions(const QList &rules) return rulesList; } +/*! Returns a variant list of action types for the given \a deviceClass. */ QVariantList JsonTypes::packActionTypes(const DeviceClass &deviceClass) { QVariantList actionTypes; @@ -801,6 +861,7 @@ QVariantList JsonTypes::packActionTypes(const DeviceClass &deviceClass) return actionTypes; } +/*! Returns a variant list of state types for the given \a deviceClass. */ QVariantList JsonTypes::packStateTypes(const DeviceClass &deviceClass) { QVariantList stateTypes; @@ -810,6 +871,7 @@ QVariantList JsonTypes::packStateTypes(const DeviceClass &deviceClass) return stateTypes; } +/*! Returns a variant list of event types for the given \a deviceClass. */ QVariantList JsonTypes::packEventTypes(const DeviceClass &deviceClass) { QVariantList eventTypes; @@ -819,6 +881,7 @@ QVariantList JsonTypes::packEventTypes(const DeviceClass &deviceClass) return eventTypes; } +/*! Returns a variant list containing all plugins. */ QVariantList JsonTypes::packPlugins() { QVariantList pluginsList; @@ -829,6 +892,7 @@ QVariantList JsonTypes::packPlugins() return pluginsList; } +/*! Returns the type string for the given \a type. */ QString JsonTypes::basicTypeToString(const QVariant::Type &type) { switch (type) { @@ -859,6 +923,7 @@ QString JsonTypes::basicTypeToString(const QVariant::Type &type) } } +/*! Returns a \l{Param} created from the given \a paramMap. */ Param JsonTypes::unpackParam(const QVariantMap ¶mMap) { if (paramMap.keys().count() == 0) { @@ -869,6 +934,7 @@ Param JsonTypes::unpackParam(const QVariantMap ¶mMap) return Param(name, value); } +/*! Returns a \l{ParamList} created from the given \a paramList. */ ParamList JsonTypes::unpackParams(const QVariantList ¶mList) { ParamList params; @@ -878,6 +944,7 @@ ParamList JsonTypes::unpackParams(const QVariantList ¶mList) return params; } +/*! Returns a \l{RuleActionParam} created from the given \a ruleActionParamMap. */ RuleActionParam JsonTypes::unpackRuleActionParam(const QVariantMap &ruleActionParamMap) { if (ruleActionParamMap.keys().count() == 0) @@ -890,6 +957,7 @@ RuleActionParam JsonTypes::unpackRuleActionParam(const QVariantMap &ruleActionPa return RuleActionParam(name, value, eventTypeId, eventParamName); } +/*! Returns a \l{RuleActionParamList} created from the given \a ruleActionParamList. */ RuleActionParamList JsonTypes::unpackRuleActionParams(const QVariantList &ruleActionParamList) { RuleActionParamList ruleActionParams; @@ -899,6 +967,7 @@ RuleActionParamList JsonTypes::unpackRuleActionParams(const QVariantList &ruleAc return ruleActionParams; } +/*! Returns a \l{ParamDescriptor} created from the given \a paramMap. */ ParamDescriptor JsonTypes::unpackParamDescriptor(const QVariantMap ¶mMap) { ParamDescriptor param(paramMap.value("name").toString(), paramMap.value("value")); @@ -911,6 +980,7 @@ ParamDescriptor JsonTypes::unpackParamDescriptor(const QVariantMap ¶mMap) return param; } +/*! Returns a list of \l{ParamDescriptor} created from the given \a paramList. */ QList JsonTypes::unpackParamDescriptors(const QVariantList ¶mList) { QList params; @@ -920,6 +990,7 @@ QList JsonTypes::unpackParamDescriptors(const QVariantList &par return params; } +/*! Returns a \l{EventDescriptor} created from the given \a eventDescriptorMap. */ EventDescriptor JsonTypes::unpackEventDescriptor(const QVariantMap &eventDescriptorMap) { EventTypeId eventTypeId(eventDescriptorMap.value("eventTypeId").toString()); @@ -929,6 +1000,7 @@ EventDescriptor JsonTypes::unpackEventDescriptor(const QVariantMap &eventDescrip return eventDescriptor; } +/*! Returns a \l{StateEvaluator} created from the given \a stateEvaluatorMap. */ StateEvaluator JsonTypes::unpackStateEvaluator(const QVariantMap &stateEvaluatorMap) { StateEvaluator ret(unpackStateDescriptor(stateEvaluatorMap.value("stateDescriptor").toMap())); @@ -943,6 +1015,7 @@ StateEvaluator JsonTypes::unpackStateEvaluator(const QVariantMap &stateEvaluator return ret; } +/*! Returns a \l{StateDescriptor} created from the given \a stateDescriptorMap. */ StateDescriptor JsonTypes::unpackStateDescriptor(const QVariantMap &stateDescriptorMap) { StateTypeId stateTypeId(stateDescriptorMap.value("stateTypeId").toString()); @@ -953,6 +1026,7 @@ StateDescriptor JsonTypes::unpackStateDescriptor(const QVariantMap &stateDescrip return stateDescriptor; } +/*! Returns a \l{LogFilter} created from the given \a logFilterMap. */ LogFilter JsonTypes::unpackLogFilter(const QVariantMap &logFilterMap) { LogFilter filter; @@ -1011,6 +1085,8 @@ LogFilter JsonTypes::unpackLogFilter(const QVariantMap &logFilterMap) return filter; } +/*! Compairs the given \a map with the given \a templateMap. Returns the error string and false if + the params are not valid. */ QPair JsonTypes::validateMap(const QVariantMap &templateMap, const QVariantMap &map) { s_lastError.clear(); @@ -1049,6 +1125,8 @@ QPair JsonTypes::validateMap(const QVariantMap &templateMap, cons return report(true, ""); } +/*! Compairs the given \a value with the given \a templateValue. Returns the error string and false if + the params are not valid. */ QPair JsonTypes::validateProperty(const QVariant &templateValue, const QVariant &value) { QString strippedTemplateValue = templateValue.toString(); @@ -1077,6 +1155,8 @@ QPair JsonTypes::validateProperty(const QVariant &templateValue, return report(false, errorString); } +/*! Compairs the given \a list with the given \a templateList. Returns the error string and false if + the params are not valid. */ QPair JsonTypes::validateList(const QVariantList &templateList, const QVariantList &list) { Q_ASSERT(templateList.count() == 1); @@ -1093,6 +1173,8 @@ QPair JsonTypes::validateList(const QVariantList &templateList, c return report(true, ""); } +/*! Compairs the given \a variant with the given \a templateVariant. Returns the error string and false if + the params are not valid. */ QPair JsonTypes::validateVariant(const QVariant &templateVariant, const QVariant &variant) { switch(templateVariant.type()) { @@ -1352,6 +1434,8 @@ QPair JsonTypes::validateVariant(const QVariant &templateVariant, return report(true, ""); } +/*! Verify the given \a variant with the possible \l{BasicType}. Returns the error string and false if + the params are not valid. */ QPair JsonTypes::validateBasicType(const QVariant &variant) { if (variant.canConvert(QVariant::Uuid) && QVariant(variant).convert(QVariant::Uuid)) { @@ -1378,6 +1462,7 @@ QPair JsonTypes::validateBasicType(const QVariant &variant) return report(false, QString("Error validating basic type %1.").arg(variant.toString())); } +/*! Returns the type of the \l{Param} with the given \a paramName of the \l{ActionType} with the given \a actionTypeId. */ QVariant::Type JsonTypes::getActionParamType(const ActionTypeId &actionTypeId, const QString ¶mName) { foreach (const DeviceClass &deviceClass, GuhCore::instance()->deviceManager()->supportedDevices()) { @@ -1394,6 +1479,7 @@ QVariant::Type JsonTypes::getActionParamType(const ActionTypeId &actionTypeId, c return QVariant::Invalid; } +/*! Returns the type of the \l{Param} with the given \a paramName of the \l{EventType} with the given \a eventTypeId. */ QVariant::Type JsonTypes::getEventParamType(const EventTypeId &eventTypeId, const QString ¶mName) { foreach (const DeviceClass &deviceClass, GuhCore::instance()->deviceManager()->supportedDevices()) { @@ -1411,6 +1497,7 @@ QVariant::Type JsonTypes::getEventParamType(const EventTypeId &eventTypeId, cons return QVariant::Invalid; } +/*! Returns true if the given \a eventTypeId is in the given \a eventDescriptors.*/ bool JsonTypes::checkEventDescriptors(const QList eventDescriptors, const EventTypeId &eventTypeId) { foreach (const EventDescriptor eventDescriptor, eventDescriptors) { @@ -1421,6 +1508,7 @@ bool JsonTypes::checkEventDescriptors(const QList eventDescript return false; } +/*! Verifies if the given \a params contain a valid rule. Returns \l{RuleEngine::RuleError} to inform about the result.*/ RuleEngine::RuleError JsonTypes::verifyRuleConsistency(const QVariantMap ¶ms) { // check if there are an eventDescriptor and an eventDescriptorList @@ -1448,6 +1536,7 @@ RuleEngine::RuleError JsonTypes::verifyRuleConsistency(const QVariantMap ¶ms return RuleEngine::RuleErrorNoError; } +/*! Verifies if the given \a params contain a valid rule. Returns \l{RuleEngine::RuleError} to inform about the result.*/ QPair, RuleEngine::RuleError> JsonTypes::verifyEventDescriptors(const QVariantMap ¶ms) { // Check and unpack eventDescriptors @@ -1467,6 +1556,7 @@ QPair, RuleEngine::RuleError> JsonTypes::verifyEventDescr return QPair, RuleEngine::RuleError>(eventDescriptorList, RuleEngine::RuleErrorNoError); } +/*! Verifies if the given \a eventDescriptorList corresponds to an action in the given \a params. Returns \l{RuleEngine::RuleError} and \l{RuleAction} list to inform about the result.*/ QPair, RuleEngine::RuleError> JsonTypes::verifyActions(const QVariantMap ¶ms, const QList &eventDescriptorList) { QList actions; @@ -1524,6 +1614,7 @@ QPair, RuleEngine::RuleError> JsonTypes::verifyActions(const Q return QPair, RuleEngine::RuleError>(actions, RuleEngine::RuleErrorNoError); } +/*! Verifies if exit actions of the rule in the given \a params. Returns \l{RuleEngine::RuleError} and \l{RuleAction} list to inform about the result. */ QPair, RuleEngine::RuleError> JsonTypes::verifyExitActions(const QVariantMap ¶ms) { QList exitActions; @@ -1545,6 +1636,8 @@ QPair, RuleEngine::RuleError> JsonTypes::verifyExitActions(con return QPair, RuleEngine::RuleError>(exitActions, RuleEngine::RuleErrorNoError); } +/*! Compairs the given \a value with the given \a enumDescription. Returns the error string and false if + the enum does not contain the given \a value. */ QPair JsonTypes::validateEnum(const QVariantList &enumDescription, const QVariant &value) { QStringList enumStrings; diff --git a/server/jsonrpc/logginghandler.cpp b/server/jsonrpc/logginghandler.cpp index 65f8dcab..be0535fb 100644 --- a/server/jsonrpc/logginghandler.cpp +++ b/server/jsonrpc/logginghandler.cpp @@ -32,6 +32,16 @@ \sa LogEngine, JsonHandler, JsonRPCServer */ +/*! \fn void guhserver::LoggingHandler::LogEntryAdded(const QVariantMap ¶ms); + This signal is emitted to the API notifications when a \l{LogEntry} was added to the database. + The \a params contain the map for the notification. +*/ + +/*! \fn void guhserver::LoggingHandler::LogDatabaseUpdated(const QVariantMap ¶ms); + This signal is emitted to the API notifications when the logging aatabase has been updated (i.e. \l{Device} or \l{Rule} removed). + The \a params contain the map for the notification. +*/ + #include "logginghandler.h" #include "logging/logengine.h" #include "logging/logfilter.h" @@ -40,6 +50,7 @@ namespace guhserver { +/*! Constructs a new \l LoggingHandler with the given \a parent. */ LoggingHandler::LoggingHandler(QObject *parent) : JsonHandler(parent) { @@ -84,6 +95,7 @@ LoggingHandler::LoggingHandler(QObject *parent) : connect(GuhCore::instance()->logEngine(), &LogEngine::logDatabaseUpdated, this, &LoggingHandler::logDatabaseUpdated); } +/*! Returns the name of the \l{LoggingHandler}. In this case \b Logging.*/ QString LoggingHandler::name() const { return "Logging"; diff --git a/server/jsonrpc/ruleshandler.cpp b/server/jsonrpc/ruleshandler.cpp index e1b943a4..f7a5dedc 100644 --- a/server/jsonrpc/ruleshandler.cpp +++ b/server/jsonrpc/ruleshandler.cpp @@ -32,6 +32,26 @@ \sa RuleEngine, JsonHandler, JsonRPCServer */ +/*! \fn void guhserver::RulesHandler::RuleRemoved(const QVariantMap ¶ms); + This signal is emitted to the API notifications when a \l{Rule} was removed. + The \a params contain the map for the notification. +*/ + +/*! \fn void guhserver::RulesHandler::RuleAdded(const QVariantMap ¶ms); + This signal is emitted to the API notifications when a \l{Rule} was added. + The \a params contain the map for the notification. +*/ + +/*! \fn void guhserver::RulesHandler::RuleActiveChanged(const QVariantMap ¶ms); + This signal is emitted to the API notifications when a \l{Rule} has changed the active status. + The \a params contain the map for the notification. +*/ + +/*! \fn void guhserver::RulesHandler::RuleConfigurationChanged(const QVariantMap ¶ms); + This signal is emitted to the API notifications when a \l{Rule} has changed the configuration. + The \a params contain the map for the notification. +*/ + #include "ruleshandler.h" #include "guhcore.h" #include "ruleengine.h" @@ -41,6 +61,7 @@ namespace guhserver { +/*! Constructs a new \l{RulesHandler} with the given \a parent. */ RulesHandler::RulesHandler(QObject *parent) : JsonHandler(parent) { @@ -173,6 +194,7 @@ RulesHandler::RulesHandler(QObject *parent) : connect(GuhCore::instance(), &GuhCore::ruleConfigurationChanged, this, &RulesHandler::ruleConfigurationChangedNotification); } +/*! Returns the name of the \l{RulesHandler}. In this case \b Rules.*/ QString RulesHandler::name() const { return "Rules"; diff --git a/server/jsonrpc/statehandler.cpp b/server/jsonrpc/statehandler.cpp index 3f5540b0..5b16cbec 100644 --- a/server/jsonrpc/statehandler.cpp +++ b/server/jsonrpc/statehandler.cpp @@ -38,6 +38,7 @@ namespace guhserver { +/*! Constructs a new \l{StateHandler} with the given \a parent. */ StateHandler::StateHandler(QObject *parent) : JsonHandler(parent) { @@ -53,6 +54,7 @@ StateHandler::StateHandler(QObject *parent) : setReturns("GetStateType", returns); } +/*! Returns the name of the \l{StateHandler}. In this case \b States.*/ QString StateHandler::name() const { return "States"; diff --git a/server/logging/logengine.cpp b/server/logging/logengine.cpp index 5dbf65ed..c8fc31e1 100644 --- a/server/logging/logengine.cpp +++ b/server/logging/logengine.cpp @@ -56,6 +56,10 @@ \sa LogEngine, LogEntry, LogFilter */ +/*! \fn guhserver::Logging::Logging(QObject *parent) + Constructs the \l{Logging} object with the given \a parent. +*/ + /*! \enum guhserver::Logging::LoggingError Represents the possible errors from the \l{LogEngine}. @@ -73,7 +77,12 @@ \value LoggingEventTypeTrigger This event type describes an \l{Event} which has triggered. \value LoggingEventTypeActiveChange - This event type describes an \l{Rule} which has changed its active status. + This event type describes a \l{Rule} which has changed its active status. + \value LoggingEventTypeActionsExecuted + This event type describes the actions execution of a \l{Rule}. + \value LoggingEventTypeExitActionsExecuted + This event type describes the exit actions execution of a \l{Rule}. + */ /*! \enum guhserver::Logging::LoggingLevel @@ -145,6 +154,7 @@ LogEngine::LogEngine(QObject *parent): initDB(); } +/*! Destructs the \l{LogEngine}. */ LogEngine::~LogEngine() { qCDebug(dcApplication) << "Shutting down \"Log Engine\""; diff --git a/server/logging/logentry.cpp b/server/logging/logentry.cpp index 3f278af7..6e88239c 100644 --- a/server/logging/logentry.cpp +++ b/server/logging/logentry.cpp @@ -43,6 +43,7 @@ namespace guhserver { +/*! Constructs a \l{LogEntry} with the given \a timestamp, \a level, \a source and \a errorCode.*/ LogEntry::LogEntry(QDateTime timestamp, Logging::LoggingLevel level, Logging::LoggingSource source, int errorCode): m_timestamp(timestamp), m_level(level), @@ -54,83 +55,99 @@ LogEntry::LogEntry(QDateTime timestamp, Logging::LoggingLevel level, Logging::Lo } +/*! Constructs a \l{LogEntry} with the given \a level, \a source and \a errorCode.*/ LogEntry::LogEntry(Logging::LoggingLevel level, Logging::LoggingSource source, int errorCode): LogEntry(QDateTime::currentDateTime(), level, source, errorCode) { } +/*! Constructs a \l{LogEntry} with the given \a source.*/ LogEntry::LogEntry(Logging::LoggingSource source): LogEntry(Logging::LoggingLevelInfo, source) { } +/*! Returns the timestamp of this \l{LogEntry}. */ QDateTime LogEntry::timestamp() const { return m_timestamp; } +/*! Returns the level of this \l{LogEntry}. */ Logging::LoggingLevel LogEntry::level() const { return m_level; } +/*! Returns the source of this \l{LogEntry}. */ Logging::LoggingSource LogEntry::source() const { return m_source; } +/*! Returns the type ID of this \l{LogEntry}. */ QUuid LogEntry::typeId() const { return m_typeId; } +/*! Sets the \a typeId of this \l{LogEntry}. */ void LogEntry::setTypeId(const QUuid &typeId) { m_typeId = typeId; } +/*! Returns the deviceId of this \l{LogEntry}. */ DeviceId LogEntry::deviceId() const { return m_deviceId; } +/*! Sets the \a deviceId of this \l{LogEntry}. */ void LogEntry::setDeviceId(const DeviceId &deviceId) { m_deviceId = deviceId; } +/*! Returns the value of this \l{LogEntry}. */ QString LogEntry::value() const { return m_value; } +/*! Sets the \a value of this \l{LogEntry}. */ void LogEntry::setValue(const QString &value) { m_value = value; } +/*! Returns the event type of this \l{LogEntry}. */ Logging::LoggingEventType LogEntry::eventType() const { return m_eventType; } +/*! Returns true if this \l{LogEntry} is a system active type. */ bool LogEntry::active() const { return m_active; } +/*! Sets this \l{LogEntry} to \a active. */ void LogEntry::setActive(bool active) { m_eventType = Logging::LoggingEventTypeActiveChange; m_active = active; } +/*! Returns the error code of this \l{LogEntry}. */ int LogEntry::errorCode() const { return m_errorCode; } + QDebug operator<<(QDebug dbg, const LogEntry &entry) { dbg.nospace() << "LogEntry (count:" << entry.timestamp().toString() << endl; diff --git a/server/logging/logfilter.cpp b/server/logging/logfilter.cpp index d7fd3bc6..3813fcd3 100644 --- a/server/logging/logfilter.cpp +++ b/server/logging/logfilter.cpp @@ -36,11 +36,13 @@ namespace guhserver { +/*! Constructs a new \l{LogFilter}.*/ LogFilter::LogFilter() { } +/*! Returns the database query string for this \l{LogFilter}.*/ QString LogFilter::queryString() const { if (isEmpty()) { @@ -83,6 +85,7 @@ QString LogFilter::queryString() const return query; } +/*! Add a new time filter with the given \a startDate and \a endDate. */ void LogFilter::addTimeFilter(const QDateTime &startDate, const QDateTime &endDate) { QPair timeFilter(startDate, endDate); @@ -90,77 +93,91 @@ void LogFilter::addTimeFilter(const QDateTime &startDate, const QDateTime &endDa m_timeFilters.append(timeFilter); } +/*! Returns the list of time filters from this \l{LogFilter}. */ QList > LogFilter::timeFilters() const { return m_timeFilters; } +/*! Add a new \a source to this \l{LogFilter}. */ void LogFilter::addLoggingSource(const Logging::LoggingSource &source) { if (!m_sources.contains(source)) m_sources.append(source); } +/*! Returns the list of logging sources from this \l{LogFilter}. */ QList LogFilter::loggingSources() const { return m_sources; } +/*! Add a new \a level to this \l{LogFilter}. */ void LogFilter::addLoggingLevel(const Logging::LoggingLevel &level) { if (!m_levels.contains(level)) m_levels.append(level); } +/*! Returns the list of logging levels from this \l{LogFilter}. */ QList LogFilter::loggingLevels() const { return m_levels; } +/*! Add a new \a eventType to this \l{LogFilter}. */ void LogFilter::addLoggingEventType(const Logging::LoggingEventType &eventType) { if (!m_eventTypes.contains(eventType)) m_eventTypes.append(eventType); } +/*! Returns the list of event types from this \l{LogFilter}. */ QList LogFilter::loggingEventTypes() const { return m_eventTypes; } +/*! Add a new \a typeId to this \l{LogFilter}. */ void LogFilter::addTypeId(const QUuid &typeId) { if (!m_typeIds.contains(typeId)) m_typeIds.append(typeId); } +/*! Returns the list of type id's from this \l{LogFilter}. */ QList LogFilter::typeIds() const { return m_typeIds; } +/*! Add a new \a deviceId to this \l{LogFilter}. */ void LogFilter::addDeviceId(const DeviceId &deviceId) { if (!m_deviceIds.contains(deviceId)) m_deviceIds.append(deviceId); } +/*! Returns the list of device id's from this \l{LogFilter}. */ QList LogFilter::deviceIds() const { return m_deviceIds; } +/*! Add a new \a value to this \l{LogFilter}. */ void LogFilter::addValue(const QString &value) { if (!m_values.contains(value)) m_values.append(value); } +/*! Returns the list of values from this \l{LogFilter}. */ QList LogFilter::values() const { return m_values; } +/*! Returns true if this \l{LogFilter} is empty. */ bool LogFilter::isEmpty() const { return m_timeFilters.isEmpty() && diff --git a/server/ruleengine.cpp b/server/ruleengine.cpp index 9e697ebf..2b4e960e 100644 --- a/server/ruleengine.cpp +++ b/server/ruleengine.cpp @@ -213,6 +213,7 @@ RuleEngine::RuleEngine(QObject *parent) : } } +/*! Destructor of the \l{RuleEngine}. */ RuleEngine::~RuleEngine() { qCDebug(dcApplication) << "Shutting down \"Rule Engine\"";