Bluetooth Logo

Writing an SDK With Core Bluetooth – 01 – BLE Basics

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

BASIC BLE STRUCTURE

This explanation will barely scratch the surface of BLE, but it should give us enough information to understand what we are doing in the next few entries.

CENTRALS AND PERIPHERALS

Before we start, Apple has a very good breakdown of what we’ll discuss here, with a lot more information than what I’ll give. I just want to get the bare basics explained, and introduce you to the cast of characters.

I will explain each concept in more detail as we get to that step in the lesson. We’ll learn better, that way, and it will make things simpler and more accessible.

If we want to put on our thinking caps, here’s a more intense discussion.

Here is a great introductory book. It’s free. This guy knows his stuff.

The most fundamental parts of a BLE system, are devices which are acting in CENTRAL and PERIPHERAL roles.

A Central device scans for other devices, in Peripheral role, that advertise their Services.

When a Central detects a Peripheral advertisement, it gets whatever information is available from that Peripheral, which isn’t much, initially.

Advertising and Scanning Is a Bit “Messy”

That’s because the “LE” in “BLE” stands for “Low Energy.” The whole standard was designed to allow devices to use as little energy as possible for Bluetooth communications.

Advertising is done is short, succinct “bursts,” a set period of time apart. The scanner has to be listening at the same time an advertiser makes an “announcement,” so that is why it can sometimes take a few seconds for a Bluetooth app to “discover” a device.

Also, there’s usually a limit as to how much data can be sent in an advertisement.

Yelling In the Cafeteria

It could be the equivalent of someone standing on a table in a crowded cafeteria, yelling “My name is Dave, and I have some fries!”

They don’t say “sweet potato fries,” or “Dave Matthews.” They provide just enough information to find them, and a very general idea of what they are able to supply.

If Matt is looking for fries, he will be listening for the keyword “fries,” and will have to be within earshot of Dave, while Dave is yelling. When he hears Dave, he can then walk over to Dave’s table, and specifically state: “Hi, Dave, I’m Matt. Let’s talk fries.”

At that point, they each have the attention of the other, and negotiations can begin in earnest. Dave is a “Peripheral,” and Matt is a “Central.”

Matt finds out that it is THE Dave, and asks for an autograph. Dave finds out that it is THE Matt, and asks for help setting up his Web site.

This is an example of how additional services and characteristics beyond the initial advertisement can be determined.

SERVICES AND CHARACTERISTICS

We could think of Dave’s fries as a “Service,” and the fact that they are sweet potato fries, as a “Characteristic” of the fries.

Each Peripheral will host one or more “Services,” which, in turn, are comprised of one or more “Characteristics.”

It gets a lot more intricate than that, as we’ll find out, but I don’t want to get ahead of myself. This is enough of a description to get us started.

Let’s move on to describing the applications…