Generates a sequence of bytes by arranging element data.
Generates a sequence of bytes by arranging element data.
pack_bytes
takes a begin()
,end()
iterator of the container class as a parameter and writes the data specified by the following parameters to the container as a sequence of bytes.
The data given for the variable argument parameters are as follows
Data Type | Number of Bytes | Description |
---|---|---|
The pack_bytes
takes a container object as a parameter and writes the data specified by the subsequent parameters as a sequence of bytes into the container. It is appended to the end by the container's .push_back()
method.
The data given as variable argument parameters is shown below.
Data Type | Number of Bytes | Description |
---|---|---|
In this example, each attribute and payload of the received packet is re-stored in a separate buffer buf
.
To simplify the description of byte arrays of type uint8_t
used in the generation of data payloads and extraction of data in non-volatile packets.
The above is the simplest description, but byte arrays can be generated using Byte array utils as follows.
uint8_t
1
uint16_t
2
Stored in big-endian order
uint32_t
4
Stored in big-endian order
uint8_t[N]
N
Fixed-length array of type uint8_t
.
std::pair<char*,N>
N
A pair of an array of type char*
,uint8_t*
and array length. Can be generated with make_pair()
.
uint8_t
1
uint16_t
2
Stored in big-endian order
uint32_t
4
Stored in big-endian order
uint8_t[N]
N
Fixed-length array of type uint8_t
.
std::pair<char*,N>
N
A pair of an array of type char*
,uint8_t*
and array length. Can be generated with make_pair()
.
smplbuf_u8?
.size()
smplbuf<>container of type
uint8_t. Container length (
.size()`) of data.