2017-04-10 13:30:51 +02:00
|
|
|
/** The "config" API ressource.
|
2017-02-18 10:57:29 -05:00
|
|
|
*
|
|
|
|
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
|
2019-01-13 00:42:39 +01:00
|
|
|
* @copyright 2014-2019, Institute for Automation of Complex Power Systems, EONERC
|
2017-04-27 12:56:43 +02:00
|
|
|
* @license GNU General Public License (version 3)
|
|
|
|
*
|
|
|
|
* VILLASnode
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* any later version.
|
2017-05-05 19:24:16 +00:00
|
|
|
*
|
2017-04-27 12:56:43 +02:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2017-05-05 19:24:16 +00:00
|
|
|
*
|
2017-04-27 12:56:43 +02:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2017-02-18 10:57:29 -05:00
|
|
|
*********************************************************************************/
|
|
|
|
|
2018-10-20 14:20:06 +02:00
|
|
|
#include <villas/api/action.hpp>
|
|
|
|
#include <villas/api/session.hpp>
|
|
|
|
#include <villas/super_node.hpp>
|
|
|
|
|
|
|
|
namespace villas {
|
|
|
|
namespace node {
|
|
|
|
namespace api {
|
|
|
|
|
|
|
|
class ConfigAction : public Action {
|
|
|
|
|
|
|
|
public:
|
|
|
|
using Action::Action;
|
2019-01-21 10:34:22 +01:00
|
|
|
|
2018-10-20 14:20:06 +02:00
|
|
|
virtual int execute(json_t *args, json_t **resp)
|
|
|
|
{
|
|
|
|
json_t *cfg = session->getSuperNode()->getConfig();
|
|
|
|
|
|
|
|
*resp = cfg
|
|
|
|
? json_incref(cfg)
|
|
|
|
: json_object();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2017-02-18 10:57:29 -05:00
|
|
|
};
|
|
|
|
|
2018-10-20 14:20:06 +02:00
|
|
|
/* Register action */
|
|
|
|
static ActionPlugin<ConfigAction> p(
|
|
|
|
"config",
|
|
|
|
"get configuration of this VILLASnode instance"
|
|
|
|
);
|
|
|
|
|
2019-03-26 07:09:55 +01:00
|
|
|
} /* namespace api */
|
|
|
|
} /* namespace node */
|
|
|
|
} /* namespace villas */
|