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.

 BlackBerry Application Development Resources
 Microsoft Visual Studio 2010 Showcase
 MSDN Spotlight
 PHP for Windows Showcase
XML error: undefined entity at line 39
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%.

ActiveState Debuts Open Source Business Suite
Salesforce Offers Visual App Builder
Codesion Steps Out From CVS's Shadow
Facebook Makes Major PHP Push With HipHop
Free Ride Over for Microsoft Azure Users
Drupal Opens the Garden to Boost CMS
Oracle Talks Plans for Linux, Solaris
Azure Makes Cloud Computing Innovation Safe
Red Hat's JBoss Looks Ahead
Microsoft Readies Two Windows Phone Systems?

Apple Surveying iPhone Developers? Happiness With The App Store
HTML 5 Leaves Client Storage Open to Web Attacks
Basic Market Forecasting with Encog Neural Networks
Location-Aware App Review
The Future of Web Content -- HTML5, Flash, and Mobile Apps
Moonlight 3.0 Preview Offered For Rich Internet Apps on Linux and Unix
Why a Moderator is Key in the Engineering Review Process, Part II
Windows 7 Features Your Clients Will Need on Day One
What Your Clients Will Ask About Windows 7
Melissa Data Helps Developers Improve the Quality of Business Data

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


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers