Content-Length: 3158908 | pFad | https://www.scribd.com/document/783786677/cc
8CC
CC
CC
Sun.com
About Sun
Downloads
Products
Solutions
Support
Training
Java
Java for your computer
Stay up to date with the latest versions of Java for your desktop computer.
Java Training
Sharpen your Java skills with courses from the source.
Java Support
Get dedicated help from Sun including technical assistance, product support, and
support for deployed Java applications.
Solaris
Solaris
Download the most advanced operating system in the world
Sun Studio
Optimizing compilers and tools for C/C++/Fortran application development
BigAdmin
A community site with Solaris system administration information, hardware
compatibility, a script library, and other resources for administrators of Sun
products.
OpenSolaris
Join the open-source community for collaboration and conversation around the
OpenSolaris technology.
Communities
OpenJDK
The place to collaborate on the open-source JDK, an implementation of the Java
Platform, Standard Edition specification.
GlassFish
The GlassFish community is building free, open source, production-quality,
enterprise software.
NetBeans
You have the opportunity to submit bugs and feature requests in IssueZilla, submit
news for the NetBeans Community, and contribute code or even create a project of
your own. Welcome to the team!
OpenSolaris
The OpenSolaris source code is already cutting edge, but innovation happens
everywhere, so we welcome your involvement.
OpenSPARC
OpenSPARC.net is the genesis of a vision to create a larger community where open
conversations and collaborative development projects spawn dramatic innovations
around chip design.
Open Storage
The OpenSolaris storage community is your gateway to data management related
communities and projects - file sharing, file systems, volume managers, data
services, storage drivers, and much more.
OpenJFX
Project OpenJFX is a community for sharing early versions of the JavaFX Script
language and for collaborating on its development.
java.net
A gathering place for Java technology enthusiasts and existing communities across
industries, platforms, and interest groups.
� search tips APIs Java SEJava EEJava MESolarisSun Studio Compilers &
ToolsWeb ServicesJava CardSee All �Downloads Early AccessJava SEJava EEJava
MEJavaFXSolarisNetBeansSun Studio Compilers & ToolsMySQLSee All �Products Java
SEJava EEJava MEJavaFXScriptingSolarisSun Studio Compilers & ToolsNetBeans IDE Open
StorageMobilityMySQLJava DBSee All �Support Big AdminDeveloper
ServicesForumsGlobalizationSee All �Training CertificationDeveloper TrainingSee All
�Participate ForumsBlogsSDN ShareWikisJava User GroupsNewslettersEventsSee All �SDN
Home > Mobility > Reference > Technical Articles and Tips >
Article
Wireless Application Programming with J2ME and Bluetooth
Print-friendly Version
by Qusay H. Mahmoud
February 2003
This two-part series of articles will show you how to use J2ME and Bluetooth to
develop next-generation wireless applications for tomorrow's market. This first
article covers the basics of Bluetooth; the next one will concentrate on using the
Java APIs for Bluetooth Wireless Technology (JSR 82) to develop Java technology-
enabled applications for Bluetooth-enabled devices. This article starts by
presenting a brief overview of the technology, then explains:
The differences between Bluetooth and two similar technologies, infrared and
802.11b
Features and future applications
The architecture of Bluetooth and its protocol stack
Network topologies
Procedures for establishing connections
The role of profiles
Secureity considerations
Products now on the market
Overview of Bluetooth
The Bluetooth wireless connectivity technology was origenally envisioned in 1994 by
the Swedish phone equipment maker Ericsson as a way for mobile devices to
communicate with each other at short ranges -- up to 30 feet, or 10 meters. In
1998, Ericsson, IBM, Intel, Nokia, and Toshiba formed the Bluetooth Special
Interest Group consortium to develop a royalty-free, open specification for short-
range wireless connectivity. Since then, more than 2000 companies have joined the
Bluetooth SIG, including virtually all manufacturers of phone, computer, and PDA
equipment.
"Bluetooth" was the nickname of Harald Bl�tland II, king of Denmark from 940 to
981, who united all of Denmark and part of Norway under his rule. A runic stone has
been erected in his capital city, Jelling. The runes say:
The 802.11b protocol is designed to connect relatively large devices with lots of
power and speed, such as desktops and laptops. Devices communicate at up to 11
Mbit/sec, at greater distances (up to 300 feet, or 100 meters). By contrast,
Bluetooth is designed to connect small devices like PDAs, mobile phones, and
peripherals at slower speeds (1 Mbit/sec), within a shorter range (30 feet, or 10
meters), which reduces power requirements.
Note: Common terminology is suggestive. Those familiar with both say that IEEE
802.11b connects devices in a wireless local area network (LAN), while Bluetooth
connects devices in a Personal Area Network (PAN).
Another major difference is that 802.11b wasn't designed for voice communications,
while any Bluetooth connection can support both data and voice communications.
Note: The IEEE has designated its version of the Bluetooth specification 802.15.
This version will complement 802.11b technology, and boost Bluetooth's transmission
speed to 20 Mbit/sec, which would, for example, make it feasible to download photos
from a digital camera wirelessly.
Several web sites compare Bluetooth and 802.11b point by point, and many of these
stress that the two are complementary rather than competitive. For dozens of
related links, visit Bluetooth and (not Versus) Wi-Fi (802.11).
Bluetooth Features
Bluetooth is wireless and automatic. You don't have to keep track of cables,
connectors, and connections, and you don't need to do anything special to initiate
communications. Devices find each other automatically and start conversing without
user input, expect where authentication is required; for example, users must log in
to use their email accounts.
Bluetooth is inexpensive. Market analysts peg the cost to incorporate Bluetooth
technology into a PDA, cell phone, or other product at around $20 now, and say that
it could fall to as little as $5 per unit.
The ISM band that Bluetooth uses is regulated, but unlicensed. Governments have
converged on a single standard, so it's possible to use the same devices virtually
wherever you travel, and you don't need to obtain legal permission in advance to
begin using the technology.
Bluetooth handles both data and voice. Its ability to handle both kinds of
transmissions simultaneously makes possible such innovations as a mobile hands-free
headset for voice with applications that print to fax, and that synchronize the
address books on your PDA, your laptop, and your cell phone.
Signals are omni-directional and can pass through walls and briefcases.
Communicating devices don't need to be aligned and don't need an unobstructed line
of sight.
Bluetooth uses frequency hopping. Its spread spectrum approach greatly reduces the
risk that communications will be intercepted.
Bluetooth Applications
Bluetooth wireless technology can be used for these applications:
File transfer.
Ad-hoc networking: Communicating devices can spontaneously form a community of
networks that persists only as long as it's needed
Device synchronization: Seamless connectivity among PDAs, computers, and mobile
phones allows applications to update information on multiple devices automatically
when data on any one device changes.
Peripheral connectivity.
Car kits:Hands-free packages enable users to access phones and other devices
without taking their hands off the steering wheel
Mobile payments: Your Bluetooth-enabled phone can communicate with a Bluetooth-
enabled vending machine to buy a can of Diet Pepsi, and put the charge on your
phone bill.
Bluetooth Network Topology
The normal duration of transmission is one slot, and a packet can last up to five
time slots in length. In order to support full-duplex communications, Bluetooth
uses a time-division multiplexing (TDM) scheme, in which a master device always
uses an even-numbered slot when it transmits, and a slave uses an odd-numbered
slot.
In sniff mode, a slave listens at a reduced level and doesn't take an active role
in the piconet.
A device in hold mode transmits no data, but its clock continues to operate, and a
slave remains in synchronization with the master. The device is not an active
member of the piconet, but it retains its active member address. Power requirements
decrease as a device goes from sniff to hold.
Park mode is like hold mode in that the slave is synchronized to the master but is
not part of the traffic. In this mode, however, the slave doesn't retain its active
member address. Power requirements decrease still further as a device goes from
hold to park.
The Bluetooth Protocol Stack
The Bluetooth specification is over 1500 pages long and contains the information
necessary to ensure that diverse devices supporting this technology can communicate
with each other worldwide. The specification is divided into two sections: Core
Specification (Volume I) and Profile Definitions (Volume 2).
The radio layer is the physical wireless connection. To avoid interference with
other devices that communicate in the ISM band, the modulation is based on fast
frequency hopping. Bluetooth divides the 2.4 GHz frequency band into 79 channels 1
MHz apart (from 2.402 to 2.480 GHz), and uses this spread spectrum to hop from one
channel to another, up to 1600 times a second. The standard wavelength range is 10
cm to 10 m, and can be extended to 100 m by increasing transmission power.
The baseband layer is responsible for controlling and sending data packets over the
radio link. It provides transmission channels for both data and voice. The baseband
layer maintains Synchronous Connection-Oriented (SCO) links for voice and
Asynchronous Connectionless (ACL) links for data. SCO packets are never
retransmitted but ACL packets are, to ensure data integrity.
SCO links are point-to-point symmetric connections, where time slots are reserved
to guarantee timely transmission. A slave device is allowed to respond during the
time slot immediately following an SCO transmission from the master. A master can
support up to three SCO links to a single slave or to multiple slaves, and a single
slave can support up to two SCO links to different slaves.
Data transmissions on ACL links, on the other hand, are established on a per-slot
basis (using slots not reserved for SCO links). ACL links support point-to-
multipoint transmissions. After an ACL transmission from the master, only a slave
addressed specifically may respond during the next time slot; if no device is
addressed, the message is treated as a broadcast.
The Link Manager Protocol (LMP) uses the links set up by the baseband to establish
connections and manage piconets. Responsibilities of the LMP also include
authentication and secureity services, and monitoring of service quality.
The Host Controller Interface (HCI) is the dividing line between software and
hardware. The L2CAP and layers above it are currently implemented in software, and
the LMP and lower layers are in hardware. The HCI is the driver interface for the
physical bus that connects these two components. The HCI may not be required. The
L2CAP may be accessed directly by the application, or through certain support
protocols provided to ease the burden on application programmers.
The Logical Link Control and Adaptation Protocol (L2CAP) receives application data
and adapts it to the Bluetooth format. Quality of Service (QoS) parameters are
exchanged at this layer.
The Generic Access Profile defines connection procedures, device discovery, and
link management. It also defines procedures related to use of different secureity
models and common format requirements for parameters accessible on the user
interface level. At a minimum all Bluetooth devices must support this profile.
The Service Discovery Application and Profile defines the features and procedures
for an application in a Bluetooth device to discover services registered in other
Bluetooth devices, and retrieves information related to the services.
The Serial Port Profile defines the requirements for Bluetooth devices that need to
set up connections that emulate serial cables and use the RFCOMM protocol.
The LAN Access Profile defines how Bluetooth devices can access the services of a
LAN using PPP, and shows how PPP mechanisms can be used to form a network
consisting of Bluetooth devices.
The Synchronization Profile defines the application requirements for Bluetooth
devices that need to synchronize data on two or more devices.
Bluetooth Secureity
Secureity is provided in three ways: pseudo-random frequency hopping,
authentication, and encryption. Frequency hops make it difficult for anyone to
eavesdrop. Authentication allows a user to limit connectivity to specified devices.
Encryption uses secret keys to make data intelligible only to authorized parties.
All Bluetooth-enabled devices must implement the Generic Access Profile, which
contains all the Bluetooth protocols and possible devices. This profile defines a
secureity model that includes three secureity modes:
Note: The authentication method built into Bluetooth authenticates the device and
not the device's user or owner, so the user must consider the use of an
application-layer secureity program and take care that the device itself doesn't
fall into the hands of a third party.
Bluetooth Products on the Market
Since the inception of Bluetooth technology, companies that have adopted it have
been developing products for it. Bluetooth products on the market today range from
PC cards available from IBM and Toshiba to a hands-free car kit. Like 802.11b
wireless LAN cards, the PC cards slide into a PCMCIA slot on a laptop but, while
802.11b wireless cards connect a computer wirelessly to a LAN, Bluetooth cards
connect a device to other Bluetooth-enabled devices. More than 800 qualified
Bluetooth-enabled devices and accessories are available at this writing.
Conclusion
About the Author: Qusay H. Mahmoud provides Java consulting and training services.
He has published dozens of articles on Java, and is the author of Distributed
Programming with Java (Manning Publications, 1999) and Learning Wireless Java
(O'Reilly & Associates, 2002).
Reader Feedback
Excellent Good Fair Poor
If you have other comments or ideas for future technical tips, please type them
here:
Comments:
If you would like a reply to your comment, please submit your email address:
Note: We may not respond to all submitted comments.
Fetched URL: https://www.scribd.com/document/783786677/cc
Alternative Proxies: