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

A class for Bluetooth communication, inheriting from AComm. More...

#include <BtComm.h>

Inheritance diagram for BtComm:
AComm <IComm>

Instance Methods

(instancetype) - initWithDeviceAddress:
 Initializes a new instance with the given device address.
 
(void) - open
 Opens the connection to the Bluetooth device.
 
(void) - close
 Closes the connection to the Bluetooth device.
 
(void) - write:
 Writes data to the Bluetooth device.
 
(NSData *) - read
 Reads data from the Bluetooth device.
 
(NSData *) - writeAndWaitForResponse:responseStartTimeOut:responseEndTimeOut:completionToken:
 Writes data to the Bluetooth device and waits for a response.
 
(NSData *) - writeAndWaitForResponseJson:responseStartTimeOut:responseEndTimeOut:completionToken:
 
- 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

NSMutableData * receivedData
 The data received from the device.
 
- 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

A class for Bluetooth communication, inheriting from AComm.

Method Documentation

◆ close

- (void) close

Closes the connection to the Bluetooth device.

Reimplemented from AComm.

◆ initWithDeviceAddress:

- (instancetype) initWithDeviceAddress: (NSString *) deviceAddress

Initializes a new instance with the given device address.

Parameters
deviceAddressThe Bluetooth address of the device.
Returns
An initialized instance of BtComm, or nil if the object could not be created.

◆ open

- (void) open

Opens the connection to the Bluetooth device.

Reimplemented from AComm.

◆ read

- (NSData *) read

Reads data from the Bluetooth device.

Returns
The data read from the device.

Reimplemented from AComm.

◆ write:

- (void) write: (NSData *) text

Writes data to the Bluetooth 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 Bluetooth 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

◆ receivedData

- (NSMutableData*) receivedData
readwritenonatomicstrong

The data received from the device.


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