OpenV2G
|
Bit stream container. More...
#include <EXITypes.h>
Data Fields | |
size_t | size |
uint8_t * | data |
size_t * | pos |
uint8_t | buffer |
uint8_t | capacity |
Bit stream container.
Structure for byteArray/file stream.
.size defines the maximum size of the byte array (see .data)
.data points to the input/output array of bytes (unsigned char*).
.pos has to be set to an pointer to an 32 bit long unsigned integer (uint32_t *) as this variable is read/write. Therefore it is best practice to declare the variable itself and use the &-operator to assign the address. The value of that variable points to the position inside the buffer where the stream begins. Which is usually the first (0th) byte but can also be another value if there more information transferred in that stream. After processing .pos points to the next "available" byte (if any left).
.buffer has to be set to 0 for internal use only (single byte buffer)
.capacity is used for addressing single bits in the actual byte (see .buffer) and has to be set to 0, which means there are 0 bits read so far and a new byte needs to be read from the input stream/data-array to the current byte buffer.
.capacity is used for addressing single bits in the actual byte (see .buffer) and has to be set to 8, which means there are still 8 bits left to fill up the current byte buffer before writing the final byte to the output stream/data-array.
uint8_t bitstream_t::buffer |
Current byte buffer
uint8_t bitstream_t::capacity |
Remaining bit capacity in current byte buffer
uint8_t* bitstream_t::data |
byte array data
size_t* bitstream_t::pos |
byte array next position in array
size_t bitstream_t::size |
byte array size