Go Contactless

The Java Contactless Communication API, developed through the JCP as JSR
257, addresses the communication needs of a significant subset of the D2D Web:
Devices that reside within about an arm's reach of where you are[2]. If you look around, you can probably
observe devices that already have some form of built-in capability to
communicate with other devices within that short radius. For instance, your
notebook computer may have the ability to communicate with your cell phone or
PDA via Bluetooth. Or your PDA may be able to sync up with your desktop
computer using infrared light.

These devices employ contactless communication: communication that requires
no wires, and is limited in range from a few inches to a few feet. Also termed
near-field communication, contactless communication technologies include
radio-frequency identification (RFID), optical barcode readers, and even
infrared communication.

Contactless communication capability is built into an increasing variety of
physical objects, such as credit cards, PDAs, mobile phones, airport kiosks,
and even packaging materials, facilitating peer-to-peer interaction between
these objects and a remote reader. The city of Taipei's public transportation
system, for instance, started to use near-field communication technology to
facilitate the purchase of bus and train tickets from mobile phones equipped
with near-field communication transmitters. The fare is billed to the
customer's mobile phone account. More recently, some credit cards include
near-field communication capabilities to offer contactless monetary
transactions, eliminating the need to swipe a credit card at the point of
purchase.

A special form of contactless communication, RFID tags attached to physical
objects respond to radio frequencies emitted from a reader device, and transmit
globally universal manufacturer and product codes[3]. Combined with sensors, such tags may
also transmit detailed product- and time-specific information, such as a
product's current temperature and location. RFID tags are designed for
high-volume, inexpensive manufacture, and thus promise ubiquitous near-field
communication access to information about all sorts of physical objects that
currently have no place on the Web. For example, while waiting in line to
purchase a movie ticket, an RFID tag embedded in the movie poster could allow
your cell phone to automatically connect to a URL recorded in the tag, and
download and play a movie preview.

Bootstrapping the D2D Web

While wire-based communication is often initiated at the moment a cable
connects two or more devices, wireless communication technologies rely on
bootstrapping mechanisms specific to each technology. Having to deal with
differing bootstrapping technologies presents a challenge to developers wanting
to harness that special corner of the D2D Web. For instance, establishing a
Bluetooth connection between two Bluetooth-enabled devices requires a priori
"pairing" of the devices. That requirement diminishes usability, since the user
has to first arrange the communication between the devices before software
could take advantage of that connection. A similar situation exists with other
wireless and near-field communication technologies, as anyone regularly
visiting wireless hotspots could confirm.

A more desirable situation would hide that communication bootstrapping from
the user, and even from applications built to exploit contactless
communication. A key value of the Java Contactless Communication API is that it
provides that bootstrapping abstraction to Java applications. Applications on a
JSR 257-enabled device can register with a DiscoveryManager to
receive notifications when other near-field communication-enabled devices come
into proximity. Based on the type of event, an application can query that newly
discovered device and retrieve data from it.

Since devices taking advantage of contactless communication often have but
scarce memory and processing resources, applications may also register with a
special PushRegistry, and request that they be "awakened" when
certain discovery events are received. That alleviates the need for
applications interested in near-field communication events to continuously stay
resident in memory.

For those familiar with Jini and RMI, the Contactless Communication API may
sound much like a pared down version of those technologies. The Jini API even
has a DiscoveryManager class to facilitate service discovery[4]. In addition, Jini's initial vision
depicted communication networks formed spontaneously by Jini-enabled devices.
The crucial difference between Jini and the Contactless Communication API is
that Jini's discovery protocol centers around services. Indeed, services in a
Jini network are defined via Java service interfaces, and the Jini discovery
protocols locate and initiate communication with services based on the
interfaces those service implement.

The devices the Contactless Communication API aims to discover and interact
with cannot be called services in the Jini sense. Instead, JSR 257's focus is
the discovery and retrieval of tiny pieces of data from devices, which is often
all such devices can offer. Once the Contactless Communication API retrieves
and processes those small data items, it may typically hand that data to other
applications via events, perhaps even triggering such applications to load into
memory as a result of those events. Higher-level applications can interpret
that data in application-specific ways, and take actions, if needed.

Some of those actions may involve further communication with the newly
discovered device, using a higher-level communication protocol, such as
Bluetooth, for example. The Contactless Communication API helps bootstrap that
higher-level communication by transferring just enough data from one device to
another to seed the higher-level protocol. Conceptually, that bootstrapping is
similar to how the Dynamic Host Configuration Protocol (DHCP) helps bootstrap
higher-level TCP/IP-based communication between hosts.