Package lejos.remote.ev3
Interface RMIUARTPort
-
- All Superinterfaces:
java.rmi.Remote
- All Known Implementing Classes:
RMIRemoteUARTPort
public interface RMIUARTPort extends java.rmi.Remote
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()bytegetByte()read a single byte from the devicevoidgetBytes(byte[] vals, int offset, int len)read a number of bytes from the devicejava.lang.StringgetModeName(int mode)Get the string name of the specified mode.intgetShort()read a single short from the device.voidgetShorts(short[] vals, int offset, int len)read a number of shorts from the devicebooleaninitialiseSensor(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.intrawRead(byte[] buffer, int offset, int len)Read bytes from the uart port.intrawWrite(byte[] buffer, int offset, int len)Attempt to write a series of bytes to the uart port.voidresetSensor()Reset the attached sensor.voidsetBitRate(int bitRate)Set the bit rate of the port when operating in RAW mode.booleansetMode(int mode)java.lang.StringtoStringValue()Return the current sensor reading to a string.intwrite(byte[] buffer, int offset, int len)Write bytes to the sensor
-
-
-
Method Detail
-
getByte
byte getByte() throws java.rmi.RemoteExceptionread a single byte from the device- Returns:
- the byte value
- Throws:
java.rmi.RemoteException
-
getBytes
void getBytes(byte[] vals, int offset, int len) throws java.rmi.RemoteExceptionread a number of bytes from the device- Parameters:
vals- byte array to accept the dataoffset- offset at which to store the datalen- number of bytes to read- Throws:
java.rmi.RemoteException
-
getShort
int getShort() throws java.rmi.RemoteExceptionread a single short from the device.- Returns:
- the short value
- Throws:
java.rmi.RemoteException
-
getShorts
void getShorts(short[] vals, int offset, int len) throws java.rmi.RemoteExceptionread a number of shorts from the device- Parameters:
vals- short array to accept the dataoffset- offset at which to store the datalen- number of shorts to read- Throws:
java.rmi.RemoteException
-
getModeName
java.lang.String getModeName(int mode) throws java.rmi.RemoteExceptionGet the string name of the specified mode.TODO: Make other mode data available.
- Parameters:
mode- mode to lookup- Returns:
- String version of the mode name
- Throws:
java.rmi.RemoteException
-
toStringValue
java.lang.String toStringValue() throws java.rmi.RemoteExceptionReturn the current sensor reading to a string.- Throws:
java.rmi.RemoteException
-
initialiseSensor
boolean initialiseSensor(int mode) throws java.rmi.RemoteExceptionInitialise 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. However it may be of use if the sensor needs to be reset or in other cases.- Parameters:
mode- target mode- Returns:
- true if ok false if error
- Throws:
java.rmi.RemoteException
-
resetSensor
void resetSensor() throws java.rmi.RemoteExceptionReset the attached sensor. Following this the sensor must be initialised before it can be used.- Throws:
java.rmi.RemoteException
-
write
int write(byte[] buffer, int offset, int len) throws java.rmi.RemoteExceptionWrite bytes to the sensor- Parameters:
buffer- bytes to be writtenoffset- offset to the start of the writelen- length of the write- Returns:
- number of bytes written
- Throws:
java.rmi.RemoteException
-
rawRead
int rawRead(byte[] buffer, int offset, int len) throws java.rmi.RemoteExceptionRead bytes from the uart port. If no bytes are available return 0.Note: The port must have been set into RAW mode to use this method.
- Parameters:
buffer- The buffer to store the read bytesoffset- The offset at which to start storing the byteslen- The maximum number of bytes to read- Returns:
- The actual number of bytes read
- Throws:
java.rmi.RemoteException
-
rawWrite
int rawWrite(byte[] buffer, int offset, int len) throws java.rmi.RemoteExceptionAttempt to write a series of bytes to the uart port. This call is non-blocking if there is no space in the write buffer a count of 0 is returned.Note: The port must have been set into RAW mode before attempting to use the method.
- Parameters:
buffer- The buffer containing the bytes to writeoffset- The offset of the first bytelen- The number of bytes to attempt to write- Returns:
- The actual number of bytes written
- Throws:
java.rmi.RemoteException
-
setBitRate
void setBitRate(int bitRate) throws java.rmi.RemoteExceptionSet the bit rate of the port when operating in RAW mode.- Parameters:
bitRate- The new bit rate- Throws:
java.rmi.RemoteException
-
close
void close() throws java.rmi.RemoteException- Throws:
java.rmi.RemoteException
-
setMode
boolean setMode(int mode) throws java.rmi.RemoteException- Throws:
java.rmi.RemoteException
-
-