|
ubloxcfg
u-blox 9 configuration helpers
|
Data Structures | |
| union | UBLOXCFG_VALUE_u |
| Configuration value storage (s.a. UBLOXCFG_TYPE_t) More... | |
| struct | UBLOXCFG_KEYVAL_s |
| Key-value pair. More... | |
Macros | |
| #define | UBLOXCFG_KEYVAL_ANY(name, value) |
| Initialiser for a UBLOXCFG_KEYVAL_t for any type. | |
| #define | UBLOXCFG_KEYVAL_ENU(name, value) |
| Initialiser for a UBLOXCFG_KEYVAL_t for enum types. | |
| #define | UBLOXCFG_KEYVAL_MSG(msg, port, rate) |
| Initialiser for UBLOXCFG_KEYVAL_t for output message rate. | |
| #define | UBLOXCFG_MAX_KEYVAL_STR_SIZE |
| Maximum size (= length + 1) for key-value stringification. | |
Typedefs | |
| typedef union UBLOXCFG_VALUE_u | UBLOXCFG_VALUE_t |
| Configuration value storage (s.a. UBLOXCFG_TYPE_t) | |
| typedef struct UBLOXCFG_KEYVAL_s | UBLOXCFG_KEYVAL_t |
| Key-value pair. | |
Functions | |
| bool | ubloxcfg_makeData (uint8_t *data, const int size, const UBLOXCFG_KEYVAL_t *keyVal, const int nKeyVal, int *dataSize) |
| Configuration data from key-value list. | |
| bool | ubloxcfg_parseData (const uint8_t *data, const int size, UBLOXCFG_KEYVAL_t *keyVal, const int maxKeyVal, int *nKeyVal) |
| Key-value list from configuration data. | |
| const char * | ubloxcfg_typeStr (UBLOXCFG_TYPE_t type) |
| Stringify item type. | |
| bool | ubloxcfg_stringifyValue (char *str, const int size, const UBLOXCFG_TYPE_t type, const UBLOXCFG_ITEM_t *item, const UBLOXCFG_VALUE_t *val) |
| Stringify item value. | |
| bool | ubloxcfg_splitValueStr (char *str, char **valueStr, char **prettyStr) |
| Split stringified value string. | |
| bool | ubloxcfg_stringifyKeyVal (char *str, const int size, const UBLOXCFG_KEYVAL_t *keyVal) |
| Stringify key-value pair (for debugging) | |
| bool | ubloxcfg_valueFromString (const char *str, const UBLOXCFG_TYPE_t type, const UBLOXCFG_ITEM_t *item, UBLOXCFG_VALUE_t *value) |
| Convert string to value. | |
| #define UBLOXCFG_KEYVAL_ANY | ( | name, | |
| value ) |
Initialiser for a UBLOXCFG_KEYVAL_t for any type.
| [in] | name | The name of the configuration item (with underscores instead of minus, e.g. CFG_NAVSPG_FIXMODE) |
| [in] | value | The value (of appropriate type, e.g. 1) |
Example
Definition at line 257 of file ubloxcfg.h.
| #define UBLOXCFG_KEYVAL_ENU | ( | name, | |
| value ) |
Initialiser for a UBLOXCFG_KEYVAL_t for enum types.
| [in] | name | The name of the configuration item (with underscores instead of minus, e.g. CFG_NAVSPG_FIXMODE) |
| [in] | value | The name of the enum value (e.g. 2DONLY) |
Example
Definition at line 275 of file ubloxcfg.h.
| #define UBLOXCFG_KEYVAL_MSG | ( | msg, | |
| port, | |||
| rate ) |
Initialiser for UBLOXCFG_KEYVAL_t for output message rate.
| [in] | msg | The name of the message (with underscores instead of minus, e.g. UBX_NAV_PVT) |
| [in] | port | The port (UART1, UART2, SPI, I2C or USB) |
| [in] | rate | The message rate (0..255) |
Example
Definition at line 298 of file ubloxcfg.h.
| #define UBLOXCFG_MAX_KEYVAL_STR_SIZE |
Maximum size (= length + 1) for key-value stringification.
Definition at line 489 of file ubloxcfg.h.
| bool ubloxcfg_makeData | ( | uint8_t * | data, |
| const int | size, | ||
| const UBLOXCFG_KEYVAL_t * | keyVal, | ||
| const int | nKeyVal, | ||
| int * | dataSize ) |
Configuration data from key-value list.
Generates binary configuration data (e.g. for UBX-CFG-VALSET message) from a list of key-value pairs.
| [out] | data | Buffer to write the binary configuration data to |
| [in] | size | Buffer size (maximum size that can be used) |
| [in] | keyVal | List of key-value pairs |
| [in] | nKeyVal | Number of key-value pairs |
| [out] | dataSize | Actually used size in data buffer |
data buffer was big enough to fit all key-value pairs, false otherwise (in which case neither data nor dataSize are valid)An empty list (nKeyVal = 0) is a valid input.
Example
Definition at line 120 of file ubloxcfg.c.
| bool ubloxcfg_parseData | ( | const uint8_t * | data, |
| const int | size, | ||
| UBLOXCFG_KEYVAL_t * | keyVal, | ||
| const int | maxKeyVal, | ||
| int * | nKeyVal ) |
Key-value list from configuration data.
Parses binary configuration data (e.g. from a UBX-CFG-VALGET response) into a list of key-value pairs.
| [in] | data | Buffer to read the binary configuration data from |
| [in] | size | Size of data buffer |
| [out] | keyVal | List of key-value pairs to populate |
| [in] | maxKeyVal | Maximum number of key-value pairs (length of key-value list) |
| [out] | nKeyVal | Number of key-value pairs written to list |
keyVal was big enough to fit all key-value pairs, false otherwise (in which case neither keyVal nor nKeyVal are valid)An empty data buffer (dataSize = 0) is a valid input.
Example
Definition at line 214 of file ubloxcfg.c.
| const char * ubloxcfg_typeStr | ( | UBLOXCFG_TYPE_t | type | ) |
Stringify item type.
| [in] | type | Type |
type is none of UBLOXCFG_TYPE_e. Definition at line 336 of file ubloxcfg.c.
| bool ubloxcfg_stringifyValue | ( | char * | str, |
| const int | size, | ||
| const UBLOXCFG_TYPE_t | type, | ||
| const UBLOXCFG_ITEM_t * | item, | ||
| const UBLOXCFG_VALUE_t * | val ) |
Stringify item value.
| [out] | str | String to format with the value |
| [in] | size | Size of the str buffer |
| [in] | type | Type |
| [in] | item | Item (or NULL) |
| [in] | val | Configuration item value |
size too small, ...)Constant names will be added for L type, and, where available, for X and E type if item is given.
This function does not apply item scale factors nor does it add item units to the formatted string.
The stringification is as follows:
That is, the string starts with the numeric value, followed by one space character, followed by a pretty-printed value in brackets (where useful).
The str buffer should be reasonably big (UBLOXCFG_MAX_KEYVAL_STR_SIZE), esp. for stringification of E and X types.
Definition at line 362 of file ubloxcfg.c.
| bool ubloxcfg_splitValueStr | ( | char * | str, |
| char ** | valueStr, | ||
| char ** | prettyStr ) |
Split stringified value string.
| [in] | str | The string formatted by ubloxcfg_stringifyValue() |
| [out] | valueStr | String with only the value |
| [out] | prettyStr | String with only the pretty part (or NULL) |
str is taintedThe str is split on the space character. A "(n/a)" pretty-printed value in str is ignored and prettyStr is set to NULL. I.e. "value (pretty)" becomes "value" and "pretty". "value" or "value (n/a)" become "value" and NULL.
Definition at line 549 of file ubloxcfg.c.
| bool ubloxcfg_stringifyKeyVal | ( | char * | str, |
| const int | size, | ||
| const UBLOXCFG_KEYVAL_t * | keyVal ) |
Stringify key-value pair (for debugging)
| [out] | str | String to format |
| [in] | size | Size of the str buffer |
| [in] | keyVal | Key-value pair |
size too small, ...)The str buffer should be reasonably big (UBLOXCFG_MAX_KEYVAL_STR_SIZE), esp. for stringification of E and X types.
Example
Definition at line 575 of file ubloxcfg.c.
| bool ubloxcfg_valueFromString | ( | const char * | str, |
| const UBLOXCFG_TYPE_t | type, | ||
| const UBLOXCFG_ITEM_t * | item, | ||
| UBLOXCFG_VALUE_t * | value ) |
Convert string to value.
| [in] | str | String to convert |
| [in] | type | Type of value |
| [in] | item | Item (or NULL) |
| [out] | value | Value |
The following conversions are accepted:
"true", "false" or any decimal, hexadecimal or octal string that translate to the value 1 or 0.item is given for E and X types, converting constant names (see below) will be attempted first.FOO.FOO, FOO|BAR, FOO|BAR|0x05, or 0x01|0x04|0x20 str must not contain any characters that are not part of the value (for example leading or trailing whitespace).Examples
Definition at line 675 of file ubloxcfg.c.