UniPRT SDK v1.0.0.0
 
Loading...
Searching...
No Matches
<IComm> Protocol Reference

A protocol defining the interface for communication classes. More...

#include <IComm.h>

Inheritance diagram for <IComm>:
AComm TcpComm

Instance Methods

(void) - close
 Closes the communication interface.
 
(void) - open
 Opens the communication interface.
 
(NSData *) - read
 Reads data from the communication interface.
 
(void) - readToBinaryWriter:
 Writes data from a binary reader (input stream) to the output stream.
 
(void) - waitForDataWithTimeout:
 Waits until data is available in the current thread. The current thread sleeps until data is received or the timeout is reached. This is a blocking call.
 
(void) - writeFromBinaryReader:
 Writes all bytes from the array passed in.
 
(void) - write:
 Writes data to the communication interface.
 
(NSData *) - writeAndWaitForResponseToBinaryWriter:fromBinaryReader:responseStartTimeout:responseEndTimeout:completionToken:
 Writes data from the input stream to the output stream and returns the data received in the output stream. The data returned is any data received or up to the completion token if received. Waits for a response timeout before returning.
 
(NSData *) - writeAndWaitForResponse:responseStartTimeOut:responseEndTimeOut:completionToken:
 Writes byte data to the output stream and returns the data received. The data returned is any data received or up to the completion token if received. Waits for a response timeout before returning.
 

Properties

NSString * descriptor
 The descriptor for the communication interface.
 
int bytesAvailable
 The number of bytes available to read.
 
BOOL isConnected
 A flag indicating whether the connection is established.
 

Detailed Description

A protocol defining the interface for communication classes.

Method Documentation

◆ close

- (void) close

Closes the communication interface.

Reimplemented in AComm, and TcpComm.

◆ open

- (void) open

Opens the communication interface.

Reimplemented in AComm, and TcpComm.

◆ read

- (NSData *) read

Reads data from the communication interface.

Returns
The data read from the interface.

Reimplemented in AComm, and TcpComm.

◆ readToBinaryWriter:

- (void) readToBinaryWriter: (NSOutputStream *) binDataIn

Writes data from a binary reader (input stream) to the output stream.

Parameters
binDataInThe output stream to write the data into.

Reimplemented in AComm.

◆ waitForDataWithTimeout:

- (void) waitForDataWithTimeout: (NSTimeInterval) msTimeOut

Waits until data is available in the current thread. The current thread sleeps until data is received or the timeout is reached. This is a blocking call.

Parameters
msTimeOutThe timeout interval in milliseconds before returning if no data is received.

Reimplemented in AComm.

◆ write:

- (void) write: (NSData *) dataOut

Writes data to the communication interface.

Parameters
dataOutThe data to write to the interface.

Reimplemented in AComm, and TcpComm.

◆ writeAndWaitForResponse:responseStartTimeOut:responseEndTimeOut:completionToken:

- (NSData *) writeAndWaitForResponse: (NSData *) text
responseStartTimeOut: (NSTimeInterval) responseStartTimeOut
responseEndTimeOut: (NSTimeInterval) responseEndTimeOut
completionToken: (NSString *) completionToken 

Writes byte data to the output stream and returns the data received. The data returned is any data received or up to the completion token if received. Waits for a response timeout before returning.

Parameters
textThe source byte array to write to the connection.
responseStartTimeOutThe timeout interval to wait for the first data to be received (time to first byte).
responseEndTimeOutThe timeout interval after the last byte if no new data is received (time after last byte).
completionTokenThe string token denoting the end of the expected response. This can be an empty string if simply waiting for a response after writing data to the connection.
Returns
The array of bytes received from the connection.

Reimplemented in AComm, and TcpComm.

◆ writeAndWaitForResponseToBinaryWriter:fromBinaryReader:responseStartTimeout:responseEndTimeout:completionToken:

- (NSData *) writeAndWaitForResponseToBinaryWriter: (NSOutputStream *) binDataIn
fromBinaryReader: (NSInputStream *) binDataOut
responseStartTimeout: (int) responseStartTimeOut
responseEndTimeout: (int) responseEndTimeOut
completionToken: (NSString *) completionToken 

Writes data from the input stream to the output stream and returns the data received in the output stream. The data returned is any data received or up to the completion token if received. Waits for a response timeout before returning.

Parameters
binDataInThe output stream to store the response received from the connection.
binDataOutThe input stream data to write to the connection.
responseStartTimeOutThe timeout interval to wait for the first data to be received (time to first byte).
responseEndTimeOutThe timeout interval after the last byte if no new data is received (time after last byte).
completionTokenThe string token denoting the end of the expected response. This can be an empty string if simply waiting for a response after writing data to the connection.
Returns
The data received from the connection.

Reimplemented in AComm.

◆ writeFromBinaryReader:

- (void) writeFromBinaryReader: (NSInputStream *) binReader

Writes all bytes from the array passed in.

Parameters
binReaderThe input stream to read the data from.

Reimplemented in AComm.

Property Documentation

◆ bytesAvailable

- (int) bytesAvailable
readnonatomicassign

The number of bytes available to read.

◆ descriptor

- (NSString*) descriptor
readnonatomicassign

The descriptor for the communication interface.

◆ isConnected

- (BOOL) isConnected
readnonatomicassign

A flag indicating whether the connection is established.


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