About this Book

This book provides an introduction to Bluetooth wireless technology and Bluetooth programming, with a specific focus on the parts of Bluetooth that concern a software developer. While there is already a host of existing literature about Bluetooth, few of these texts are written for the programmer who is concerned only with creating Bluetooth software applications. Instead, they tell all about Bluetooth, when most of the time, the programmer is interested only in a tiny fraction of this information.

This book purposefully and happily leaves out a great deal of information about Bluetooth. Concepts are simplified and described in ways that make sense to a programmer, not necessarily the ways they're laid out in the Bluetooth specification. The approach is to start simple, allowing the reader to quickly master the basic concepts with the default parameters before addressing only a few advanced features.

Despite these omissions, this book is a rigorous introduction to Bluetooth, albeit with a narrow focus. Applications can be developed without an understanding of the radio modulation techniques or the algorithms underlying the generation of Bluetooth encryption keys. Programmers, however, do need to understand issues such as the available transport protocols, the processes governing establishing connections, and the mechanisms for transferring data.

We strongly believe in learning by example, and have included working programs that demonstrate the concepts and techniques introduced in the text. Examples are provided for a wide variety of programming languages and environments, including Python, C, and Java, running on GNU/Linux, Windows, Nokia Series 60, and OS X. Special emphasis is given to the Python language examples -- the simplicity and clarity of Python allows us to very easily show the translation of concepts and techniques into actual working programs. We believe that programmers who have never seen or used Python before will find these examples easy to follow and understand.

This book is not meant to be a be-all-end-all guide to Bluetooth programming, rather it is meant to serve as a stepping stone, the first foothold for programmers interested in working with Bluetooth. The exposition of concepts and demonstration of techniques should be sufficient to allow any programmer to start creating his or her own functional Bluetooth applications that can interoperate with many other Bluetooth devices. For those interested in a deeper understanding of the inner workings and nitty-gritty details of Bluetooth, this book servers as sufficient preparation to enable one to tackle the more complex and technical documents like the Bluetooth specification itself.

Audience

This book targets the computer programmer looking for an introduction to Bluetooth and how to program with it. It assumes no previous knowledge of Bluetooth (you may have never even heard of it before picking up this book), but does assume that you have some programming experience and have access to and can use either a GNU/Linux, Windows XP, or OS X development environment.

Because Bluetooth programming shares much in common with network programming, there will be frequent references and comparisons to concepts in network programmingm, such as sockets and the TCP/IP transport protocols. Having a basic understanding of these concepts will help solidify your understanding of Bluetooth programming, but the text is written such that it does not assume the reader has this knowledge.

Organization

  • Chapter 1 provides an introduction to Bluetooth and the essentials of Bluetooth programming. The first chapter is divided into two major sections. The first section can be considered the bare essentials, most of which must be understood in order to create a functional Bluetooth program. The second section is material that is highly relevant to the Bluetooth programmer, but is not of critical importance when creating simple Bluetooth programs.
  • Chatper 2 shows how the concepts and techniques introduced in Chapter 1 can be implemented in the Python programming language using the PyBluez extension module. The simplest examples (Device Discovery, Service Search, and RFCOMM) work on both GNU/Linux and Windows XP SP2 computers, and a few examples require a GNU/Linux computer. This chapter allows the programmer to quickly and easily create fully functional Bluetooth programs with minimal effort.
  • Chapter 3 describes in detail how to create Bluetooth applications targeted for the GNU/Linux operating system. Programming examples are given in C, and require the BlueZ stack, which is now a part of the standard Linux kernel. Device Discovery, Service Search, RFCOMM, L2CAP, HCI, and SCO are described.
  • Chapter 4 describes the current state of Bluetooth programming in Windows XP. A detailed introduction is then given for the Microsoft Bluetooth stack, which comes standard in Windows XP SP2 (and is expected to be present in Windows Vista as well). Examples are given for Device Discovery, Service Search, and RFCOMM.
  • Chapter 5 describes how to create Bluetooth applications, using the Java programming language. JSR-82, the standard Java API for Bluetooth programming, is introduced along with examples for Device Discovery, Service Search, RFCOMM, and L2CAP.
  • Chapter 6 provides a partial introduction to Bluetooth programming on the Nokia Series 60 and OS X operating systems. The Series 60 Python Bluetooth API is described with examples for Device Discovery, Service Search, and RFCOMM. Device Discovery and outgoing RFCOMM connections using the OS X Objective C Bluetooth API are introduced with examples. Lastly, Bluetooth serial ports are introduced as an alternative to standard Bluetooth programming. Bluetooth programming using RFCOMM serial ports is described along with its merits and drawbacks. Examples are given for GNU/Linux, Windows XP, and OS X.
  • Chapter 7 introduces a series of GNU/Linux Bluetooth development tools that are indispensable for the serious Bluetooth developer. Although these tools are built only for the GNU/Linux operating system, Bluetooth programmers creating applications targeted for other platforms may still find these tools highly useful.

About | Examples | Errata | Cambridge