Bluetooth Logo

Writing an SDK With Core Bluetooth – 11 – At Your Service

This entry is part 15 of 24 in the series Writing an SDK With Core Bluetooth

An important part of setting up a Bluetooth system, is registering unique GATT IDs for our Service and Characteristics.

“GATT” is an acronym for “Generic ATTribute profile.” It is defined here. There are a number of “predetermined” types of services, and we can add to them.

Service UUIDs are large hex “hashes” that are uniquely assigned to a Service. There are also UUIDs for Characteristics.

These UUIDs need to be globally unique.

We can generate hashes at this site.

It is also possible to generate them on your machine, in Terminal.

Simply start Terminal, and enter “uuidgen“, followed by a carriage return.

$ uuidgen
8E38140A-27BE-4090-8955-4FC4B5698D1E

I will assign the hash 8E38140A-27BE-4090-8955-4FC4B5698D1E to our Service. We may use that, or generate another for our own use. All the examples from here on out, will use this hash.

The Characteristics will have the following hashes:

  • Question:
    BDD37D7A-F66A-47B9-A49C-FE29FD235A77
  • Answer:
    349A0D7B-6215-4E2C-A095-AF078D737445

These UUIDs will be hidden from the SDK user, and will be declared internal. In fact, the user will never know about the Service, or any of its Characteristics.

Let’s begin the process of adding Bluetooth to our SDK.