logo资料库

Getting Started with Bluetooth Low Energy.pdf

第1页 / 共180页
第2页 / 共180页
第3页 / 共180页
第4页 / 共180页
第5页 / 共180页
第6页 / 共180页
第7页 / 共180页
第8页 / 共180页
资料共180页,剩余部分请下载后查看
Copyright
Table of Contents
Preface
Who This Book Is For
How to Use This Book
Overview of BLE
Tools for Development and Testing
Development Platforms
Conventions Used in This Book
Using Code Examples
Safari® Books Online
How to Contact Us
Acknowledgments
Chapter 1. Introduction
What Makes BLE Different
The Specification
Configurations
Based on Specification Support
Based on Chip Count
Key Limitations
Data Throughput
Operating Range
Network Topology
Broadcasting and Observing
Connections
Protocols versus Profiles
Generic Profiles
Use-Case-Specific Profiles
Chapter 2. Protocol Basics
Physical Layer
Link Layer
Bluetooth Device Address
Advertising and Scanning
Connections
Host Controller Interface (HCI)
Logical Link Control and Adaptation Protocol (L2CAP)
Attribute Protocol (ATT)
ATT operations
Security Manager (SM)
Security Procedures
Pairing Algorithms
Security Keys
Generic Attribute Profile (GATT)
Generic Access Profile (GAP)
Chapter 3. GAP (Advertising and Connections)
Roles
Modes and Procedures
Broadcast and Observation
Discovery
Connection Establishment
Additional GAP Procedures
Security
Address Types
Authentication
Security Modes
Security Modes and Procedures
Additional GAP Definitions
Advertising Data Format
GAP Service
Chapter 4. GATT (Services and Characteristics)
Roles
UUIDs
Attributes
Handle
Type
Permissions
Value
Attribute and Data Hierarchy
Services
Characteristics
Characteristic Descriptors
Example Service
Advanced Attribute Concepts
Attribute Caching
GATT Attribute Data in Advertising Packets
Features
Exchange MTU
Service and Characteristic Discovery
Reading Characteristics and Descriptors
Writing Characteristics and Descriptors
Server-Initiated Updates
Security
GATT Service
Chapter 5. Hardware Platforms
nRF51822-EK (Nordic Semiconductors)
Technical Specifications
SoftDevice Architecture
Working with the nRF51822-EK
Examples and Toolchains
CC2541DK-MINI (Texas Instruments)
Other Hardware Platforms and Modules
Laird’s BL600 Module
Bluegiga’s BLE112/BLE113 Modules
RFDuino
Chapter 6. Debugging Tools
PCA10000 USB Dongle and the Master Control Panel
PCA10000 USB Dongle and Wireshark
CC2540 USB Dongle and SmartRF Sniffer
SmartRF-to-Wireshark Converter
Bluez hcitool and gatttool
Chapter 7. Application Design Tools
Bluetooth Application Accelerator
SensorTag
LightBlue for iOS
nRF Master Control Panel for Android
Chapter 8. Android Programming
Getting Started
Get the Hardware
Get the Software
Configure the Hardware
Start a New Project
Initializing the BLE Library
Connecting to a Remote Device
Communicating with a Remote Device
Chapter 9. iOS Programming
Simple Battery-Level Peripheral
Scanning for Remote Peripherals
Connecting to Remote Peripherals
Looking Up Services Associated with a Remote Peripheral
Looking Up Characteristics Associated with Services
Methods for Reading and Decoding Characteristics
iBeacon
Advertising
Ranging
Implementing an iBeacon App
Apple Notification Center Service with an External Display
Chapter 10. Embedded Application Development
mbed BLE API
Embedded Toolchains
Installing GNU Tools on OS X and Linux
Installing GNU Tools on Windows
nRF51822 GNU Codebase and Sample Project
Getting the nRF51822 GNU Codebase
nR51822 GNU Codebase Structure
Compiling Projects
Writing to the nRF51822
Going Further
Index
About the Authors
www.allitebooks.com
Getting Started with Bluetooth Low Energy Kevin Townsend, Carles Cufí, Akiba, and Robert Davidson www.allitebooks.com
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 O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.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 Cover Designer: Karen Montgomery Interior Designer: David Futato Illustrator: Rebecca Demarest May 2014: First Edition Revision History for the First Edition: 2014-04-29: First release See http://oreilly.com/catalog/errata.csp?isbn=9781491949511 for release details. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Getting Started with Bluetooth Low Energy, the image of a Mousebird, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. ISBN: 978-1-491-94951-1 [LSI] www.allitebooks.com
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 www.allitebooks.com iii
Security Procedures 29 Pairing Algorithms 30 Security Keys 31 Generic Attribute Profile (GATT) 32 Generic Access Profile (GAP) 33 3. GAP (Advertising and Connections). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Roles 36 Modes 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 iv | Table of Contents www.allitebooks.com
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 gatttool 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 Table of Contents | v www.allitebooks.com
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 144 Installing GNU Tools on OS X and Linux 146 Installing GNU Tools on Windows 147 nRF51822 GNU Codebase and Sample Project 149 Getting the nRF51822 GNU Codebase 149 nR51822 GNU Codebase Structure 150 Compiling Projects 151 Writing to the nRF51822 153 Going Further 156 Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 vi | Table of Contents www.allitebooks.com
分享到:
收藏