CAN Error frame support for future extensibility

This commit is contained in:
Pavel Kirienko
2014-03-21 10:43:34 +04:00
parent 670d844f08
commit 6246f24297
4 changed files with 13 additions and 2 deletions
+6
View File
@@ -14,6 +14,7 @@ const uint32_t CanFrame::MaskStdID;
const uint32_t CanFrame::MaskExtID;
const uint32_t CanFrame::FlagEFF;
const uint32_t CanFrame::FlagRTR;
const uint32_t CanFrame::FlagERR;
std::string CanFrame::toString(StringRepresentation mode) const
@@ -42,6 +43,11 @@ std::string CanFrame::toString(StringRepresentation mode) const
{
wpos += snprintf(wpos, epos - wpos, " RTR");
}
else if (id & FlagERR)
{
// TODO: print error flags
wpos += snprintf(wpos, epos - wpos, " ERR");
}
else
{
for (int dlen = 0; dlen < dlc; dlen++) // hex bytes