15 for (
size_t i = 0; i <
sizeof(
out); i++) {
17 if (
value == INVALID_HEX_CHAR)
20 if (low != INVALID_HEX_CHAR) {
24 if (i <
sizeof(
out) - 1 && *str++ !=
':')
28 memcpy(addr,
out,
sizeof(
out));
37 for (
size_t i = 0; i <
len; i++) {
47static constexpr size_t CONFIG_BIN_STACK_BYTES = 32;
50template<
typename GetStr>
55 int size_bytes =
static_cast<int>(
size);
56 if (!get_str(section,
key, buf.
get(), &size_bytes))
Helper class for efficient buffer allocation - uses stack for small sizes, heap for large This is use...
std::vector< uint8_t > & out
bool parse_bdaddr(const char *str, uint8_t *addr)
Parse "xx:xx:xx:xx:xx:xx" as Bluedroid's string_to_bdaddr does: one or two hex digits per byte,...
bool config_get_bin(GetStr get_str, const char *section, const char *key, uint8_t *value, size_t *length)
btc_config_get_bin on top of btc_config_get_str, passed as get_str, which strlcpy's the stored string...
bool parse_config_bin(const char *str, size_t len, uint8_t *value, size_t *length)
Decode a stored hex string as Bluedroid's btc_config_get_bin does: even length, at most *length bytes...
size_t parse_hex(const char *str, size_t length, uint8_t *data, size_t count)
Parse bytes from a hex-encoded string into a byte array.
constexpr uint8_t parse_hex_char(char c)