AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
Loading...
Searching...
No Matches
can_message_frame.cpp
Go to the documentation of this file.
1//================================================================================================
8//================================================================================================
12
13namespace isobus
14{
16 {
17 constexpr std::uint32_t MAX_CONSECUTIVE_SAME_BITS = 5; // After 5 consecutive bits, 6th will be opposite
18 const std::uint32_t dataLengthBits = CAN_DATA_LENGTH * dataLength;
19 std::uint32_t retVal = 0;
20
22 {
23 constexpr std::uint32_t EXTENDED_ID_BEST_NON_DATA_LENGTH = 67; // SOF, ID, Control, CRC, ACK, EOF, and interframe space
24 constexpr std::uint32_t EXTENDED_ID_WORST_NON_DATA_LENGTH = 78;
25 retVal = ((dataLengthBits + EXTENDED_ID_BEST_NON_DATA_LENGTH) + (dataLengthBits + (dataLengthBits / MAX_CONSECUTIVE_SAME_BITS) + EXTENDED_ID_WORST_NON_DATA_LENGTH));
26 }
27 else
28 {
29 constexpr std::uint32_t STANDARD_ID_BEST_NON_DATA_LENGTH = 47; // SOF, ID, Control, CRC, ACK, EOF, and interframe space
30 constexpr std::uint32_t STANDARD_ID_WORST_NON_DATA_LENGTH = 54;
31 retVal = ((dataLengthBits + STANDARD_ID_BEST_NON_DATA_LENGTH) + (dataLengthBits + (dataLengthBits / MAX_CONSECUTIVE_SAME_BITS) + STANDARD_ID_WORST_NON_DATA_LENGTH));
32 }
33 return retVal / 2;
34 }
35} // namespace isobus
General constants used throughout this library.
A representation of a classical CAN identifier with utility functions for ectracting values that are ...
A classical CAN frame, with 8 data bytes.
std::uint8_t dataLength
The length of the data used in the frame.
bool isExtendedFrame
Denotes if the frame is extended format.
std::uint32_t get_number_bits_in_message() const
This namespace encompasses all of the ISO11783 stack's functionality to reduce global namespace pollu...
constexpr std::uint8_t CAN_DATA_LENGTH
The length of a classical CAN frame.