public class RemoteNXTI2CPort extends RemoteNXTIOPort implements I2CPort
currentMode, dc, nxtCommand, openPorts, port, ref, typ
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, BROWN, GREEN, GREEN_INDEX, MAX_TYPE, MIN_TYPE, MODE_RAW, NXT_ADC_RES, RED, RED_INDEX, TYPE_ANGLE, TYPE_COLORBLUE, TYPE_COLORFULL, TYPE_COLORGREEN, TYPE_COLORNONE, TYPE_COLORRED, TYPE_CUSTOM, TYPE_HIGHSPEED, TYPE_HIGHSPEED_9V, 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
ADC_REF, ADC_RES, CMD_AUTOMATIC, CMD_COL_AMB, CMD_COL_BLU, CMD_COL_COL, CMD_COL_GRN, CMD_COL_RED, CMD_CONNECTED, CMD_DISCONNECTED, CMD_FLOAT, CMD_NONE, CMD_PIN1, CMD_PIN5, CMD_SET, CONN_DAISYCHAIN, CONN_ERROR, CONN_INPUT_DUMB, CONN_INPUT_UART, CONN_NONE, CONN_NXT_COLOR, CONN_NXT_DUMB, CONN_NXT_IIC, CONN_OUTPUT_DUMB, CONN_OUTPUT_INTELLIGENT, CONN_OUTPUT_TACHO, CONN_UNKNOWN, IIC_DATA_LENGTH, MAX_DEVICE_DATALENGTH, MOTORS, PORTS, STATUS_BUSY, STATUS_FAIL, STATUS_OK, STATUS_STOP, TYPE_ERROR, TYPE_IIC_UNKNOWN, TYPE_MINITACHO, TYPE_NEWTACHO, TYPE_NONE, TYPE_NXT_COLOR, TYPE_NXT_IIC, TYPE_NXT_LIGHT, TYPE_NXT_SOUND, TYPE_NXT_TEST, TYPE_NXT_TOUCH, TYPE_TACHO, TYPE_TERMINAL, TYPE_THIRD_PARTY_END, TYPE_THIRD_PARTY_START, TYPE_UNKNOWN, UART_MAX_MODES
Constructor and Description |
---|
RemoteNXTI2CPort(NXTCommand nxtCommand) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
getChanged() |
protected byte |
getStatus() |
void |
i2cTransaction(int deviceAddress,
byte[] writeBuf,
int writeOffset,
int writeLen,
byte[] readBuf,
int readOffset,
int readLen)
High level i2c interface.
|
protected boolean |
initSensor() |
boolean |
open(int t,
int p,
RemoteNXTPort r)
allow access to the specified port
|
protected void |
reset() |
boolean |
setMode(int mode)
Set the sensor mode
|
protected void |
setOperatingMode(int typ,
int mode) |
boolean |
setType(int type)
Set the sensor type
|
boolean |
setTypeAndMode(int type,
int mode)
Set the sensor type and mode
|
close, getMode, getName, getType, setPinMode
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, getName, setPinMode
getMode, getType
public RemoteNXTI2CPort(NXTCommand nxtCommand)
protected boolean getChanged()
protected byte getStatus()
protected void reset()
protected void setOperatingMode(int typ, int mode)
protected boolean initSensor()
public boolean open(int t, int p, RemoteNXTPort r)
open
in class RemoteNXTIOPort
p
- port number to opent
- The type of port motor/sensorr
- the Port ref for this portpublic void i2cTransaction(int deviceAddress, byte[] writeBuf, int writeOffset, int writeLen, byte[] readBuf, int readOffset, int readLen)
i2cTransaction
in interface I2CPort
deviceAddress
- The I2C device address.writeBuf
- The buffer containing data to be written to the device.writeOffset
- The offset of the data within the write bufferwriteLen
- The number of bytes to write.readBuf
- The buffer to use for the transaction resultsreadOffset
- Location to write the results toreadLen
- The length of the readpublic boolean setTypeAndMode(int type, int mode)
setTypeAndMode
in interface BasicSensorPort
setTypeAndMode
in class RemoteNXTIOPort
type
- the sensor typemode
- the sensor modepublic boolean setType(int type)
setType
in interface BasicSensorPort
setType
in class RemoteNXTIOPort
type
- the sensor typepublic boolean setMode(int mode)
setMode
in interface BasicSensorPort
setMode
in class RemoteNXTIOPort
mode
- the sensor mode