j3d.org Code

org.j3d.device.input.spaceball
Class Spaceball3003Packet

java.lang.Object
  extended byorg.j3d.device.input.spaceball.SpaceballPacket
      extended byorg.j3d.device.input.spaceball.Spaceball3003Packet

public class Spaceball3003Packet
extends SpaceballPacket

Generates and decodes data packets for Labtec's Spaceball 2003/3003 device according to the Spaceball 2003/3003 Packet Protocol (alpha3).

NOTE: Some data packets will contain an additional "special character" ('^' - 0x5e) inserted within the data stream. This escape character notifies the system to modify the following byte. If the following byte is 'Q', (0x51), 'S' (0x53), or an 'M' (0x4d) the seventh bit should be cleared. (Which should result in 0x11, 0x13, 0x0d respectively.) If the following character is a second '^' (0x5e) then no modification should be made. (Do not forget to remove the '^' character from the packet buffer.). This is currently not implemented. Therefore certain data packets may be ignored, specially if buttons 3 and 4 are pressed at the same time.

NOTE: The Ignore Packet is not implemented.

NOTE: Implementation not finished and not tested. Any feedback welcome.

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

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

Field Summary
static int BEEPER_QUEUE_OVERFLOW_ERROR_CODE
           
static int CALIBRATION_CHECKSUM_ERROR_CODE
           
static byte DISABLE_BALL_DATA
          This command disables data packets.
static int ENABLE_BALL_DATA
          This command enables data packets.
static byte GET_REZERO_BALL
          This command causes the Spaceball to rezero.
static int HARDWARE_ERROR_CODE_1
           
static int HARDWARE_ERROR_CODE_2
           
static int HARDWARE_ERROR_CODE_3
           
static int PACKET_TOO_LONG_ERROR_CODE
           
static int RECEIVE_ERROR_CODE
           
static int RECEIVE_OVERFLOW_ERROR_ERROR_CODE
           
static int TRANSMIT_TIMEOUT_ERROR_CODE
           
 
Fields inherited from class org.j3d.device.input.spaceball.SpaceballPacket
BALL_DATA, BUTTON_DATA, BUTTON_DATA_PACKET_LENGTH, BUTTON_MASK, ECHO, ERROR, PACKET_TERMINATOR, PATTERNED_BEEP, POSITION_DATA_PACKET_LENGTH, RESET_DEVICE
 
Constructor Summary
Spaceball3003Packet()
           
 
Method Summary
static int createEnableDevicePacket(byte[] data, int offset)
          Creates a simple request packet (packet which consists only of a header).
static void decodeButtonEvent(int[] buttonData, byte[] readBuffer, int packetStart)
           
static void doCallBacks(byte[] readBuffer, Spaceball3003CallbackInterface caller, int dataStart, int dataLength, int header)
           
 
Methods inherited from class org.j3d.device.input.spaceball.SpaceballPacket
createEchoPacket, createPatternedBeepPacket, createSimpleRequestPacket, decodeBallData, decodeButtonData, makeWord
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HARDWARE_ERROR_CODE_1

public static final int HARDWARE_ERROR_CODE_1
See Also:
Constant Field Values

CALIBRATION_CHECKSUM_ERROR_CODE

public static final int CALIBRATION_CHECKSUM_ERROR_CODE
See Also:
Constant Field Values

HARDWARE_ERROR_CODE_2

public static final int HARDWARE_ERROR_CODE_2
See Also:
Constant Field Values

HARDWARE_ERROR_CODE_3

public static final int HARDWARE_ERROR_CODE_3
See Also:
Constant Field Values

TRANSMIT_TIMEOUT_ERROR_CODE

public static final int TRANSMIT_TIMEOUT_ERROR_CODE
See Also:
Constant Field Values

RECEIVE_OVERFLOW_ERROR_ERROR_CODE

public static final int RECEIVE_OVERFLOW_ERROR_ERROR_CODE
See Also:
Constant Field Values

RECEIVE_ERROR_CODE

public static final int RECEIVE_ERROR_CODE
See Also:
Constant Field Values

BEEPER_QUEUE_OVERFLOW_ERROR_CODE

public static final int BEEPER_QUEUE_OVERFLOW_ERROR_CODE
See Also:
Constant Field Values

PACKET_TOO_LONG_ERROR_CODE

public static final int PACKET_TOO_LONG_ERROR_CODE
See Also:
Constant Field Values

ENABLE_BALL_DATA

public static final int ENABLE_BALL_DATA
This command enables data packets. The Spaceball device will not send any ball movement packets until this command is sent. This is a simple request packet (packet which consists only of a header).Packet size = 2 bytes.

See Also:
Constant Field Values

DISABLE_BALL_DATA

public static final byte DISABLE_BALL_DATA
This command disables data packets. The Spaceball device will cease to send ball movement packets after this command is sent. This is a simple request packet (packet which consists only of a header).Packet size = 2 bytes.

See Also:
Constant Field Values

GET_REZERO_BALL

public static final byte GET_REZERO_BALL
This command causes the Spaceball to rezero. It takes the current position as the Powersensor rest position. All subsequent measurements (until reset) are taken relative to this position. This is a simple request packet (packet which consists only of a header). Packet size = 2 byte.

See Also:
Constant Field Values
Constructor Detail

Spaceball3003Packet

public Spaceball3003Packet()
Method Detail

createEnableDevicePacket

public static int createEnableDevicePacket(byte[] data,
                                           int offset)
Creates a simple request packet (packet which consists only of a header).

Parameters:
data - buffer into which the packet will be copied; Packet size = 2 bytes.
offset - first byte of packet will be copied at data[offset]
Returns:
packet size

decodeButtonEvent

public static void decodeButtonEvent(int[] buttonData,
                                     byte[] readBuffer,
                                     int packetStart)

doCallBacks

public static void doCallBacks(byte[] readBuffer,
                               Spaceball3003CallbackInterface caller,
                               int dataStart,
                               int dataLength,
                               int header)
Parameters:
dataStart - start of data packet in readBuffer excluding header
dataLength - length of data packet excluding header and packet terminator

j3d.org Code

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