Helper class for binary driver: provides methods for handling binary data.
More...
#include <BinaryDriver.h>
|
void | PushUint16 (std::vector< uint8_t > *data, uint16_t value, bool littleEndian=true) |
| Helper function to push a uint16 to a std::vector of bytes, as two consecutive bytes (either little-endian or big-endian according to littleEndian parameter) More...
|
|
uint16_t | ReadUint16 (const std::vector< uint8_t > &data, uint8_t index, bool littleEndian=true) |
| Bounds-checked read of a 16-bit value from a byte vector. More...
|
|
uint8_t | ReadUint8 (const std::vector< uint8_t > &data, uint8_t index) |
| Bounds-checked read of an 8-bit value from a byte vector. More...
|
|
uint16_t | CalculateCRC (const uint8_t *buff, size_t len) |
|
Helper class for binary driver: provides methods for handling binary data.
◆ PushUint16()
void BinaryDriver::PushUint16 |
( |
std::vector< uint8_t > * |
data, |
|
|
uint16_t |
value, |
|
|
bool |
littleEndian = true |
|
) |
| |
|
inlineprotected |
Helper function to push a uint16 to a std::vector of bytes, as two consecutive bytes (either little-endian or big-endian according to littleEndian parameter)
- Parameters
-
data | the vector to push data to |
value | the value to push |
littleEndian | push data in little-endian format if true (default), big-endian otherwise |
◆ ReadUint16()
uint16_t BinaryDriver::ReadUint16 |
( |
const std::vector< uint8_t > & |
data, |
|
|
uint8_t |
index, |
|
|
bool |
littleEndian = true |
|
) |
| |
|
inlineprotected |
Bounds-checked read of a 16-bit value from a byte vector.
- Parameters
-
data | Input vector |
index | Byte index to read |
littleEndian | push data in little-endian format if true (default), big-endian otherwise |
- Returns
- data[index] if in bounds, or 0 if out of bounds
◆ ReadUint8()
uint8_t BinaryDriver::ReadUint8 |
( |
const std::vector< uint8_t > & |
data, |
|
|
uint8_t |
index |
|
) |
| |
|
inlineprotected |
Bounds-checked read of an 8-bit value from a byte vector.
- Parameters
-
data | Input vector |
index | Byte index to read |
- Returns
- data[index] if in bounds, or 0 if out of bounds
The documentation for this class was generated from the following files: