1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-16 00:00:02 +01:00
VILLASnode/include/villas/nodes/can.hpp

65 lines
1.2 KiB
C++
Raw Normal View History

2020-01-21 19:34:23 +01:00
/** Node-type: CAN bus
*
* @file
2020-07-08 13:32:33 +02:00
* @author Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
2022-03-15 09:28:57 -04:00
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
2022-07-04 18:20:03 +02:00
* @license Apache 2.0
2020-01-21 19:34:23 +01:00
*********************************************************************************/
#pragma once
#include <jansson.h>
#include <villas/timing.hpp>
namespace villas {
namespace node {
2020-01-21 19:34:23 +01:00
/* Forward declarations */
class NodeCompat;
union SignalData;
struct can_signal {
uint32_t id;
int offset;
int size;
};
2020-01-21 19:34:23 +01:00
struct can {
/* Settings */
char *interface_name;
struct can_signal *in;
struct can_signal *out;
/* States */
int socket;
union SignalData *sample_buf;
size_t sample_buf_num;
struct timespec start_time;
2020-01-21 19:34:23 +01:00
};
int can_init(NodeCompat *n);
2020-01-21 19:34:23 +01:00
int can_destroy(NodeCompat *n);
2020-01-21 19:34:23 +01:00
int can_parse(NodeCompat *n, json_t *json);
2020-01-21 19:34:23 +01:00
char * can_print(NodeCompat *n);
2020-01-21 19:34:23 +01:00
int can_check(NodeCompat *n);
2020-01-21 19:34:23 +01:00
int can_prepare(NodeCompat *n);
2020-01-21 19:34:23 +01:00
int can_start(NodeCompat *n);
2020-01-21 19:34:23 +01:00
int can_stop(NodeCompat *n);
2020-01-21 19:34:23 +01:00
int can_write(NodeCompat *n, struct Sample * const smps[], unsigned cnt);
2020-01-21 19:34:23 +01:00
int can_read(NodeCompat *n, struct Sample * const smps[], unsigned cnt);
2020-01-21 19:34:23 +01:00
int can_poll_fds(NodeCompat *n, int fds[]);
2020-01-21 19:34:23 +01:00
} // namespace node
} // namespace villas