UniPRT SDK  v1.0.0.0
com.UniPRT.Sdk.Comm.AComm Class Referenceabstract

Abstract class that implements default functionality for IComm interface class. More...

Inheritance diagram for com.UniPRT.Sdk.Comm.AComm:
com.UniPRT.Sdk.Comm.IComm com.UniPRT.Sdk.Comm.TcpConnection

Public Member Functions

void Read (OutputStream binDataIn) throws IOException
 
void WaitForData (int msTimeOut)
 Waits until data available BytesAvailable in current thread. Current thread sleeps until data received or timeout reached. Blocking call. More...
 
void Write (InputStream binReader) throws IOException
 Write from input stream to output stream. More...
 
void WriteAndWaitForResponse (OutputStream binDataIn, InputStream binDataOut, int responseStartTimeOut, int responseEndTimeOut, String completetionToken) throws IOException
 Write binDataOut stream data to output stream and return data received in binDataIn stream. Data returned is any data received or up to completion token if received. Wait for response timeout before returning. More...
 
byte[] WriteAndWaitForResponse (byte[] dataOut, int responseStartTimeOut, int responseEndTimeOut, String completetionToken) throws IOException
 Write byte data to output stream and return data received. Data returned is any data received or up to completion token if received. Wait for response timeout before returning. More...
 
- Public Member Functions inherited from com.UniPRT.Sdk.Comm.IComm
String Descriptor ()
 
int BytesAvailable ()
 
boolean Connected ()
 
void Close ()
 
void Open ()
 
byte[] Read ()
 
void Write (byte[] dataOut)
 

Private Attributes

final int MAX_PACKET_SIZE = 1024 * 4
 

Detailed Description

Abstract class that implements default functionality for IComm interface class.

Member Function Documentation

◆ Read()

void com.UniPRT.Sdk.Comm.AComm.Read ( OutputStream  binDataIn) throws IOException

Read all available bytes into the stream passed in.

Parameters
binDataInData input stream.
Exceptions
IOException

Implements com.UniPRT.Sdk.Comm.IComm.

References com.UniPRT.Sdk.Comm.IComm.Read().

◆ WaitForData()

void com.UniPRT.Sdk.Comm.AComm.WaitForData ( int  msTimeOut)

Waits until data available BytesAvailable in current thread. Current thread sleeps until data received or timeout reached. Blocking call.

Parameters
[in]msTimeOutMillisecond timeout before return if no data received.

Implements com.UniPRT.Sdk.Comm.IComm.

References com.UniPRT.Sdk.Comm.IComm.BytesAvailable().

Referenced by com.UniPRT.Sdk.Comm.AComm.WriteAndWaitForResponse().

◆ Write()

void com.UniPRT.Sdk.Comm.AComm.Write ( InputStream  binReader) throws IOException

Write from input stream to output stream.

Parameters
[in]binReaderSource data to send

Implements com.UniPRT.Sdk.Comm.IComm.

References com.UniPRT.Sdk.Comm.AComm.MAX_PACKET_SIZE.

Referenced by com.UniPRT.Sdk.Comm.AComm.WriteAndWaitForResponse().

◆ WriteAndWaitForResponse() [1/2]

byte [] com.UniPRT.Sdk.Comm.AComm.WriteAndWaitForResponse ( byte[]  dataOut,
int  responseStartTimeOut,
int  responseEndTimeOut,
String  completionToken 
) throws IOException

Write byte data to output stream and return data received. Data returned is any data received or up to completion token if received. Wait for response timeout before returning.

Return values
byte[]Array of bytes received from connection. Data returned is any data received or up to completetionToken if token received
Parameters
[in]dataOutSource byte array to write to connection.
[in]responseStartTimeOutTimeout to wait for first data to be received. Time to first byte.
[in]responseEndTimeOutTimeout of no new data received. Time after last byte.
[in]completetionTokenString token denoting the end of the response expected. This can be empty string if simply want to wait for response after writing data to connection.

Implements com.UniPRT.Sdk.Comm.IComm.

References com.UniPRT.Sdk.Comm.IComm.BytesAvailable(), com.UniPRT.Sdk.Comm.IComm.Read(), com.UniPRT.Sdk.Comm.AComm.WaitForData(), and com.UniPRT.Sdk.Comm.AComm.Write().

◆ WriteAndWaitForResponse() [2/2]

void com.UniPRT.Sdk.Comm.AComm.WriteAndWaitForResponse ( OutputStream  binDataIn,
InputStream  binDataOut,
int  responseStartTimeOut,
int  responseEndTimeOut,
String  completionToken 
) throws IOException

Write binDataOut stream data to output stream and return data received in binDataIn stream. Data returned is any data received or up to completion token if received. Wait for response timeout before returning.

Parameters
[out]binDataInDestination stream to store response received from connection.
[in]binDataOutSource stream data to write to connection.
[in]responseStartTimeOutTimeout to wait for first data to be received. Time to first byte.
[in]responseEndTimeOutTimeout of no new data received. Time after last byte.
[in]completetionTokenString token denoting the end of the response expected. This can be empty string if simply want to wait for response after writing data to connection.

Implements com.UniPRT.Sdk.Comm.IComm.

References com.UniPRT.Sdk.Comm.IComm.BytesAvailable(), com.UniPRT.Sdk.Comm.IComm.Read(), com.UniPRT.Sdk.Comm.AComm.WaitForData(), and com.UniPRT.Sdk.Comm.AComm.Write().

Member Data Documentation

◆ MAX_PACKET_SIZE

final int com.UniPRT.Sdk.Comm.AComm.MAX_PACKET_SIZE = 1024 * 4
private

The documentation for this class was generated from the following file: