Serial Studio 1.1.6
A dashboard software for your embedded projects
IO::DataSources::Serial Class Reference

The Network class. More...

#include <Serial.h>

Inheritance diagram for IO::DataSources::Serial:
Inheritance graph
Collaboration diagram for IO::DataSources::Serial:
Collaboration graph

Public Slots

void disconnectDevice ()
 
void setBaudRate (const qint32 rate)
 
void setParity (const quint8 parityIndex)
 IO::DataSources::Serial::setParity. More...
 
void setPortIndex (const quint8 portIndex)
 
void appendBaudRate (const QString &baudRate)
 
void setDataBits (const quint8 dataBitsIndex)
 
void setStopBits (const quint8 stopBitsIndex)
 
void setAutoReconnect (const bool autoreconnect)
 
void setFlowControl (const quint8 flowControlIndex)
 

Signals

void portChanged ()
 
void parityChanged ()
 
void baudRateChanged ()
 
void dataBitsChanged ()
 
void stopBitsChanged ()
 
void portIndexChanged ()
 
void flowControlChanged ()
 
void baudRateListChanged ()
 
void autoReconnectChanged ()
 
void baudRateIndexChanged ()
 
void availablePortsChanged ()
 
void connectionError (const QString &name)
 

Public Member Functions

QString portName () const
 
QSerialPort * port () const
 
bool autoReconnect () const
 
bool configurationOk () const
 
quint8 portIndex () const
 
quint8 parityIndex () const
 
quint8 displayMode () const
 
quint8 dataBitsIndex () const
 
quint8 stopBitsIndex () const
 
quint8 flowControlIndex () const
 
StringList portList () const
 
StringList parityList () const
 
StringList baudRateList () const
 
StringList dataBitsList () const
 
StringList stopBitsList () const
 
StringList flowControlList () const
 
qint32 baudRate () const
 
QSerialPort::Parity parity () const
 
QSerialPort::DataBits dataBits () const
 
QSerialPort::StopBits stopBits () const
 
QSerialPort::FlowControl flowControl () const
 
QSerialPort * openSerialPort ()
 

Static Public Member Functions

static Serialinstance ()
 

Properties

QString portName
 
bool autoReconnect
 
quint8 portIndex
 
quint8 parityIndex
 
quint8 dataBitsIndex
 
quint8 stopBitsIndex
 
quint8 flowControlIndex
 
qint32 baudRate
 
StringList portList
 
StringList parityList
 
StringList baudRateList
 
StringList dataBitsList
 
StringList stopBitsList
 
StringList flowControlList
 

Private Slots

void readSettings ()
 
void writeSettings ()
 
void refreshSerialDevices ()
 
void handleError (QSerialPort::SerialPortError error)
 IO::DataSources::Serial::handleError. More...
 

Private Member Functions

 Serial ()
 
 Serial (Serial &&)=delete
 
 Serial (const Serial &)=delete
 
Serialoperator= (Serial &&)=delete
 
Serialoperator= (const Serial &)=delete
 
 ~Serial ()
 
QVector< QSerialPortInfo > validPorts () const
 

Private Attributes

QSerialPort * m_port
 
bool m_autoReconnect
 
int m_lastSerialDeviceIndex
 
qint32 m_baudRate
 
QSettings m_settings
 
QSerialPort::Parity m_parity
 
QSerialPort::DataBits m_dataBits
 
QSerialPort::StopBits m_stopBits
 
QSerialPort::FlowControl m_flowControl
 
quint8 m_portIndex
 
quint8 m_parityIndex
 
quint8 m_dataBitsIndex
 
quint8 m_stopBitsIndex
 
quint8 m_flowControlIndex
 
StringList m_portList
 
StringList m_baudRateList
 

Detailed Description

The Network class.

Serial Studio "driver" class to interact with serial port devices.

Constructor & Destructor Documentation

◆ Serial() [1/3]

IO::DataSources::Serial::Serial ( )
explicitprivate

Constructor function

◆ Serial() [2/3]

IO::DataSources::Serial::Serial ( Serial &&  )
privatedelete

◆ Serial() [3/3]

IO::DataSources::Serial::Serial ( const Serial )
privatedelete

◆ ~Serial()

IO::DataSources::Serial::~Serial ( )
private

Destructor function, closes the serial port before exiting the application and saves the user's baud rate list settings.

Member Function Documentation

◆ appendBaudRate

void IO::DataSources::Serial::appendBaudRate ( const QString &  baudRate)
slot

Registers the new baud rate to the list

◆ autoReconnect()

bool IO::DataSources::Serial::autoReconnect ( ) const

Returns true if auto-reconnect is enabled

◆ autoReconnectChanged

void IO::DataSources::Serial::autoReconnectChanged ( )
signal

◆ availablePortsChanged

void IO::DataSources::Serial::availablePortsChanged ( )
signal

◆ baudRate()

qint32 IO::DataSources::Serial::baudRate ( ) const

Returns the current baud rate configuration used by the serial port handler object.

◆ baudRateChanged

void IO::DataSources::Serial::baudRateChanged ( )
signal

◆ baudRateIndexChanged

void IO::DataSources::Serial::baudRateIndexChanged ( )
signal

◆ baudRateList()

StringList IO::DataSources::Serial::baudRateList ( ) const

Returns a list with the available baud rate configurations. This function can be used with a combo-box to build UIs.

◆ baudRateListChanged

void IO::DataSources::Serial::baudRateListChanged ( )
signal

◆ configurationOk()

bool IO::DataSources::Serial::configurationOk ( ) const

Returns true if the user selects the appropiate controls & options to be able to connect to a serial device

◆ connectionError

void IO::DataSources::Serial::connectionError ( const QString &  name)
signal

◆ dataBits()

QSerialPort::DataBits IO::DataSources::Serial::dataBits ( ) const

Returns the current data bits configuration used by the serial port handler object.

◆ dataBitsChanged

void IO::DataSources::Serial::dataBitsChanged ( )
signal

◆ dataBitsIndex()

quint8 IO::DataSources::Serial::dataBitsIndex ( ) const

Returns the correspoding index of the data bits configuration in relation to the StringList returned by the dataBitsList() function.

◆ dataBitsList()

StringList IO::DataSources::Serial::dataBitsList ( ) const

Returns a list with the available data bits configurations. This function can be used with a combo-box to build UIs.

◆ disconnectDevice

void IO::DataSources::Serial::disconnectDevice ( )
slot

Disconnects from the current serial device and clears temp. data

◆ displayMode()

quint8 IO::DataSources::Serial::displayMode ( ) const

◆ flowControl()

QSerialPort::FlowControl IO::DataSources::Serial::flowControl ( ) const

Returns the current flow control configuration used by the serial port handler object.

◆ flowControlChanged

void IO::DataSources::Serial::flowControlChanged ( )
signal

◆ flowControlIndex()

quint8 IO::DataSources::Serial::flowControlIndex ( ) const

Returns the correspoding index of the flow control config. in relation to the StringList returned by the flowControlList() function.

◆ flowControlList()

StringList IO::DataSources::Serial::flowControlList ( ) const

Returns a list with the available flow control configurations. This function can be used with a combo-box to build UIs.

◆ handleError

void IO::DataSources::Serial::handleError ( QSerialPort::SerialPortError  error)
privateslot

◆ instance()

IO::DataSources::Serial & IO::DataSources::Serial::instance ( )
static

Returns the only instance of the class

◆ openSerialPort()

QSerialPort * IO::DataSources::Serial::openSerialPort ( )

Tries to open the serial port with the current configuration

◆ operator=() [1/2]

Serial & IO::DataSources::Serial::operator= ( const Serial )
privatedelete

◆ operator=() [2/2]

Serial & IO::DataSources::Serial::operator= ( Serial &&  )
privatedelete

◆ parity()

QSerialPort::Parity IO::DataSources::Serial::parity ( ) const

Returns the current parity configuration used by the serial port handler object.

◆ parityChanged

void IO::DataSources::Serial::parityChanged ( )
signal

◆ parityIndex()

quint8 IO::DataSources::Serial::parityIndex ( ) const

Returns the correspoding index of the parity configuration in relation to the StringList returned by the parityList() function.

◆ parityList()

StringList IO::DataSources::Serial::parityList ( ) const

Returns a list with the available parity configurations. This function can be used with a combo-box to build UIs.

◆ port()

QSerialPort * IO::DataSources::Serial::port ( ) const

Returns the pointer to the current serial port handler

◆ portChanged

void IO::DataSources::Serial::portChanged ( )
signal

◆ portIndex()

quint8 IO::DataSources::Serial::portIndex ( ) const

Returns the index of the current serial device selected by the program.

◆ portIndexChanged

void IO::DataSources::Serial::portIndexChanged ( )
signal

◆ portList()

StringList IO::DataSources::Serial::portList ( ) const

Returns a list with the available serial devices/ports to use. This function can be used with a combo box to build nice UIs.

Note
The first item of the list will be invalid, since it's value will be "Select Serial Device". This is inteded to make the user interface a little more friendly.

◆ portName()

QString IO::DataSources::Serial::portName ( ) const

Returns the name of the current serial port device

◆ readSettings

void IO::DataSources::Serial::readSettings ( )
privateslot

Read saved settings (if any)

◆ refreshSerialDevices

void IO::DataSources::Serial::refreshSerialDevices ( )
privateslot

Scans for new serial ports available & generates a StringList with current serial ports.

◆ setAutoReconnect

void IO::DataSources::Serial::setAutoReconnect ( const bool  autoreconnect)
slot

Enables or disables the auto-reconnect feature

◆ setBaudRate

void IO::DataSources::Serial::setBaudRate ( const qint32  rate)
slot

Changes the baud rate of the serial port

◆ setDataBits

void IO::DataSources::Serial::setDataBits ( const quint8  dataBitsIndex)
slot

Changes the data bits of the serial port.

Note
This function is meant to be used with a combobox in the QML interface

◆ setFlowControl

void IO::DataSources::Serial::setFlowControl ( const quint8  flowControlIndex)
slot

Changes the flow control option of the serial port.

Note
This function is meant to be used with a combobox in the QML interface

◆ setParity

void IO::DataSources::Serial::setParity ( const quint8  parityIndex)
slot

IO::DataSources::Serial::setParity.

Parameters
parityIndex

◆ setPortIndex

void IO::DataSources::Serial::setPortIndex ( const quint8  portIndex)
slot

Changes the port index value, this value is later used by the openSerialPort() function.

◆ setStopBits

void IO::DataSources::Serial::setStopBits ( const quint8  stopBitsIndex)
slot

Changes the stop bits of the serial port.

Note
This function is meant to be used with a combobox in the QML interface

◆ stopBits()

QSerialPort::StopBits IO::DataSources::Serial::stopBits ( ) const

Returns the current stop bits configuration used by the serial port handler object.

◆ stopBitsChanged

void IO::DataSources::Serial::stopBitsChanged ( )
signal

◆ stopBitsIndex()

quint8 IO::DataSources::Serial::stopBitsIndex ( ) const

Returns the correspoding index of the stop bits configuration in relation to the StringList returned by the stopBitsList() function.

◆ stopBitsList()

StringList IO::DataSources::Serial::stopBitsList ( ) const

Returns a list with the available stop bits configurations. This function can be used with a combo-box to build UIs.

◆ validPorts()

QVector< QSerialPortInfo > IO::DataSources::Serial::validPorts ( ) const
private

Returns a list with all the valid serial port objects

◆ writeSettings

void IO::DataSources::Serial::writeSettings ( )
privateslot

Save settings between application runs

Member Data Documentation

◆ m_autoReconnect

bool IO::DataSources::Serial::m_autoReconnect
private

◆ m_baudRate

qint32 IO::DataSources::Serial::m_baudRate
private

◆ m_baudRateList

StringList IO::DataSources::Serial::m_baudRateList
private

◆ m_dataBits

QSerialPort::DataBits IO::DataSources::Serial::m_dataBits
private

◆ m_dataBitsIndex

quint8 IO::DataSources::Serial::m_dataBitsIndex
private

◆ m_flowControl

QSerialPort::FlowControl IO::DataSources::Serial::m_flowControl
private

◆ m_flowControlIndex

quint8 IO::DataSources::Serial::m_flowControlIndex
private

◆ m_lastSerialDeviceIndex

int IO::DataSources::Serial::m_lastSerialDeviceIndex
private

◆ m_parity

QSerialPort::Parity IO::DataSources::Serial::m_parity
private

◆ m_parityIndex

quint8 IO::DataSources::Serial::m_parityIndex
private

◆ m_port

QSerialPort* IO::DataSources::Serial::m_port
private

◆ m_portIndex

quint8 IO::DataSources::Serial::m_portIndex
private

◆ m_portList

StringList IO::DataSources::Serial::m_portList
private

◆ m_settings

QSettings IO::DataSources::Serial::m_settings
private

◆ m_stopBits

QSerialPort::StopBits IO::DataSources::Serial::m_stopBits
private

◆ m_stopBitsIndex

quint8 IO::DataSources::Serial::m_stopBitsIndex
private

Property Documentation

◆ autoReconnect

bool IO::DataSources::Serial::autoReconnect
readwrite

◆ baudRate

qint32 IO::DataSources::Serial::baudRate
readwrite

◆ baudRateList

StringList IO::DataSources::Serial::baudRateList
read

◆ dataBitsIndex

quint8 IO::DataSources::Serial::dataBitsIndex
readwrite

◆ dataBitsList

StringList IO::DataSources::Serial::dataBitsList
read

◆ flowControlIndex

quint8 IO::DataSources::Serial::flowControlIndex
readwrite

◆ flowControlList

StringList IO::DataSources::Serial::flowControlList
read

◆ parityIndex

quint8 IO::DataSources::Serial::parityIndex
readwrite

◆ parityList

StringList IO::DataSources::Serial::parityList
read

◆ portIndex

quint8 IO::DataSources::Serial::portIndex
readwrite

◆ portList

StringList IO::DataSources::Serial::portList
read

◆ portName

QString IO::DataSources::Serial::portName
read

◆ stopBitsIndex

quint8 IO::DataSources::Serial::stopBitsIndex
readwrite

◆ stopBitsList

StringList IO::DataSources::Serial::stopBitsList
read

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