Getting Started with Bluetooth Low Energy
By Kevin Townsend , Carles Cuf , Akiba , and Robert Davidson
Copyright 2014 Kevin Townsend, Carles Cuf, Akiba, and Robert Davidson. All rights reserved.
Printed in the United States of America.
Published by OReilly Media, Inc. , 1005 Gravenstein Highway North, Sebastopol, CA 95472.
OReilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://safaribooksonline.com). For more information, contact our corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com .
- Editors: Brian Sawyer and Mike Loukides
- Production Editor: Melanie Yarbrough
- Proofreader: Eliahu Sussman
- Indexer: Judith McConville
- Interior Designer: David Futato
- Cover Designer: Karen Montgomery
- Illustrator: Rebecca Demarest
Revision History for the First Edition
- 2014-04-29: First release
- 2015-04-17: Second release
See http://oreilly.com/catalog/errata.csp?isbn=9781491949511 for release details.
The OReilly logo is a registered trademark of OReilly Media, Inc. Getting Started with Bluetooth Low Energy, the cover image, and related trade dress are trademarks of OReilly Media, Inc.
While the publisher and the authors have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the authors disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights.
978-1-491-94951-1
[LSI]
Preface
Bluetooth Low Energy (BLE), which was introduced as part of the Bluetooth 4.0 specification, is an exciting wireless technology that gives mobile application developers unprecedented access to external hardware and provides hardware engineers with easy and reliable access to their devices from every major mobile operating system.
This book aims to provide a solid, practical, high-level understanding of Bluetooth Low Energy: how data is organized, how devices communicate with each other, and the key design decisions and tradeoffs that were made by the protocol design teams. It should leave you with enough of an understanding of BLE to approach the high-level APIs on most modern embedded devices and mobile operating systems with confidence and enable you to make sense of the terminology and naming conventions in more in-depth technical documentation when you need to dig deeper. It should also clarify some of the specific strengths and limitations that distinguish BLE from other wireless technologies, such as WiFi, NFC, classic Bluetooth, Zigbee, and so on.
Experienced embedded firmware engineers will leave better prepared to dive deeper into the existing technical documentation, and mobile application developers will have a clearer idea of how data is organized in BLE devices and how to communicate with existing hardware.
Who This Book Is For
This book intends to serve two main audiences:
Mobile application developers
First, the book serves as a high-level conceptual overview of Bluetooth Low Energy for mobile application developers who want to design applications capable of talking to physical devices in the outside world, but who might not find the official 2,600-page Bluetooth Core Specification 4.1 particularly easy to approach.
Embedded engineers
On the other side of the coin, the book is also for traditional embedded engineers who are considering Bluetooth Low Energy from a product design point of view. If you need to get up to speed quickly on what BLE is and isnt, this book should help you quickly evaluate its strengths and weaknesses as a wireless protocol for your project.
How to Use This Book
This book is organized into three main sections.
Overview of BLE
The first four chapters provide a high-level overview of Bluetooth Low Energy as a technology, explaining how data is organized and what its key limitations are, while also introducing all the key concepts that youre likely to encounter working with BLE:
The first chapter introduces the basic concepts of the wireless standard known as Bluetooth Low Energy. It briefly describes the essentials required for understanding the most important elements of the technology and gives an outline of the different specification and chip configurations that can be found today. This chapter also introduces and explains elementary concepts fundamental to BLE, such as broadcasting, connections, and the different roles that devices can assume.
This chapter focuses on the protocol stack as a whole and the different entities that belong to it. It gives an overview of each of the protocol layers and their essential features, filtering out details from the specification that are not directly relevant to BLE application developers. Each layer is described in the context of the role it assumes as part of the bigger picture, with special attention to the impact it might have in real-life scenarios.
This chapter presents the Generic Access Profile (GAP), which governs the advertising process as well as connections. It gives an overview of the modes and procedures that allow devices to interact using both advertising packets to broadcast information and connections to exchange data.
This chapter provides an overview of the Generic Attribute Profile (GATT), which establishes the hierarchy and format used to represent and manipulate data in BLE. It introduces the fundamental concepts of services and characteristics, as well as the procedures that allow connected devices to exchange data with each other.
Tools for Development and Testing
The next three chapters present useful tools (both hardware and software) for developing or testing BLE-enabled applications or devices. These chapters focus on low-cost, easily accessible tools to help you get started without investing thousands of dollars:
This chapter provides product designers with an overview of some of the latest embedded development platforms for BLE peripherals or products.
Whether youre designing your own device or designing an application that talks to existing hardware, youll almost certainly have many hours of debugging ahead of you. Debugging wireless devices is a different process than purely software-based development. This chapter presents some useful debugging tools for working with BLE and seeing whats actually being sent over the air.
This chapter presents key tools for mobile application developers working with BLE. These tools will help you quickly test and verify your software or even simulate devices, if you dont have access to real hardware early in the design process.
Development Platforms
Finally, the last three chapters introduce the main development platforms you are likely to work with for BLE (iOS and Android for application developers, and various embedded platforms for product designers and embedded hardware engineers):
This chapter provides a basic overview of the hardware, software, and processes required to implement Bluetooth Low Energy on the Android operating system.
This chapter explores some of the key iOS 7 frameworks, classes, and methods that support BLE application development. Examples explore application development using BLE to read the battery level of a peripheral and an application that uses the iBeacon for location determination.