5. 详细时序图

5.1. 握手

!pragma teoz true
participant 手机 as P #cyan
box 设备 #LightBlue
box BLE
participant Write as W #khaki
participant Indication as I  #lightgreen
end box
participant MCU as M #deepskyblue
participant 传感器 as S #lightcoral
end box

autonumber
note over W, S: 上电
M -> S : 检查传感器种类
...
note over P, I: 手机连接BLE
...
== 发送命令 ==

P ->(10) W : Lynx.request.handshake()
W -> M:
M -> I:
P (10)<- I : Lynx.response.handshake(\n\t softVersion, \n\t hardwareType,\n\t error)

5.2. 压力垫计时

!pragma teoz true
participant 手机 as P #cyan
box 设备(开始) #LightBlue
box BLE
participant Write as W #khaki
participant Indication as I  #lightgreen
participant Central as C  #darkseagreen
end box
participant MCU as M #deepskyblue
participant 传感器 as S #lightcoral
end box

box 设备(结束) #LightBlue
participant BLE as B2
participant MCU as M2 #deepskyblue
participant 传感器 as S2 #lightcoral
participant NFC as N2 #coral
end box


autonumber
...
note over P, I: 手机连接BLE
...

== 添加压力垫计时(结束)设备 ==

P <- N2 : 读取设备的 NFC Tag, 获取设备序列号
P ->(10) W : Lynx.request.copilot(sn, \n\t timeoutInSecond)
W -> M :
M -> I :
I ->(10) P: Lynx.response.copilot(error)

M -> C ++:
note over C, B2 : 设备互联
C -> M --:

M -> I :
I ->(10) P : Lynx.indication.copilot(error)

== 发送命令 ==

P ->(10) W : Lynx.request.measure(start,\n\t  timeoutInSecond)
W -> M :
note over C, B2 : 信息同步
M -> I:
I ->(10) P: Lynx.response.measure(error)

== 开始测量 ==
?-> M ++:
M -> S :
& M2 -> S2 :
note over M, S2 : 持续检测,直到有结果或超时
S -> M :
S2 -> M2 :
note over C, B2 : 返回结果给(开始)设备
C -> M :

== 测量完毕 ==
M -> I -- :
P (10)<- I : Lynx.indication.measure(result, error)

5.3. 坐位体前屈测距

!pragma teoz true
participant 手机 as P #cyan
box 设备 #LightBlue
box BLE
participant Write as W #khaki
participant Indication as I  #lightgreen
end box
participant MCU as M #deepskyblue
participant 传感器 as S #lightcoral
end box

autonumber
...
note over P,I: BLE已连接
...
== 发送命令 ==

P ->(10) W : Lynx.request.measure(start, timeoutInSecond)
W -> M :
M -> I:
I ->(10) P: Lynx.response.measure(error)

== 开始测量 ==
?-> M ++:
M -> S :
note over M, S : 持续检测,直到有结果或超时
S -> M:

== 测量完毕 ==
M -> I -- :
P (10)<- I : Lynx.indication.measure(result, error)

5.4. 跳远测距

坐位体前屈测距.

5.5. 获取最后一次结果

!pragma teoz true
participant 手机 as P #cyan
box 设备 #LightBlue
box BLE
participant Write as W #khaki
participant Indication as I  #lightgreen
end box
participant MCU as M #deepskyblue
participant 传感器 as S #lightcoral
end box

autonumber
...
note over P,I: BLE已连接
...
== 发送命令 ==

P ->(10) W : Lynx.request.latestResult()
W -> M:
M -> I:
P (10)<- I : Lynx.response.latestResult(result, error)