C++ Qt和串口编程

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1459344/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 20:03:24  来源:igfitidea点击:

Qt and serial port programming

c++qtqtserialport

提问by cybevnm

Is there any serial port facilities in Qt ?

Qt 中是否有任何串口设施?

If not, which crossplatform (desirable) libraries (for working with serial port and, maybe, with other I/O ports), do you recommend ?

如果没有,您推荐哪些跨平台(理想的)库(用于串行端口和其他 I/O 端口)?

采纳答案by Frank Bollack

Take a look at the Project QextSerialPort.

看看项目QextSerialPort

回答by Edu Felipe

Well, there's always Boost.

好吧,总是有Boost

In Boost there is a great Async I/O library called ASIO. It can perform operations in all sorts of endpoints, including serial ports.

在 Boost 中有一个很棒的异步 I/O 库,称为ASIO。它可以在各种端点上执行操作,包括串口

There is a great exampleabout how to build a minicom-like application using Boost::Asio, that you can use to see if ASIO will attend your needs.

有一个关于如何使用 Boost::Asio 构建类似 minicom 的应用程序的很好的示例,您可以使用它来查看 ASIO 是否满足您的需求。

Since boost works on all platforms/compilers under the sun, the cross platform requirement can be checked.

由于 boost 适用于所有平台/编译器,因此可以检查跨平台要求。

Cheers.

干杯。

回答by user483558

Here is a Qt serial library, works on Win, WinCE, Linux (i386 and ARM), Mac...

这是一个 Qt 串行库,适用于 Win、WinCE、Linux(i386 和 ARM)、Mac...

http://gitorious.org/inbiza-labs/qserialport

http://gitorious.org/inbiza-labs/qserialport

Also, it is based on QIODevice for a native feel, with it you can, if you like, direct serial communication onto TCPIP with little no no effort.

此外,它基于 QIODevice 以获得原生感觉,如果您愿意,您可以使用它轻松地将串行通信直接连接到 TCPIP。

It is LGPL also... enjoy.

它也是 LGPL... 享受。