Class JSSCVideoIO
java.lang.Object
org.mbari.vcr4j.jssc.JSSCVideoIO
- All Implemented Interfaces:
Closeable,AutoCloseable,VCRVideoIO,org.mbari.vcr4j.VideoIO<RS422State,RS422Error>
- Since:
- 2016-02-03T15:39:00
- Author:
- Brian Schlining
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longFor RXTX we have to put the thread to sleep VERY briefly in order for the serial io to workstatic final intMaximum receive timeout in millisecs -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()io.reactivex.rxjava3.subjects.Subject<org.mbari.vcr4j.VideoCommand<?>> io.reactivex.rxjava3.core.Observable<RS422Error> io.reactivex.rxjava3.core.Observable<org.mbari.vcr4j.VideoIndex> io.reactivex.rxjava3.core.Observable<RS422State> io.reactivex.rxjava3.core.Observable<RS422Timecode> io.reactivex.rxjava3.core.Observable<RS422Userbits> static JSSCVideoIOFactory method.protected voidreadResponse(byte[] mostRecentCommand, org.mbari.vcr4j.VideoCommand videoCommand) Reads the response to a command from the serial port connected to the VCR.<A extends org.mbari.vcr4j.VideoCommand<?>>
voidsend(A videoCommand) protected voidsendCommand(byte[] command, org.mbari.vcr4j.VideoCommand<?> videoCommand) Sends a command, in the format of a byte[], to the VCR.
-
Field Details
-
IO_DELAY
public static final long IO_DELAYFor 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_TIMEOUTMaximum 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:
sendin interfaceorg.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 VCRvideoCommand- 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 VCRvideoCommand- The command last sent to the vcr- Throws:
jssc.SerialPortException- bad exceptionRS422Exception- ugly exceptionInterruptedException- rude exceptionjssc.SerialPortTimeoutException- bored exception
-
open
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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceorg.mbari.vcr4j.VideoIO<RS422State,RS422Error>
-
getConnectionID
- Specified by:
getConnectionIDin interfaceorg.mbari.vcr4j.VideoIO<RS422State,RS422Error>
-
getCommandSubject
public io.reactivex.rxjava3.subjects.Subject<org.mbari.vcr4j.VideoCommand<?>> getCommandSubject()- Specified by:
getCommandSubjectin interfaceorg.mbari.vcr4j.VideoIO<RS422State,RS422Error>
-
getErrorObservable
- Specified by:
getErrorObservablein interfaceorg.mbari.vcr4j.VideoIO<RS422State,RS422Error>
-
getIndexObservable
public io.reactivex.rxjava3.core.Observable<org.mbari.vcr4j.VideoIndex> getIndexObservable()- Specified by:
getIndexObservablein interfaceorg.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
- Specified by:
getStateObservablein interfaceorg.mbari.vcr4j.VideoIO<RS422State,RS422Error>
-
getTimecodeObservable
- Specified by:
getTimecodeObservablein interfaceVCRVideoIO
-
getUserbitsObservable
- Specified by:
getUserbitsObservablein interfaceVCRVideoIO
-