continue with documentation update and increase json timeout to 15 s

pull/135/head
Simon Stürz 2016-11-25 12:27:50 +01:00 committed by Michael Zanetti
parent 68d0ed1b34
commit e189f69df2
15 changed files with 287 additions and 22 deletions

View File

@ -54,6 +54,10 @@
\endcode
Now the connection is established and waits for commands.
\section1 Classes
\annotatedlist json
\section1 Examples

View File

@ -25,8 +25,8 @@ tests.depends = libguh
doc.depends = libguh server
# Note: some how extraimages in qdocconf did not the trick
doc.commands = cd $$top_srcdir/doc; qdoc config.qdocconf; cp images/* html/images/; \
cp favicons/* html/; cp -r $$top_srcdir/doc/html $$top_builddir/
doc.commands = cd $$top_srcdir/doc; qdoc config.qdocconf; cp -r images/* html/images/; \
cp -r favicons/* html/; cp -r $$top_srcdir/doc/html $$top_builddir/
licensecheck.commands = $$top_srcdir/tests/auto/checklicenseheaders.sh $$top_srcdir

View File

@ -343,6 +343,12 @@ RuleEngine::RuleError GuhCore::removeRule(const RuleId &id)
return removeError;
}
/*! Returns a pointer to the \l{GuhConfiguration} instance owned by GuhCore.*/
GuhConfiguration *GuhCore::configuration() const
{
return m_configuration;
}
/*! Returns a pointer to the \l{DeviceManager} instance owned by GuhCore.*/
DeviceManager *GuhCore::deviceManager() const
{
@ -361,6 +367,7 @@ TimeManager *GuhCore::timeManager() const
return m_timeManager;
}
/*! Returns a pointer to the \l{WebServer} instance owned by GuhCore.*/
WebServer *GuhCore::webServer() const
{
return m_webServer;
@ -409,6 +416,7 @@ MockTcpServer *GuhCore::tcpServer() const
return m_tcpServer;
}
#else
/*! Returns a pointer to the \l{TcpServer} instance owned by GuhCore. */
TcpServer *GuhCore::tcpServer() const
{
return m_tcpServer;

View File

@ -18,10 +18,30 @@
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*!
\class guhserver::CloudHandler
\brief This subclass of \l{JsonHandler} processes the JSON requests for the \tt Cloud namespace.
\ingroup json
\inmodule core
This \l{JsonHandler} will be created in the \l{JsonRPCServer} and used to handle JSON-RPC requests
for the \tt {Cloud} namespace of the API.
\sa JsonHandler, JsonRPCServer
*/
/*! \fn void guhserver::CloudHandler::ConnectionStatusChanged(const QVariantMap &params);
This signal is emitted to the API notifications when the status of the \l{CloudManager} has changed.
The \a params contains the map for the notification.
*/
#include "cloudhandler.h"
namespace guhserver {
/*! Constructs a new \l CloudHandler with the given \a parent. */
CloudHandler::CloudHandler(QObject *parent) :
JsonHandler(parent)
{
@ -66,6 +86,7 @@ CloudHandler::CloudHandler(QObject *parent) :
connect(GuhCore::instance()->cloudManager(), SIGNAL(authenticatedChanged()), this, SLOT(onConnectionStatusChanged()));
}
/*! Returns the name of the \l{CloudHandler}. In this case \b Cloud.*/
QString CloudHandler::name() const
{
return "Cloud";

View File

@ -18,11 +18,52 @@
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*!
\class guhserver::ConfigurationHandler
\brief This subclass of \l{JsonHandler} processes the JSON requests for the \tt Configuration namespace.
\ingroup json
\inmodule core
This \l{JsonHandler} will be created in the \l{JsonRPCServer} and used to handle JSON-RPC requests
for the \tt {Configuration} namespace of the API.
\sa JsonHandler, JsonRPCServer
*/
/*! \fn void guhserver::ConfigurationHandler::BasicConfigurationChanged(const QVariantMap &params);
This signal is emitted to the API notifications when the configurations of the server have been changed.
The \a params contains the map for the notification.
*/
/*! \fn void guhserver::ConfigurationHandler::TcpServerConfigurationChanged(const QVariantMap &params);
This signal is emitted to the API notifications when the configurations of the \l{TcpServer} have been changed.
The \a params contains the map for the notification.
*/
/*! \fn void guhserver::ConfigurationHandler::WebServerConfigurationChanged(const QVariantMap &params);
This signal is emitted to the API notifications when the configurations of the \l{WebServer} have been changed.
The \a params contains the map for the notification.
*/
/*! \fn void guhserver::ConfigurationHandler::WebSocketServerConfigurationChanged(const QVariantMap &params);
This signal is emitted to the API notifications when the configurations of the \l{WebSocketServer} have been changed.
The \a params contains the map for the notification.
*/
/*! \fn void guhserver::ConfigurationHandler::LanguageChanged(const QVariantMap &params);
This signal is emitted to the API notifications when the language of the system has changed.
The \a params contains the map for the notification.
*/
#include "configurationhandler.h"
#include "guhcore.h"
namespace guhserver {
/*! Constructs a new \l ConfigurationHandler with the given \a parent. */
ConfigurationHandler::ConfigurationHandler(QObject *parent):
JsonHandler(parent)
{
@ -152,6 +193,7 @@ ConfigurationHandler::ConfigurationHandler(QObject *parent):
connect(GuhCore::instance()->deviceManager(), &DeviceManager::languageUpdated, this, &ConfigurationHandler::onLanguageChanged);
}
/*! Returns the name of the \l{ConfigurationHandler}. In this case \b Configuration.*/
QString ConfigurationHandler::name() const
{
return "Configuration";

View File

@ -336,7 +336,7 @@ void JsonReply::setCommandId(int commandId)
/*! Start the timeout timer for this \l{JsonReply}. The default timeout is 10 seconds. */
void JsonReply::startWait()
{
m_timeout.start(10000);
m_timeout.start(15000);
}
void JsonReply::timeout()

View File

@ -112,15 +112,15 @@ JsonReply* JsonRPCServer::Introspect(const QVariantMap &params) const
QVariantMap data;
data.insert("types", JsonTypes::allTypes());
QVariantMap methods;
foreach (JsonHandler *handler, m_handlers) {
foreach (JsonHandler *handler, m_handlers)
methods.unite(handler->introspect(QMetaMethod::Method));
}
data.insert("methods", methods);
QVariantMap signalsMap;
foreach (JsonHandler *handler, m_handlers) {
foreach (JsonHandler *handler, m_handlers)
signalsMap.unite(handler->introspect(QMetaMethod::Signal));
}
data.insert("notifications", signalsMap);
return createReply(data);
@ -151,6 +151,7 @@ QHash<QString, JsonHandler *> JsonRPCServer::handlers() const
return m_handlers;
}
/*! Register a new \l{TransportInterface} to the JSON server. The \a enabled flag indivates if the given \a interface sould be enebeld on startup. */
void JsonRPCServer::registerTransportInterface(TransportInterface *interface, const bool &enabled)
{
// Now set up the logic

View File

@ -1065,6 +1065,7 @@ QVariantList JsonTypes::packDeviceDescriptors(const QList<DeviceDescriptor> devi
return deviceDescriptorList;
}
/*! Returns a variant map with the current basic configuration of the server. */
QVariantMap JsonTypes::packBasicConfiguration()
{
QVariantMap basicConfiguration;
@ -1076,6 +1077,7 @@ QVariantMap JsonTypes::packBasicConfiguration()
return basicConfiguration;
}
/*! Returns a variant map with the current tcp configuration of the server. */
QVariantMap JsonTypes::packTcpServerConfiguration()
{
QVariantMap tcpServerConfiguration;
@ -1084,6 +1086,7 @@ QVariantMap JsonTypes::packTcpServerConfiguration()
return tcpServerConfiguration;
}
/*! Returns a variant map with the current web server configuration of the server. */
QVariantMap JsonTypes::packWebServerConfiguration()
{
QVariantMap webServerConfiguration;
@ -1092,6 +1095,7 @@ QVariantMap JsonTypes::packWebServerConfiguration()
return webServerConfiguration;
}
/*! Returns a variant map with the current web socket server configuration of the server. */
QVariantMap JsonTypes::packWebSocketServerConfiguration()
{
QVariantMap webSocketServerConfiguration;

View File

@ -18,6 +18,55 @@
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*!
\class guhserver::NetworkManagerHandler
\brief This subclass of \l{JsonHandler} processes the JSON requests for the \tt NetworkManager namespace of the JSON-RPC API.
\ingroup json
\inmodule core
This \l{JsonHandler} will be created in the \l{JsonRPCServer} and used to handle JSON-RPC requests
for the \tt {NetworkManager} namespace of the API.
\sa NetworkManager, JsonHandler, JsonRPCServer
*/
/*! \fn void guhserver::NetworkManagerHandler::NetworkStatusChanged(const QVariantMap &params);
This signal is emitted to the API notifications when the state of the \l{NetworkManager} has changed.
The \a params contains the map for the notification.
*/
/*! \fn void guhserver::NetworkManagerHandler::WiredNetworkDeviceAdded(const QVariantMap &params);
This signal is emitted to the API notifications when a \l{WiredNetworkDevice} has been added to the \l{NetworkManager}.
The \a params contains the map for the notification.
*/
/*! \fn void guhserver::NetworkManagerHandler::WiredNetworkDeviceRemoved(const QVariantMap &params);
This signal is emitted to the API notifications when a \l{WiredNetworkDevice} has been removed from the \l{NetworkManager}.
The \a params contains the map for the notification.
*/
/*! \fn void guhserver::NetworkManagerHandler::WiredNetworkDeviceChanged(const QVariantMap &params);
This signal is emitted to the API notifications when a \l{WiredNetworkDevice} has changed in the \l{NetworkManager}.
The \a params contains the map for the notification.
*/
/*! \fn void guhserver::NetworkManagerHandler::WirelessNetworkDeviceAdded(const QVariantMap &params);
This signal is emitted to the API notifications when a \l{WirelessNetworkDevice} has been added to the \l{NetworkManager}.
The \a params contains the map for the notification.
*/
/*! \fn void guhserver::NetworkManagerHandler::WirelessNetworkDeviceRemoved(const QVariantMap &params);
This signal is emitted to the API notifications when a \l{WirelessNetworkDevice} has been removed from the \l{NetworkManager}.
The \a params contains the map for the notification.
*/
/*! \fn void guhserver::NetworkManagerHandler::WirelessNetworkDeviceChanged(const QVariantMap &params);
This signal is emitted to the API notifications when a \l{WirelessNetworkDevice} has changed in the \l{NetworkManager}.
The \a params contains the map for the notification.
*/
#include "guhcore.h"
#include "jsontypes.h"
#include "loggingcategories.h"
@ -27,6 +76,7 @@
namespace guhserver {
/*! Constructs a new \l{NetworkManagerHandler} with the given \a parent. */
NetworkManagerHandler::NetworkManagerHandler(QObject *parent) :
JsonHandler(parent)
{
@ -143,9 +193,9 @@ NetworkManagerHandler::NetworkManagerHandler(QObject *parent) :
connect(GuhCore::instance()->networkManager(), &NetworkManager::wiredDeviceAdded, this, &NetworkManagerHandler::onWiredNetworkDeviceAdded);
connect(GuhCore::instance()->networkManager(), &NetworkManager::wiredDeviceRemoved, this, &NetworkManagerHandler::onWiredNetworkDeviceRemoved);
connect(GuhCore::instance()->networkManager(), &NetworkManager::wiredDeviceChanged, this, &NetworkManagerHandler::onWiredNetworkDeviceChanged);
}
/*! Returns the name of the \l{NetworkManagerHandler}. In this case \b NetworkManager. */
QString NetworkManagerHandler::name() const
{
return "NetworkManager";

View File

@ -82,6 +82,7 @@
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}.
\value LoggingEventTypeEnabledChange
*/
@ -106,7 +107,7 @@
\value LoggingSourceStates
This \l{LogEntry} was created from an \l{State} which hase changed.
\value LoggingSourceRules
This \l{LogEntry} was created from an \l{Rule} which hase changed the active state or triggered.
This \l{LogEntry} represents the enable/disable event from an \l{Rule}.
*/
#include "guhsettings.h"

View File

@ -18,6 +18,16 @@
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*!
\class guhserver::NetworkConnection
\brief Represents a saved network connection of the \l{NetworkManager}.
\ingroup networkmanager
\inmodule core
\sa NetworkSettings
*/
#include "networkconnection.h"
#include "dbus-interfaces.h"
#include "loggingcategories.h"
@ -26,6 +36,7 @@
namespace guhserver {
/*! Constructs a new \l{NetworkConnection} with the given dbus \a objectPath and \a parent. */
NetworkConnection::NetworkConnection(const QDBusObjectPath &objectPath, QObject *parent) :
QObject(parent),
m_objectPath(objectPath)
@ -51,6 +62,7 @@ NetworkConnection::NetworkConnection(const QDBusObjectPath &objectPath, QObject
m_connectionSettings = qdbus_cast<ConnectionSettings>(argument);
}
/*! Delets this \l{NetworkConnection} in the \l{NetworkManager}. */
void NetworkConnection::deleteConnection()
{
QDBusMessage query = m_connectionInterface->call("Delete");
@ -59,41 +71,55 @@ void NetworkConnection::deleteConnection()
}
/*! Returns the dbus object path of this \l{NetworkConnection}. */
QDBusObjectPath NetworkConnection::objectPath() const
{
return m_objectPath;
}
/*! Returns the connection settings of this \l{NetworkConnection}. */
ConnectionSettings NetworkConnection::connectionSettings() const
{
return m_connectionSettings;
}
/*! Returns the id of this \l{NetworkConnection}. */
QString NetworkConnection::id() const
{
return m_connectionSettings.value("connection").value("id").toString();
}
/*! Returns the name of this \l{NetworkConnection}. */
QString NetworkConnection::name() const
{
return m_connectionSettings.value("connection").value("name").toString();
}
/*! Returns the type of this \l{NetworkConnection}. */
QString NetworkConnection::type() const
{
return m_connectionSettings.value("connection").value("type").toString();
}
/*! Returns the uuid of this \l{NetworkConnection}. */
QUuid NetworkConnection::uuid() const
{
return m_connectionSettings.value("connection").value("uuid").toUuid();
}
/*! Returns the interface name of this \l{NetworkConnection}. */
QString NetworkConnection::interfaceName() const
{
return m_connectionSettings.value("connection").value("interface-name").toString();
}
/*! Returns true if this \l{NetworkConnection} will autoconnect if available. */
bool NetworkConnection::autoconnect() const
{
return m_connectionSettings.value("connection").value("autoconnect").toBool();
}
/*! Returns the timestamp of this \l{NetworkConnection} from the last connection. */
QDateTime NetworkConnection::timeStamp() const
{
return QDateTime::fromTime_t(m_connectionSettings.value("connection").value("timestamp").toUInt());

View File

@ -60,10 +60,6 @@ private:
ConnectionSettings m_connectionSettings;
signals:
public slots:
};
QDebug operator<<(QDebug debug, NetworkConnection *networkConnection);

View File

@ -28,6 +28,117 @@
\sa WiredNetworkDevice, WirelessNetworkDevice
*/
/*! \enum guhserver::NetworkDevice::NetworkDeviceState
\value NetworkDeviceStateUnknown
\value NetworkDeviceStateUnmanaged
\value NetworkDeviceStateUnavailable
\value NetworkDeviceStateDisconnected
\value NetworkDeviceStatePrepare
\value NetworkDeviceStateConfig
\value NetworkDeviceStateNeedAuth
\value NetworkDeviceStateIpConfig
\value NetworkDeviceStateIpCheck
\value NetworkDeviceStateSecondaries
\value NetworkDeviceStateActivated
\value NetworkDeviceStateDeactivating
\value NetworkDeviceStateFailed
*/
/*! \enum guhserver::NetworkDevice::NetworkDeviceStateReason
\value NetworkDeviceStateReasonNone
\value NetworkDeviceStateReasonUnknown
\value NetworkDeviceStateReasonNowManaged
\value NetworkDeviceStateReasonNowUnmanaged
\value NetworkDeviceStateReasonConfigFailed
\value NetworkDeviceStateReasonIpConfigUnavailable
\value NetworkDeviceStateReasonIpConfigExpired
\value NetworkDeviceStateReasonNoSecrets
\value NetworkDeviceStateReasonSupplicantDisconnected
\value NetworkDeviceStateReasonSupplicantConfigFailed
\value NetworkDeviceStateReasonSupplicantFailed
\value NetworkDeviceStateReasonSupplicantTimeout
\value NetworkDeviceStateReasonPppStartFailed
\value NetworkDeviceStateReasonPppDisconnected
\value NetworkDeviceStateReasonPppFailed
\value NetworkDeviceStateReasonDhcpStartFailed
\value NetworkDeviceStateReasonDhcpError
\value NetworkDeviceStateReasonDhcpFailed
\value NetworkDeviceStateReasonSharedStartFailed
\value NetworkDeviceStateReasonSharedFailed
\value NetworkDeviceStateReasonAutoIpStartFailed
\value NetworkDeviceStateReasonAutoIpError
\value NetworkDeviceStateReasonAutoIpFailed
\value NetworkDeviceStateReasonModemBusy
\value NetworkDeviceStateReasonModemNoDialTone
\value NetworkDeviceStateReasonModemNoCarrier
\value NetworkDeviceStateReasonModemDialTimeout
\value NetworkDeviceStateReasonModemDialFailed
\value NetworkDeviceStateReasonModemInitFailed
\value NetworkDeviceStateReasonGsmApnFailed
\value NetworkDeviceStateReasonGsmRegistrationNotSearching
\value NetworkDeviceStateReasonGsmRegistrationDenied
\value NetworkDeviceStateReasonGsmRegistrationTimeout
\value NetworkDeviceStateReasonGsmRegistrationFailed
\value NetworkDeviceStateReasonGsmPinCheckFailed
\value NetworkDeviceStateReasonFirmwareMissing
\value NetworkDeviceStateReasonRemoved
\value NetworkDeviceStateReasonSleeping
\value NetworkDeviceStateReasonConnectionRemoved
\value NetworkDeviceStateReasonUserRequest
\value NetworkDeviceStateReasonCarrier
\value NetworkDeviceStateReasonConnectionAssumed
\value NetworkDeviceStateReasonSupplicantAvailable
\value NetworkDeviceStateReasonModemNotFound
\value NetworkDeviceStateReasonBtFailed
\value NetworkDeviceStateReasonGsmSimNotInserted
\value NetworkDeviceStateReasonGsmSimPinRequired
\value NetworkDeviceStateReasonGsmSimPukRequired
\value NetworkDeviceStateReasonGsmSimWrong
\value NetworkDeviceStateReasonInfinibandMode
\value NetworkDeviceStateReasonDependencyFailed
\value NetworkDeviceStateReasonBR2684Failed
\value NetworkDeviceStateReasonModemManagerUnavailable
\value NetworkDeviceStateReasonSsidNotFound
\value NetworkDeviceStateReasonSecondaryConnectionFailed
\value NetworkDeviceStateReasonDcbFoecFailed
\value NetworkDeviceStateReasonTeamdControlFailed
\value NetworkDeviceStateReasonModemFailed
\value NetworkDeviceStateReasonModemAvailable
\value NetworkDeviceStateReasonSimPinIncorrect
\value NetworkDeviceStateReasonNewActivision
\value NetworkDeviceStateReasonParentChanged
\value NetworkDeviceStateReasonParentManagedChanged
*/
/*! \enum guhserver::NetworkDevice::NetworkDeviceType
\value NetworkDeviceTypeUnknown
\value NetworkDeviceTypeEthernet
\value NetworkDeviceTypeWifi
\value NetworkDeviceTypeBluetooth
\value NetworkDeviceTypeOlpcMesh
\value NetworkDeviceTypeWiMax
\value NetworkDeviceTypeModem
\value NetworkDeviceTypeInfiniBand
\value NetworkDeviceTypeBond
\value NetworkDeviceTypeVLan
\value NetworkDeviceTypeAdsl
\value NetworkDeviceTypeBridge
\value NetworkDeviceTypeGeneric
\value NetworkDeviceTypeTeam
\value NetworkDeviceTypeTun
\value NetworkDeviceTypeIpTunnel
\value NetworkDeviceTypeMacVLan
\value NetworkDeviceTypeVXLan
\value NetworkDeviceTypeVEth
*/
/*! \fn void NetworkDevice::deviceChanged();
This signal will be emitted when the properties of this \l{NetworkDevice} have changed.
*/
#include "networkdevice.h"
#include "loggingcategories.h"
@ -194,7 +305,7 @@ void NetworkDevice::disconnectDevice()
}
/*! Returns the human readable deviceType of this \l{NetworkDevice}. \sa NetworkDeviceType, */
/*! Returns the human readable device type string of the given \a deviceType. \sa NetworkDeviceType, */
QString NetworkDevice::deviceTypeToString(const NetworkDevice::NetworkDeviceType &deviceType)
{
QMetaObject metaObject = NetworkDevice::staticMetaObject;
@ -203,7 +314,7 @@ QString NetworkDevice::deviceTypeToString(const NetworkDevice::NetworkDeviceType
return QString(metaEnum.valueToKey(deviceType)).remove("NetworkDeviceType");
}
/*! Returns the human readable device state of this \l{NetworkDevice}. \sa NetworkDeviceState, */
/*! Returns the human readable device state string of the given \a deviceState. \sa NetworkDeviceState, */
QString NetworkDevice::deviceStateToString(const NetworkDevice::NetworkDeviceState &deviceState)
{
QMetaObject metaObject = NetworkDevice::staticMetaObject;
@ -212,7 +323,7 @@ QString NetworkDevice::deviceStateToString(const NetworkDevice::NetworkDeviceSta
return QString(metaEnum.valueToKey(deviceState));
}
/*! Returns the human readable device state reason of this \l{NetworkDevice}. \sa NetworkDeviceStateReason, */
/*! Returns the human readable device state reason string of the given \a deviceStateReason. \sa NetworkDeviceStateReason, */
QString NetworkDevice::deviceStateReasonToString(const NetworkDevice::NetworkDeviceStateReason &deviceStateReason)
{
QMetaObject metaObject = NetworkDevice::staticMetaObject;

View File

@ -221,12 +221,13 @@ void WirelessNetworkDevice::propertiesChanged(const QVariantMap &properties)
setActiveAccessPoint(qdbus_cast<QDBusObjectPath>(properties.value("ActiveAccessPoint")));
}
QDebug operator<<(QDebug debug, WirelessNetworkDevice *manager)
/*! Writes the given \a device to the given to \a debug. \sa WirelessNetworkDevice, */
QDebug operator<<(QDebug debug, WirelessNetworkDevice *device)
{
debug.nospace() << "WirelessNetworkDevice(" << manager->interface() << ", ";
debug.nospace() << manager->macAddress() << ", ";
debug.nospace() << manager->bitRate() << " [Mb/s], ";
debug.nospace() << manager->deviceStateString() << ") ";
debug.nospace() << "WirelessNetworkDevice(" << device->interface() << ", ";
debug.nospace() << device->macAddress() << ", ";
debug.nospace() << device->bitRate() << " [Mb/s], ";
debug.nospace() << device->deviceStateString() << ") ";
return debug;
}

View File

@ -80,7 +80,7 @@ signals:
void stateChanged(const NetworkDeviceState &state);
};
QDebug operator<<(QDebug debug, WirelessNetworkDevice *manager);
QDebug operator<<(QDebug debug, WirelessNetworkDevice *device);
}