2022-12-14 17:39:50 +01: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
|
|
|
* @file
|
2022-12-14 17:41:58 +01:00
|
|
|
* @author Steffen Vogel <post@steffenvogel.de>
|
2022-03-28 18:06:47 +02:00
|
|
|
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
|
2022-07-04 18:20:03 +02:00
|
|
|
* @license Apache 2.0
|
2022-03-28 18:06:47 +02:00
|
|
|
*********************************************************************************/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <villas/node.hpp>
|
2022-12-14 17:39:50 +01:00
|
|
|
#include <villas/api/universal.hpp>
|
2022-03-28 18:06:47 +02:00
|
|
|
#include <pthread.h>
|
|
|
|
|
|
|
|
namespace villas {
|
|
|
|
namespace node {
|
|
|
|
|
|
|
|
/* Forward declarations */
|
|
|
|
struct Sample;
|
|
|
|
|
|
|
|
class APINode : public Node {
|
|
|
|
|
|
|
|
public:
|
2023-06-30 10:51:01 +02:00
|
|
|
APINode(const uuid_t &id = {}, const std::string &name = "");
|
2022-03-28 18:06:47 +02:00
|
|
|
|
|
|
|
struct Direction {
|
|
|
|
Sample *sample;
|
2022-12-14 17:39:50 +01:00
|
|
|
api::universal::ChannelList channels;
|
2022-03-28 18:06:47 +02:00
|
|
|
pthread_cond_t cv;
|
|
|
|
pthread_mutex_t mutex;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Accessed by api::universal::SignalRequest
|
|
|
|
Direction read, write;
|
|
|
|
|
|
|
|
virtual
|
|
|
|
int prepare();
|
|
|
|
|
2022-12-14 17:39:50 +01:00
|
|
|
virtual
|
|
|
|
int check();
|
|
|
|
|
2022-03-28 18:06:47 +02:00
|
|
|
protected:
|
2022-12-14 17:39:50 +01:00
|
|
|
virtual
|
2023-06-30 10:51:01 +02:00
|
|
|
int parse(json_t *json);
|
2022-03-28 18:06:47 +02:00
|
|
|
|
|
|
|
virtual
|
|
|
|
int _read(struct Sample *smps[], unsigned cnt);
|
|
|
|
|
|
|
|
virtual
|
|
|
|
int _write(struct Sample *smps[], unsigned cnt);
|
|
|
|
};
|
|
|
|
|
2023-08-28 09:34:02 +02:00
|
|
|
} // namespace node
|
|
|
|
} // namespace villas
|