AtCore  1.0.70
AtCore is a API to manage the serial connection between the computer and 3D Printers.
Classes | Signals | Public Member Functions | Private Member Functions | Private Attributes | List of all members
SerialLayer Class Reference

The SerialLayer class. Provide the low level serial operations. More...

#include <seriallayer.h>

Inheritance diagram for SerialLayer:

Classes

struct  SerialLayerPrivate
 The SerialLayerPrivate class. More...
 

Signals

void pushedCommand (const QByteArray &comm)
 Emit signal when command is pushed. More...
 
void receivedCommand (const QByteArray &comm)
 Emit signal when command is received. More...
 
void serialError (QSerialPort::SerialPortError error)
 Emit a signal if an error has happened. More...
 

Public Member Functions

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

Private Member Functions

void readAllData ()
 Read all available serial data. More...
 

Private Attributes

SerialLayerPrivated
 

Detailed Description

The SerialLayer class. Provide the low level serial operations.

Constructor & Destructor Documentation

◆ 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

Member Function Documentation

◆ add() [1/2]

void SerialLayer::add ( const QByteArray &  comm,
const QByteArray &  term 
)

Add command to be pushed.

Parameters
comm: Command
term: Terminator

◆ add() [2/2]

void SerialLayer::add ( const QByteArray &  comm)

Add command to be pushed.

Parameters
comm: Command, default terminator will be used

◆ 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
errorThe reported error

◆ push()

void SerialLayer::push ( )

Push all commands used in add to serial write.

◆ pushCommand() [1/2]

void SerialLayer::pushCommand ( const QByteArray &  comm,
const QByteArray &  term 
)

Push command directly.

Parameters
comm: Command
term: Terminator

◆ pushCommand() [2/2]

void SerialLayer::pushCommand ( const QByteArray &  comm)

Push command directly.

Parameters
comm: Command, default terminator will be used

◆ pushedCommand

void SerialLayer::pushedCommand ( const QByteArray &  comm)
signal

Emit signal when command is pushed.

Parameters
comm: Command

◆ 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
comm: Command

◆ serialError

void SerialLayer::serialError ( QSerialPort::SerialPortError  error)
signal

Emit a signal if an error has happened.

Parameters
errorthe Error

◆ validBaudRates()

QStringList SerialLayer::validBaudRates ( ) const

Return a QStringList of valids serial baud rates.

Returns
QStringList

Member Data Documentation

◆ d

SerialLayerPrivate* SerialLayer::d
private

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