Class RemoteRequestUARTPort

    • Constructor Detail

      • RemoteRequestUARTPort

        public RemoteRequestUARTPort​(java.io.ObjectInputStream is,
                                     java.io.ObjectOutputStream os)
    • Method Detail

      • close

        public void close()
        Description copied from interface: IOPort
        Close the port, the port can not be used after this call.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface IOPort
        Overrides:
        close in class RemoteRequestIOPort
      • getByte

        public byte getByte()
        Description copied from interface: UARTPort
        read a single byte from the device
        Specified by:
        getByte in interface UARTPort
        Returns:
        the byte value
      • getBytes

        public void getBytes​(byte[] vals,
                             int offset,
                             int len)
        Description copied from interface: UARTPort
        read a number of bytes from the device
        Specified by:
        getBytes in interface UARTPort
        Parameters:
        vals - byte array to accept the data
        offset - offset at which to store the data
        len - number of bytes to read
      • getShort

        public int getShort()
        Description copied from interface: UARTPort
        read a single short from the device.
        Specified by:
        getShort in interface UARTPort
        Returns:
        the short value
      • getShorts

        public void getShorts​(short[] vals,
                              int offset,
                              int len)
        Description copied from interface: UARTPort
        read a number of shorts from the device
        Specified by:
        getShorts in interface UARTPort
        Parameters:
        vals - short array to accept the data
        offset - offset at which to store the data
        len - number of shorts to read
      • getModeName

        public java.lang.String getModeName​(int mode)
        Description copied from interface: UARTPort
        Get the string name of the specified mode.

        TODO: Make other mode data available.

        Specified by:
        getModeName in interface UARTPort
        Parameters:
        mode - mode to lookup
        Returns:
        String version of the mode name
      • initialiseSensor

        public boolean initialiseSensor​(int mode)
        Description copied from interface: UARTPort
        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. However it may be of use if the sensor needs to be reset or in other cases.
        Specified by:
        initialiseSensor in interface UARTPort
        Parameters:
        mode - target mode
        Returns:
        true if ok false if error
      • resetSensor

        public void resetSensor()
        Description copied from interface: UARTPort
        Reset the attached sensor. Following this the sensor must be initialised before it can be used.
        Specified by:
        resetSensor in interface UARTPort
      • setMode

        public boolean setMode​(int mode)
        Description copied from interface: BasicSensorPort
        Set the current operating mode for the sensor attached to the port.
        Specified by:
        setMode in interface BasicSensorPort
        Overrides:
        setMode in class RemoteRequestIOPort
        Parameters:
        mode - the new mode
        Returns:
        true if the mode has been accepted
      • write

        public int write​(byte[] buffer,
                         int offset,
                         int len)
        Description copied from interface: UARTPort
        Write bytes to the sensor
        Specified by:
        write in interface UARTPort
        Parameters:
        buffer - bytes to be written
        offset - offset to the start of the write
        len - length of the write
        Returns:
        number of bytes written
      • rawRead

        public int rawRead​(byte[] buffer,
                           int offset,
                           int len)
        Description copied from interface: UARTPort
        Read 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.

        Specified by:
        rawRead in interface UARTPort
        Parameters:
        buffer - The buffer to store the read bytes
        offset - The offset at which to start storing the bytes
        len - The maximum number of bytes to read
        Returns:
        The actual number of bytes read
      • rawWrite

        public int rawWrite​(byte[] buffer,
                            int offset,
                            int len)
        Description copied from interface: UARTPort
        Attempt 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.

        Specified by:
        rawWrite in interface UARTPort
        Parameters:
        buffer - The buffer containing the bytes to write
        offset - The offset of the first byte
        len - The number of bytes to attempt to write
        Returns:
        The actual number of bytes written
      • setBitRate

        public void setBitRate​(int bitRate)
        Description copied from interface: UARTPort
        Set the bit rate of the port when operating in RAW mode.
        Specified by:
        setBitRate in interface UARTPort
        Parameters:
        bitRate - The new bit rate