![]() |
NDEVR
API Documentation
|
A ConnectionBackend that provides logic for interfacing with a QBluetooth connection. More...
Public Member Functions | |
| BluetoothConnection (LogPtr log) | |
| Constructs a BluetoothConnection with the given log. | |
| ~BluetoothConnection () | |
| Destroys the BluetoothConnection and releases the underlying socket. | |
| virtual uint04 | bytesAvailable () const override |
| Returns the number of bytes available for reading from the socket. | |
| virtual void | close () override |
| Closes the Bluetooth connection and releases the socket. | |
| void | handleBluetoothError (int error) |
| Handles a Bluetooth error by updating the internal error state. | |
| virtual bool | isOpen () const override |
| Checks whether the Bluetooth socket is currently open and connected. | |
| virtual TranslatedString | lastError () const override |
| Returns the last error message from this connection. | |
| virtual bool | open (const ConnectionInfo &request) override |
| Opens a Bluetooth connection using the provided connection info. | |
| virtual bool | openInMainThread (const ConnectionInfo &request) |
| Opens a Bluetooth connection on the main thread, required for some Qt Bluetooth operations. | |
| virtual uint04 | peek (char *s, uint04 size=Constant< uint04 >::Max) const override |
| Peeks at incoming data without consuming it from the receive buffer. | |
| virtual uint04 | rx (char *s, uint04 size=Constant< uint04 >::Max) override |
| Receives data from the Bluetooth socket into the provided buffer. | |
| virtual bool | setBluetoothPort (QBluetoothSocket *bluetooth_port, const ConnectionInfo &info) |
| Assigns an existing QBluetoothSocket to this connection. | |
| virtual void | tx (const StringView &command) override |
| Transmits the given command string over the Bluetooth socket. | |
| virtual bool | waitForReadyRead (const TimeSpan &span) override |
| Blocks until data is ready to read or the timeout expires. | |
| Public Member Functions inherited from ConnectionBackend | |
| ConnectionBackend (LogPtr log) | |
| Constructs a ConnectionBackend with the given log. | |
| void | connectionStateChangedSignal (ConnectionState state) |
| Emitted when the connection state changes. | |
| void | dataAvailableSignal () |
| Emitted when data is available to be read from the connection. | |
| virtual String | threadID () const |
| Returns the thread ID this backend must execute on, if any. | |
Protected Attributes | |
| TranslatedString | m_last_error |
| The most recent error message from this connection. | |
| QPointer< QBluetoothSocket > | m_socket |
| The underlying Qt Bluetooth socket used for communication. | |
| Protected Attributes inherited from ConnectionBackend | |
| LogPtr | m_log |
| Log for diagnostic messages. | |
A ConnectionBackend that provides logic for interfacing with a QBluetooth connection.
Definition at line 12 of file BluetoothConnection.h.
| BluetoothConnection::BluetoothConnection | ( | LogPtr | log | ) |
Constructs a BluetoothConnection with the given log.
| [in] | log | The log to use for reporting connection events and errors. |
|
overridevirtual |
Returns the number of bytes available for reading from the socket.
Implements ConnectionBackend.
| void BluetoothConnection::handleBluetoothError | ( | int | error | ) |
Handles a Bluetooth error by updating the internal error state.
| [in] | error | The Bluetooth error code to handle. |
|
overridevirtual |
Checks whether the Bluetooth socket is currently open and connected.
Implements ConnectionBackend.
|
overridevirtual |
Returns the last error message from this connection.
Implements ConnectionBackend.
|
overridevirtual |
Opens a Bluetooth connection using the provided connection info.
| [in] | request | The connection parameters specifying the target device. |
Implements ConnectionBackend.
|
virtual |
Opens a Bluetooth connection on the main thread, required for some Qt Bluetooth operations.
| [in] | request | The connection parameters specifying the target device. |
|
overridevirtual |
Peeks at incoming data without consuming it from the receive buffer.
| [in] | s | The buffer to copy peeked data into. |
| [in] | size | The maximum number of bytes to peek. |
Implements ConnectionBackend.
|
overridevirtual |
Receives data from the Bluetooth socket into the provided buffer.
| [in] | s | The buffer to copy received data into. |
| [in] | size | The maximum number of bytes to receive. |
Implements ConnectionBackend.
|
virtual |
Assigns an existing QBluetoothSocket to this connection.
| [in] | bluetooth_port | The QBluetoothSocket to use for communication. |
| [in] | info | The connection info associated with this socket. |
|
overridevirtual |
Transmits the given command string over the Bluetooth socket.
| [in] | command | The string data to send. |
Implements ConnectionBackend.
|
overridevirtual |
Blocks until data is ready to read or the timeout expires.
| [in] | span | The maximum time to wait for incoming data. |
Implements ConnectionBackend.