#ifndef __COM_CAN_H__
#define __COM_CAN_H__
#include "tc_system.h"

typedef struct com_can
{
	int	fd;
	int bitrate;
	const char* can_name;
}com_can_t;

int com_CAN_init(com_can_t* dev, const char* can_name, int bitrate);
int com_CAN_filter(com_can_t* dev, uint32_t canMask, int canID);
void com_CAN_exit(com_can_t* dev);

int	com_CAN_read(com_can_t* dev, struct can_frame *frame, int timeout);
int	com_CAN_send(com_can_t* dev, struct can_frame *frame);

int com_CAN_send_PDU1PNG(com_can_t* dev, uint32_t PGN, uint8_t SA, uint8_t* data, int len);
int com_CAN_send_PDU1(com_can_t* dev, uint8_t RDP, uint8_t PF, uint8_t PS, uint8_t SA, uint8_t* data, int len);

#endif//__COM_CAN_H__