Package lejos.remote.nxt
Class LCP
- java.lang.Object
-
- lejos.remote.nxt.LCP
-
public class LCP extends java.lang.ObjectImplements the Lego Communication Protocol, with some extensions for lejos NXJ.
-
-
Field Summary
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddMessageListener(LCPMessageListener aListener)Add a listener for incoming LCP messages.static intemulateCommand(byte[] cmd, int cmdLen, byte[] reply)Emulates a Lego firmware Direct or System commandstatic voidmessageWrite(int mailbox, java.lang.String msg)Write a message to a remote inboxstatic voidsetMenuVersion(int version, int revision)Store the menu version and revisionstatic voidupdateMsg(int mailbox, java.lang.String key, java.lang.String msg)Update a message in the inbox, or add a new one if no match
-
-
-
Field Detail
-
DIRECT_COMMAND_REPLY
public static final byte DIRECT_COMMAND_REPLY
- See Also:
- Constant Field Values
-
SYSTEM_COMMAND_REPLY
public static final byte SYSTEM_COMMAND_REPLY
- See Also:
- Constant Field Values
-
REPLY_COMMAND
public static final byte REPLY_COMMAND
- See Also:
- Constant Field Values
-
DIRECT_COMMAND_NOREPLY
public static final byte DIRECT_COMMAND_NOREPLY
- See Also:
- Constant Field Values
-
SYSTEM_COMMAND_NOREPLY
public static final byte SYSTEM_COMMAND_NOREPLY
- See Also:
- Constant Field Values
-
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 final byte NXJ_DISCONNECT
- See Also:
- Constant Field Values
-
NXJ_DEFRAG
public static final byte NXJ_DEFRAG
- See Also:
- Constant Field Values
-
NXJ_SET_DEFAULT_PROGRAM
public static final byte NXJ_SET_DEFAULT_PROGRAM
- See Also:
- Constant Field Values
-
NXJ_SET_SLEEP_TIME
public static final byte NXJ_SET_SLEEP_TIME
- See Also:
- Constant Field Values
-
NXJ_SET_VOLUME
public static final byte NXJ_SET_VOLUME
- See Also:
- Constant Field Values
-
NXJ_SET_KEY_CLICK_VOLUME
public static final byte NXJ_SET_KEY_CLICK_VOLUME
- See Also:
- Constant Field Values
-
NXJ_SET_AUTO_RUN
public static final byte NXJ_SET_AUTO_RUN
- See Also:
- Constant Field Values
-
NXJ_GET_VERSION
public static final byte NXJ_GET_VERSION
- See Also:
- Constant Field Values
-
NXJ_GET_DEFAULT_PROGRAM
public static final byte NXJ_GET_DEFAULT_PROGRAM
- See Also:
- Constant Field Values
-
NXJ_GET_SLEEP_TIME
public static final byte NXJ_GET_SLEEP_TIME
- See Also:
- Constant Field Values
-
NXJ_GET_VOLUME
public static final byte NXJ_GET_VOLUME
- See Also:
- Constant Field Values
-
NXJ_GET_KEY_CLICK_VOLUME
public static final byte NXJ_GET_KEY_CLICK_VOLUME
- See Also:
- Constant Field Values
-
NXJ_GET_AUTO_RUN
public static final byte NXJ_GET_AUTO_RUN
- See Also:
- Constant Field Values
-
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_PACKET_MODE
public static final byte NXJ_PACKET_MODE
- See Also:
- Constant Field Values
-
-
Method Detail
-
addMessageListener
public static void addMessageListener(LCPMessageListener aListener)
Add a listener for incoming LCP messages. Currently only one listener is supported.- Parameters:
aListener- the LCP message listener
-
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 commandcmdLen- the length of the command
-
messageWrite
public static void messageWrite(int mailbox, java.lang.String msg)Write a message to a remote inbox- Parameters:
mailbox- the remote inboxmsg- the message
-
updateMsg
public static void updateMsg(int mailbox, java.lang.String key, java.lang.String msg)Update a message in the inbox, or add a new one if no match- Parameters:
mailbox- the remote mail boxkey- an initial prefix of the stringmsg- the new message
-
setMenuVersion
public static void setMenuVersion(int version, int revision)Store the menu version and revision- Parameters:
version- the menu version numberrevision- the menu revision number
-
-