mirror of https://github.com/nymea/nymea.git
Add support for restarting nymea in system api
parent
9af820b696
commit
28624e264d
|
|
@ -161,7 +161,7 @@ Depends: ${shlibs:Depends},
|
|||
Replaces: libguh1
|
||||
Provides: nymea-update-plugin-api-1,
|
||||
nymea-zeroconf-plugin-api-1,
|
||||
nymea-system-plugin-api-1
|
||||
nymea-system-plugin-api-2
|
||||
Description: An open source IoT server - core library
|
||||
The nymea daemon is a plugin based IoT (Internet of Things) server. The
|
||||
server works like a translator for devices, things and services and
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ SystemHandler::SystemHandler(Platform *platform, QObject *parent):
|
|||
// Methods
|
||||
QString description; QVariantMap params; QVariantMap returns;
|
||||
description = "Get the list of capabilites on this system. The property \"powerManagement\" indicates whether "
|
||||
"rebooting or shutting down is supported on this system. The property \"updateManagement indicates "
|
||||
"restarting nymea and rebooting or shutting down is supported on this system. The property \"updateManagement indicates "
|
||||
"whether system update features are available in this system. The property \"timeManagement\" "
|
||||
"indicates whether the system time can be configured on this system. Note that GetTime will be "
|
||||
"available in any case.";
|
||||
|
|
@ -56,6 +56,11 @@ SystemHandler::SystemHandler(Platform *platform, QObject *parent):
|
|||
returns.insert("timeManagement", enumValueName(Bool));
|
||||
registerMethod("GetCapabilities", description, params, returns);
|
||||
|
||||
params.clear(); returns.clear();
|
||||
description = "Initiate a restart of the nymea service. The return value will indicate whether the procedure has been initiated successfully.";
|
||||
returns.insert("success", enumValueName(Bool));
|
||||
registerMethod("Restart", description, params, returns);
|
||||
|
||||
params.clear(); returns.clear();
|
||||
description = "Initiate a reboot of the system. The return value will indicate whether the procedure has been initiated successfully.";
|
||||
returns.insert("success", enumValueName(Bool));
|
||||
|
|
@ -283,6 +288,15 @@ JsonReply *SystemHandler::GetCapabilities(const QVariantMap ¶ms)
|
|||
return createReply(data);
|
||||
}
|
||||
|
||||
JsonReply *SystemHandler::Restart(const QVariantMap ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params)
|
||||
bool status = m_platform->systemController()->restart();
|
||||
QVariantMap returns;
|
||||
returns.insert("success", status);
|
||||
return createReply(returns);
|
||||
}
|
||||
|
||||
JsonReply *SystemHandler::Reboot(const QVariantMap ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params)
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ public:
|
|||
|
||||
Q_INVOKABLE JsonReply *GetCapabilities(const QVariantMap ¶ms);
|
||||
|
||||
Q_INVOKABLE JsonReply *Restart(const QVariantMap ¶ms) const;
|
||||
Q_INVOKABLE JsonReply *Reboot(const QVariantMap ¶ms) const;
|
||||
Q_INVOKABLE JsonReply *Shutdown(const QVariantMap ¶ms) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,11 @@ bool PlatformSystemController::powerManagementAvailable() const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PlatformSystemController::restart()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PlatformSystemController::reboot()
|
||||
{
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ public:
|
|||
virtual ~PlatformSystemController() = default;
|
||||
|
||||
virtual bool powerManagementAvailable() const;
|
||||
virtual bool restart();
|
||||
virtual bool reboot();
|
||||
virtual bool shutdown();
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ NYMEA_VERSION_STRING=$$system('dpkg-parsechangelog | sed -n -e "s/^Version: //p"
|
|||
|
||||
# define protocol versions
|
||||
JSON_PROTOCOL_VERSION_MAJOR=5
|
||||
JSON_PROTOCOL_VERSION_MINOR=0
|
||||
JSON_PROTOCOL_VERSION_MINOR=1
|
||||
JSON_PROTOCOL_VERSION="$${JSON_PROTOCOL_VERSION_MAJOR}.$${JSON_PROTOCOL_VERSION_MINOR}"
|
||||
LIBNYMEA_API_VERSION_MAJOR=5
|
||||
LIBNYMEA_API_VERSION_MINOR=0
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
5.0
|
||||
5.1
|
||||
{
|
||||
"enums": {
|
||||
"BasicType": [
|
||||
|
|
@ -1653,7 +1653,7 @@
|
|||
}
|
||||
},
|
||||
"System.GetCapabilities": {
|
||||
"description": "Get the list of capabilites on this system. The property \"powerManagement\" indicates whether rebooting or shutting down is supported on this system. The property \"updateManagement indicates whether system update features are available in this system. The property \"timeManagement\" indicates whether the system time can be configured on this system. Note that GetTime will be available in any case.",
|
||||
"description": "Get the list of capabilites on this system. The property \"powerManagement\" indicates whether restarting nymea and rebooting or shutting down is supported on this system. The property \"updateManagement indicates whether system update features are available in this system. The property \"timeManagement\" indicates whether the system time can be configured on this system. Note that GetTime will be available in any case.",
|
||||
"params": {
|
||||
},
|
||||
"returns": {
|
||||
|
|
@ -1725,6 +1725,14 @@
|
|||
"success": "Bool"
|
||||
}
|
||||
},
|
||||
"System.Restart": {
|
||||
"description": "Initiate a restart of the nymea service. The return value will indicate whether the procedure has been initiated successfully.",
|
||||
"params": {
|
||||
},
|
||||
"returns": {
|
||||
"success": "Bool"
|
||||
}
|
||||
},
|
||||
"System.RollbackPackages": {
|
||||
"description": "Starts a rollback. Returns true if the rollback has been started successfully. Before calling this method, clients should check whether the package can be rolled back (canRollback set to true).",
|
||||
"params": {
|
||||
|
|
|
|||
Loading…
Reference in New Issue