|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lejos.nxt.remote.RemoteSensorPort
public class RemoteSensorPort
Emulates a Sensor Port using LCP
Field Summary |
---|
Fields inherited from interface lejos.nxt.I2CPort |
---|
ALWAYS_ACTIVE, LEGO_MODE, NO_RELEASE, STANDARD_MODE |
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 |
i2cBusy()
Test if I2C is busy |
int |
i2cComplete(byte[] buffer,
int numBytes)
Complete the i2c transaction, and read any returned data. |
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,
int internalAddress,
int numInternalBytes,
byte[] buffer,
int numBytes,
int transferType)
Start an I2C transaction. |
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 BasicSensorPort
public int getMode()
getMode
in interface BasicSensorPort
public void setTypeAndMode(int type, int mode)
setTypeAndMode
in interface BasicSensorPort
type
- the sensor typemode
- the sensor modepublic void setType(int type)
setType
in interface BasicSensorPort
type
- the sensor typepublic void setMode(int mode)
setMode
in interface BasicSensorPort
mode
- the sensor modepublic boolean readBooleanValue()
readBooleanValue
in interface ADSensorPort
public int readRawValue()
readRawValue
in interface ADSensorPort
public int readValue()
readValue
in interface ADSensorPort
public NXTCommand getNXTCommand()
public int i2cBusy()
i2cBusy
in interface I2CPort
public void i2cDisable()
i2cDisable
in interface I2CPort
public void i2cEnable(int mode)
i2cEnable
in interface I2CPort
mode
- One or more of the mode bits above.public int i2cStart(int address, int internalAddress, int numInternalBytes, byte[] buffer, int numBytes, int transferType)
i2cStart
in interface I2CPort
address
- the I2C address (x01 - x7F)internalAddress
- the register or internal addressnumInternalBytes
- not usedbuffer
- the buffer for reading or writing datanumBytes
- the number of bytes to read or writetransferType
- 0 for read, 1 for write
public int i2cComplete(byte[] buffer, int numBytes)
I2CPort
i2cComplete
in interface I2CPort
buffer
- The buffer for a read (null for write)numBytes
- Number of bytes to transfer
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |