Hardware Reference
In-Depth Information
come in, allowing for fine-grained enabling and disabling of notifications and indica‐
tions for all characteristics that support them.
A CCCD's value is nothing more than a two-bit bitfield, with one bit corresponding to
notifications and the other to indications. A client can set and clear those bits at any
time, and the server will check them every time the characteristic that encloses them
has changed value and might be susceptible to an update over the air.
Every time a client wants to enable notifications or indications for a particular charac‐
teristic that supports them, it simply uses a Write Request ATT packet to set the corre‐
sponding bit to 1 . The server will then reply with a Write Response and start sending
the appropriate packets whenever it wants to alert the client of a change in value.
Additionally, CCCDs have two special properties that separate them from other at‐
tributes:
Their values are unique per connection
In multi-connection scenarios, in which a central is connected to multiple periph‐
erals and also acting as a GATT server, each peripheral will receive its own copy of
the CCCD's value when reading it with ATT.
Their values are preserved across connections with bonded devices
“Attribute Caching” on page 66 discusses attribute caching in more detail, but that
concerns only attribute handles . Values are typically not stored per-device and the
GATT server can reset them between connections. This is not the case with CCCDs
among bonded devices: the last value written by a client to a CCCD on the server
is guaranteed to be restored upon reconnection, regardless of the time elapsed be‐
tween connections.
Many protocol stacks have special mechanisms to deal with CCCDs, both from a client's
and a server's perspective, because they are so critical to correct operation and to guar‐
antee timely data updates between peers.
Characteristic presentation format descriptor
When present, this descriptor type contains the actual format of the enclosing charac‐
teristic value in its seven-byte attribute value. The list of formats available include Boo‐
leans, strings, integers, floating-point, and even generic untyped buffers.
Example Service
This section presents an example of a particular service found in many commercial
products today. The Heart Rate Service (HRS) exposes the user's heart rate to a moni‐
toring device.
 
Search WWH ::




Custom Search