UUIDs are neat. y'know, cfbff0d1-9375-5685-968c-48ce8b15ae17 type of shit. if you're like me until a few days ago, all you know about the types of UUID is that v4 is the good one. but why are there other ones? is there a secret better one? why are the dashes asymmetrical? let's take a (roughly paraphrased from wikipedia and probably not quite accurate) look.
So for a thing at work, I had to learn entirely too much about Bluetooth, and I learned about a thing called "GATT" which is used to provide an...extremely complicated thing that Bluetooth Low Energy uses for defining hierarchies of whatever the fuck this device has accessible.
Anyway, the way the individual GATT tags are identified is that each type of GATT tag has its own UUID. Now you might say, sure, that makes sense, a 128 bit ID is unique enough you won't have any accidental overlaps. Which is, of course, why GATT introduces a concept of a 16-bit UUID.
Wait, what?
It turns out that the Bluetooth spec defines a custom 112 bit UUID "namespace" (0000xxxx-0000-1000-8000-00805f9b34fb) that has assigned numbers for what type of thing it is (from a document called "assigned numbers", of course) that you just slot into the empty 16 bits in that namespace. Which, I mean, I guess kinda makes sense. Assuming you never run out of those 16 bit IDs.
No one has ever regretted making identifiers too few bits. Never.
Anyway, while the assigned numbers haven't run out yet, you'd say, okay sure, just use the full 128-bit UUID filled in with the APIs over the wire (or well, air, I guess), right?
No, you can just use the abridged 16-bit "UUID" and everything is supposed to know what this means without the full 128-bits.
bluetooth, everyone