CMP EMBEDDED.COM

Login | Register     Welcome Guest  
HOME DESIGN PRODUCTS COLUMNS E-LEARNING CONFERENCES CODE FORUMS/BLOGS NEWSLETTERS CONTACT FEATURES RSS RSS

Bringing the benefits of Java to Bluetooth



Embedded.com
C Bala Kumar and Paul Kline of Motorola explain how an API has been specified to ease integration.

How an end user will use Bluetooth wireless technology varies from person to person. Two people with the same model of a Bluetooth enabled phone might want to use it for different purposes. One person might want to be able to download video games to the phone or use the phone as a TV remote control. The other person might want to use the same model phone to unlock car doors or operate kitchen appliances and garage doors.

One way for both people to achieve their goals is to make it possible to download Bluetooth applications onto your PDAs and cell phones to customize those handheld devices. To make downloading applications a viable possibility you need a standard API that will let programmers write Bluetooth applications that work across many different hardware platforms.

The Bluetooth specification defines the over-the-air behavior to assure compatibility of Bluetooth devices from different vendors. The specification does not standardize a software API to Bluetooth stacks for use by Bluetooth applications. Java Specification Request (JSR) 82, Java APIs for Bluetooth Wireless Technology, helps solve this problem by defining the first standard API for Bluetooth application developers.

An expert group whose members represented 21 companies started work on defining this API in December 2000 under the Java Community Process program. Drafts of the specification were made available for public review in the fourth quarter of 2001, and the 1.0 version of the specification was released in March 2002. The specification can be downloaded from http://jcp.org/jsr/detail/082.jsp.

JSR-82 goals and design

The goal of the specification was to define an API that could be used by all devices that support the Java 2 Platform, Micro Edition (J2ME).

J2ME is intended for embedded devices, and the expert group felt that these devices would be the first to implement the Bluetooth API. Hence, the API was built using standard J2ME APIs and the Generic Connection Framework defined in J2ME. Thus JSR-82 API could be ported to any Java platform that supports the Generic Connection Framework.

Though the initial thinking was to define an API based on the Bluetooth profiles, the JSR-82 expert group realized that the number of Bluetooth profiles is constantly growing. The expert group decided to provide support for only basic protocols and profiles rather than introducing new API elements for each Bluetooth profile.

Although it is difficult to predict the needs of future Bluetooth profiles, the hope is that the design of this API will allow Bluetooth profiles to be written in the Java programming language as applications using the JSR-82 API.

Currently, Bluetooth profiles are built using either the OBject EXchange protocol (OBEX), the Logical Link Control and Adaptation Protocol (L2CAP), or the RFCOMM protocol. For this reason, all three of these communication protocols are incorporated in the JSR-82 API.

In addition, the specification addresses the following profiles: the Generic Access Profile, the Service Discovery Application Profile, the Serial Port Profile and the Generic Object Exchange Profile.

Finally, the Service Discovery protocol is also supported. Although the Bluetooth specification thoroughly addresses the client side of service discovery, the mechanisms that server applications use to register their services with a service discovery server are not standardized. JSR-82 defined service registration in detail in an effort to standardize the registration process for the application programmer.

OBEX as a separate API

While defining the API for the OBEX protocol, the expert group recognized that the OBEX protocol could be used over a number of different transports (e.g., IrDA', USB). Therefore, the OBEX API is defined to be transport independent. There is a separate Java package, javax.obex, for the OBEX part of the API. An IrDA device could implement the javax.obex package and not implement the javax.bluetooth package, which contains the Bluetooth API. It is expected that all Bluetooth devices will implement both packages.

Bluetooth Control Center

The JSR-82 specification also introduced the concept of a Bluetooth Control Center (BCC). The J2ME platform allows multiple Bluetooth applications to run concurrently. The BCC resolves any conflicts that arise as applications contend for Bluetooth resources, request different configurations of the Bluetooth system, or request different levels of security. The policies enforced by the BCC are expected to vary for different types of devices; therefore, the details of how BCC operates will depend on the Bluetooth stack and hardware used. The JSR-82 specification only lists the functions of the BCC and leaves the implementation details to the API implementers.

The JSR-82 implementation, including the BCC, depends on the underlying Bluetooth system and the J2ME implementation. JSR-82 imposes the requirement that the Bluetooth stack underlying a JSR-82 implementation be qualified for the Generic Access Profile, the Service Discovery Application Profile and the Serial Port Profile. The stack must also provide access to its Service Discovery Protocol, RFCOMM, and L2CAP layers. The reason for these requirements is that APIs developed under the Java Community Process are not allowed to have optional elements. The whole Java package must be implemented on a device if any part of it is implemented. This was the most challenging part of defining the JSR-82 specification: to fit a changing, growing Bluetooth specification with many optional elements into a Java API where no optionality is allowed.

Who should implement JSR-82?

1. Device manufacturers who support J2ME and plan to add Bluetooth technology to their devices. 2. Bluetooth device manufacturers who would like to extend the programming capability of their devices to the vast number of Java programmers.

This API brings together two different worlds, Bluetooth and Java, thus uniting the benefits of each. As the specification lead company, Motorola has a JSR-82 Reference Implementation and a JSR-82 Technology Compatibility Kit available for licensing. The Technology Compatibility Kit ensures that an implementation of the Bluetooth APIs correctly implement the JSR-82 specification. Visit www.motorola.com/java for details or send email to motorolajava@javaland.sps.mot.com.

Many companies have started to implement the JSR-82 APIs. This is not surprising, as every handset is expected to be Java-enabled in a few years, and many handsets will incorporate Bluetooth technology. Every technology needs a boost, a catalyst to proliferate. We believe the Java APIs for Bluetooth Wireless Technology is a key that will help unlock the potential of Bluetooth wireless technology.

l C Bala Kumar is the JSR Specification Lead and Paul Kline is the JSR 82 Maintenance Lead.

Published in Embedded Systems May 2002

1

Rate this article: Low High
Current rating
  • .
Embedded.com Career Center
Looking for a new job?
SEARCH JOBS

Browse all jobs

SPONSOR
RECENT JOB POSTINGS





 :