int bt_string_to_uuid(bt_uuid_t *uuid, const char *string) { if (is_uuid128(string)) return bt_string_to_uuid128(uuid, string); else if (is_uuid32(string)) return bt_string_to_uuid32(uuid, string); else if (is_uuid16(string)) return bt_string_to_uuid16(uuid, string); return -EINVAL; }
static inline int is_base_uuid128(const char *string) { uint16_t uuid; char dummy; if (!is_uuid128(string)) return 0; return sscanf(string, "0000%04hx-0000-1000-8000-00805%1[fF]9%1[bB]34%1[fF]%1[bB]", &uuid, &dummy, &dummy, &dummy, &dummy) == 5; }