UniPRT SDK v2.0.0.0
 
Loading...
Searching...
No Matches
UsbComm Class Reference

Class that implements the USB specific communication and extends the AComm class. More...

#include <UsbComm.h>

Inheritance diagram for UsbComm:
AComm <IComm>

Instance Methods

(instancetype) - initWithVendorId:productId:
 Initializes a new instance with the given vendor ID and product ID.
 
(void) - open
 Opens the connection to the device.
 
(void) - close
 Closes the connection to the device.
 
(void) - write:
 Writes data to the device.
 
(NSData *) - read
 Reads data from the device.
 
(NSData *) - writeAndWaitForResponse:responseStartTimeOut:responseEndTimeOut:completionToken:
 Writes data to the device and waits for a response.
 
(NSData *) - writeAndWaitForResponseJson:responseStartTimeOut:responseEndTimeOut:completionToken:
 
(void) - asyncListenRead
 Asynchronously listens for and reads data from the device.
 
(void) - stopListenRead
 Stops asynchronous reading from the device.
 
- Instance Methods inherited from AComm
(void) - readToBinaryWriter:
 Reads data into a binary writer (output stream).
 
(void) - waitForDataWithTimeout:
 Waits for data to be available within a specified timeout.
 
(void) - writeFromBinaryReader:
 Writes data from a binary reader (input stream) to the communication interface.
 
(void) - writeAndWaitForResponseToBinaryWriter:fromBinaryReader:responseStartTimeout:responseEndTimeout:completionToken:
 Writes data to the communication interface and waits for a response, using binary streams.
 

Properties

NSMutableArray< UsbInterfaceInfo * > * discoveredInterfaces
 
NSMutableDictionary * deviceList
 
UsbInterfaceInfo * matchedInterfaces
 
- Properties inherited from AComm
int maxPacketSize
 The maximum packet size for communication.
 
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.
 
- Properties inherited from <IComm>
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

Class that implements the USB specific communication and extends the AComm class.

Method Documentation

◆ asyncListenRead

- (void) asyncListenRead

Asynchronously listens for and reads data from the device.

◆ close

- (void) close

Closes the connection to the device.

Reimplemented from AComm.

◆ initWithVendorId:productId:

- (instancetype) initWithVendorId: (NSString *) vendorId
productId: (NSString *) productId 

Initializes a new instance with the given vendor ID and product ID.

Parameters
vendorIdThe vendor ID for the instance.
productIdThe product ID for the instance.
Returns
An initialized instance of the class, or nil if the object could not be created.

◆ open

- (void) open

Opens the connection to the device.

Reimplemented from AComm.

◆ read

- (NSData *) read

Reads data from the device.

Returns
The data read from the device.

Reimplemented from AComm.

◆ stopListenRead

- (void) stopListenRead

Stops asynchronous reading from the device.

◆ write:

- (void) write: (NSData *) text

Writes data to the device.

Parameters
textThe data to write to the device.

Reimplemented from AComm.

◆ writeAndWaitForResponse:responseStartTimeOut:responseEndTimeOut:completionToken:

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

Writes data to the device and waits for a response.

Parameters
textThe data to write to the device.
responseStartTimeOutThe timeout interval for the start of the response.
responseEndTimeOutThe timeout interval for the end of the response.
completionTokenA token indicating the completion of the response.
Returns
The data received in response from the device.

Reimplemented from AComm.

◆ writeAndWaitForResponseJson:responseStartTimeOut:responseEndTimeOut:completionToken:

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

Property Documentation

◆ deviceList

- (NSMutableDictionary*) deviceList
readnonatomicassign

◆ discoveredInterfaces

- (NSMutableArray<UsbInterfaceInfo *>*) discoveredInterfaces
readnonatomicstrong

◆ matchedInterfaces

- (UsbInterfaceInfo*) matchedInterfaces
readnonatomicassign

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