Serial port
前言
 使用qt开发一款简易串口助手。
 目标:
	1. 实现正常串口通信。
	2. 能够传输AT指令。(需要注意回车符)
github仓库地址:shadow-wd/Serial-port-assistant: 简易串口助手 (github.com)
还在持续更新.......
开发环境
windows平台:qtcreator 5.9.5
代码
 代码量小,注释写在代码中。
QcomboBox
 对于下拉选项框来说,有一些选项框需要显示给用户汉字(字符串),但是代码中获取用户选项的时候,不能去匹配汉字。

使用QMap将string和int类型绑定,显示给用户string类型,匹配时通过int类型匹配。
QMap<QString,int> parityvalue;
    parityvalue.insert("NoParity",1);
    parityvalue.insert("EvenParity",2);
    parityvalue.insert("OddParity",3);
    parityvalue.insert("SpaceParity",4);
    parityvalue.insert("MarkParity",5);
    // 不知道为什么这里插入的顺序很混乱
    foreach (const QString &str, parityvalue.keys()) {
        ui->checkbit->addItem(str,parityvalue.value(str));
    }
AT指令回车
 在开发过程中,接收数据很容易,但是发送AT指令总是失败,经过排查问题发现时AT指令的回车符没能成功识别。
    // 对发送数据追加回车
    if(ui->enter->isChecked())
    {
        bytes.append("\r\n");
    }
    a= serialPort->write(bytes.data());
 因此添加了给数据追加回车的选项框。
Serial port的更多相关文章
- Serial Port Programming on Linux(转载)
		This is a tutorial on how to program the Serial Ports on your Linux box.Serial Ports are nice little ... 
- Serial Port Programming using Win32 API(转载)
		In this tutorial we will learn How to communicate with an external device like a microcontroller boa ... 
- select/poll/epoll on serial port
		In this article, I will use three asynchronous conferencing--select, poll and epoll on serial port t ... 
- [转]How Can I Find Out What Is Using a Busy or Reserved Serial Port?
		转自:http://digital.ni.com/public.nsf/allkb/29B079481C5ECE76862578810082394E How Can I Find Out What I ... 
- 串口总是报'Error opening serial port'
		Comm1.CommName := '//./' + Trim(combx_Port.Text); 目前串口大于20 用上面方法解决的 网上也有上面方法解决如下错误的. 若是您已会应用SPCOMM且 ... 
- Unable to open serial port /dev/ttyUSB0
		ubuntu12.04使用USB转串口时出现权限不够问题,如下 Unable to open serial port /dev/ttyUSB0 权限不够 解决办法: 通过增加udev规则来实现.步骤如 ... 
- [原]OS X 10.9 Mavericks - Virtual Serial Port Issues
		If want to do iOS kernel debugging on A4 device, first you should install Virtual COM port (VCP) dri ... 
- ROS 进阶学习笔记(12) - Communication with ROS through USART Serial Port
		Communication with ROS through USART Serial Port We always need to communicate with ROS through seri ... 
- Connecting to a Remote Serial Port over TCP/IP
		https://www.acmesystems.it/socat This article illustrates how to realize a lan to serial gateway Rem ... 
- Non-standard serial port baud rate setting
		////combuad_recv.cpp #include <stdio.h> /*标准输入输出定义*/ #include <stdlib.h> /*标准函数库定义*/ #in ... 
随机推荐
- Zabbix 监控服务介绍
			Zabbix 监控服务介绍 目录 Zabbix 监控服务介绍 一.Zabbix 监控服务介绍 1.1.1 Zabbix 监控服务介绍 1.1.2 如何去做监控 1.13 硬件监控 1.1.4 系统监控 ... 
- GPS时钟之户外防水防雷细节
			GPS时钟之户外防水防雷细节------专业LED时钟厂家![点击进入] GPS的脆弱性: 由于在GPS设计时,干扰环境下的工作能力不是优先考虑的因素,它只是作为一种导航的辅助工具,而不是用于精确制导 ... 
- vue项目中 vscode 保存时自动格式化设置,保持单引号和去除多余分号、逗号
			1.settings.json中添加: "prettier.semi": false, // 取消自动加分号 "prettier.singleQuote": t ... 
- create-react-app react 使用dll抽离公共库,大幅缩减项目体积,及项目打包速度
			1.安装依赖(clean-webpack-plugin.add-asset-html-webpack-plugin.webpack-cli) yarn add clean-webpack-plugin ... 
- 关于git错误:Git未能顺利结束(退出码 128)的解决办法
			如图: 问题原因: 主要是:用户名.邮箱.用户密钥跟github官网上配置的不一致 https://blog.csdn.net/weixin_52517585/article/details/1269 ... 
- C语言初级阶段4——数组3——字符数组
			C语言初级阶段4--数组3--字符数组 字符数组的定义:储存字符类型数据的集合 1.注意:如果用字符串给字符数组初始化,那么不需要{},但是要有"". 2.%s :用来输出字符串的 ... 
- Linux系列(8)-添加用户并设置密码
			#添加用户[root@iZm5ehnt0e8indgne1hibuZ ~]# useradd -m linsiyu #设置用户密码[root@iZm5ehnt0e8indgne1hibuZ ~]# p ... 
- Adaboost分类器
			Adaboost分类器 2019-08-31 非集成的机器学习算法就像古代皇帝一样,一个人说了算:集成学习算法类似于现在的国会,需要听取在会所有人的意见. Adaboost是一个集成学习算法,下面将会 ... 
- FtpClient上传文件异常:java.net.SocketException: Connection reset
			FtpClient上传文件异常:java.net.SocketException: Connection reset 这问题折磨我快一天了,下午这会儿终于解决了,问题不在程序错误,原因还是出在上传图片 ... 
- php上传文件时出现 caution: request is not finished yet
			其中的一个原因:是wamp64下的tmp文件夹中的临时文件太多,把这个文件夹的临时文件清理后就可以了. 
