QSocketNotifier丢数据
来源:互联网 发布:openwrt 进入webshell 编辑:程序博客网 时间:2024/05/18 03:00
1,遇到这个问题
用QSocketNotifier监测串口读取数据 http://bbs.embedsky.net/forum.php?mod=viewthread&tid=9066用
相应的解决方法:没
QSocketNotifier监测串口问题http://www.qtcn.org/bbs/read-htm-tid-36369-displayMode-1-page-1.html#133140
相应的解决方法:
使用这个要遵循三步:1、Disable the notifier.2、Read data from the socket.3、Re-enable the notifier if you are interested in more data
2,看看是不是我的校验的问题,置位校验都取消看看
果真如此:
i1:0
JIN_remoteDataIncoming
handleData:OK
read_buf:134521496
i1:1
JIN_remoteDataIncoming
handleData:OK
read_buf:134521496
i1:2
JIN_remoteDataIncoming
handleData:OK
read_buf:134521496
i1:3
JIN_remoteDataIncoming
handleData:OK
read_buf:134521496
i1:4
不过 还有一个问题就是,如果读多个数据怎么办?
①:http://blog.chinaunix.net/uid-24948299-id-2899775.html
void MainWindow::read_serial(){ QByteArray temp=myCom->readAll();//全部读取ui->textEdit->insertPlainText(temp);//显示读取到的数据}
②:还是回到上边的问题中,想办法Disable
m_notifier->setEnabled(false);//不使能
m_notifier->setEnabled(true); //使能
结论:禁止是能禁止了,不过效果没有达到!还是一个数据就激活一次!
③:
void TMainForm::remoteDataIncoming(){char c;if (read(m_fd, &c, sizeof c) != 1) {QMessageBox::warning(this, tr("Error"), tr("Receive error!"));return;}m_receiveEdit->insert(QString(QChar(c)));}
仔细读这段代码时,并加上亲自实验,每次读一个字节是就最好的办法了,我可以让它们累加到数组中去!
- QSocketNotifier丢数据
- QSocketNotifier监听
- QT--QSocketNotifier类介绍
- QT--QSocketNotifier类介绍
- QT--QSocketNotifier类介绍 .
- QT--QSocketNotifier类介绍
- QT--QSocketNotifier类介绍
- QT--QSocketNotifier类介绍
- QT--QSocketNotifier类介绍
- QSocketNotifier使用在Uart上
- QT下 QSocketNotifier 类的使用
- QT中解决QSocketNotifier: socket notifiers cannot be enabled from another thread错误
- QSocketNotifier 实现文件监控(demo Linux系统U盘插拔监控)
- QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread
- QT-QSocketNotifier监听系统文件操作(在已知键值情况下,可现实开发板的自定义按键)
- kafka丢数据和数据重复
- kafka丢数据、重复数据分析
- streamwriter丢数据
- 为何重构?
- C-枚举
- C语言数据类型之枚举类型
- CodeForces Round #142(229B) - Planets
- 基于jQuery的Ajax聊天室程序
- QSocketNotifier丢数据
- java线程之中断interrupt详解
- Android模拟器键盘不能用解决方法
- DB2中类似于ORACLE中的DUAL表的表
- 【编程之美】数组分割问题
- 死锁的有关问题
- 华为2012.09.03浙大机试题
- Hibernate缓存机制
- Lzma(7-zip)