51 lines
1.5 KiB
C
51 lines
1.5 KiB
C
#ifndef _HEXAGRAM_CAPTURE_H
|
|
#define _HEXAGRAM_CAPTURE_H
|
|
|
|
#include <stdint.h>
|
|
#include <sys/types.h>
|
|
#include <sys/time.h>
|
|
#include <linux/can.h>
|
|
|
|
#include <hexagram/can.h>
|
|
|
|
#define HEXAGRAM_CAPTURE_MAGIC "HCAN"
|
|
#define HEXAGRAM_CAPTURE_ENDIAN 0x0a0b0c0d
|
|
#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;
|
|
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);
|
|
|
|
void hexagram_capture_close(hexagram_capture *capture);
|
|
|
|
ssize_t hexagram_capture_read(hexagram_capture *capture,
|
|
struct timeval *timestamp,
|
|
struct can_frame *frame);
|
|
|
|
ssize_t hexagram_capture_write(hexagram_capture *capture,
|
|
struct timeval *timestamp,
|
|
struct can_frame *frame);
|
|
|
|
int hexagram_capture_save(hexagram_capture *capture,
|
|
hexagram_can_if *can_if);
|
|
|
|
int hexagram_capture_replay(hexagram_capture *capture,
|
|
hexagram_can_if *can_if,
|
|
float speed);
|
|
|
|
#endif /* _HEXAGRAM_CAPTURE_H */
|