当前位置:网站首页>test4
test4
2022-07-30 07:28:00 【挖煤的小李同学】
项目场景:
提示:这里简述项目相关背景:
例如:项目场景:示例:通过蓝牙芯片(HC-05)与手机 APP 通信,每隔 5s 传输一批传感器数据(不是很大)
问题描述
提示:这里描述项目中遇到的问题:
例如:数据传输过程中数据不时出现丢失的情况,偶尔会丢失一部分数据
APP 中接收数据代码:
@Override
public void run() {
bytes = mmInStream.read(buffer);
mHandler.obtainMessage(READ_DATA, bytes, -1, buffer).sendToTarget();
}
原因分析:
提示:这里填写问题的分析:
例如:Handler 发送消息有两种方式,分别是 Handler.obtainMessage()和 Handler.sendMessage(),其中 obtainMessage 方式当数据量过大时,由于 MessageQuene 大小也有限,所以当 message 处理不及时时,会造成先传的数据被覆盖,进而导致数据丢失。
解决方案:
提示:这里填写该问题的具体解决方案:
例如:新建一个 Message 对象,并将读取到的数据存入 Message,然后 mHandler.obtainMessage(READ_DATA, bytes, -1, buffer).sendToTarget();换成 mHandler.sendMessage()。
边栏推荐
猜你喜欢

立创EDA——PCB的走线(五)

Interview with Ant: How do these technology pioneers do the bottom-level development well?| Excellent technical team interview
![[Mini Program Column] Summarize the development specifications of uniapp to develop small programs](/img/7b/110d324eba00652e4987bc623a5bc6.png)
[Mini Program Column] Summarize the development specifications of uniapp to develop small programs

一文带你玩转offer-01

typescript8 - type annotations

Why does typescript2-typescript add type support to js

你好,我的新名字叫 “铜锁 / Tongsuo”

SwiftUI SQLite 教程之 构建App本地数据库实现创建、读取、更新和删除(教程含完成项目源码)

41.【vector应用操作2】

typescript7-typescript common types
随机推荐
SQL行列转换
02 多线程与高并发 - synchronized 解析
基于SSM实现个性化健康饮食推荐系统
redis多节点部署实施指引
数据分发服务 (DDS) 内置主题
39.【vector动态数组定义及初始化】
sql注入数据库原理详解
SQL注入漏洞(postgresql注入)
【sleuth + zipkin 服务链路追踪】
Two Permutations(2022杭电杯)
muduo库学习记录(一)
风靡全球25年的重磅IP,新作沦为脚本乐园
typescript7-typescript common types
通过位运算进行两个变量值的交换功能
求大佬解答,这种 sql 应该怎么写?
40.【vector的运用】
实现定时器
MongoDB - 千万级数据脚本过滤笔记
【微信小程序】页面事件
41.【vector应用操作2】