-
Notifications
You must be signed in to change notification settings - Fork 1
/
ble.drawio
134 lines (134 loc) · 14.9 KB
/
ble.drawio
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<mxfile host="app.diagrams.net" modified="2023-08-08T06:14:55.117Z" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36" etag="rjyGj5Yh87pXNBvQ-zkH" version="21.6.6" type="github">
<diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1">
<mxGraphModel dx="1434" dy="680" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1600" math="0" shadow="0">
<root>
<mxCell id="WIyWlLk6GJQsqaUBKTNV-0" />
<mxCell id="WIyWlLk6GJQsqaUBKTNV-1" parent="WIyWlLk6GJQsqaUBKTNV-0" />
<mxCell id="WIyWlLk6GJQsqaUBKTNV-2" value="" style="rounded=0;html=1;jettySize=auto;orthogonalLoop=1;fontSize=11;endArrow=block;endFill=0;endSize=8;strokeWidth=1;shadow=0;labelBackgroundColor=none;edgeStyle=orthogonalEdgeStyle;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="WIyWlLk6GJQsqaUBKTNV-3" target="WIyWlLk6GJQsqaUBKTNV-6" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="WIyWlLk6GJQsqaUBKTNV-3" value="开始扫描(带上设备标识)" style="rounded=1;whiteSpace=wrap;html=1;fontSize=12;glass=0;strokeWidth=1;shadow=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="160" y="80" width="190" height="40" as="geometry" />
</mxCell>
<mxCell id="WIyWlLk6GJQsqaUBKTNV-5" value="No" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;jettySize=auto;orthogonalLoop=1;fontSize=11;endArrow=block;endFill=0;endSize=8;strokeWidth=1;shadow=0;labelBackgroundColor=none;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="WIyWlLk6GJQsqaUBKTNV-6" target="WIyWlLk6GJQsqaUBKTNV-7" edge="1">
<mxGeometry y="10" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-3" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="WIyWlLk6GJQsqaUBKTNV-6" target="4Q__4F4uSHIKYperc5K1-2" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-4" value="Yes" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="4Q__4F4uSHIKYperc5K1-3" vertex="1" connectable="0">
<mxGeometry x="-0.0444" y="-1" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="WIyWlLk6GJQsqaUBKTNV-6" value="扫描到了?" style="rhombus;whiteSpace=wrap;html=1;shadow=0;fontFamily=Helvetica;fontSize=12;align=center;strokeWidth=1;spacing=6;spacingTop=-4;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="205" y="160" width="100" height="80" as="geometry" />
</mxCell>
<mxCell id="WIyWlLk6GJQsqaUBKTNV-7" value="设备不存在,重试 or 让用户确认设备是否开启蓝牙" style="rounded=1;whiteSpace=wrap;html=1;fontSize=12;glass=0;strokeWidth=1;shadow=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="360" y="175" width="320" height="50" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-0" value="BLE 扫描" style="text;strokeColor=none;fillColor=none;html=1;fontSize=24;fontStyle=1;verticalAlign=middle;align=center;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="60" y="40" width="100" height="40" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-2" value="展示扫描列表(有可能多台设备)<br>用户选择设备,保存MAC地址,方便下次用户选择" style="rounded=1;whiteSpace=wrap;html=1;shadow=0;strokeWidth=1;spacing=6;spacingTop=-4;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="140" y="310" width="230" height="60" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-11" value="<ul><li>BLE 扫描耗电,注意在不使用的时候,<font color="#ff0000">关闭扫描</font></li><li>BLE 一次扫描可能扫描不到,需要重新扫描</li><li>Android手机微信 <font color="#ff0000">查找附近的设备</font> 权限没有打开(会扫描不到任何设备)<br style="border-color: var(--border-color);"></li></ul>" style="text;strokeColor=none;fillColor=none;html=1;whiteSpace=wrap;verticalAlign=middle;overflow=hidden;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="387" y="60" width="440" height="90" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-12" value="BLE 链接" style="text;strokeColor=none;fillColor=none;html=1;fontSize=24;fontStyle=1;verticalAlign=middle;align=center;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="40" y="410" width="100" height="40" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-15" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="4Q__4F4uSHIKYperc5K1-13" target="4Q__4F4uSHIKYperc5K1-14" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-13" value="用户选择链接蓝牙" style="rounded=1;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="180" y="460" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-17" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="4Q__4F4uSHIKYperc5K1-14" target="4Q__4F4uSHIKYperc5K1-16" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-18" value="No" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="4Q__4F4uSHIKYperc5K1-17" vertex="1" connectable="0">
<mxGeometry x="-0.2308" y="-3" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-25" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="4Q__4F4uSHIKYperc5K1-14" target="4Q__4F4uSHIKYperc5K1-24" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-26" value="Yes" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="4Q__4F4uSHIKYperc5K1-25" vertex="1" connectable="0">
<mxGeometry x="-0.3111" y="1" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-14" value="链接是否成功?" style="rhombus;whiteSpace=wrap;html=1;rounded=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="185" y="590" width="110" height="80" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-19" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=1;entryY=0;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="4Q__4F4uSHIKYperc5K1-16" target="4Q__4F4uSHIKYperc5K1-14" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="430" y="590" />
<mxPoint x="268" y="590" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-16" value="启动<b><font color="#ff0000">重试机制</font></b>" style="whiteSpace=wrap;html=1;rounded=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="370" y="600" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-21" value="<ul><li>1. 重新链接</li><li><span style="background-color: initial;">2. 重新扫描,再链接</span></li><li><span style="background-color: initial;">3. 重启手机蓝牙,再扫描,再链接</span><br></li><li><span style="background-color: initial;">4. 重启蓝牙设备</span></li></ul>" style="text;strokeColor=none;fillColor=none;html=1;whiteSpace=wrap;verticalAlign=middle;overflow=hidden;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="480" y="567.51" width="240" height="125" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-24" value="启动全局订阅,并监听蓝牙连接状态<br>蓝牙连接状态回调,小程序不一定准" style="whiteSpace=wrap;html=1;rounded=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="125" y="710" width="230" height="60" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-28" value="BLE 读/写" style="text;strokeColor=none;fillColor=none;html=1;fontSize=24;fontStyle=1;verticalAlign=middle;align=center;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="20" y="1050" width="110" height="40" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-29" value="BLE 读写 Attribution 相对简单, 不再赘述" style="whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="180" y="1040" width="380" height="60" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-30" value="BLE 传输协议设计" style="text;strokeColor=none;fillColor=none;html=1;fontSize=24;fontStyle=1;verticalAlign=middle;align=center;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry y="840" width="250" height="40" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-31" value="参考涂鸦的设计即可" style="whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="290" y="830" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-32" value="<ul><li>BLE 状态监听最好能补上超时机制<br></li></ul>" style="text;strokeColor=none;fillColor=none;html=1;whiteSpace=wrap;verticalAlign=middle;overflow=hidden;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="340" y="710" width="250" height="60" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-33" value="BLE 订阅" style="text;strokeColor=none;fillColor=none;html=1;fontSize=24;fontStyle=1;verticalAlign=middle;align=center;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="15" y="1220" width="120" height="40" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-34" value="由于硬件开发,喜欢用透传的方式和手机打交道。<br>所以必须依靠发布订阅,去区分消息" style="rounded=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="172.5" y="1210" width="395" height="60" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-35" value="<ul><li>BLE 蓝牙读写 最好不要并行处理,确保当前时刻只有一个指令在执行, 否则有可能有需要解决粘包、拆包问题。</li></ul>" style="text;strokeColor=none;fillColor=none;html=1;whiteSpace=wrap;verticalAlign=middle;overflow=hidden;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="540" y="1030" width="660" height="80" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-36" value="<ul><li style="border-color: var(--border-color);">小程序在订阅后,不能立即写数据,所以最好有个delay机制,指令有时间间隔,可以通过队列的方式实现</li><li style="border-color: var(--border-color);">蓝牙收发消息不要过快,容易触发硬件工程师的代码BUG</li><li style="border-color: var(--border-color);">要有超时机制,硬件主动Push 消息可能会影响到你发送的指令,导致返回值没有接收到</li></ul>" style="text;strokeColor=none;fillColor=none;html=1;whiteSpace=wrap;verticalAlign=middle;overflow=hidden;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="550" y="1185" width="530" height="110" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-37" value="<b><font style="font-size: 25px;" color="#ff0000">这是最容易出问题的地方</font></b>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="540" y="540" width="365" height="45" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-38" value="&nbsp;BLE 固件升级" style="text;strokeColor=none;fillColor=none;html=1;fontSize=24;fontStyle=1;verticalAlign=middle;align=center;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="10" y="1360" width="165" height="40" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-39" value="BLE 固件升级,不麻烦,主要的是MCU固件、WiFi 固件等,<br>这些存在" style="whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="185" y="1335" width="420" height="90" as="geometry" />
</mxCell>
<mxCell id="4Q__4F4uSHIKYperc5K1-40" value="<ul><li>BLE 升级过程中, 手机和硬件要暂停其他指令交互</li><li>升级完成后,需要重新链接BLE</li></ul>" style="text;strokeColor=none;fillColor=none;html=1;whiteSpace=wrap;verticalAlign=middle;overflow=hidden;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="590" y="1352.5" width="350" height="55" as="geometry" />
</mxCell>
<mxCell id="A0C16KF9qsN41Usq-8sh-0" value="链接失败的原因:<br>1. 设备没打开蓝牙<br>2. 设备还在连接其他设备<br>3. 设备/手机蓝牙处于异常重试机制,需要重新链接" style="rounded=1;whiteSpace=wrap;html=1;align=left;fillStyle=auto;strokeColor=#6c8ebf;sketch=1;curveFitting=1;jiggle=2;fillColor=#dae8fc;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="730" y="590" width="370" height="92.49" as="geometry" />
</mxCell>
<mxCell id="A0C16KF9qsN41Usq-8sh-1" value="实际情况是硬件开发工程师说的算" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="530" y="845" width="200" height="30" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>