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

94 lines
2.2 KiB
C++
Raw Permalink 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>
2020-01-21 19:34:23 +01:00
* @copyright 2014-2020, Institute for Automation of Complex Power Systems, EONERC
* @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.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
/**
* @addtogroup can CAN bus Node Type
* @ingroup node
* @{
*/
#pragma once
#include <jansson.h>
2020-01-21 19:34:23 +01:00
#include <villas/timing.h>
/* Forward declarations */
2020-08-25 21:00:52 +02:00
struct vnode;
union signal_data;
struct can_signal {
uint32_t id;
int offset;
int size;
};
2020-01-21 19:34:23 +01:00
struct can {
/* Settings */
char *interface_name;
double *sample_rate;
struct can_signal *in;
struct can_signal *out;
/* States */
int socket;
union signal_data *sample_buf;
size_t sample_buf_num;
struct timespec start_time;
2020-01-21 19:34:23 +01:00
};
/** @see node_type::init */
2020-08-25 21:00:52 +02:00
int can_init(struct vnode *n);
2020-01-21 19:34:23 +01:00
/** @see node_type::destroy */
2020-08-25 21:00:52 +02:00
int can_destroy(struct vnode *n);
2020-01-21 19:34:23 +01:00
/** @see node_type::parse */
2020-08-25 21:00:52 +02:00
int can_parse(struct vnode *n, json_t *cfg);
2020-01-21 19:34:23 +01:00
/** @see node_type::print */
2020-08-25 21:00:52 +02:00
char * can_print(struct vnode *n);
2020-01-21 19:34:23 +01:00
/** @see node_type::check */
int can_check();
/** @see node_type::prepare */
int can_prepare();
/** @see node_type::start */
2020-08-25 21:00:52 +02:00
int can_start(struct vnode *n);
2020-01-21 19:34:23 +01:00
/** @see node_type::stop */
2020-08-25 21:00:52 +02:00
int can_stop(struct vnode *n);
2020-01-21 19:34:23 +01:00
/** @see node_type::write */
2020-08-25 21:00:52 +02:00
int can_write(struct vnode *n, struct sample *smps[], unsigned cnt, unsigned *release);
2020-01-21 19:34:23 +01:00
/** @see node_type::read */
2020-08-25 21:00:52 +02:00
int can_read(struct vnode *n, struct sample *smps[], unsigned cnt, unsigned *release);
2020-01-21 19:34:23 +01:00
/** @see node_type::poll_fds */
2020-08-25 21:00:52 +02:00
int can_poll_fds(struct vnode *n, int fds[]);
2020-01-21 19:34:23 +01:00
/** @} */