QSerialPortInfo

落爺英雄遲暮 提交于 2020-01-29 23:53:07

欢迎加入QQ群:853840665,一块学习分享资料

 

PyQt5类翻译、示例学习 class-learning

描述

提供有关现有串行端口的信息。
使用静态函数生成QSerialPortInfo对象的列表。列表中的每个QSerialPortInfo对象表示单个串行端口,可以查询端口名称、系统位置、描述和制造商。QSerialPortInfo类还可以用作QSerialPort类的setPort() 方法的输入参数。
示例:

from PyQt5.QtSerialPort import QSerialPortInfo

port = QSerialPortInfo()
for p in port.availablePorts():
    print(p.manufacturer())
    print(p.portName())

 

Public Functions

QSerialPortInfo(const QSerialPortInfo &other)

构造另一个的副本。

QSerialPortInfo(const QString &name)

从串行端口名构造QSerialPortInfo对象。
该构造函数根据端口名在可用的串行端口中查找相关的串行端口,并构造该端口的串行端口信息实例。

QSerialPortInfo(const QSerialPort &port)

从串行端口构造QSerialPortInfo对象。

QSerialPortInfo()

构造空的QSerialPortInfo对象。

QSerialPortInfo &operator=(const QSerialPortInfo &other)

将QSerialPortInfo对象设置为等于other。

~QSerialPortInfo()

销毁QSerialPortInfo对象。对对象中值的引用无效。

QString description()

返回串行端口的描述字符串(如果可用);否则返回空字符串。

bool hasProductIdentifier()

如果存在有效的16位产品编号,则返回true;否则返回false。

bool hasVendorIdentifier()

如果存在有效的16位供应商编号,则返回true;否则返回false。

bool isNull()

返回此QSerialPortInfo对象是否包含串行端口定义。

QString manufacturer()

返回串行端口的制造商字符串(如果可用);否则返回空字符串。

QString portName()

返回串行端口的名称。

quint16 productIdentifier()

返回串行端口的16位产品号(如果可用);否则返回0。

QString serialNumber()

返回串行端口的序列号字符串(如果可用);否则返回空字符串。
注意:序列号可以包括字母。
这个函数是在Qt 5.3中引入的。

void swap(QSerialPortInfo &other)

用这个QSerialPortInfo交换QSerialPortInfo。这个操作非常快,从来没有失败过。

QString systemLocation()

返回串口的系统位置。

quint16 vendorIdentifier()

返回串行端口的16位供应商编号(如果可用);否则返回0。

Static Public Members

QList availablePorts()

返回系统上可用的串行端口列表。

QList standardBaudRates()

返回目标平台支持的可用标准波特率列表。

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!