I've been thinking about devices and mapping them with a URI. I think
hardware is a digital resource, too. If we use a device: scheme, we can ask
for all kinds of devices through the BCNI (and Smart API).

If I have a Modem interface called jos.device.Modem, I can "open" a
connection to my modem with a URI like this:

bcni:jos.device.Modem?port=0

or

device:Modem?port=0

The device: scheme maps a request through BCNI to create a JVM-specific class.

If I have a Keyboard interface called jos.device.Keyboard, I can "open" a
connection to my keyboard with a URI like this:

device:Keyboard?language=en

If I have a ParallelPort interface called jos.device.ParallelPort, I can
"open" a connection to my parallel port with a URI like this:

device:ParallelPort?port=0

If I have a CommPort interface called jos.device.CommPort, I can "open" a
connection to my comm port with a URI like this:

device:CommPort?port=0

Of course, these are limited resources. Following in the tradition of BCNI
(and Smart API), null is returned when a device is already in use.

  public void example() {
    URI uri = new URI( "device:Modem?port=0" );
    Modem m = (Modem) uri.getObject();
    if ( m == null ) {
      println( "Modem is busy." );
      return;
    }
    :
  }

While "devices" are not exactly JVM-specific classes, they are below the
line in a user process environment.


_______________________________________________
Kernel maillist  -  [EMAIL PROTECTED]
http://jos.org/mailman/listinfo/kernel

Reply via email to