Skip to main content

Applying JSR 257 and NFC for Close-Range Bluetooth Communication

Posted by editor on July 23, 2009 at 6:53 AM PDT

The Mobile and Embedded Community pointed out an interesting new article by Bruce Hopkins, Faster Data Transfer With Bluetooth and Contactless Communication. Bruce is the author of Bluetooth for Java. The article was published on the Sun Developer Network.

Bruce starts out with some basic facts about data transfer speed:

Bluetooth technology allows two devices near each other to communicate at a maximum speed of 3 Mb per second. In the grand scheme of wireless communication, Bluetooth is roughly two times faster than the data throughput of a 3G wireless phone but still 10 to 20 times slower than today's Wi-Fi speeds.

He then talks about how difficult and time consuming it is for Bluetooth devices to discover one another, even when they are right next to each other:

due to the inherent nature of most wireless communication protocols, Bluetooth devices need to discover other Bluetooth devices, even if both devices are right next to each other... To find the available services on a remote Bluetooth device, you also need to search for a service... But device discovery and service searching are extremely time-consuming and frustrating to use when you're trying to communicate with a device that's right in front of you.

Is there a solution? That's the point of Bruce's article. In the main body of the article, Bruce introduces Near-Field Communication (NFC) and JSR 257: Contactless Communication API. Taken together, these enable Bluetooth devices to completely bypass the standard device-discovery and service search processes, speeding up the process of finding and connecting with nearby Bluetooth services immensely.

NFC is a radio communication standard that enables wireless data transfer between two devices at a very short distance -- less than 10 centimeters. NFC devices include a certain class of radio-frequency identification (RFID) tags and contactless smart cards. NFC devices operate within the 13.56 MHz frequency range, and they support extremely low data rates -- a maximum of 0.42 Mb per second.

So, the communication speed is very slow, yet NFC is still worthwhile? Well, yes -- because the setup time for NFC is virtually nil. So, in fact, your connection with the nearby device occurs much sooner than with the traditional network based device discovery process.

JSR 257, the Contactless Communication API, is the Java ME API that allows mobile phones to communicate with a variety of devices within proximity.


Bruce demonstrates the speed difference between basic Bluetooth and Bluetooth with NFC through a Java application he created that applies the NFC classes in JSR 257. Here are the results:

In my testing, the total time to transfer a 50k file using standard Bluetooth device discovery and service searching is between 40 seconds, which is OK, and 90 seconds, which is terrible.

But the use of NFC technology reduced the total transfer time to 11 seconds -- that's roughly a 75 percent to 90 percent performance increase.

Read Bruce's article for all the details.

In Java Today, the Mobile and Embedded Community points out a new article on the Sun Developer Network, Faster Data Transfer With Bluetooth and Contactless Communication, by Bruce Hopkins: "Learn how Bluetooth applications can bypass the device discovery and service searching by using Near-Field Communication (NFC) technology and JSR 257 (Contactless Communication API)."

Peligri announces the upcoming GlassFish Porfolio Webinar in Chinese - Aug 6th, 2009: "In two weeks (Thu, August 6th, 2009, 10-11am) we will host our first Webinar in Chinese. Judy (Ms FishCAT) will present; she is a native speaker and has presented on GlassFish in multiple occasions, including online and in Person.

Emmanuel Bernard wrote about the Road to Final: Bean Validation JSR 303 and Hibernate Validator 4: "JSR 303 Bean Validation and Hibernate Validator 4 (the reference implementation) are now in their last draft before final. Bean Validation standardizes constraint declaration, definition, validation and metadata for the Java platform. Said otherwise, add an annotation to a property and hop it's validated..."

In today's Weblogs, Cay Horstmann says Say Sayonara to sPAL!: "When I teach my JSF crash course to my software engineering students, everyone nods, works through the lab, and I don't hear any JSF issues from them for a couple of weeks. Then they run into links with parameters and the need for the dreaded sPAL. Not anymore! JSF2 supports parameters in action methods, which let you express your intent without contortions. Here is how."

Felipe Gaucho had some fun recently: RSJUG BBQ: "During my holiday in Porto Alegre I met the RSJUG leaders during a friendly BBQ. The agenda included Java in the local market, PUJ and - of course - the best meat you can find in Brazil."

And Fabrizio Giudici writes about Installing Mercurial with no root privileges: "After more than one year of experience with Mercurial (because NetBeans repository moved to hg time ago), I feel good with it and I've decided to switch most of my projects from Subversion to it. I'll talk in another post..."

In the Forums, dmaroto83 finds that CellCache doesn`t work with standalone client: "Hi, I`m running a standalone client in Wonderland 0.5 to do some tasks (based on the connectionsample module programmed by Jonathan Kaplan), and I`ve found that CellCache doesn`t work with these type of clients. When I try to get the references to cells placed in world doing a "session.getCellCache().getCell(cellID)", I always obtain a null reference, even when the cellID corresponds to a cell that I`ve just created and inserted in the world. How can I get the references to cells in world from this standalone client? Thanks."

jferrandi asks for information on The way to manually request the secured token: "Hi all, I've got a Client/Webservice/STS application, using glassfish v2.1, switching metro 1.5 and 2.0EA( cause of integrated fixes in 2.0EA). I ask myself what the steps are (on each side, client, STS ...) to manually ask a token to the STS. I've already seen all the posts of user Vietda, but it doesn't seem clear to me. To my mind, the steps are : 1 - Manually ask for the token from the client to the STS, in a Servlet for example. (using IssuedTokenManager); 2 - Configure the STS to provide this token. (If i'll already configure the STS, there's nothing to change); 3 - Once the client get the token, include it in the SOAP message, for consuming the targeted web service. To my mind this step is achieve in a callback handler... "

And cinacio is getting a NullPointerException in getDeployedWebInfo( "Ladies and Gentlemen, While display the Web Applications list after adding my third of ten Web Applications to the Web Admin Tool for GlassFish v2.1 I received a NullPointerException in: getDeployedWebInfo( The add appeared to have worked based on the results using the CLI. I continued to add the other Web Applications to the server without problems using the CLI. Any ideas on restoring the Web Interface would be helpful..."

The current Spotlight is Chris Hegarty's "Stream Control Transport Protocol (SCTP) in Java": "Providing support for Stream Control Transport Protocol (SCTP) in Java has been approved as one of the JDK 7 features. The work of defining the API and reference implementation was done through the sctp openjdk project. This work was integrated into JDK 7 Milestone 3 and is available in all future promotions..."

This week's Poll asks "Do you use open source software (OSS) tools in your daily work?". Today (Thursday) is the last full day of voting.

Our Feature Articles include an article by Jeff Friesen, Introducting Custom Cursors to JavaFX. In this article, Jeff shows developers how to leverage undocumented JavaFX capabilities to support custom cursors in versions 1.2 and 1.1.1. Meanwhile, Francesco Azzola's Integrating JavaFX with JavaEE Using Spring and Hessian Protocol shows how a JavaFX client can call remote JavaEE services using the Spring framework and the Hessian protocol.

The latest Java Mobility Podcast is Java Mobility Podcast 82: M3DD/LA: a conversation with the organizers of Mobile, Media, and eMbedded Developer Days/Latin America in Goiania, Brazil.

The latest OpenJDK Podcast is

The latest JavaOne Community Corner Podcast is


Current and upcoming Java

Registered users can submit event listings for the href=""> Events Page using our href="">events submission form.
All submissions go through an editorial review before being posted to the

Archives and Subscriptions: This blog is delivered weekdays as
the Java
Today RSS feed
. Also, once this page is no longer featured as the
front page of it will be
archived along with other past issues in the href=""> Archive.

The Mobile and Embedded Community pointed out an interesting new article by Bruce Hopkins, "Faster Data Transfer With Bluetooth and Contactless Communication"...