The core Bluetooth framework lets your iOS and Mac applications communicate with Bluetooth low-power devices. For example, your app can discover, explore, and interact with low-power peripherals, such as heart rate monitors, digital thermostats, and even other iOS devices.

The framework is an abstraction of the Bluetooth 4.0 specification for low-power devices. That is, it hides many low-level details of the specification from developers, making it easier for you to develop applications that interact with Bluetooth low-power devices. Because the framework is based on the specification, some concepts and terms from the specification are adopted. This chapter introduces you to the key terms and concepts you need to know to start developing good applications using the Core Bluetooth framework.

Important: iOS apps linked on iOS 10.0 or later must include a Key in their info.plist file for the type of data they need to access, or they will crash. To access the bluetooth peripherals data, must contain NSBluetoothPeripheralUsageDescription.

Central and Peripheral devices and their role in Bluetooth communication

All Bluetooth low-power communication involves two main actors: the central and peripheral devices. A central device usually uses information provided by peripherals to perform specific tasks. As Figure 1-1 shows, for example, a heart monitor might be useful for information that your Mac or iOS app might need to display in a user-friendly way in the user’s heart rate.

The center finds and connects to the AD perimeter

Peripheral devices broadcast some of the data they have in the form of advertising packages. An advertising package is a relatively small package of data that may contain useful information about what peripherals are provided, such as the names of peripherals and major functions. For example, a digital thermostat can advertise that it provides the current temperature of a room. In Bluetooth Low Power, advertising is the main way peripherals make it exist.

The central, on the other hand, can scan and listen to any peripheral that is advertising information of interest to it, as shown in Figure 1-2. The central can ask to connect to any peripherals it finds advertising on.