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:
 
(void) - startCommunicationThread [implementation]
 
(void) - runCommunicationThread [implementation]
 
(void) - stopCommunicationThread [implementation]
 
(void) - performSelectorOnCommunicationThread:withObject: [implementation]
 
(void) - openInternal [implementation]
 
(void) - configureStreams [implementation]
 
(void) - closeInternal [implementation]
 
(void) - accessoryDidConnect: [implementation]
 
(void) - accessoryDidDisconnect: [implementation]
 
(void) - reloadConnectedAccessories [implementation]
 
(void) - dealloc [implementation]
 
(void) - tryWriteData [implementation]
 
(void) - stream:handleEvent: [implementation]
 
(void) - waitForDataWithTimeout: [implementation]
 Waits for data to be available within a specified timeout.
 
- Instance Methods inherited from AComm
(void) - readToBinaryWriter:
 Reads data into a binary writer (output stream).
 
(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

BOOL connected
 
NSString * deviceAddress [implementation]
 
EASession * session [implementation]
 
EAAccessory * accessory [implementation]
 
NSMutableArray< NSData * > * writeQueue [implementation]
 
BOOL isReadyToWrite [implementation]
 
NSMutableData * receivedData [implementation]
 
NSThread * communicationThread [implementation]
 
CFRunLoopRef communicationRunLoop [implementation]
 
- 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

◆ accessoryDidConnect:

- (void) accessoryDidConnect: (NSNotification *) notification
implementation

◆ accessoryDidDisconnect:

- (void) accessoryDidDisconnect: (NSNotification *) notification
implementation

◆ close

- (void) close

Closes the connection to the Bluetooth device.

Reimplemented from AComm.

◆ closeInternal

- (void) closeInternal
implementation

◆ configureStreams

- (void) configureStreams
implementation

◆ dealloc

- (void) dealloc
implementation

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

◆ openInternal

- (void) openInternal
implementation

◆ performSelectorOnCommunicationThread:withObject:

- (void) performSelectorOnCommunicationThread: (SEL) selector
withObject: (id) object 
implementation

◆ read

- (NSData *) read

Reads data from the Bluetooth device.

Returns
The data read from the device.

Reimplemented from AComm.

◆ reloadConnectedAccessories

- (void) reloadConnectedAccessories
implementation

◆ runCommunicationThread

- (void) runCommunicationThread
implementation

◆ startCommunicationThread

- (void) startCommunicationThread
implementation

◆ stopCommunicationThread

- (void) stopCommunicationThread
implementation

◆ stream:handleEvent:

- (void) stream: (NSStream *) aStream
handleEvent: (NSStreamEvent) eventCode 
implementation

◆ tryWriteData

- (void) tryWriteData
implementation

◆ waitForDataWithTimeout:

- (void) waitForDataWithTimeout: (NSTimeInterval) msTimeOut
implementation

Waits for data to be available within a specified timeout.

Parameters
msTimeOutThe timeout interval in milliseconds.

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

◆ accessory

- (EAAccessory*) accessory
readwritenonatomicstrongimplementation

◆ communicationRunLoop

- (CFRunLoopRef) communicationRunLoop
readwritenonatomicassignimplementation

◆ communicationThread

- (NSThread*) communicationThread
readwritenonatomicstrongimplementation

◆ connected

- (BOOL) connected
readwritenonatomicassign

◆ deviceAddress

- (NSString*) deviceAddress
readwritenonatomicstrongimplementation

◆ isReadyToWrite

- (BOOL) isReadyToWrite
readwritenonatomicassignimplementation

◆ receivedData

- (NSMutableData*) receivedData
readwritenonatomicstrongimplementation

◆ session

- (EASession*) session
readwritenonatomicstrongimplementation

◆ writeQueue

- (NSMutableArray<NSData *>*) writeQueue
readwritenonatomicstrongimplementation

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