Skip to main content

JSR 82 is not only for mobiles!

Posted by brunogh on September 4, 2007 at 4:59 AM PDT

How could you create Java SE Bluetooth applications, since JSR 82 (Java Apis for Bluetooth) was made thinking in Java ME? In this entry, I am going to explain some aspects around it and also give some tips in order to you start doing Bluetooth desktop applications. In addition, we are going to talk a little about the GCF (Generic Connection Framework).

JSR 82 (Java Apis for Bluetooth) uses GCF, which is an extensible framework intended to support all kind of connections. GCF was defined in CLDC (Connected Limited Device Configuration) 1.0 and CLDC is a usual Java ME configuration for mobile phones. CLDC does not specify the actual supported network protocols or mandate implementations of any specific networking protocols, they are made at the profile level, such as, for example, MIDP (Mobile Information Device Profile). Read this C. Enrique Ortiz's article in order to get more information about GCF.

GCF does not only works in CLDC, it can run in CDC (Connected Device Configuration) - differing from CLDC, CDC requires two protocols to be implemented: File access and Datagram capability, and profiles will extend others - and it is also provided to the Java SE platform as an optional package with JSR 197 (Generic Connection Framework Optional Package for the J2SETM Platform), which is derivated from CLDC 1.1 and mandates a minimum of protocols: Socket, HTTP, File and Datagram. Having GCF in Java SE means that you can use JSR 82 to make compliant desktop applications, you will just need a JSR 82 implementation for that in your classpath. There is a lot of them for different OS (operating system) that runs in different Bluetooth stacks, but I recommend you to try some open source ones:

  • Bluecove, which runs over Windows (WIDCOMM, BlueSoleil and Microsoft Bluetooth stack found in Windows XP SP2 and newer) and [updated] at the moment it is not JSR-82 certified implementation (has not passed in all the TCK tests, take a look in Vlad's comment in this entry for more explanation) [updated], but they also have plans to extend it to Linux. Take a look in a cool interview about this project here.
  • Avetana, which has a open source version that runs over Linux (BlueZ stack). Lucas Torri used Avetana on the experiments that he have posted.

So, after you got a JSR 82 implementation, you will need a USB Bluetooth dongle - if your desktop does not have a Bluetooth hardware support, because a lot of notebooks are coming with it - and then you can start coding and creating applications that use your desktop, such as, for example, something to communicate with your mobile, remote controllers and so on. Also, Project Marge has a framework on the top of JSR 82 that facilitates a lot of Bluetooth stuff and it is compatible with Java SE. My final advice is that Rococo has a 100% Java free simulator (for non commercial use), called Impronto Simulator. You can use it to test your Java SE Bluetooth code in a simulated environment, it is quite cool before deploying. Take a try doing something and sent me your feedback! ;)

Have a great week!

Bruno Ghisi

Related Topics >>