lejos.nxt.comm
Class LCP

java.lang.Object
  extended by lejos.nxt.comm.LCP

public class LCP
extends Object

Implements the Lego Communication Protocol, with some extensions for lejos NXJ.


Field Summary
static byte BOOT
           
static byte CLOSE
           
static byte DELETE
           
static byte DELETE_USER_FLASH
           
static byte DIRECT_COMMAND_NOREPLY
           
static byte DIRECT_COMMAND_REPLY
           
static byte DIRECTORY_FULL
           
static byte FILE_NOT_FOUND
           
static byte FIND_FIRST
           
static byte FIND_NEXT
           
static byte GET_BATTERY_LEVEL
           
static byte GET_CURRENT_PROGRAM_NAME
           
static byte GET_DEVICE_INFO
           
static byte GET_FIRMWARE_VERSION
           
static byte GET_INPUT_VALUES
           
static byte GET_OUTPUT_STATE
           
static Queue[] inBoxes
           
static byte INSUFFICIENT_MEMORY
           
static byte KEEP_ALIVE
           
static byte LS_GET_STATUS
           
static byte LS_READ
           
static byte LS_WRITE
           
static byte MAILBOX_EMPTY
           
static byte MESSAGE_READ
           
static byte MESSAGE_WRITE
           
static byte NOT_IMPLEMENTED
           
static byte NXJ_DEFRAG
           
static byte NXJ_DISCONNECT
           
static byte NXJ_FIND_FIRST
           
static byte NXJ_FIND_NEXT
           
static byte NXJ_PACKET_MODE
           
static byte OPEN_APPEND_DATA
           
static byte OPEN_READ
           
static byte OPEN_READ_LINEAR
           
static byte OPEN_WRITE
           
static byte OPEN_WRITE_DATA
           
static byte OPEN_WRITE_LINEAR
           
static byte PLAY_SOUND_FILE
           
static byte PLAY_TONE
           
static byte POLL
           
static byte POLL_LENGTH
           
static byte READ
           
static byte REPLY_COMMAND
           
static byte RESET_MOTOR_POSITION
           
static byte RESET_SCALED_INPUT_VALUE
           
static byte SET_BRICK_NAME
           
static byte SET_INPUT_MODE
           
static byte SET_OUTPUT_STATE
           
static byte START_PROGRAM
           
static byte STOP_PROGRAM
           
static byte STOP_SOUND_PLAYBACK
           
static byte SYSTEM_COMMAND_NOREPLY
           
static byte SYSTEM_COMMAND_REPLY
           
static byte UNDEFINED_ERROR
           
static byte WRITE
           
 
Method Summary
static int emulateCommand(byte[] cmd, int cmdLen, byte[] reply)
          Emulates a Lego firmware Direct or System command
static void messageWrite(int mailbox, String msg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inBoxes

public static Queue[] inBoxes

DIRECT_COMMAND_REPLY

public static byte DIRECT_COMMAND_REPLY

SYSTEM_COMMAND_REPLY

public static byte SYSTEM_COMMAND_REPLY

REPLY_COMMAND

public static byte REPLY_COMMAND

DIRECT_COMMAND_NOREPLY

public static byte DIRECT_COMMAND_NOREPLY

SYSTEM_COMMAND_NOREPLY

public static byte SYSTEM_COMMAND_NOREPLY

START_PROGRAM

public static final byte START_PROGRAM
See Also:
Constant Field Values

STOP_PROGRAM

public static final byte STOP_PROGRAM
See Also:
Constant Field Values

PLAY_SOUND_FILE

public static final byte PLAY_SOUND_FILE
See Also:
Constant Field Values

PLAY_TONE

public static final byte PLAY_TONE
See Also:
Constant Field Values

SET_OUTPUT_STATE

public static final byte SET_OUTPUT_STATE
See Also:
Constant Field Values

SET_INPUT_MODE

public static final byte SET_INPUT_MODE
See Also:
Constant Field Values

GET_OUTPUT_STATE

public static final byte GET_OUTPUT_STATE
See Also:
Constant Field Values

GET_INPUT_VALUES

public static final byte GET_INPUT_VALUES
See Also:
Constant Field Values

RESET_SCALED_INPUT_VALUE

public static final byte RESET_SCALED_INPUT_VALUE
See Also:
Constant Field Values

MESSAGE_WRITE

public static final byte MESSAGE_WRITE
See Also:
Constant Field Values

RESET_MOTOR_POSITION

public static final byte RESET_MOTOR_POSITION
See Also:
Constant Field Values

GET_BATTERY_LEVEL

public static final byte GET_BATTERY_LEVEL
See Also:
Constant Field Values

STOP_SOUND_PLAYBACK

public static final byte STOP_SOUND_PLAYBACK
See Also:
Constant Field Values

KEEP_ALIVE

public static final byte KEEP_ALIVE
See Also:
Constant Field Values

LS_GET_STATUS

public static final byte LS_GET_STATUS
See Also:
Constant Field Values

LS_WRITE

public static final byte LS_WRITE
See Also:
Constant Field Values

LS_READ

public static final byte LS_READ
See Also:
Constant Field Values

GET_CURRENT_PROGRAM_NAME

public static final byte GET_CURRENT_PROGRAM_NAME
See Also:
Constant Field Values

MESSAGE_READ

public static final byte MESSAGE_READ
See Also:
Constant Field Values

NXJ_DISCONNECT

public static byte NXJ_DISCONNECT

NXJ_DEFRAG

public static byte NXJ_DEFRAG

OPEN_READ

public static final byte OPEN_READ
See Also:
Constant Field Values

OPEN_WRITE

public static final byte OPEN_WRITE
See Also:
Constant Field Values

READ

public static final byte READ
See Also:
Constant Field Values

WRITE

public static final byte WRITE
See Also:
Constant Field Values

CLOSE

public static final byte CLOSE
See Also:
Constant Field Values

DELETE

public static final byte DELETE
See Also:
Constant Field Values

FIND_FIRST

public static final byte FIND_FIRST
See Also:
Constant Field Values

FIND_NEXT

public static final byte FIND_NEXT
See Also:
Constant Field Values

GET_FIRMWARE_VERSION

public static final byte GET_FIRMWARE_VERSION
See Also:
Constant Field Values

OPEN_WRITE_LINEAR

public static final byte OPEN_WRITE_LINEAR
See Also:
Constant Field Values

OPEN_READ_LINEAR

public static final byte OPEN_READ_LINEAR
See Also:
Constant Field Values

OPEN_WRITE_DATA

public static final byte OPEN_WRITE_DATA
See Also:
Constant Field Values

OPEN_APPEND_DATA

public static final byte OPEN_APPEND_DATA
See Also:
Constant Field Values

BOOT

public static final byte BOOT
See Also:
Constant Field Values

SET_BRICK_NAME

public static final byte SET_BRICK_NAME
See Also:
Constant Field Values

GET_DEVICE_INFO

public static final byte GET_DEVICE_INFO
See Also:
Constant Field Values

DELETE_USER_FLASH

public static final byte DELETE_USER_FLASH
See Also:
Constant Field Values

POLL_LENGTH

public static final byte POLL_LENGTH
See Also:
Constant Field Values

POLL

public static final byte POLL
See Also:
Constant Field Values

NXJ_FIND_FIRST

public static final byte NXJ_FIND_FIRST
See Also:
Constant Field Values

NXJ_FIND_NEXT

public static final byte NXJ_FIND_NEXT
See Also:
Constant Field Values

NXJ_PACKET_MODE

public static final byte NXJ_PACKET_MODE
See Also:
Constant Field Values

MAILBOX_EMPTY

public static final byte MAILBOX_EMPTY
See Also:
Constant Field Values

FILE_NOT_FOUND

public static final byte FILE_NOT_FOUND
See Also:
Constant Field Values

INSUFFICIENT_MEMORY

public static final byte INSUFFICIENT_MEMORY
See Also:
Constant Field Values

DIRECTORY_FULL

public static final byte DIRECTORY_FULL
See Also:
Constant Field Values

UNDEFINED_ERROR

public static final byte UNDEFINED_ERROR
See Also:
Constant Field Values

NOT_IMPLEMENTED

public static final byte NOT_IMPLEMENTED
See Also:
Constant Field Values
Method Detail

emulateCommand

public static int emulateCommand(byte[] cmd,
                                 int cmdLen,
                                 byte[] reply)
Emulates a Lego firmware Direct or System command

Parameters:
cmd - the buffer containing the command
cmdLen - the length of the command

messageWrite

public static void messageWrite(int mailbox,
                                String msg)