About Core Bluetooth
Brief: The core Bluetooth framework provides the classes required for iOS and Mac applications to communicate wirelessly with BLE devices. The framework allows applications to scan, discover, and interact with BLE peripherals, the L-rate, electronic temperature sensors, and more. In OSX 10.9 and iOS6, your Mac,ios device can also play the role of peripherals.
- How to use the This Document
If you have never used the core Bluetooth framework, or if you are unfamiliar with the basic BLE concept, you can read the entire document. In Corebluetooth overview, you can see the key concepts you need to know.
After you understand the key concepts, you can read performing Common central role Tasks to learn how to get your device to play the role of a center player. Similarly, read performing Common peripheral role Tasks to learn how to make your device play peripheral roles.
To ensure that the application runs well and adheres to good specifications, read the following chapters: Core Bluetooth Background processing for IOS Apps, best practices for interacting with a Remo Te peripheral Device, and best practice for Setting up Your Local Device as a peripheral.
The official Bluetooth special Interst Group (SIG) website provides information on the definition of Bluetooth low-power wireless transmission technology. You can also find the Bluetooth 4.0 specification here.
If you are designing hardware accessories that use Bluetooth BLE technology to interact with Apple products, read the Bluetooth accessory Design guidelines for Apple product. If your Bluetooth accessory needs to access the notification generated by your iOS device, read Apple notificaition Center Service (ANCS) Specifacaiton.
First, Core Bluetooth overview
- Central and peripheral Devices and their Roles in Bluetooth communication
In Bluetooth low-power communication, there are two main objects: center (Central) and peripheral (peripheral). Based on the traditional client-server architecture, one peripheral (peripheral) has the data needed by other devices, while a central (center) uses the information provided by the peripherals to accomplish certain tasks. As shown in 1-1.
- Central Discover and Connect to peripherals that is advertising
Peripherals broadcasts their own data in the form of broadcast packets. A advertising packet is a group of packets that contain very little useful information provided by peripheral, such as the name of peripheral, the primary service. For example, a digital temperature regulator may broadcast data to provide the current temperature of a house.
Central can scan and listen to any peripheral device in which it is interested in broadcasting information, as shown in 1-2. A central can request to connect it has found any peripheral.
- How the Data of a peripheral is structured
The peripheral contains one or more services (the service) and can provide information about the strength of their connection signals. A Servcie (service) is a set of data and a collection of related behaviors that implement a feature or device feature. For example, a service for a heart rate monitor might be used to publish a heart rate sensor data from a monitor.
Service (services) consists of characteristic (features) and included services (built-in services), which are references to other services. Characteristic provides further details about a peripheral service. For example, the heart rate service may simply contain a characteristic used to describe the position of the heart rate sensor in the human body target, and the other characteristic is used to pass the heart rate measurement data. Figure 1-3 shows the possible structure of a heart rate monitor's service and characteristics:
- Central Explore and Interacat with the Data on a peripheral
After a central has successfully connected to a peripheral, it can discover all the services and characteristics of peripheral. (Published data may contain only a small number of available service)
A central is interacting with a peripheral service by reading or writing the value of the service ' characteristic. For example, an application can request a temperature in the current room from a digital thermostat, or it can provide a value to the temperature regulator to set the temperature in the house.
- How Centrals,peripherals and peripherals Data is represented
- Ojects on the central Side
- Local Centrals and Remote Peripherals
On the central side of development, a local central device is represented by a Cbcentralmanager object. These objects are used to manage discovered or connected remote peripheral devices (represented by Cbperipheral objects), including scans, discoveries, and connections to peripherals that are being broadcast. Figure 1-4 shows the representation of the local centrals and remote peripherals in Corebluetooth.
-
- A Remote Peripheral ' s Data is representd by Cbservice and Cbcharacteristic Objects
When you are interacting with a remote peripheral (represented by a Cbperiheral object), you will be dealing with its services and characteristics. In the Corebluetooth framework, a remote peripheral service is represented by a Cbservicses object. Similarly, the characteristic of a remote peripheral service is represented using the Cbcharacteristic object. Figure 1-5 shows the services and characteristics of the remote peripheral.
- Objects on the peripheral side
In particular, iOS devices and MAC devices can be used as ble peripheral in OSX 10.9 and iOS 6.
-
- Local Peripherals and Remote Centrals
On the peripheral side, a local peripheral device is represented by a Cbperipheralmanager object. These objects are used to manage published services that are stored on the local peripheral device services and Charactersitics databases and are responsible for the remote central Device (expressed in cbcentral) to publish services. The peripheral Manager object is also used to respond to read-write requests from remote central. Figure 1-6 shows the representation of the local peripheral and remote central in the Corebluetooth framework.
-
- A local Periphra ' s Data is repersented by Cbmutableservice and Cbmutalbecharacteristic objects
When you create and interact with a local peripheral (an object represented by Cbperipheralmanager), you deal with its variable versions of services and characteristic. In the Corebluetooth framework, a local peripheral service is represented by a Cbmutableservice object. Similarly, a local peripheral characteristic is represented by a Cbmutalbecharacteristic object. Figure 1-7 shows the basic architecture of the basic local peripheral services and characteristic.
Original translation: About Core Bluetooth