11#include "isobus/utility/to_string.hpp"
24 rxBuffer.reserve(txBuffer->size());
41 LOG_ERROR(
"[SPIFrame] Tried to read byte at index " + isobus::to_string(index) +
", but the buffer only contains " + isobus::to_string(
rxBuffer.size()) +
" bytes");
46 LOG_ERROR(
"[SPIFrame] The transaction was not configured to read, but tried to read byte at index: " + isobus::to_string(index));
56 if (index + length <=
rxBuffer.size())
58 std::memcpy(buffer, &
rxBuffer[index], length);
63 LOG_ERROR(
"[SPIFrame] Tried to read " + isobus::to_string(length) +
" bytes at index " + isobus::to_string(index) +
", but the buffer only contains " + isobus::to_string(
rxBuffer.size()) +
" bytes");
68 LOG_ERROR(
"[SPIFrame] The transaction was not configured to read, but tried to read " + isobus::to_string(length) +
" bytes at index: " + isobus::to_string(index));
A class that acts as a logging sink. The intent is that someone could make their own derived class of...
const bool read
If true, the plugin will read the response to the write operation.
const std::vector< std::uint8_t > * get_tx_buffer() const
Get the buffer to transmit.
std::vector< std::uint8_t > rxBuffer
The buffer to store the response in.
bool get_is_read() const
Get whether the interface should read the response to the write operation.
bool read_byte(std::size_t index, std::uint8_t &byte) const
Read a byte from the response buffer.
std::vector< std::uint8_t > & get_rx_buffer()
Get the buffer to store the response in.
const std::vector< std::uint8_t > * txBuffer
The buffer to transmit.
SPITransactionFrame(const std::vector< std::uint8_t > *txBuffer, bool read=false)
Construct a new SPITransactionFrame object.
bool read_bytes(std::size_t index, std::uint8_t *buffer, std::size_t length) const
Read multiple bytes from the response buffer.
This namespace encompasses all of the ISO11783 stack's functionality to reduce global namespace pollu...
A class containing the data for a single SPI transaction. Used in combination with SPIHardwarePlugin ...