|
MIP_SDK
v4.0.0-237-g9879cb72
MicroStrain Communications Library for embedded systems
|
#include "serialization.h"Macros | |
| #define | INSERT_MACRO(name, type) |
| #define | EXTRACT_MACRO(name, type) |
Functions | |
| void | microstrain_serializer_init_insertion (microstrain_serializer *serializer, uint8_t *buffer, size_t buffer_size) |
| Initialize a serialization struct for insertion into a buffer. More... | |
| void | microstrain_serializer_init_extraction (microstrain_serializer *serializer, const uint8_t *buffer, size_t buffer_size) |
| Initialize a serialization struct for extraction from a buffer. More... | |
| size_t | microstrain_serializer_capacity (const microstrain_serializer *serializer) |
| Determines the total length the buffer. More... | |
| size_t | microstrain_serializer_length (const microstrain_serializer *serializer) |
| Determines the length of the data in the buffer. More... | |
| int | microstrain_serializer_remaining (const microstrain_serializer *serializer) |
| Determines the difference between the length and buffer size. More... | |
| bool | microstrain_serializer_is_ok (const microstrain_serializer *serializer) |
| Determines if the data read/written is less than the buffer size. More... | |
| bool | microstrain_serializer_is_complete (const microstrain_serializer *serializer) |
| Determines if the number of remaining bytes is 0. More... | |
| static void | pack (uint8_t *buffer, const void *value, size_t size) |
| static void | unpack (const uint8_t *buffer, void *value, size_t size) |
| void | microstrain_extract_count (microstrain_serializer *serializer, uint8_t *count_out, uint8_t max_count) |
| Similar to microstrain_extract_u8 but allows a maximum value to be specified. More... | |
| #define INSERT_MACRO | ( | name, | |
| type | |||
| ) |
| #define EXTRACT_MACRO | ( | name, | |
| type | |||
| ) |
| void microstrain_serializer_init_insertion | ( | microstrain_serializer * | serializer, |
| uint8_t * | buffer, | ||
| size_t | buffer_size | ||
| ) |
| serializer | |
| buffer | Buffer into which data will be written. Can be NULL if buffer_size==0. |
| buffer_size | Size of the buffer. Data will not be written beyond this size. |
| void microstrain_serializer_init_extraction | ( | microstrain_serializer * | serializer, |
| const uint8_t * | buffer, | ||
| size_t | buffer_size | ||
| ) |
| serializer | |
| buffer | A pointer from which data will be read. |
| buffer_size | Maximum number of bytes to be read from the buffer. |
| size_t microstrain_serializer_capacity | ( | const microstrain_serializer * | serializer | ) |
| serializer |
| size_t microstrain_serializer_length | ( | const microstrain_serializer * | serializer | ) |
| serializer | For insertion, returns how many bytes have been written. For extraction, returns how many bytes have been read. |
| int microstrain_serializer_remaining | ( | const microstrain_serializer * | serializer | ) |
| serializer | For insertion, returns how many unwritten bytes remain in the buffer. For extraction, returns how many bytes have not been read. |
| bool microstrain_serializer_is_ok | ( | const microstrain_serializer * | serializer | ) |
If the application attempts to read or write beyond the end of the buffer (as defined by the buffer_size passed to the init function), the read or write will be a no-op but the offset will still be advanced. This allows the condition to be detected.
| serializer |
| bool microstrain_serializer_is_complete | ( | const microstrain_serializer * | serializer | ) |
Use this to determine if the entire buffer has been extracted. It is not particularly useful for insertion.
| serializer |
|
static |
|
static |
| void microstrain_extract_count | ( | microstrain_serializer * | serializer, |
| uint8_t * | count_out, | ||
| uint8_t | max_count | ||
| ) |
If the maximum count would be exceeded, an error is generated which causes further extraction to fail.
| serializer | |
| count_out | The counter value read from the buffer. |
| max_count | The maximum value of the counter. If the count exceeds this, it is set to 0 and the serializer is insert into an error state. |
1.8.17