Free Programming Books
Free download ebooks on computer and programming

Free Java Ebook "Bluetooth For Java" Sample Chapter

Bluetooth For Java
Free download chapter 3: Before You Get Started
Download chapter

Bluetooth is a technology for wireless communication that functions in much the same way that home/office laptops connect to the Internet. It is typically used for short burst communications instead of a continuous connection. Because of this difference, Bluetooth is more typically found supported in wireless phones and personal devices.

Bluetooth for Java is not an overview of Bluetooth. In the book, Bruce Hopkins and Ranjith Antony describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and walkthroughs for development with some of the different tools available. Programs will not be just J2ME (micro devices) based, but will also be for J2SE (client/desktop).

< < prev next > >

When NOT to Use Bluetooth and Java

You should not use Bluetooth with Java for the following purposes:

  • Signal strength indicator
  • Voice applications
  • Distance measuring
The next few sections explain why to avoid those scenarios.

Signal Strength Indicator

Let's say that you have two Bluetooth units, and you want to know what the signal strength is between them. A good example is when you want to use the services of a network access point. A signal strength indicator would let you know if you were within range. Well, Java is not the ideal language for that sort of application because that kind of information is not exposed to the level where a JVM would have access to it. The JVM will let you know if you are within range or not within range; there is no middle ground. In this scenario, you're better off using a native language for your device such as C or C++.

Voice Applications

Now, you've already read Chapter 2, and you realize that Bluetooth is a really great technology because you have the ability to transmit voice and data information wirelessly to other Bluetooth devices. Suddenly, you get ideas bubbling in your head about how great it would be to create a speech-to-text application on your Bluetooth-enabled phone. Unfortunately, Java (especially J2ME) is not well suited to this arena just yet. Performance is a key factor in voice-based applications, and once again, in this case, you're better off using a native language such as C. However, this application may be feasible to do in Java if the Java Real-Time Technology can be incorporated.

Distance Measuring

The best wireless technology for accurately measuring distance is light waves and not radio signals. Light waves are direct, and the calculations can be pretty simple because the speed of light (in various mediums) is pretty well documented. Using radio signals to measure distance can be quite tricky, and one of the best ways to do that is to use triangulation, like GPS transceivers do. Whether you are using Java or C, Bluetooth might be a viable technology for triangulation, but definitely not for calculating or measuring accurate distances.