UniPRT SDK  v1.0.0.0
IComm Interface Reference

Interface to a communication connection. More...

Inheritance diagram for IComm:
AComm TcpConnection

Public Member Functions

int BytesAvailable ()
 Number of bytes available to read. This is estimate and number can change as data is received.
 
void Close ()
 Closes a connection.
 
boolean Connected ()
 true if connection is established
 
String Descriptor ()
 string descriptor of the connection.
 
void Open ()
 Opens a connection.
 
byte[] Read ()
 Read all bytes available.
 
void Read (OutputStream binDataIn) throws IOException
 Reads all bytes available into the stream passed in.
 
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 (byte[] dataOut)
 Writes all bytes from the array passed in.
 
void Write (InputStream binReader) throws IOException
 Write from input stream to output stream
More...
 
byte[] 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. More...
 
void 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. More...
 

Detailed Description

Interface to a communication connection.

Member Function Documentation

◆ WaitForData()

void 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.

Implemented in AComm.

◆ Write()

void Write ( InputStream  binReader) throws IOException

Write from input stream to output stream

Parameters
[in]binReaderSource data to send

Implemented in AComm.

◆ WriteAndWaitForResponse() [1/2]

byte [] 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.

Implemented in AComm.

◆ WriteAndWaitForResponse() [2/2]

void 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.

Implemented in AComm.