mergCanBus
 All Classes Functions Variables Typedefs
CANMessage.h
1 #ifndef CANMESSAGE_H
2 #define CANMESSAGE_H
3 
4 #include <Arduino.h>
5 
6 #define DATA_SIZE 8
7 #define HEADER_SIZE 2
8 
9 class CANMessage
10 {
11  public:
12  CANMessage();
13  CANMessage(byte data[DATA_SIZE],byte header[HEADER_SIZE]);
14  byte* getData() { return _data; }
15  void setData(byte val[DATA_SIZE] );
16  byte* get_header() { return _header; }
17  void set_header(byte val[HEADER_SIZE] );
18  //has to be set by the message reader. the mcp library knows about the RTR bits
19  void setRTR() {_RTR=true;};
20  void unsetRTR(){_RTR=false;};
21  bool getRTR(){return _RTR;};
22  void clear(); //clear the buffers
23  byte getCanId();
24  byte getOpc();
25  byte getDataSize(); //canBusMessage size
26  void setCanMsgSize(byte val){canMsgSize=val;}; //number of byte read from can
27  byte getCanMsgSize(){return canMsgSize;}; //number of byte read from can
28 
29  protected:
30  private:
31  byte _data[DATA_SIZE]; //CANBUS Data
32  byte _header[HEADER_SIZE]; //CAN Header
33  bool _RTR; //1 if RTR
34  byte canMsgSize; //number of byte read from can
35 };
36 
37 #endif // CANMESSAGE_H
byte getOpc()
Definition: CANMessage.cpp:51
void clear()
Definition: CANMessage.cpp:28
Definition: CANMessage.h:9