aboutsummaryrefslogtreecommitdiff
path: root/ballotbox/ballotbox.puml
blob: d03c65069257a1c71de9144ed0906184b99c2fec (plain)
  1. @startuml
  2. start
  3. partition init {
  4. :setup serial connection;
  5. :setup Bluetooth
  6. * init server background task
  7. * add hook to capture votes;
  8. :setup ballot
  9. * resolve nextVotingTime
  10. * clear votes;
  11. :print "ready";
  12. }
  13. while (repeat every few millisecond)
  14. partition loop {
  15. :resolve currentTime;
  16. if (currentTime >= nextVotingTime?) equals (yes) then
  17. :count and print ballot;
  18. switch (voterCount?)
  19. case (< 5)
  20. :print "ALARM: Too few voters!";
  21. kill
  22. case (<= 8)
  23. :resolve votesPositive;
  24. if (votesPositive < 5 ?) equals (yes) then
  25. :print "ALARM: Bad water quality!";
  26. kill
  27. endif
  28. :setup ballot;
  29. case (> 8)
  30. :print "ALARM: Too many voters!";
  31. kill
  32. endswitch
  33. endif
  34. }
  35. endwhile
  36. -[hidden]->
  37. kill
  38. @enduml