WTF is “Exact time 256”
The Bluetooth Special Interest Group (SIG) has a metric ton of Bluetooth LE device specs in a massively confusing pile. In this walkthrough I’ll show how I figured out the details of a fairly simple LE protocol. In particular, I’ll be creating something that needs to match the “Current Time Service”, services # 0x1805.
TL/DR: the good document is the “Gatt Specification Supplement”.
On the Bluetooth.com
site, you want “Specifications” and under specification you’ll need a tab open
for both the “Assigned numbers” and the “Specifications” directory.
In “Assigned numbers”, there’s two important documents. The
first is “Assigned
Numbers Document”. It’s a giant list of all of the GATT services by name
and all of the characteristics. The second is “Gatt
Specification Supplement”.
In the “Specifications” directory, find the listing for the
"Current Time Service” and click the link
to get the service page. It's got a bunch of the lest useful programming documents ever. The only document that’s interesting for most
developers is the Current Time Service 1.1 PDF file. Click the link
to read the long, complicated document.
Page 9 starts to be interesting: the Current Time Service
supports three characteristics: the “Current Time” (page 10), “Local Time”, and
“reference Time”. On page 10 it’s mentioned that we’ll be reading the Exact
Time 256 field. This is the first bit of useful (and critical) information
in the spec.
BTW, when they say “Unknown”, it’s not clear to me which
“Unknown” value they mean. But in the Assigned Numbers document there are 8 time that
“Unknown” is mentioned; all of the numeric values (6 of them) are zero. The
others are weird strings for something having to do with telegrams. Or not,
it’s a Bluetooth SIG spec, so nothing is clear.
At this point you might wonder what the actual bytes are.
The Bluetooth SIG doesn’t care that you’re wondering. You might even try typing
“Exact Time 256” into the main page search box on the main page, but you won’t get any hits.
However, you can find it in the Assigned numbers where it has number 0x2A0C in
the “Characteristics by name” and “Characteristics by UUID” section.
Note that in the “Specifications” it lists “Current Time” as
the characteristic; that’s characteristic 0x2A2B.
And then finally, take a look at the GATT Specification Supplement,
page 78, section 3.62, “Current Time”. It lists the bytes: there’s an Exact
Time 256 and then a U8 “Adjust Reason” which says why the time changed. Even better, there's a decent overview of the Exact Time 256 fields!
And here the path through the forest of all Bluetooth knowledge ends. If only there was some way to know that the "supplement" is in fact the useful document, and not the pile of other docs.