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 isnât, 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 youâre likely to encounter working with BLE:
- Chapter 1, Introduction
- 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.
- Chapter 2, Protocol Basics
- 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.
- Chapter 3, GAP (Advertising and Connections)
- 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.
- Chapter 4, GATT (Services and Characteristics)
- 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:
- Chapter 5, Hardware Platforms
- This chapter provides product designers with an overview of some of the latest embedded development platforms for BLE peripherals or products.
- Chapter 6, Debugging Tools
- Whether youâre designing your own device or designing an application that talks to existing hardware, youâll 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 whatâs actually being sent over the air.
- Chapter 7, Application Design Tools
- 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 donât 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 appication developers, and various embedded platforms for product designs and embedded harware engineers):
- Chapter 8, Android Programming
- This chapter provides a basic overview of the hardware, software, and processes required to implement Bluetooth Low Energy on the Android operating system.
- Chapter 9, iOS Programming
- 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.
- Chapter 10, Embedded Application Development
- This chapter introduces the tools needed to compile code for embedded devices. Using the nRF51822-EK discussed in Chapter 5 with the free, open source GNU toolchain and cross-compiler for ARM, youâll create a heart rate monitor example to run natively on the nRF51822 SoC.
Conventions Used in This Book
The following typographical conventions are used in this book:
- Italic
- Indicates new terms, URLs, email addresses, filenames, and file extensions.
-
Constant width
- Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.
-
Constant width bold
- Shows commands or other text that should be typed literally by the user.
-
Constant width italic
- Shows text that should be replaced with user-supplied values or by values determined by context.
Tip
This element signifies a tip, suggestion, or general note.
Warning
This element indicates a warning or caution.
Using Code Examples
Supplemental material (code examples, exercises, etc.) is available for download at https://github.com/microbuilder/IntroToBLE.
This book is here to help you get your job done. In general, if example code is offered with this book, you may use it in your programs and documentation. You do not need to contact us for permission unless youâre reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from OâReilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your productâs documentation does require permission.
We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: âGetting Started with Bluetooth Low Energy by Kevin Townsend, Carles CufÃ, Akiba, and Robert Davidson (OâReilly). Copyright 2014 Kevin Townsend, Carles CufÃ, Akiba, and Robert Davidson, 978-1-491-94951-1.â
If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at permissions@oreilly.com.
Safari® Books Online
Note
Safari Books Online is an on-demand digital library that delivers expert content in both book and video form from the worldâs leading authors in technology and business.
Technology professionals, software developers, web designers, and business and creative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training.
Safari Books Online offers a range of product mixes and pricing programs for organizations, government agencies, and individuals. Subscribers have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like OâReilly Media, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technology, and dozens more. For more information about Safari Books Online, please visit us online.
How to Contact Us
Please address comments and questions concerning this book to the publisher:
OâReilly Media, Inc. |
1005 Gravenstein Highway North |
Sebastopol, CA 95472 |
800-998-9938 (in the United States or Canada) |
707-829-0515 (international or local) |
707-829-0104 (fax) |
We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at http://bit.ly/gs-with-bluetooth-low-energy.
To comment or ask technical questions about this book, send email to bookquestions@oreilly.com.
For more information about our books, courses, conferences, and news, see our website at http://www.oreilly.com.
Find us on Facebook: http://facebook.com/oreilly
Follow us on Twitter: http://twitter.com/oreillymedia
Watch us on YouTube: http://www.youtube.com/oreillymedia
Acknowledgments
Thanks to Clara and Judith, for their endless patience and understanding, to Ha Thach, for his endless help on the CNU codebase for the nRF51822, and to pt and Limor for helping make this possible day after day.
â Kevin Townsend
Thanks to Carla for putting up with the incessant keyboard clicking, and to Vinayak for all I have learned from him over the years.
â Carles CufÃ
Itâs rare I get to work with a great team so Iâd like to thank all the coauthors for allowing me to participate in this project and all the OâReilly staff for giving me a glimpse of all the work that goes into putting a book together. Iâd also like to thank the worldwide community of hackers and hackerspaces for providing constant inspiration and the drive to learn more so I can teach workshops. And finally, Iâd like to thank the wireless sensor network community and all the crazies that are part of it, many of whom are also part of the hacker community as well as part of this book.
â Akiba
Thanks to my son Joseph and my daughter Leah for giving up the time with me so I could work on this.
â Robert Davidson
Get Getting Started with Bluetooth Low Energy now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.