|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectlejos.nxt.remote.RemoteSensorPort
public class RemoteSensorPort
Emulates a Sensor Port using LCP
| Field Summary |
|---|
| Fields inherited from interface lejos.nxt.SensorConstants |
|---|
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, GREEN, GREEN_INDEX, MAX_AD_RAW, MAX_TYPE, MIN_TYPE, MODE_ANGLESTEP, MODE_BOOLEAN, MODE_CELSIUS, MODE_FARENHEIT, MODE_PCTFULLSCALE, MODE_PERIODCOUNTER, MODE_RAW, MODE_TRANSITIONCNT, 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 |
| Fields inherited from interface lejos.nxt.I2CPort |
|---|
ALWAYS_ACTIVE, ERR_ABORT, ERR_BUS_BUSY, ERR_BUSY, ERR_FAULT, ERR_INVALID_LENGTH, ERR_INVALID_PORT, HIGH_SPEED, LEGO_MODE, MAX_IO, NO_RELEASE, STANDARD_MODE |
| Fields inherited from interface lejos.nxt.SensorConstants |
|---|
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, GREEN, GREEN_INDEX, MAX_AD_RAW, MAX_TYPE, MIN_TYPE, MODE_ANGLESTEP, MODE_BOOLEAN, MODE_CELSIUS, MODE_FARENHEIT, MODE_PCTFULLSCALE, MODE_PERIODCOUNTER, MODE_RAW, MODE_TRANSITIONCNT, 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 | |
|---|---|
RemoteSensorPort(NXTCommand nxtCommand,
int id)
|
|
| Method Summary | |
|---|---|
int |
getId()
Get the port number |
int |
getMode()
Get the sensor mode |
NXTCommand |
getNXTCommand()
Get the NXTCommand object used for remote access |
int |
getType()
Get the sensor type |
int |
i2cComplete(byte[] buffer,
int offset,
int numBytes)
|
void |
i2cDisable()
Disable I2C on the port - null for remote ports |
void |
i2cEnable(int mode)
Enable I2C on the port - null for remote ports |
int |
i2cStart(int address,
byte[] writeBuffer,
int writeOffset,
int writeLength,
int readLength)
Start an I2C transaction. |
int |
i2cStatus()
Test if I2C is busy |
int |
i2cTransaction(int deviceAddress,
byte[] writeBuf,
int writeOffset,
int writeLen,
byte[] readBuf,
int readOffset,
int readLen)
High level i2c interface. |
void |
i2cWaitIOComplete()
Wait for the current IO operation on the i2c port to complete. |
boolean |
readBooleanValue()
Reads the boolean value of the sensor. |
int |
readRawValue()
Reads the raw value of the sensor. |
int |
readValue()
Returns value compatible with Lego firmware. |
void |
setMode(int mode)
Set the sensor mode |
void |
setType(int type)
Set the sensor type |
void |
setTypeAndMode(int type,
int mode)
Set the sensor type and mode |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RemoteSensorPort(NXTCommand nxtCommand,
int id)
| Method Detail |
|---|
public int getId()
public int getType()
getType in interface BasicSensorPortpublic int getMode()
getMode in interface BasicSensorPort
public void setTypeAndMode(int type,
int mode)
setTypeAndMode in interface BasicSensorPorttype - the sensor typemode - the sensor modepublic void setType(int type)
setType in interface BasicSensorPorttype - the sensor typepublic void setMode(int mode)
setMode in interface BasicSensorPortmode - the sensor modepublic boolean readBooleanValue()
readBooleanValue in interface ADSensorPortpublic int readRawValue()
readRawValue in interface ADSensorPortpublic int readValue()
readValue in interface ADSensorPortpublic NXTCommand getNXTCommand()
public int i2cStatus()
i2cStatus in interface I2CPortpublic void i2cDisable()
i2cDisable in interface I2CPortpublic void i2cEnable(int mode)
i2cEnable in interface I2CPortmode - One or more of the mode bits above.
public int i2cStart(int address,
byte[] writeBuffer,
int writeOffset,
int writeLength,
int readLength)
address - the I2C address (x01 - x7F)writeBuffer - data to writewriteOffset - offset of the data in the write bufferwriteLength - length of the data to writereadLength - Number of bytes to read
public int i2cComplete(byte[] buffer,
int offset,
int numBytes)
public void i2cWaitIOComplete()
public int i2cTransaction(int deviceAddress,
byte[] writeBuf,
int writeOffset,
int writeLen,
byte[] readBuf,
int readOffset,
int readLen)
i2cTransaction in interface I2CPortdeviceAddress - 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 read
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||