-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsequence-diagrams.puml
87 lines (69 loc) · 1.58 KB
/
sequence-diagrams.puml
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
@startuml sequence-diagram
actor User
participant Requester as a
participant Holder as b
participant 2nd_requester as c
group Startup
a -> a: Generate ID
a -> a: Ramp up radio\nin RX
a -> a: Init GPIO
end
group User action
User -> a: Button1 press
a -> a: Check if\nholding LED1
alt Holding 1
note over a: No action
else Not holding 1
a -> a: Switch to TX
a -> b: LED req(IDa, LED1)
a -> a: Switch to RX
a -> a: Begin timer
end
end
group Holder receives request
a -> b: LED req(IDa, LED1)
b -> b: Check if\nholding LED1
alt Holding 1
b -> b: LED1 off
b -> b: Switch to TX
b -> a: LED res(IDa, LED1)
b -> b: Switch to RX
else Not holding 1
note over b: No action
end
b -> b: Compare IDa and IDb
alt IDa == IDb
b -> b: Generate new ID
else IDa != IDb
note over b: No action
end
end
group Requester receives response
b -> a: LED res(IDa, LED1)
a -> a: LED1 on
a -> a: Cancel timer
a -> a: Reset retries
end
group Timer timeout
alt Retries < 3
a -> a: Switch to TX
a -> b: LED req(IDa, LED1)
a -> a: Switch to RX
a -> a: Begin timer
a -> a: Increment retries
else
a -> a: LED1 on
a -> a: Reset retries
end
end
group Requester detects another request
c -> a: LED req(IDc, LED1)
a -> a: Drop request
a -> a: Compare IDa and IDc
alt IDa == IDc
a -> a: Generate new ID
else
note over a: No action
end
end
@enduml