Bluetooth Logo

Writing an SDK With Core Bluetooth

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

INTRODUCTION

In the next series of posts, I will walk through designing and implementing a very simple SDK (Software Development Kit), using Apple’s Core Bluetooth API.

Core Bluetooth is Apple’s method for interacting with Bluetooth devices; in particular, with devices that use Bluetooth Low Energy (BLE).

In the latest versions of Apple’s operating systems, Core Bluetooth will also support “Bluetooth Classic.”

SUPPORTED ON ALL APPLE DEVICES

Every Apple device, including Macs, Watches, iPhones, iPads, iPods, and TVs, will support our code, if we use Core Bluetooth.

It’s possible that the new support for Bluetooth Classic in Core Bluetooth will allow us to also use “classic” Bluetooth on our devices.

In this initial series, I’ll just cover BLE, but I also want to explore BT Classic, using Core Bluetooth, in future series.

Read more

Writing an SDK With Core Bluetooth – 00 – Prerequisites

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

BEFORE WE BEGIN

In order to proceed, we have to assume that we are all on the same page.

This is actually a fairly advanced-level tutorial, aimed at Apple-platform developers with some experience writing release-level applications.

There is no requirement to be an expert, or for particular expertise on any Apple platform (the tutorial is “platform-agnostic.” We can have experience writing iOS, MacOS, WatchOS or TVOS native apps, in Swift).

With this in mind, I will make some assumptions about the folks that want to use the tutorial:

Read more

Writing an SDK With Core Bluetooth – 04 – Let’s SDK!

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

THIS REFLECTS MY PERSONAL PHILOSOPHY

I just wanted to make it clear that the approach, and the resulting structure that we will develop, is based upon my own personal experience and viewpoint. There are definitely other ways to do this; some, a bit simpler.

But I have been writing SDKs since the 1980s, and I think that my point of view “has legs,” so to speak.

Read more

Writing an SDK With Core Bluetooth – 05 – What’s Happening?

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

MAPPING OUT THE INTERACTION

At this point, we should review the behavior of the apps, determine what we think will be going on between the devices (in Bluetooth), and decide the structure of our exposed API.

We should start by mapping out a transaction diagram of messages and data.

Read more

Writing an SDK With Core Bluetooth – 06 – One Lump, Or Two?

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

RUBBER, MEET ROAD. ROAD, MEET RUBBER

Now, it’s time for us to make some fundamental decisions about the SDK we’ll be designing.

STATE-HEAVY VS. STATE-LITE

For example, the app will have two distinct states: Peripheral and Central. Should these be reflected as a single API, with a set state, or should we actually provide two APIs, with the app loading the appropriate one for the state?

Read more

Writing an SDK With Core Bluetooth – 07 – Properties

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

WHAT DOES THE USER NEED?

One of the biggest issues that I have with many SDKs, is that they slavishly model the system they are representing. This is often not the most optimal way to present functionality to the user.

Bluetooth is a highly flexible system. It is used by millions of devices that each may have a very different dynamic from other devices, and Bluetooth needs to serve them all, so it is rather complex and flexible. Core Bluetooth does a relatively good job of simplifying the standard, but it is still fairly byzantine.

I like to start with the user; ask them what they want, and then make the SDK an interpreter between them and the interface. Hide that Bluetooth complexity, and boil it down to the basics for the user.

Read more