Table of Contents
Preface vii
1 Introduction 1
What Makes BLE Different 1
The Specification 3
Configurations 3
Based on Specification Support 3
Based on Chip Count 5
Key Limitations 6
Data Throughput 6
Operating Range 8
Network Topology 9
Broadcasting and Observing 9
Connections 10
Protocols versus Profiles 12
Generic Profiles 13
Use-Case-Specific Profiles 13
2 Protocol Basics 15
Physical Layer 16
Link Layer 17
Bluetooth Device Address 19
Advertising and Scanning 19
Connections 22
Host Controller Interface (HCI) 24
Logical Link Control and Adaptation Protocol (L2CAP) 25
Attribute Protocol (ATT) 26
ATT operations 26
Security Manager (SM) 28
Security Procedures 29
Pairing Algorithms 30
Security Keys 31
Generic Attribute Profile (GATT) 32
Generic Access Profile (GAP) 33
5 GAP (Advertising and Connections) 35
Roles 36
Modo and Procedures 37
Broadcast and Observation 38
Discovery 39
Connection Establishment 41
Additional GAP Procedures 42
Security 43
Address Types 44
Authentication 45
Security Modes 45
Security Modes and Procedures 46
Additional GAP Definitions 48
Advertising Data Format 48
GAP Service 50
4 GATT (Services and Characteristics) 51
Roles 51
UUIDs 52
Attributes 53
Handle 53
Type 54
Permissions 54
Value 55
Attribute and Data Hierarchy 56
Services 58
Characteristics 59
Characteristic Descriptors 61
Example Service 63
Advanced Attribute Concepts 66
Attribute Caching 66
GATT Attribute Data in Advertising Packets 67
Features 68
Exchange MTU 68
Service and Characteristic Discovery 69
Reading Characteristics and Descriptors 70
Writing Characteristics and Descriptors 71
Server-Initiated Updates 72
Security 72
GATT Service 73
5 Hardware Platforms 75
nRF51822-EK (Nordic Semiconductors) 75
Technical Specifications 75
SoftDevice Architecture 76
Working with the nRF51822-EK 77
Examples and Toolchains 78
CC2541DK-MINI (Texas Instruments) 78
Other Hardware Platforms and Modules 80
Laird's BL600 Module 81
Bluegiga's BLE112/BLE113 Modules 81
RFDuino 82
6 Debugging Tools 83
PCA10000 USB Dongle and the Master Control Panel 83
PCA10000 USB Dongle and Wireshark 86
CC2540 USB Dongle and SmartRF Sniffer 88
SmartRF-to-Wireshark Converter 88
Bluez hcitool and galttool 89
7 Application Design Tools 91
Bluetooth Application Accelerator 91
SensorTag 91
LightBlue for iOS 93
nRF Master Control Panel for Android 94
8 Android Programming 97
Getting Started 97
Get the Hardware 97
Get the Software 98
Configure the Hardware 98
Start a New Project 101
Initializing the BLE Library 104
Connecting to a Remote Device 107
Communicating with a Remote Device 111
9 iOS Programming 123
Simple Battery-Level Peripheral 124
Scanning for Remote Peripherals 127
Connecting to Remote Peripherals 127
Looking Up Services Associated with a Remote Peripheral 128
Looking Up Characteristics Associated with Services 129
Methods for Reading and Decoding Characteristics 131
iBeacon 132
Advertising 133
Ranging 134
Implementing an iBeacon App 135
Apple Notification Center Service with an External Display 138
10 Embedded Application Development 143
mbed BLE API 144
Embedded Toolchains 145
Installing GNU Tools on OS X and Linux 146
Installing GNU Tools on Windows 148
nRF51822 GNU Codebase and Sample Project 149
Getting the nRF51822 GNU Codebase 150
nR51822 GNU Codebase Structure 150
Compiling Projects 152
Writing to the nRF51822 153
Going Further 156
Index 157