AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
|
A class that represents data of a CAN message by using a callback function. More...
#include <can_message_data.hpp>
Public Member Functions | |
CANMessageDataCallback (std::size_t size, DataChunkCallback callback, void *parentPointer=nullptr, std::size_t chunkSize=7) | |
Constructor for transport data that uses a callback function. | |
std::size_t | size () const override |
Get the size of the data. | |
std::uint8_t | get_byte (std::size_t index) override |
Get the byte at the given index. | |
std::unique_ptr< CANMessageData > | copy_if_not_owned (std::unique_ptr< CANMessageData > self) const override |
If the data isn't owned by this class, make a copy of the data. | |
Public Member Functions inherited from isobus::CANMessageData | |
virtual | ~CANMessageData ()=default |
Default destructor. | |
Private Attributes | |
std::size_t | totalSize |
The total size of the data. | |
DataChunkCallback | callback |
The callback function to be called for each data chunk. | |
void * | parentPointer |
The parent object that gets passed to the callback function. | |
std::vector< std::uint8_t > | buffer |
The buffer to store the data chunks. | |
std::size_t | bufferSize |
The size of the buffer. | |
std::size_t | dataOffset = 0 |
The offset of the data in the buffer. | |
bool | initialized = false |
Whether the buffer has been initialized. | |
A class that represents data of a CAN message by using a callback function.
Definition at line 119 of file can_message_data.hpp.
isobus::CANMessageDataCallback::CANMessageDataCallback | ( | std::size_t | size, |
DataChunkCallback | callback, | ||
void * | parentPointer = nullptr, | ||
std::size_t | chunkSize = 7 ) |
Constructor for transport data that uses a callback function.
[in] | size | The size of the data. |
[in] | callback | The callback function to be called for each data chunk. |
[in] | parentPointer | The parent object that owns this callback (optional). |
[in] | chunkSize | The size of each data chunk (optional, default is 7). |
Definition at line 83 of file can_message_data.cpp.
|
overridevirtual |
If the data isn't owned by this class, make a copy of the data.
[in] | self | A pointer to this object. |
Implements isobus::CANMessageData.
Definition at line 116 of file can_message_data.cpp.
|
overridevirtual |
Get the byte at the given index.
[in] | index | The index of the byte to get. |
Implements isobus::CANMessageData.
Definition at line 100 of file can_message_data.cpp.
|
overridevirtual |
Get the size of the data.
Implements isobus::CANMessageData.
Definition at line 95 of file can_message_data.cpp.
|
private |
The buffer to store the data chunks.
Definition at line 150 of file can_message_data.hpp.
|
private |
The size of the buffer.
Definition at line 151 of file can_message_data.hpp.
|
private |
The callback function to be called for each data chunk.
Definition at line 148 of file can_message_data.hpp.
|
private |
The offset of the data in the buffer.
Definition at line 152 of file can_message_data.hpp.
|
private |
Whether the buffer has been initialized.
Definition at line 153 of file can_message_data.hpp.
|
private |
The parent object that gets passed to the callback function.
Definition at line 149 of file can_message_data.hpp.
|
private |
The total size of the data.
Definition at line 147 of file can_message_data.hpp.