34 static uint8_t
bt_base_uuid_be[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
35 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB };
39 switch(
static_cast<TypeSize>(size) ) {
49 return std::unique_ptr<const uuid_t>(
new uuid16_t(buffer, byte_offset, littleEndian));
51 return std::unique_ptr<const uuid_t>(
new uuid32_t(buffer, byte_offset, littleEndian));
53 return std::unique_ptr<const uuid_t>(
new uuid128_t(buffer, byte_offset, littleEndian));
60 case TypeSize::UUID16_SZ:
return uuid128_t(*((
uuid16_t*)
this), base_uuid, uuid32_le_octet_index);
61 case TypeSize::UUID32_SZ:
return uuid128_t(*((
uuid32_t*)
this), base_uuid, uuid32_le_octet_index);
75 :
uuid_t(TypeSize::UUID128_SZ), value(
merge_uint128(uuid16.value, base_uuid.value, uuid16_le_octet_index)) {}
78 :
uuid_t(TypeSize::UUID128_SZ), value(
merge_uint128(uuid32.value, base_uuid.value, uuid32_le_octet_index)) {}
83 str.reserve(length+1);
87 if( length != count ) {
88 ABORT(
"UUID16 string not of length %d but %d", length, count);
95 uuid128_t u128(*
this, base_uuid, le_octet_index);
102 str.reserve(length+1);
106 if( length != count ) {
107 ABORT(
"UUID32 string not of length %d but %d", length, count);
114 uuid128_t u128(*
this, base_uuid, le_octet_index);
129 str.reserve(length+1);
131 uint32_t part0, part4;
132 uint16_t part1, part2, part3, part5;
136 #if __BYTE_ORDER == __BIG_ENDIAN
143 #elif __BYTE_ORDER == __LITTLE_ENDIAN
151 #error "Unexpected __BYTE_ORDER"
153 const jau::nsize_t count = snprintf(&str[0], str.capacity(),
"%.8x-%.4x-%.4x-%.4x-%.8x%.4x",
154 part0, part1, part2, part3, part4, part5);
155 if( length != count ) {
156 ABORT(
"UUID128 string not of length %d but %d", length, count);
164 uint32_t part0, part4;
165 uint16_t part1, part2, part3, part5;
167 if( 36 != str.length() ) {
168 std::string msg(
"UUID128 string not of length 36 but ");
170 msg.append(
": "+str);
173 if ( sscanf(str.c_str(),
"%08x-%04hx-%04hx-%04hx-%08x%04hx",
174 &part0, &part1, &part2, &part3, &part4, &part5) != 6 )
176 std::string msg(
"UUID128 string not in format '00000000-0000-1000-8000-00805F9B34FB' but "+str);
182 #if __BYTE_ORDER == __BIG_ENDIAN
189 #elif __BYTE_ORDER == __LITTLE_ENDIAN
197 #error "Unexpected __BYTE_ORDER"