lejos.hardware.device
Class IRLink

java.lang.Object
  extended by lejos.hardware.Device
      extended by lejos.hardware.sensor.BaseSensor
          extended by lejos.hardware.sensor.I2CSensor
              extended by lejos.hardware.device.IRLink
All Implemented Interfaces:
java.io.Closeable, IRTransmitter, SensorConstants, SensorModes, Opcode

public class IRLink
extends I2CSensor
implements Opcode, IRTransmitter

Supports for HiTechnic NXT IRLink Sensor (NIL1046) IRLink.

Author:
Lawrie Griffiths

Field Summary
static byte PF_BACKWARD
           
static byte PF_BRAKE
           
static byte PF_FLOAT
           
static byte PF_FORWARD
           
static byte PF_MODE_COMBO_DIRECT
           
static int RCX_REMOTE_A_BWD
           
static int RCX_REMOTE_A_FWD
           
static int RCX_REMOTE_B_BWD
           
static int RCX_REMOTE_B_FWD
           
static int RCX_REMOTE_BEEP
           
static int RCX_REMOTE_C_BWD
           
static int RCX_REMOTE_C_FWD
           
static int RCX_REMOTE_MSG1
           
static int RCX_REMOTE_MSG2
           
static int RCX_REMOTE_MSG3
           
static int RCX_REMOTE_P1
           
static int RCX_REMOTE_P2
           
static int RCX_REMOTE_P3
           
static int RCX_REMOTE_P4
           
static int RCX_REMOTE_P5
           
static int RCX_REMOTE_STOP
           
 
Fields inherited from class lejos.hardware.sensor.I2CSensor
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION
 
Fields inherited from class lejos.hardware.sensor.BaseSensor
modes
 
Fields inherited from class lejos.hardware.Device
closeList
 
Fields inherited from interface lejos.remote.rcx.Opcode
OPCODE_ABSOLUTE_VALUE, OPCODE_ABSOLUTE_VALUE_REPLY, OPCODE_ADD_TO_VARIABLE, OPCODE_ADD_TO_VARIABLE_REPLY, OPCODE_ALIVE, OPCODE_ALIVE_REPLY, OPCODE_AND_VARIABLE, OPCODE_AND_VARIABLE_REPLY, OPCODE_BRANCH_ALWAYS_FAR, OPCODE_BRANCH_ALWAYS_NEAR, OPCODE_CALL_SUBROUTINE, OPCODE_CLEAR_MESSAGE, OPCODE_CLEAR_SENSOR_VALUE, OPCODE_CLEAR_SENSOR_VALUE_REPLY, OPCODE_CLEAR_TIMER, OPCODE_CLEAR_TIMER_REPLY, OPCODE_DATALOG_NEXT, OPCODE_DATALOG_NEXT_REPLY, OPCODE_DECREMENT_LOOP_COUNTER_FAR, OPCODE_DECREMENT_LOOP_COUNTER_NEAR, OPCODE_DELETE_ALL_SUBROUTINES, OPCODE_DELETE_ALL_SUBROUTINES_REPLY, OPCODE_DELETE_ALL_TASKS, OPCODE_DELETE_ALL_TASKS_REPLY, OPCODE_DELETE_FIRMWARE, OPCODE_DELETE_FIRMWARE_REPLY, OPCODE_DELETE_SUBROUTINE, OPCODE_DELETE_SUBROUTINE_REPLY, OPCODE_DELETE_TASK, OPCODE_DELETE_TASK_REPLY, OPCODE_DIVIDE_VARIABLE, OPCODE_DIVIDE_VARIABLE_REPLY, OPCODE_GET_BATTERY_POWER, OPCODE_GET_BATTERY_POWER_REPLY, OPCODE_GET_MEMORY_MAP, OPCODE_GET_MEMORY_MAP_REPLY, OPCODE_GET_VALUE, OPCODE_GET_VALUE_REPLY, OPCODE_GET_VERSIONS, OPCODE_GET_VERSIONS_REPLY, OPCODE_MASK, OPCODE_MULTIPLY_VARIABLE, OPCODE_MULTIPLY_VARIABLE_REPLY, OPCODE_OR_VARIABLE, OPCODE_OR_VARIABLE_REPLY, OPCODE_PLAY_SOUND_REPLY, OPCODE_PLAY_TONE, OPCODE_PLAY_TONE_REPLY, OPCODE_POWER_OFF, OPCODE_POWER_OFF_REPLY, OPCODE_REMOTE_COMMAND, OPCODE_SEND_MESSAGE, OPCODE_SET_DATALOG_SIZE, OPCODE_SET_DATALOG_SIZE_REPLY, OPCODE_SET_DISPLAY, OPCODE_SET_DISPLAY_REPLY, OPCODE_SET_LOOP_COUNTER, OPCODE_SET_MESSAGE, OPCODE_SET_MOTOR_DIRECTION, OPCODE_SET_MOTOR_DIRECTION_REPLY, OPCODE_SET_MOTOR_ON_OFF, OPCODE_SET_MOTOR_ON_OFF_REPLY, OPCODE_SET_MOTOR_POWER, OPCODE_SET_MOTOR_POWER_REPLY, OPCODE_SET_POWER_DOWN_DELAY, OPCODE_SET_POWER_DOWN_DELAY_REPLY, OPCODE_SET_PROGRAM_NUMBER, OPCODE_SET_PROGRAM_NUMBER_REPLY, OPCODE_SET_SENSOR_MODE, OPCODE_SET_SENSOR_MODE_REPLY, OPCODE_SET_SENSOR_TYPE, OPCODE_SET_SENSOR_TYPE_REPLY, OPCODE_SET_TIME, OPCODE_SET_TIME_REPLY, OPCODE_SET_TRANSMITTER_RANGE, OPCODE_SET_TRANSMITTER_RANGE_REPLY, OPCODE_SET_VARIABLE, OPCODE_SET_VARIABLE_REPLY, OPCODE_SIGN_VARIABLE, OPCODE_SIGN_VARIABLE_REPLY, OPCODE_START_FIRMWARE_DOWNLOAD, OPCODE_START_FIRMWARE_DOWNLOAD_REPLY, OPCODE_START_SUBROUTINE_DOWNLOAD, OPCODE_START_SUBROUTINE_DOWNLOAD_REPLY, OPCODE_START_TASK, OPCODE_START_TASK_DOWNLOAD, OPCODE_START_TASK_DOWNLOAD_REPLY, OPCODE_START_TASK_REPLY, OPCODE_STOP_ALL_TASKS, OPCODE_STOP_ALL_TASKS_REPLY, OPCODE_STOP_TASK, OPCODE_STOP_TASK_REPLY, OPCODE_SUBTRACT_FROM_VARIABLE, OPCODE_SUBTRACT_FROM_VARIABLE_REPLY, OPCODE_TEST_AND_BRANCH_FAR, OPCODE_TEST_AND_BRANCH_NEAR, OPCODE_TRANSFER_DATA, OPCODE_TRANSFER_DATA_REPLY, OPCODE_UNLOCK_FIRMWARE, OPCODE_UNLOCK_FIRMWARE_REPLY, OPCODE_UPLOAD_DATALOG, OPCODE_UPLOAD_DATALOG_REPLY, OPCODE_WAIT
 
Fields inherited from interface lejos.hardware.sensor.SensorConstants
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, GREEN, GREEN_INDEX, MAX_TYPE, MIN_TYPE, MODE_ANGLESTEP, MODE_BOOLEAN, MODE_CELSIUS, MODE_FARENHEIT, MODE_PCTFULLSCALE, MODE_PERIODCOUNTER, MODE_RAW, MODE_TRANSITIONCNT, NXT_ADC_RES, RED, RED_INDEX, TYPE_ANGLE, TYPE_COLORBLUE, TYPE_COLORFULL, TYPE_COLORGREEN, TYPE_COLORNONE, TYPE_COLORRED, TYPE_CUSTOM, TYPE_HISPEED, TYPE_LIGHT_ACTIVE, TYPE_LIGHT_INACTIVE, TYPE_LOWSPEED, TYPE_LOWSPEED_9V, TYPE_NO_SENSOR, TYPE_REFLECTION, TYPE_SOUND_DB, TYPE_SOUND_DBA, TYPE_SWITCH, TYPE_TEMPERATURE, WHITE, YELLOW
 
Constructor Summary
IRLink(I2CPort port)
           
IRLink(Port port)
           
 
Method Summary
 void backwardStep(int motor)
           
 void beep()
           
 void forwardStep(int motor)
           
 void runProgram(int programNumber)
           
 void sendBytes(byte[] data, int len)
          Send raw bytes to the RCX
 void sendPacket(byte[] data)
          Send a packet of data to the RCX
 void sendPFComboDirect(int channel, int opA, int opB)
          Send commands to both motors.
 void sendRemoteCommand(int msg)
          Send a remote control command to the RCX
 void stopAllPrograms()
           
 
Methods inherited from class lejos.hardware.sensor.I2CSensor
fetchString, getAddress, getData, getData, getPort, getProductID, getVendorID, getVersion, sendData, sendData, sendData, setAddress
 
Methods inherited from class lejos.hardware.sensor.BaseSensor
getAvailableModes, getMode, getMode, setModes
 
Methods inherited from class lejos.hardware.Device
close, releaseOnClose
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PF_MODE_COMBO_DIRECT

public static final byte PF_MODE_COMBO_DIRECT
See Also:
Constant Field Values

PF_FLOAT

public static final byte PF_FLOAT
See Also:
Constant Field Values

PF_FORWARD

public static final byte PF_FORWARD
See Also:
Constant Field Values

PF_BACKWARD

public static final byte PF_BACKWARD
See Also:
Constant Field Values

PF_BRAKE

public static final byte PF_BRAKE
See Also:
Constant Field Values

RCX_REMOTE_BEEP

public static int RCX_REMOTE_BEEP

RCX_REMOTE_STOP

public static int RCX_REMOTE_STOP

RCX_REMOTE_P5

public static int RCX_REMOTE_P5

RCX_REMOTE_P4

public static int RCX_REMOTE_P4

RCX_REMOTE_P3

public static int RCX_REMOTE_P3

RCX_REMOTE_P2

public static int RCX_REMOTE_P2

RCX_REMOTE_P1

public static int RCX_REMOTE_P1

RCX_REMOTE_C_BWD

public static int RCX_REMOTE_C_BWD

RCX_REMOTE_B_BWD

public static int RCX_REMOTE_B_BWD

RCX_REMOTE_A_BWD

public static int RCX_REMOTE_A_BWD

RCX_REMOTE_C_FWD

public static int RCX_REMOTE_C_FWD

RCX_REMOTE_B_FWD

public static int RCX_REMOTE_B_FWD

RCX_REMOTE_A_FWD

public static int RCX_REMOTE_A_FWD

RCX_REMOTE_MSG3

public static int RCX_REMOTE_MSG3

RCX_REMOTE_MSG2

public static int RCX_REMOTE_MSG2

RCX_REMOTE_MSG1

public static int RCX_REMOTE_MSG1
Constructor Detail

IRLink

public IRLink(I2CPort port)

IRLink

public IRLink(Port port)
Method Detail

sendPFComboDirect

public void sendPFComboDirect(int channel,
                              int opA,
                              int opB)
Send commands to both motors. Uses PF Combo direct mode.

Parameters:
channel - the channel number (0-3)
opA - Motor A operation
opB - Motor B operation

sendBytes

public void sendBytes(byte[] data,
                      int len)
Description copied from interface: IRTransmitter
Send raw bytes to the RCX

Specified by:
sendBytes in interface IRTransmitter
Parameters:
data - the raw data
len - the number of bytes

sendPacket

public void sendPacket(byte[] data)
Description copied from interface: IRTransmitter
Send a packet of data to the RCX

Specified by:
sendPacket in interface IRTransmitter

sendRemoteCommand

public void sendRemoteCommand(int msg)
Description copied from interface: IRTransmitter
Send a remote control command to the RCX

Specified by:
sendRemoteCommand in interface IRTransmitter
Parameters:
msg - the code for the remote command

runProgram

public void runProgram(int programNumber)
Specified by:
runProgram in interface IRTransmitter

beep

public void beep()
Specified by:
beep in interface IRTransmitter

stopAllPrograms

public void stopAllPrograms()
Specified by:
stopAllPrograms in interface IRTransmitter

forwardStep

public void forwardStep(int motor)
Specified by:
forwardStep in interface IRTransmitter

backwardStep

public void backwardStep(int motor)
Specified by:
backwardStep in interface IRTransmitter