Module vcr4j.jssc

Class JSSCVideoIO

java.lang.Object
org.mbari.vcr4j.jssc.JSSCVideoIO
All Implemented Interfaces:
Closeable, AutoCloseable, VCRVideoIO, org.mbari.vcr4j.VideoIO<RS422State,RS422Error>

public class JSSCVideoIO extends Object implements VCRVideoIO
Since:
2016-02-03T15:39:00
Author:
Brian Schlining
  • Field Details

    • IO_DELAY

      public static final long IO_DELAY
      For RXTX we have to put the thread to sleep VERY briefly in order for the serial io to work
      See Also:
    • RECEIVE_TIMEOUT

      public static final int RECEIVE_TIMEOUT
      Maximum receive timeout in millisecs
      See Also:
  • Constructor Details

    • JSSCVideoIO

      public JSSCVideoIO(jssc.SerialPort serialPort, long ioDelay)
  • Method Details

    • send

      public <A extends org.mbari.vcr4j.VideoCommand<?>> void send(A videoCommand)
      Specified by:
      send in interface org.mbari.vcr4j.VideoIO<RS422State,RS422Error>
    • sendCommand

      protected void sendCommand(byte[] command, org.mbari.vcr4j.VideoCommand<?> videoCommand)
      Sends a command, in the format of a byte[], to the VCR.
      Parameters:
      command - The command to send to the VCR
      videoCommand - The corresponding videoCommand sent to the vcr
    • readResponse

      protected void readResponse(byte[] mostRecentCommand, org.mbari.vcr4j.VideoCommand videoCommand) throws jssc.SerialPortException, RS422Exception, InterruptedException, jssc.SerialPortTimeoutException
      Reads the response to a command from the serial port connected to the VCR.
      Parameters:
      mostRecentCommand - The bytes representing the last command sent to the VCR
      videoCommand - The command last sent to the vcr
      Throws:
      jssc.SerialPortException - bad exception
      RS422Exception - ugly exception
      InterruptedException - rude exception
      jssc.SerialPortTimeoutException - bored exception
    • open

      public static JSSCVideoIO open(String portName)
      Factory method. Use this to open a connection
      Parameters:
      portName - The port name (e.g. COM1 or /dev/tty6)
      Returns:
      A VideoIO object
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface org.mbari.vcr4j.VideoIO<RS422State,RS422Error>
    • getConnectionID

      public String getConnectionID()
      Specified by:
      getConnectionID in interface org.mbari.vcr4j.VideoIO<RS422State,RS422Error>
    • getCommandSubject

      public io.reactivex.rxjava3.subjects.Subject<org.mbari.vcr4j.VideoCommand<?>> getCommandSubject()
      Specified by:
      getCommandSubject in interface org.mbari.vcr4j.VideoIO<RS422State,RS422Error>
    • getErrorObservable

      public io.reactivex.rxjava3.core.Observable<RS422Error> getErrorObservable()
      Specified by:
      getErrorObservable in interface org.mbari.vcr4j.VideoIO<RS422State,RS422Error>
    • getIndexObservable

      public io.reactivex.rxjava3.core.Observable<org.mbari.vcr4j.VideoIndex> getIndexObservable()
      Specified by:
      getIndexObservable in interface org.mbari.vcr4j.VideoIO<RS422State,RS422Error>
      Returns:
      An Observable for the VideoIndex. If the device is recording, the VideoIndex will also have a timestamp from the computers clock as well as a timecode. Otherwise, only a timecode will be included.
    • getStateObservable

      public io.reactivex.rxjava3.core.Observable<RS422State> getStateObservable()
      Specified by:
      getStateObservable in interface org.mbari.vcr4j.VideoIO<RS422State,RS422Error>
    • getTimecodeObservable

      public io.reactivex.rxjava3.core.Observable<RS422Timecode> getTimecodeObservable()
      Specified by:
      getTimecodeObservable in interface VCRVideoIO
    • getUserbitsObservable

      public io.reactivex.rxjava3.core.Observable<RS422Userbits> getUserbitsObservable()
      Specified by:
      getUserbitsObservable in interface VCRVideoIO