Introduction:
The last few years saw a huge boom in the software market with
the computer reaching the doorstep of general public. With that,
rose the demand for components and programs that would cater to
this general segment of the market. The most important addition
to the computer in the last few years is the USB port which can
been seen on most of the recent computers. This facility greatly
simplifies how third party devices or common devices like
printers, scanners, digital cameras, and USB storage devices can
interact with personal computers. Computers always had serial
ports and parallel ports, which could be used to connect to
third party devices but these, were limited in their
capabilities as the ports were not dynamic and expandable. Most
of the time any device connected to these ports required some
installation or driver configuration and or a restart of the
computer. Moreover these devices were not scalable, expandable
or robust. Devices connected to USB devices are scalable,
expandable, tree based, plug and play and, added to that most
devices connected to the USB port do not need any installation
and will start working just by plugging into the USB port. This
makes it easier for manufacturers to create user friendly
products and saves the customers the nightmares of installation.
Sun had seen a growth in the external device market and had
proposed a Java communication API. The Java communication API
provides access to RS232 serial ports and parallel ports from
Java applications. The Java communication API though
comprehensive enough to cover all communications to the computer
was too generic for USB based devices. Moreover, since the USB
specification is quite different from any serial port or
parallel port specifications, a common specification for all
these devices does not do justice to USB and USB based devices.
For that reason IBM proposed a new JSR (JSR 80) using the Java
Community Process for a new Java USB API. The intent of this
article will be to educate readers on the important parts of the
API and how it would be useful to programmers and vendors who
make USB based products.
Architecture:
The following subsystems constitute the core of the Java USB Architecture.
- OS Services
This section defines the services required from the underlying
operating system needed for implementing the USB specification
- Device Model
This section defines the main interface provided to the users
of the USB Specification.
- Events Model
The USB events model defines a event model for USB pipes and
devices.
- USB Pipes Model
These are logical pipes that help in communication between USB devices
and their components.
- USB Operations
This section defines the kind of requests users can send to USB devices.
The core of the system is a USB driver. The USB driver uses the
Device model to interact with the Operating system services. The
USB driver also listens to the Events subsystem to listen for
any events that are fires to the Device model or the USB pipes.
The driver uses the USB pipes subsystem to propagate commands or
requests to the USB operations subsystem.
The Components:
1. OS Services:
The heart of the OS Services subsystem is the UsbHostManager
class. This class has the responsibility of being an interface
to all the devices and hubs attached to the host system. The
UsbHostManager uses the UsbServicesUtility class to load the
properties from a jusb.properties file and creates an object of
type UsbServices. The class that is created implements the
UsbServices interface but in actuality it is the current
implementation class for the UsbServices interface.
The UsbHostManager class is a singleton class that allows only
one instance of itself per JVM. The UsbHostManager class is
instantiated when the first client makes a request to it. Once
the client gets an instance of the UsbHostManager class it
registers for events through the
UsbHostManager.getInstance().getUsbServices()
.addUsbServicesListerner(listener) method. This notifies the
client if any devices are attached to the system or when current
devices are removed from the system. The UsbHostManager also
provides access to the root USB hub which can be used to query
about devices already connected to the hub. There could be
multiple USB controllers attached to a host, the UsbHostManager
provides information about the multiple USB controllers and
provides for mechanisms to find devices attached to any of them.
The client can iteratively search for devices on any controller
using the UsbServices object.
New on the Java Boutique:
New Review:
Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling
API boasts simplicity, ease-of-integration, a well-rounded feature
set, and it's free!
New Applet:
Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA
sequences into three useful formats.
Elsewhere on internet.com:
WebDeveloper Java
Lots of Java information on webdeveloper.com
WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.
ScriptSearch Java
Hundreds of free Java code files to download.
jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.
|