2023-09-04 12:21:37 +02:00
|
|
|
/* Node type: Universal Data-exchange API (v2).
|
2022-03-28 18:06:47 +02:00
|
|
|
*
|
2022-12-14 17:39:50 +01:00
|
|
|
* @see https://github.com/ERIGrid2/JRA-3.1-api
|
2022-03-28 18:06:47 +02:00
|
|
|
* Author: Steffen Vogel <post@steffenvogel.de>
|
|
|
|
* SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
|
2022-07-04 18:20:03 +02:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2022-03-28 18:06:47 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <pthread.h>
|
2023-09-07 11:46:39 +02:00
|
|
|
#include <villas/api/universal.hpp>
|
|
|
|
#include <villas/node.hpp>
|
2022-03-28 18:06:47 +02:00
|
|
|
|
|
|
|
namespace villas {
|
|
|
|
namespace node {
|
|
|
|
|
|
|
|
// Forward declarations
|
|
|
|
struct Sample;
|
|
|
|
|
|
|
|
class APINode : public Node {
|
|
|
|
|
|
|
|
public:
|
2023-09-07 11:46:39 +02:00
|
|
|
APINode(const uuid_t &id = {}, const std::string &name = "");
|
2022-03-28 18:06:47 +02:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
struct Direction {
|
|
|
|
Sample *sample;
|
|
|
|
api::universal::ChannelList channels;
|
|
|
|
pthread_cond_t cv;
|
|
|
|
pthread_mutex_t mutex;
|
|
|
|
};
|
2022-03-28 18:06:47 +02:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
// Accessed by api::universal::SignalRequest
|
|
|
|
Direction read, write;
|
2022-03-28 18:06:47 +02:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
virtual int prepare();
|
2022-03-28 18:06:47 +02:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
virtual int check();
|
2022-12-14 17:39:50 +01:00
|
|
|
|
2022-03-28 18:06:47 +02:00
|
|
|
protected:
|
2023-09-07 11:46:39 +02:00
|
|
|
virtual int parse(json_t *json);
|
2022-03-28 18:06:47 +02:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
virtual int _read(struct Sample *smps[], unsigned cnt);
|
2022-03-28 18:06:47 +02:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
virtual int _write(struct Sample *smps[], unsigned cnt);
|
2022-03-28 18:06:47 +02:00
|
|
|
};
|
|
|
|
|
2023-08-28 09:34:02 +02:00
|
|
|
} // namespace node
|
|
|
|
} // namespace villas
|