Communication: Add missing CAN error types

This commit is contained in:
Jonathan Schwartz
2025-02-04 15:15:44 +00:00
committed by Kyle Schwarz
parent a22791c9e0
commit c5ba2d8d32
17 changed files with 126 additions and 69 deletions
@@ -1,25 +0,0 @@
#ifndef __CANERRORCOUNTMESSAGE_H_
#define __CANERRORCOUNTMESSAGE_H_
#ifdef __cplusplus
#include "icsneo/communication/message/message.h"
namespace icsneo {
class CANErrorCountMessage : public Message {
public:
CANErrorCountMessage(uint8_t tec, uint8_t rec, bool busOffFlag)
: Message(Message::Type::CANErrorCount), transmitErrorCount(tec), receiveErrorCount(rec), busOff(busOffFlag){}
Network network;
uint8_t transmitErrorCount;
uint8_t receiveErrorCount;
bool busOff;
};
}
#endif // __cplusplus
#endif
@@ -0,0 +1,40 @@
#ifndef __CANERRORMESSAGE_H_
#define __CANERRORMESSAGE_H_
#ifdef __cplusplus
#include "icsneo/communication/message/message.h"
namespace icsneo {
enum class CANErrorCode : uint8_t
{
NoError = 0,
StuffError = 1,
FormError = 2,
AckError = 3,
Bit1Error = 4,
Bit0Error = 5,
CRCError = 6,
NoChange = 7
};
class CANErrorMessage : public Message {
public:
CANErrorMessage() : Message(Type::CANError) {}
Network network;
uint8_t transmitErrorCount;
uint8_t receiveErrorCount;
bool busOff;
bool errorPassive;
bool errorWarn;
CANErrorCode dataErrorCode;
CANErrorCode errorCode;
};
using CANErrorCountMessage = CANErrorMessage;
}
#endif // __cplusplus
#endif
@@ -17,6 +17,7 @@ public:
Frame = 0,
CANErrorCount = 0x100,
CANError = 0x100,
LINHeaderOnly = 0x200,
LINBreak = 0x201,