The SerialLayer class. Provide the low level serial operations.
More...
#include <seriallayer.h>
|
| SerialLayer (const QString &port, int32_t baud, QObject *parent=nullptr) |
| SerialLayer Class to realize communication. More...
|
|
void | add (const QByteArray &comm, const QByteArray &term) |
| Add command to be pushed. More...
|
|
void | add (const QByteArray &comm) |
| Add command to be pushed. More...
|
|
void | handleError (QSerialPort::SerialPortError error) |
| handleError Handle Errors from the serial port More...
|
|
void | pushCommand (const QByteArray &comm, const QByteArray &term) |
| Push command directly. More...
|
|
void | pushCommand (const QByteArray &comm) |
| Push command directly. More...
|
|
void | push () |
| Push all commands used in add to serial write. More...
|
|
bool | commandAvailable () const |
| Check if is a command available. More...
|
|
QStringList | validBaudRates () const |
| Return a QStringList of valids serial baud rates. More...
|
|
The SerialLayer class. Provide the low level serial operations.
◆ SerialLayer()
SerialLayer::SerialLayer |
( |
const QString & |
port, |
|
|
int32_t |
baud, |
|
|
QObject * |
parent = nullptr |
|
) |
| |
SerialLayer Class to realize communication.
- Parameters
-
port | : Port (/dev/ttyUSB ACM) |
baud | : Baud rate (115200) |
parent | : Parent |
◆ add() [1/2]
void SerialLayer::add |
( |
const QByteArray & |
comm | ) |
|
Add command to be pushed.
- Parameters
-
comm | : Command, default terminator will be used |
◆ add() [2/2]
void SerialLayer::add |
( |
const QByteArray & |
comm, |
|
|
const QByteArray & |
term |
|
) |
| |
Add command to be pushed.
- Parameters
-
comm | : Command |
term | : Terminator |
◆ commandAvailable()
bool SerialLayer::commandAvailable |
( |
| ) |
const |
Check if is a command available.
- Returns
- bool
◆ handleError()
void SerialLayer::handleError |
( |
QSerialPort::SerialPortError |
error | ) |
|
handleError Handle Errors from the serial port
- Parameters
-
◆ push()
void SerialLayer::push |
( |
| ) |
|
Push all commands used in add to serial write.
◆ pushCommand() [1/2]
void SerialLayer::pushCommand |
( |
const QByteArray & |
comm | ) |
|
Push command directly.
- Parameters
-
comm | : Command, default terminator will be used |
◆ pushCommand() [2/2]
void SerialLayer::pushCommand |
( |
const QByteArray & |
comm, |
|
|
const QByteArray & |
term |
|
) |
| |
Push command directly.
- Parameters
-
comm | : Command |
term | : Terminator |
◆ pushedCommand
void SerialLayer::pushedCommand |
( |
const QByteArray & |
comm | ) |
|
|
signal |
Emit signal when command is pushed.
- Parameters
-
◆ readAllData()
void SerialLayer::readAllData |
( |
| ) |
|
|
private |
Read all available serial data.
◆ receivedCommand
void SerialLayer::receivedCommand |
( |
const QByteArray & |
comm | ) |
|
|
signal |
Emit signal when command is received.
- Parameters
-
◆ serialError
void SerialLayer::serialError |
( |
QSerialPort::SerialPortError |
error | ) |
|
|
signal |
Emit a signal if an error has happened.
- Parameters
-
◆ validBaudRates()
QStringList SerialLayer::validBaudRates |
( |
| ) |
const |
Return a QStringList of valids serial baud rates.
- Returns
- QStringList
The documentation for this class was generated from the following files: