[ This chapter does not appear in the book. ]
In many ways, this chapter is similar to chapter B1, in that it's about an echo client/server application using Bluetooth. It deserves it's own chapter because I've rewritten the code to use the BlueCove implementation of the Java Bluetooth API, aimed at JavaSE. This means that the midlet GUI had to be changed to Swing – a fairly easy task. A more important, and difficult, job was revamping the device and service discovery code. The standard approach, described in chapter B1, isn't robust enough to deal with the radio interference in my test environment. I made several changes to deal with the very lengthy discovery and search times, and infrequent connection failures.
I could write at length about the hassles of finding the 'right' Bluetooth stack for Windows XP, but you may be pleased to read that I've moved my moaning and groaning to chapter B3, Bluetooth Programming Problems. In essence, when the Bluetooth communication protocol is RFCOMM (as here), then you may as well stick with the Microsoft stack – it's a lot less hassle than trying to replace it with a more fully-featured implementation such as the Widcomm/Broadcom stack. I know this because the server in this chapter is running BlueCove on top of a Widcomm stack, while my test clients use BlueCove on Microsoft's own stack.
If pairing is a problem, then the server side of the application should be run on the Linux BlueZ stack, which can create an 'agent' process to accept pairing requests. The clients can keep on using the Microsoft (or Widcomm) stack but have to utilize non-standard extensions to JSR-82 in BlueCove to send pairing requests. I'll talk more about this in section 8.
Dr. Andrew Davison
Back to my home page