2020-10-12 15:26:03 +02:00
|
|
|
/* Dump fields and values in a socket to plot them with villasDump.py.
|
|
|
|
*
|
|
|
|
* Author: Manuel Pitz <manuel.pitz@eonerc.rwth-aachen.de>
|
2022-03-15 09:28:57 -04:00
|
|
|
* 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
|
2020-10-12 15:26:03 +02:00
|
|
|
*/
|
|
|
|
|
2021-02-16 14:41:55 +01:00
|
|
|
#pragma once
|
|
|
|
|
2021-02-16 14:15:14 +01:00
|
|
|
#include <villas/log.hpp>
|
|
|
|
|
2020-10-12 15:26:03 +02:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace villas {
|
|
|
|
namespace node {
|
|
|
|
|
|
|
|
class Dumper {
|
|
|
|
|
2020-11-03 18:56:07 +01:00
|
|
|
protected:
|
2023-07-06 11:51:59 +02:00
|
|
|
bool active;
|
2020-11-03 18:56:07 +01:00
|
|
|
int socketFd;
|
2023-07-06 11:51:59 +02:00
|
|
|
std::string socketPath;
|
2020-11-03 18:56:07 +01:00
|
|
|
bool supressRepeatedWarning;
|
|
|
|
uint64_t warningCounter;
|
2021-02-16 14:15:14 +01:00
|
|
|
Logger logger;
|
2020-11-03 18:56:07 +01:00
|
|
|
|
|
|
|
public:
|
2023-07-06 11:51:59 +02:00
|
|
|
Dumper();
|
2020-11-03 18:56:07 +01:00
|
|
|
~Dumper();
|
2021-02-16 14:41:55 +01:00
|
|
|
|
2021-02-16 13:25:37 +01:00
|
|
|
int openSocket();
|
2021-02-16 14:41:55 +01:00
|
|
|
int closeSocket();
|
2023-07-06 11:51:59 +02:00
|
|
|
bool isActive();
|
|
|
|
int setActive();
|
2021-02-16 14:41:55 +01:00
|
|
|
|
2023-07-06 19:56:18 +02:00
|
|
|
int setPath(const std::string &socketPathIn);
|
2021-06-25 15:32:40 +02:00
|
|
|
void writeDataCSV(unsigned len, double *yData, double *xData = nullptr);
|
|
|
|
void writeDataBinary(unsigned len, double *yData, double *xData = nullptr);
|
2020-11-03 18:56:07 +01:00
|
|
|
};
|
|
|
|
|
2023-08-28 09:34:02 +02:00
|
|
|
} // namespace node
|
|
|
|
} // namespace villas
|