Bluetooth Logo

Writing an SDK With Core Bluetooth – 10 – Dark Age

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

We will now start to add the actual Core Bluetooth code to our SDK; replacing the mock code that we have in there.

This will result in a short “dark age.” We won’t be able to do much more than syntax-check until there’s enough code in place –on both ends of the connection– to enable an actual running example.

All the work that we’ve done until now has been to reduce the duration of the “dark age,” and make sure that it can be tested as soon as possible.

Testing is life. My philosophy is that I test at every possible opportunity, and periods of coding without being able to run and step through the code really bother me.

But Before We Start Coding…

We need to map out our Bluetooth Service and Characteristic structure, and register Bluetooth UUIDs for these, before we start setting up an implementation.

Advertisement Information

Peripheral devices will be using BLE Advertising to announce to the Central that they have an “8-Ball” Service.

They will have a very simple set of information for their advertisements:

  • The Service UUID
  • The Device Name

Each SDK instance will have a localName property, which can be set by the user of the SDK to represent whatever they want. That name will be advertised.

Service Structure

I have decided that we will establish a single Bluetooth Service, and have three Characteristics, like so:

  • Magic8BallService
    • Question (UTF-8 String)
    • Answer (UTF-8 String)

We could get a lot fancier; but we won’t. I don’t want to distract too much from the lesson.

Time to start preparing to implement Bluetooth.