|An Introduction to Bluetooth Programming|
|Prev||Chapter 3. Bluetooth programming with Python - PyBluez||Next|
The main purpose of PyBluez is to allow Bluetooth programmers to quickly and easily develop and deploy Bluetooth applications. By providing high level objects and methods, PyBluez allows the programmer to focus on designing the algorithm and structure of the program instead having to worry about syntactic details, memory management, and parsing complex data structures and byte strings. PyBluez is not the only, or first, high level Bluetooth implementation with this goal.
There are a number of Java bindings for Bluetooth programming currently available. The Java community has the advantage of having standardized on an API for Bluetooth development, called JSR-82. Almost all Java Bluetooth implementations adhere to this specification. This makes porting Bluetooth applications from one device to another much simpler. Current implementations of JSR-82 for the GNU/Linux operating system include Rocosoft Impronto , Avetana , and JavaBluetooth .
A disadvantage of using Java is that JSR-82 is very limited, providing virtually no control over the device discovery process or established data connections. For example, JSR-82 provides no method for adjusting delivery semantics, flushing a cache of previously detected devices during a device discovery, or obtaining signal strength information . While JSR-82 is acceptable for creating simple Bluetooth applications, it is not well suited for research and academic purposes. Furthermore, Java and many JSR-82 implementations are not available on a number of platforms.
PyAffix  is also a Python extension module for GNU/Linux that provides access to system Bluetooth resources. Unlike PyBluez, PyAffix is written for the Affix Bluetooth protocol stack, which is an alternative Bluetooth implementation for GNU/Linux. BlueZ is the official Bluetooth protocol stack for GNU/Linux, and almost all Linux distributions are shipped with BlueZ. In order to use PyAffix, the user must first remove BlueZ and install Affix - a complex and laborious process requiring a high level of expertise. PyBluez originated as a port of PyAffix for BlueZ, and grew to provide functionality not present in PyAffix.
Cache flushing and signal strength were not covered in this chapter, but are described in the PyBluez documentation and examples