aboutsummaryrefslogtreecommitdiff
path: root/ballotbox/ballotbox.puml
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2025-03-05 06:39:44 +0100
committerJonas Smedegaard <dr@jones.dk>2025-03-05 06:39:44 +0100
commit94b900d3c5d092e6457f928b5d016d44c8470dfc (patch)
tree80e55705ad931f56b99cdcdf3d84532e2a5d4872 /ballotbox/ballotbox.puml
parent0e8975d88ab0b3b43f2e462188473df2114d5c3d (diff)
add draft diagram for ballotbox
Diffstat (limited to 'ballotbox/ballotbox.puml')
-rw-r--r--ballotbox/ballotbox.puml38
1 files changed, 38 insertions, 0 deletions
diff --git a/ballotbox/ballotbox.puml b/ballotbox/ballotbox.puml
new file mode 100644
index 0000000..d03c650
--- /dev/null
+++ b/ballotbox/ballotbox.puml
@@ -0,0 +1,38 @@
+@startuml
+start
+partition init {
+:setup serial connection;
+:setup Bluetooth
+ * init server background task
+ * add hook to capture votes;
+:setup ballot
+ * resolve nextVotingTime
+ * clear votes;
+:print "ready";
+}
+while (repeat every few millisecond)
+partition loop {
+:resolve currentTime;
+if (currentTime >= nextVotingTime?) equals (yes) then
+:count and print ballot;
+switch (voterCount?)
+case (< 5)
+:print "ALARM: Too few voters!";
+kill
+case (<= 8)
+:resolve votesPositive;
+if (votesPositive < 5 ?) equals (yes) then
+:print "ALARM: Bad water quality!";
+kill
+endif
+:setup ballot;
+case (> 8)
+:print "ALARM: Too many voters!";
+kill
+endswitch
+endif
+}
+endwhile
+-[hidden]->
+kill
+@enduml