j3d.org Code

org.j3d.device.input.spaceball
Class Spaceball3003Driver

java.lang.Object
  extended byorg.j3d.device.input.spaceball.SpaceballDriver
      extended byorg.j3d.device.input.spaceball.Spaceball3003Driver
All Implemented Interfaces:
Spaceball3003CallbackInterface

public class Spaceball3003Driver
extends SpaceballDriver
implements Spaceball3003CallbackInterface

Driver for Labtec's Spaceball 2003/3003 device. NOTE: Implementation not finished and not tested. Any feedback welcome.

Spaceball, Spaceball 2003 and Spaceball 3003 are Trademarks of Labtec Inc.

Version:
20. Aug. 2001 Copyright (c) Dipl. Ing. Paul Szawlowski
Author:
Dipl. Ing. Paul Szawlowski - University of Vienna, Dept. of Medical Computer Sciences

Field Summary
 
Fields inherited from class org.j3d.device.input.spaceball.SpaceballDriver
itsButtonData, itsPositionData, itsWriteBuffer
 
Constructor Summary
Spaceball3003Driver(SerialPort serialPort, java.io.InputStream inputStream, java.io.OutputStream outputStream)
           
 
Method Summary
 void disableDevice(int timeout)
          Ceases postion data transfer from the Spaceball device.
protected  void dispatch(byte[] readBuffer, int dataStart, int dataLength, int header)
           
 void enableDevice(int timeout)
          Requests data from the Spaceball 2003/3003 device.
 void rezeroDevice(int timeout)
           
 
Methods inherited from class org.j3d.device.input.spaceball.SpaceballDriver
close, emitPatternedBeep, getLastButtonValues, getLastPositionValues, getNumOfButtons, getSerialPort, openPort, pause, printBuffer, processDeviceInfoResponse, processEchoResponse, processError, processRequestResponse, read, resetDevice, setNumOfButtons, waitForResponse, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.j3d.device.input.spaceball.Spaceball3003CallbackInterface
processDeviceInfoResponse, processEchoResponse, processError, processRequestResponse
 

Constructor Detail

Spaceball3003Driver

public Spaceball3003Driver(SerialPort serialPort,
                           java.io.InputStream inputStream,
                           java.io.OutputStream outputStream)
Method Detail

dispatch

protected void dispatch(byte[] readBuffer,
                        int dataStart,
                        int dataLength,
                        int header)
Specified by:
dispatch in class SpaceballDriver

enableDevice

public void enableDevice(int timeout)
                  throws java.io.IOException
Requests data from the Spaceball 2003/3003 device. Must be called once after SpaceballDriver#open in order to receive position data. The first data packet will be "null-data" packet (all position data is set to zero).

Blocking until response from device received or timeout is over.

Specified by:
enableDevice in class SpaceballDriver
Parameters:
timeout - [ms] timeout for response from the Spaceball device
Throws:
java.io.IOException - if timeout is reached without a response from the Spaceball device or if an error occurs during reading the serial port

disableDevice

public void disableDevice(int timeout)
                   throws java.io.IOException
Ceases postion data transfer from the Spaceball device. Blocking until response from the Spaceball device received or timeout is over.

Specified by:
disableDevice in class SpaceballDriver
Parameters:
timeout - [ms] timeout for response from the Spaceball device
Throws:
java.io.IOException - if timeout is reached without a response from the Spaceball device or if an error occurs during reading the serial port

rezeroDevice

public void rezeroDevice(int timeout)
                  throws java.io.IOException
Throws:
java.io.IOException

j3d.org Code

Latest Info from http://code.j3d.org/
Copyright © 2001 - j3d.org