Fixed CAN frame bug
This commit is contained in:
@ -32,8 +32,8 @@ typedef struct can_filter CanFilter;
|
||||
typedef struct can_frame CanFrame;
|
||||
|
||||
typedef struct _BcmFrame {
|
||||
struct bcm_msg_head head;
|
||||
struct can_frame frame;
|
||||
struct bcm_msg_head head;
|
||||
// struct can_frame frame;
|
||||
} BcmFrame;
|
||||
|
||||
/* c class definitions ******************************************************/
|
||||
@ -42,60 +42,60 @@ typedef struct _BcmFrame {
|
||||
// Uses the Peak Systems CAN Linux driver and Nissan CAN data
|
||||
//
|
||||
class CanSocket {
|
||||
// public data
|
||||
// public data
|
||||
public:
|
||||
int m_sock;
|
||||
int m_proto;
|
||||
|
||||
// private data
|
||||
int m_sock;
|
||||
int m_proto;
|
||||
|
||||
// private data
|
||||
private:
|
||||
// device
|
||||
int m_flags;
|
||||
|
||||
// errors
|
||||
bool m_logerrs;
|
||||
long m_errcount;
|
||||
|
||||
// static data
|
||||
|
||||
// public methods
|
||||
// device
|
||||
int m_flags;
|
||||
|
||||
// errors
|
||||
bool m_logerrs;
|
||||
long m_errcount;
|
||||
|
||||
// static data
|
||||
|
||||
// public methods
|
||||
public:
|
||||
// constructors
|
||||
CanSocket();
|
||||
|
||||
// destructor
|
||||
virtual ~CanSocket();
|
||||
|
||||
// virtual functions
|
||||
|
||||
// public methods
|
||||
void AddrFlags( u_long f ) { m_flags = f; };
|
||||
int GetSock(void) {return m_sock;};
|
||||
int GetSocket(void) {return m_sock;};
|
||||
int GetProto(void) {return m_proto;};
|
||||
int CanOpen( const char *dev="can0", int proto=CAN_RAW, int flags=0 );
|
||||
void CanClose(void);
|
||||
|
||||
// misc
|
||||
int ClearFilters( void );
|
||||
int Blocking(bool block=true);
|
||||
int NonBlocking(void) { return Blocking(false); };
|
||||
int Loopback(bool loop=true);
|
||||
int NoLoopback(void) { return Loopback(false); };
|
||||
void LogErrors(bool logerrs=true) {m_logerrs = logerrs;};
|
||||
|
||||
// rx filter
|
||||
int CanAddRx( u_int32_t addr );
|
||||
int CanAddRx( const CanFilter *filter, int max=1 );
|
||||
int CanDelRx( u_int32_t addr );
|
||||
|
||||
// raw
|
||||
int CanRawRead( CanFrame *buf, int max=1 );
|
||||
int CanRawWrite( const CanFrame *buf, int max=1 );
|
||||
|
||||
// bcm
|
||||
int CanBcmRead( BcmFrame *msg, int max=1 );
|
||||
int CanBcmWrite( BcmFrame *msg, int max=1 );
|
||||
// constructors
|
||||
CanSocket();
|
||||
|
||||
// destructor
|
||||
virtual ~CanSocket();
|
||||
|
||||
// virtual functions
|
||||
|
||||
// public methods
|
||||
void AddrFlags( u_long f ) { m_flags = f; };
|
||||
int GetSock(void) {return m_sock;};
|
||||
int GetSocket(void) {return m_sock;};
|
||||
int GetProto(void) {return m_proto;};
|
||||
int CanOpen( const char *dev="can0", int proto=CAN_RAW, int flags=0 );
|
||||
void CanClose(void);
|
||||
|
||||
// misc
|
||||
int ClearFilters( void );
|
||||
int Blocking(bool block=true);
|
||||
int NonBlocking(void) { return Blocking(false); };
|
||||
int Loopback(bool loop=true);
|
||||
int NoLoopback(void) { return Loopback(false); };
|
||||
void LogErrors(bool logerrs=true) {m_logerrs = logerrs;};
|
||||
|
||||
// rx filter
|
||||
int CanAddRx( u_int32_t addr );
|
||||
int CanAddRx( const CanFilter *filter, int max=1 );
|
||||
int CanDelRx( u_int32_t addr );
|
||||
|
||||
// raw
|
||||
int CanRawRead( CanFrame *buf, int max=1 );
|
||||
int CanRawWrite( const CanFrame *buf, int max=1 );
|
||||
|
||||
// bcm
|
||||
int CanBcmRead( BcmFrame *msg, int max=1 );
|
||||
int CanBcmWrite( BcmFrame *msg, int max=1 );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user