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, unexportObject
protected RMIRemoteUARTPort(java.lang.String portName) throws java.rmi.RemoteException
java.rmi.RemoteException
public byte getByte() throws java.rmi.RemoteException
RMIUARTPort
getByte
in interface RMIUARTPort
java.rmi.RemoteException
public void getBytes(byte[] vals, int offset, int len) throws java.rmi.RemoteException
RMIUARTPort
getBytes
in interface RMIUARTPort
vals
- byte array to accept the dataoffset
- offset at which to store the datalen
- number of bytes to readjava.rmi.RemoteException
public int getShort() throws java.rmi.RemoteException
RMIUARTPort
getShort
in interface RMIUARTPort
java.rmi.RemoteException
public void getShorts(short[] vals, int offset, int len) throws java.rmi.RemoteException
RMIUARTPort
getShorts
in interface RMIUARTPort
vals
- short array to accept the dataoffset
- offset at which to store the datalen
- number of shorts to readjava.rmi.RemoteException
public java.lang.String getModeName(int mode) throws java.rmi.RemoteException
RMIUARTPort
TODO: Make other mode data available.
getModeName
in interface RMIUARTPort
mode
- mode to lookupjava.rmi.RemoteException
public java.lang.String toStringValue() throws java.rmi.RemoteException
RMIUARTPort
toStringValue
in interface RMIUARTPort
java.rmi.RemoteException
public boolean initialiseSensor(int mode) throws java.rmi.RemoteException
RMIUARTPort
initialiseSensor
in interface RMIUARTPort
mode
- target modejava.rmi.RemoteException
public void resetSensor() throws java.rmi.RemoteException
RMIUARTPort
resetSensor
in interface RMIUARTPort
java.rmi.RemoteException
public void close() throws java.rmi.RemoteException
close
in interface RMIUARTPort
java.rmi.RemoteException
public boolean setMode(int mode) throws java.rmi.RemoteException
setMode
in interface RMIUARTPort
java.rmi.RemoteException
public int rawRead(byte[] buffer, int offset, int len) throws java.rmi.RemoteException
RMIUARTPort
Note: The port must have been set into RAW mode to use this method.
rawRead
in interface RMIUARTPort
buffer
- The buffer to store the read bytesoffset
- The offset at which to start storing the byteslen
- The maximum number of bytes to readjava.rmi.RemoteException
public int rawWrite(byte[] buffer, int offset, int len) throws java.rmi.RemoteException
RMIUARTPort
Note: The port must have been set into RAW mode before attempting to use the method.
rawWrite
in interface RMIUARTPort
buffer
- The buffer containing the bytes to writeoffset
- The offset of the first bytelen
- The number of bytes to attempt to writejava.rmi.RemoteException
public void setBitRate(int bitRate) throws java.rmi.RemoteException
RMIUARTPort
setBitRate
in interface RMIUARTPort
bitRate
- The new bit ratejava.rmi.RemoteException
public int write(byte[] buffer, int offset, int len)
RMIUARTPort
write
in interface RMIUARTPort
buffer
- bytes to be writtenoffset
- offset to the start of the writelen
- length of the write