A class for Bluetooth communication, inheriting from AComm. More...
#include <BtComm.h>
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. | |
A class for Bluetooth communication, inheriting from AComm.
| - (void) close |
Closes the connection to the Bluetooth device.
Reimplemented from AComm.
| - (instancetype) initWithDeviceAddress: | (NSString *) | deviceAddress |
Initializes a new instance with the given device address.
| deviceAddress | The Bluetooth address of the device. |
| - (void) open |
Opens the connection to the Bluetooth device.
Reimplemented from AComm.
| - (NSData *) read |
Reads data from the Bluetooth device.
Reimplemented from AComm.
| - (void) write: | (NSData *) | text |
Writes data to the Bluetooth device.
| text | The data to write to the device. |
Reimplemented from AComm.
| - (NSData *) writeAndWaitForResponse: | (NSData *) | text | |
| responseStartTimeOut: | (NSTimeInterval) | responseStartTimeOut | |
| responseEndTimeOut: | (NSTimeInterval) | responseEndTimeOut | |
| completionToken: | (NSString *) | completionToken |
Writes data to the Bluetooth device and waits for a response.
| text | The data to write to the device. |
| responseStartTimeOut | The timeout interval for the start of the response. |
| responseEndTimeOut | The timeout interval for the end of the response. |
| completionToken | A token indicating the completion of the response. |
Reimplemented from AComm.
| - (NSData *) writeAndWaitForResponseJson: | (NSData *) | text | |
| responseStartTimeOut: | (NSTimeInterval) | responseStartTimeOut | |
| responseEndTimeOut: | (NSTimeInterval) | responseEndTimeOut | |
| completionToken: | (NSString *) | completionToken |
|
readwritenonatomicstrong |
The data received from the device.