public class RemoteUARTPort extends RemoteIOPort implements UARTPort
| Modifier and Type | Field and Description |
|---|---|
protected RMIUARTPort |
rmi |
protected RMIEV3 |
rmiEV3 |
currentMode, openPorts, port, ref, typUART_RAW_MODEBLACK, 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, YELLOWADC_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 |
|---|
RemoteUARTPort(RMIEV3 rmiEV3) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the port, the port can not be used after this call.
|
byte |
getByte()
read a single byte from the device
|
void |
getBytes(byte[] vals,
int offset,
int len)
read a number of bytes from the device
|
java.lang.String |
getModeName(int mode)
Get the string name of the specified mode.
|
int |
getShort()
read a single short from the device.
|
void |
getShorts(short[] vals,
int offset,
int len)
read a number of shorts from the device
|
boolean |
initialiseSensor(int mode)
Initialise the attached sensor and set it to the required operating mode.
Note: This method is not normally needed as the sensor will be initialised when it is opened. |
boolean |
open(int typ,
int portNum,
RemotePort remotePort) |
int |
rawRead(byte[] buffer,
int offset,
int len)
Read bytes from the uart port.
|
int |
rawWrite(byte[] buffer,
int offset,
int len)
Attempt to write a series of bytes to the uart port.
|
void |
resetSensor()
Reset the attached sensor.
|
void |
setBitRate(int bitRate)
Set the bit rate of the port when operating in RAW mode.
|
boolean |
setMode(int mode)
Set the current operating mode for the sensor attached to the port.
|
java.lang.String |
toString()
Return the current sensor reading to a string.
|
int |
write(byte[] buffer,
int offset,
int len)
Write bytes to the sensor
|
getMode, getName, getType, setPinMode, setType, setTypeAndModeclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetName, setPinModegetMode, getType, setType, setTypeAndModeprotected RMIUARTPort rmi
protected RMIEV3 rmiEV3
public RemoteUARTPort(RMIEV3 rmiEV3)
public boolean open(int typ,
int portNum,
RemotePort remotePort)
open in class RemoteIOPortpublic void close()
IOPortclose in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface IOPortclose in class RemoteIOPortpublic byte getByte()
UARTPortpublic void getBytes(byte[] vals,
int offset,
int len)
UARTPortpublic int getShort()
UARTPortpublic void getShorts(short[] vals,
int offset,
int len)
UARTPortpublic java.lang.String getModeName(int mode)
UARTPortTODO: Make other mode data available.
getModeName in interface UARTPortmode - mode to lookuppublic boolean initialiseSensor(int mode)
UARTPortinitialiseSensor in interface UARTPortmode - target modepublic void resetSensor()
UARTPortresetSensor in interface UARTPortpublic java.lang.String toString()
UARTPortpublic boolean setMode(int mode)
BasicSensorPortsetMode in interface BasicSensorPortsetMode in class RemoteIOPortmode - the new modepublic int rawRead(byte[] buffer,
int offset,
int len)
UARTPortNote: The port must have been set into RAW mode to use this method.
public int rawWrite(byte[] buffer,
int offset,
int len)
UARTPortNote: The port must have been set into RAW mode before attempting to use the method.
public void setBitRate(int bitRate)
UARTPortsetBitRate in interface UARTPortbitRate - The new bit ratepublic int write(byte[] buffer,
int offset,
int len)
UARTPort