public class RMIRemoteUARTPort extends java.rmi.server.UnicastRemoteObject implements RMIUARTPort
| Modifier | Constructor and Description |
|---|---|
protected |
RMIRemoteUARTPort(java.lang.String portName) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
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. |
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) |
java.lang.String |
toStringValue()
Return the current sensor reading to a string.
|
int |
write(byte[] buffer,
int offset,
int len)
Write bytes to the sensor
|
clone, exportObject, exportObject, exportObject, unexportObjectprotected RMIRemoteUARTPort(java.lang.String portName)
throws java.rmi.RemoteException
java.rmi.RemoteExceptionpublic byte getByte()
throws java.rmi.RemoteException
RMIUARTPortgetByte in interface RMIUARTPortjava.rmi.RemoteExceptionpublic void getBytes(byte[] vals,
int offset,
int len)
throws java.rmi.RemoteException
RMIUARTPortgetBytes in interface RMIUARTPortvals - byte array to accept the dataoffset - offset at which to store the datalen - number of bytes to readjava.rmi.RemoteExceptionpublic int getShort()
throws java.rmi.RemoteException
RMIUARTPortgetShort in interface RMIUARTPortjava.rmi.RemoteExceptionpublic void getShorts(short[] vals,
int offset,
int len)
throws java.rmi.RemoteException
RMIUARTPortgetShorts in interface RMIUARTPortvals - short array to accept the dataoffset - offset at which to store the datalen - number of shorts to readjava.rmi.RemoteExceptionpublic java.lang.String getModeName(int mode)
throws java.rmi.RemoteException
RMIUARTPortTODO: Make other mode data available.
getModeName in interface RMIUARTPortmode - mode to lookupjava.rmi.RemoteExceptionpublic java.lang.String toStringValue()
throws java.rmi.RemoteException
RMIUARTPorttoStringValue in interface RMIUARTPortjava.rmi.RemoteExceptionpublic boolean initialiseSensor(int mode)
throws java.rmi.RemoteException
RMIUARTPortinitialiseSensor in interface RMIUARTPortmode - target modejava.rmi.RemoteExceptionpublic void resetSensor()
throws java.rmi.RemoteException
RMIUARTPortresetSensor in interface RMIUARTPortjava.rmi.RemoteExceptionpublic void close()
throws java.rmi.RemoteException
close in interface RMIUARTPortjava.rmi.RemoteExceptionpublic boolean setMode(int mode)
throws java.rmi.RemoteException
setMode in interface RMIUARTPortjava.rmi.RemoteExceptionpublic int rawRead(byte[] buffer,
int offset,
int len)
throws java.rmi.RemoteException
RMIUARTPortNote: The port must have been set into RAW mode to use this method.
rawRead in interface RMIUARTPortbuffer - The buffer to store the read bytesoffset - The offset at which to start storing the byteslen - The maximum number of bytes to readjava.rmi.RemoteExceptionpublic int rawWrite(byte[] buffer,
int offset,
int len)
throws java.rmi.RemoteException
RMIUARTPortNote: The port must have been set into RAW mode before attempting to use the method.
rawWrite in interface RMIUARTPortbuffer - The buffer containing the bytes to writeoffset - The offset of the first bytelen - The number of bytes to attempt to writejava.rmi.RemoteExceptionpublic void setBitRate(int bitRate)
throws java.rmi.RemoteException
RMIUARTPortsetBitRate in interface RMIUARTPortbitRate - The new bit ratejava.rmi.RemoteExceptionpublic int write(byte[] buffer,
int offset,
int len)
RMIUARTPortwrite in interface RMIUARTPortbuffer - bytes to be writtenoffset - offset to the start of the writelen - length of the write