advertisement
javaboutique
Search Tips
Articles  |   Tutorials  |   Reviews  |   Tools  |   by Category  |   by Date  |   by Name  |   Submit  |   Source  |   Forums  |  
javaboutique
Browse DevX


Partners & Affiliates











advertisement

Articles : The New Java USB API :

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.

  1. OS Services This section defines the services required from the underlying operating system needed for implementing the USB specification
  2. Device Model This section defines the main interface provided to the users of the USB Specification.
  3. Events Model The USB events model defines a event model for USB pipes and devices.
  4. USB Pipes Model These are logical pipes that help in communication between USB devices and their components.
  5. 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.

How to Add Java Applets to Your Site

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.

XML error: undefined entity at line 19
advertisement
Receive Articles via our XML/RSS feed
Receive Articles via our XML/RSS feed

JavaBytes
Internet Cyclone
This powerful, easy-to-use, internet optimizer is for Windows 95, 98, ME, NT, 2000 and XP. It's designed to automatically optimize your Windows settings, boosting your Internet connection up to 200%.

Linux Vendors Head to the Cloud in Search of Cash
iPhone 3GS: Overheating Fears, OS Update Nears
PostgreSQL 8.4 Revs Up Database Admin, Security
PHP 5.3 Accelerates PHP
Sun Releases NetBeans 6.7 IDE for Java, PHP
Why Firefox Doesn't Take Google Chrome Features
First Major PHP Update in Years Coming Soon
Red Hat CEO Calls on Oracle to Keep Java Open
Google Widens AdSense for iPhone, Android Apps
Eclipse Galileo Releases 33 Open Source Projects

A Taste of JavaFX for the Uninitiated
A Guide to Caching and Compression for High Performance Web Applications
How User-Centered Design Can Put User Stories in Proper Context
Explore C# 4's New Dynamic Types and Named/Optional Parameters
Enterprise Architecture: The Journey Begins Here, Part 2
Create a Syslog Sender/Receiver Using the MS Winsock Control
AMD CodeAnalyst Helps Developers Optimize and Tune Applications
Securing Microsoft's Cloud Infrastructure
Introducing the Azure Services Platform
An Introduction to Microsoft .NET Services for Developers

Advertising Info  |   Member Services  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs