hexagram/include/hexagram/capture.h

52 lines
1.5 KiB
C
Raw Normal View History

2019-02-11 20:12:09 -06:00
#ifndef _HEXAGRAM_CAPTURE_H
#define _HEXAGRAM_CAPTURE_H
#include <stdint.h>
#include <sys/types.h>
#include <sys/time.h>
#include <linux/can.h>
2019-02-12 20:55:40 -06:00
#include <hexagram/can.h>
#define HEXAGRAM_CAPTURE_MAGIC "HCAN"
#define HEXAGRAM_CAPTURE_ENDIAN 0x0a0b0c0d
2019-02-11 20:12:09 -06:00
#define HEXAGRAM_CAPTURE_ENDIAN_SWAPPED 0x0d0c0b0a
typedef struct _hexagram_capture hexagram_capture;
typedef struct _hexagram_capture_header {
char magic[4];
uint32_t endian;
} hexagram_capture_header;
typedef struct _hexagram_capture_frame {
uint32_t sec,
usec;
2019-02-11 20:12:09 -06:00
struct can_frame frame;
} hexagram_capture_frame;
hexagram_capture *hexagram_capture_open_fd(int fd, int flags);
hexagram_capture *hexagram_capture_open_file(const char *file, int flags);
void hexagram_capture_destroy(hexagram_capture *capture);
2019-02-12 00:00:13 -06:00
void hexagram_capture_close(hexagram_capture *capture);
ssize_t hexagram_capture_read(hexagram_capture *capture,
struct timeval *timestamp,
2019-02-12 00:00:13 -06:00
struct can_frame *frame);
ssize_t hexagram_capture_write(hexagram_capture *capture,
struct timeval *timestamp,
struct can_frame *frame);
2019-02-11 20:12:09 -06:00
int hexagram_capture_save(hexagram_capture *capture,
hexagram_can_if *can_if);
2019-02-12 20:55:40 -06:00
int hexagram_capture_replay(hexagram_capture *capture,
hexagram_can_if *can_if,
float speed);
2019-02-11 20:12:09 -06:00
#endif /* _HEXAGRAM_CAPTURE_H */