QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QSerialPortInfo Class Reference

Provides information about existing serial ports. More...

#include <qserialportinfo.h>

+ Inheritance diagram for QSerialPortInfo:

Public Member Functions

 QSerialPortInfo ()
 Constructs an empty QSerialPortInfo object.
 
 QSerialPortInfo (const QSerialPort &port)
 Constructs a QSerialPortInfo object from serial port.
 
 QSerialPortInfo (const QString &name)
 Constructs a QSerialPortInfo object from serial port name.
 
 QSerialPortInfo (const QSerialPortInfo &other)
 Constructs a copy of other.
 
 QSerialPortInfo (const QSerialPortInfoPrivate &dd)
 
 ~QSerialPortInfo ()
 Destroys the QSerialPortInfo object.
 
QSerialPortInfooperator= (const QSerialPortInfo &other)
 Sets the QSerialPortInfo object to be equal to other.
 
void swap (QSerialPortInfo &other)
 Swaps QSerialPortInfo other with this QSerialPortInfo.
 
QString portName () const
 Returns the name of the serial port.
 
QString systemLocation () const
 Returns the system location of the serial port.
 
QString description () const
 Returns the description string of the serial port, if available; otherwise returns an empty string.
 
QString manufacturer () const
 Returns the manufacturer string of the serial port, if available; otherwise returns an empty string.
 
QString serialNumber () const
 
quint16 vendorIdentifier () const
 Returns the 16-bit vendor number for the serial port, if available; otherwise returns zero.
 
quint16 productIdentifier () const
 Returns the 16-bit product number for the serial port, if available; otherwise returns zero.
 
bool hasVendorIdentifier () const
 Returns true if there is a valid 16-bit vendor number present; otherwise returns false.
 
bool hasProductIdentifier () const
 Returns true if there is a valid 16-bit product number present; otherwise returns false.
 
bool isNull () const
 Returns whether this QSerialPortInfo object holds a serial port definition.
 

Static Public Member Functions

static QList< qint32 > standardBaudRates ()
 Returns a list of available standard baud rates supported by the target platform.
 
static QList< QSerialPortInfoavailablePorts ()
 Returns a list of available serial ports on the system.
 

Friends

QList< QSerialPortInfoavailablePortsByFiltersOfDevices (bool &ok)
 

Detailed Description

Provides information about existing serial ports.

\inmodule QtSerialPort

Since
5.1

Use the static \l availablePorts() function to generate a list of QSerialPortInfo objects. Each QSerialPortInfo object in the list represents a single serial port and can be queried for the \l {portName}{port name}, \l {systemLocation}{system location}, \l description, \l manufacturer, and some other hardware parameters. The QSerialPortInfo class can also be used as an input parameter for the \l {QSerialPort::}{setPort()} method of the QSerialPort class.

Definition at line 17 of file qserialportinfo.h.

Constructor & Destructor Documentation

◆ QSerialPortInfo() [1/5]

QSerialPortInfo::QSerialPortInfo ( )

Constructs an empty QSerialPortInfo object.

See also
isNull()

Definition at line 52 of file qserialportinfo.cpp.

Referenced by operator=().

◆ QSerialPortInfo() [2/5]

QSerialPortInfo::QSerialPortInfo ( const QSerialPort port)
explicit

Constructs a QSerialPortInfo object from serial port.

Definition at line 67 of file qserialportinfo.cpp.

◆ QSerialPortInfo() [3/5]

QSerialPortInfo::QSerialPortInfo ( const QString &  name)
explicit

Constructs a QSerialPortInfo object from serial port name.

This constructor finds the relevant serial port among the available ones according to the port name name, and constructs the serial port info instance for that port.

Definition at line 79 of file qserialportinfo.cpp.

References availablePorts().

◆ QSerialPortInfo() [4/5]

QSerialPortInfo::QSerialPortInfo ( const QSerialPortInfo other)

Constructs a copy of other.

Definition at line 59 of file qserialportinfo.cpp.

◆ QSerialPortInfo() [5/5]

QSerialPortInfo::QSerialPortInfo ( const QSerialPortInfoPrivate dd)

Definition at line 90 of file qserialportinfo.cpp.

◆ ~QSerialPortInfo()

QSerialPortInfo::~QSerialPortInfo ( )

Destroys the QSerialPortInfo object.

References to the values in the object become invalid.

Definition at line 99 of file qserialportinfo.cpp.

Member Function Documentation

◆ availablePorts()

QList< QSerialPortInfo > QSerialPortInfo::availablePorts ( )
static

Returns a list of available serial ports on the system.

Definition at line 38 of file qserialportinfo_android.cpp.

References availablePortsByFiltersOfDevices.

Referenced by QGCSerialPortInfo::availablePorts(), SerialConfiguration::cleanPortDisplayName(), and QSerialPortInfo().

◆ description()

QString QSerialPortInfo::description ( ) const

Returns the description string of the serial port, if available; otherwise returns an empty string.

See also
manufacturer(), serialNumber()

Definition at line 149 of file qserialportinfo.cpp.

Referenced by FirmwareUpgradeController::boardDescription(), QGCSerialPortInfo::getBoardInfo(), QGCSerialPortInfo::isBlackCube(), and QGCSerialPortInfo::isBootloader().

◆ hasProductIdentifier()

bool QSerialPortInfo::hasProductIdentifier ( ) const

Returns true if there is a valid 16-bit product number present; otherwise returns false.

See also
productIdentifier(), vendorIdentifier(), hasVendorIdentifier()

Definition at line 225 of file qserialportinfo.cpp.

◆ hasVendorIdentifier()

bool QSerialPortInfo::hasVendorIdentifier ( ) const

Returns true if there is a valid 16-bit vendor number present; otherwise returns false.

See also
vendorIdentifier(), productIdentifier(), hasProductIdentifier()

Definition at line 213 of file qserialportinfo.cpp.

◆ isNull()

bool QSerialPortInfo::isNull ( ) const
inline

Returns whether this QSerialPortInfo object holds a serial port definition.

Definition at line 53 of file qserialportinfo.h.

Referenced by QGCSerialPortInfo::getBoardInfo().

◆ manufacturer()

QString QSerialPortInfo::manufacturer ( ) const

Returns the manufacturer string of the serial port, if available; otherwise returns an empty string.

See also
description(), serialNumber()

Definition at line 161 of file qserialportinfo.cpp.

Referenced by QGCSerialPortInfo::getBoardInfo().

◆ operator=()

QSerialPortInfo & QSerialPortInfo::operator= ( const QSerialPortInfo other)

Sets the QSerialPortInfo object to be equal to other.

Definition at line 115 of file qserialportinfo.cpp.

References QSerialPortInfo(), and swap().

◆ portName()

QString QSerialPortInfo::portName ( ) const

Returns the name of the serial port.

See also
systemLocation()

Definition at line 126 of file qserialportinfo.cpp.

Referenced by FirmwareUpgradeController::boardPort().

◆ productIdentifier()

quint16 QSerialPortInfo::productIdentifier ( ) const

Returns the 16-bit product number for the serial port, if available; otherwise returns zero.

See also
hasProductIdentifier(), vendorIdentifier(), hasVendorIdentifier()

Definition at line 201 of file qserialportinfo.cpp.

Referenced by QGCSerialPortInfo::getBoardInfo().

◆ serialNumber()

QString QSerialPortInfo::serialNumber ( ) const
Since
5.3

Returns the serial number string of the serial port, if available; otherwise returns an empty string.

Note
The serial number may include letters.
See also
description(), manufacturer()

Definition at line 177 of file qserialportinfo.cpp.

◆ standardBaudRates()

QList< qint32 > QSerialPortInfo::standardBaudRates ( )
static

Returns a list of available standard baud rates supported by the target platform.

Definition at line 244 of file qserialportinfo.cpp.

References QSerialPortPrivate::standardBaudRates().

Referenced by SerialConfiguration::supportedBaudRates().

◆ swap()

void QSerialPortInfo::swap ( QSerialPortInfo other)

Swaps QSerialPortInfo other with this QSerialPortInfo.

This operation is very fast and never fails.

Definition at line 107 of file qserialportinfo.cpp.

Referenced by operator=().

◆ systemLocation()

QString QSerialPortInfo::systemLocation ( ) const

Returns the system location of the serial port.

See also
portName()

Definition at line 137 of file qserialportinfo.cpp.

Referenced by QGCSerialPortInfo::isSystemPort(), and QSerialPort::setPort().

◆ vendorIdentifier()

quint16 QSerialPortInfo::vendorIdentifier ( ) const

Returns the 16-bit vendor number for the serial port, if available; otherwise returns zero.

See also
hasVendorIdentifier(), productIdentifier(), hasProductIdentifier()

Definition at line 189 of file qserialportinfo.cpp.

Referenced by QGCSerialPortInfo::getBoardInfo().

Friends And Related Symbol Documentation

◆ availablePortsByFiltersOfDevices

QList< QSerialPortInfo > availablePortsByFiltersOfDevices ( bool &  ok)
friend

Definition at line 19 of file qserialportinfo_android.cpp.

Referenced by availablePorts().


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