rsmp 0.46.0 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (433) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/copilot-setup-steps.yml +1 -1
  3. data/.github/workflows/rubocop.yaml +1 -1
  4. data/.github/workflows/sus.yaml +1 -1
  5. data/CHANGELOG.md +14 -0
  6. data/Gemfile.lock +5 -5
  7. data/README.md +3 -1
  8. data/documentation/cli.md +225 -0
  9. data/documentation/configuration.md +83 -0
  10. data/lib/rsmp/cli/configuration.rb +30 -0
  11. data/lib/rsmp/cli.rb +45 -45
  12. data/lib/rsmp/collect/command_matcher.rb +13 -4
  13. data/lib/rsmp/collect/status_matcher.rb +14 -4
  14. data/lib/rsmp/command_list.rb +1 -1
  15. data/lib/rsmp/config.rb +63 -0
  16. data/lib/rsmp/convert/export/json_schema/index.rb +64 -0
  17. data/lib/rsmp/convert/export/json_schema/items.rb +9 -1
  18. data/lib/rsmp/convert/export/json_schema/outputs.rb +65 -25
  19. data/lib/rsmp/convert/export/json_schema/values.rb +40 -11
  20. data/lib/rsmp/convert/export/json_schema.rb +3 -1
  21. data/lib/rsmp/message/sxl_codec.rb +194 -0
  22. data/lib/rsmp/message.rb +2 -0
  23. data/lib/rsmp/node/site/connections.rb +80 -0
  24. data/lib/rsmp/node/site/site.rb +21 -35
  25. data/lib/rsmp/node/supervisor/supervisor.rb +42 -0
  26. data/lib/rsmp/options/options.rb +21 -9
  27. data/lib/rsmp/options/schemas/config_common.json +129 -0
  28. data/lib/rsmp/options/schemas/log.json +71 -0
  29. data/lib/rsmp/options/schemas/site.json +12 -57
  30. data/lib/rsmp/options/schemas/supervisor.json +4 -29
  31. data/lib/rsmp/options/schemas/supervisor_site.json +19 -31
  32. data/lib/rsmp/options/schemas/traffic_controller_site.json +1 -2
  33. data/lib/rsmp/options/site_options.rb +31 -23
  34. data/lib/rsmp/options/supervisor_options.rb +1 -0
  35. data/lib/rsmp/proxy/modules/receive.rb +3 -1
  36. data/lib/rsmp/proxy/modules/send.rb +26 -14
  37. data/lib/rsmp/proxy/proxy.rb +17 -0
  38. data/lib/rsmp/proxy/site/connection.rb +79 -0
  39. data/lib/rsmp/proxy/site/modules/commands.rb +24 -1
  40. data/lib/rsmp/proxy/site/site_proxy.rb +6 -15
  41. data/lib/rsmp/proxy/supervisor/modules/commands.rb +55 -0
  42. data/lib/rsmp/proxy/supervisor/modules/message_buffer.rb +0 -5
  43. data/lib/rsmp/proxy/supervisor/modules/status.rb +13 -104
  44. data/lib/rsmp/proxy/supervisor/modules/status_updates.rb +148 -0
  45. data/lib/rsmp/proxy/supervisor/supervisor_proxy.rb +19 -0
  46. data/lib/rsmp/schema.rb +38 -1
  47. data/lib/rsmp/tlc/detector_logic.rb +2 -2
  48. data/lib/rsmp/tlc/modules/helpers.rb +0 -22
  49. data/lib/rsmp/tlc/modules/inputs.rb +4 -3
  50. data/lib/rsmp/tlc/modules/modes.rb +2 -2
  51. data/lib/rsmp/tlc/modules/plans.rb +7 -3
  52. data/lib/rsmp/tlc/modules/system.rb +1 -1
  53. data/lib/rsmp/tlc/proxy/control.rb +19 -19
  54. data/lib/rsmp/tlc/proxy/detectors.rb +3 -3
  55. data/lib/rsmp/tlc/proxy/io.rb +15 -12
  56. data/lib/rsmp/tlc/proxy/plans.rb +14 -14
  57. data/lib/rsmp/tlc/proxy/status.rb +9 -5
  58. data/lib/rsmp/tlc/proxy/system.rb +12 -6
  59. data/lib/rsmp/tlc/signal_group.rb +2 -2
  60. data/lib/rsmp/tlc/supervisor_interface.rb +42 -0
  61. data/lib/rsmp/tlc/traffic_controller_site.rb +1 -18
  62. data/lib/rsmp/version.rb +1 -1
  63. data/lib/rsmp.rb +5 -0
  64. data/schemas/core/3.1.4/command_response.json +11 -0
  65. data/schemas/core/3.1.5/command_response.json +11 -0
  66. data/schemas/core/3.2.0/command_response.json +11 -0
  67. data/schemas/core/3.2.1/command_response.json +11 -0
  68. data/schemas/core/3.2.2/command_response.json +11 -0
  69. data/schemas/core/3.3.0/command_response.json +11 -0
  70. data/schemas/tlc/1.0.10/alarms/A0008.json +21 -15
  71. data/schemas/tlc/1.0.10/alarms/A0201.json +26 -20
  72. data/schemas/tlc/1.0.10/alarms/A0202.json +26 -20
  73. data/schemas/tlc/1.0.10/alarms/A0301.json +69 -63
  74. data/schemas/tlc/1.0.10/alarms/A0302.json +87 -81
  75. data/schemas/tlc/1.0.10/commands/M0001.json +66 -60
  76. data/schemas/tlc/1.0.10/commands/M0002.json +48 -42
  77. data/schemas/tlc/1.0.10/commands/M0003.json +48 -42
  78. data/schemas/tlc/1.0.10/commands/M0004.json +35 -29
  79. data/schemas/tlc/1.0.10/commands/M0005.json +48 -42
  80. data/schemas/tlc/1.0.10/commands/M0006.json +48 -42
  81. data/schemas/tlc/1.0.10/commands/M0007.json +35 -29
  82. data/schemas/tlc/1.0.10/commands/M0008.json +48 -42
  83. data/schemas/tlc/1.0.10/commands/M0010.json +35 -29
  84. data/schemas/tlc/1.0.10/commands/M0011.json +35 -29
  85. data/schemas/tlc/1.0.10/commands/M0012.json +35 -29
  86. data/schemas/tlc/1.0.10/commands/M0013.json +35 -29
  87. data/schemas/tlc/1.0.10/commands/M0019.json +61 -55
  88. data/schemas/tlc/1.0.10/commands/M0103.json +51 -45
  89. data/schemas/tlc/1.0.10/commands/M0104.json +100 -94
  90. data/schemas/tlc/1.0.10/commands/command_requests.json +995 -1
  91. data/schemas/tlc/1.0.10/defs/guards.json +19 -0
  92. data/schemas/tlc/1.0.10/sxl.yaml +56 -56
  93. data/schemas/tlc/1.0.10/sxl_index.json +226 -244
  94. data/schemas/tlc/1.0.13/alarms/A0008.json +21 -15
  95. data/schemas/tlc/1.0.13/alarms/A0201.json +26 -20
  96. data/schemas/tlc/1.0.13/alarms/A0202.json +26 -20
  97. data/schemas/tlc/1.0.13/alarms/A0301.json +69 -63
  98. data/schemas/tlc/1.0.13/alarms/A0302.json +87 -81
  99. data/schemas/tlc/1.0.13/commands/M0001.json +66 -60
  100. data/schemas/tlc/1.0.13/commands/M0002.json +48 -42
  101. data/schemas/tlc/1.0.13/commands/M0003.json +48 -42
  102. data/schemas/tlc/1.0.13/commands/M0004.json +35 -29
  103. data/schemas/tlc/1.0.13/commands/M0005.json +48 -42
  104. data/schemas/tlc/1.0.13/commands/M0006.json +48 -42
  105. data/schemas/tlc/1.0.13/commands/M0007.json +35 -29
  106. data/schemas/tlc/1.0.13/commands/M0008.json +48 -42
  107. data/schemas/tlc/1.0.13/commands/M0010.json +35 -29
  108. data/schemas/tlc/1.0.13/commands/M0011.json +35 -29
  109. data/schemas/tlc/1.0.13/commands/M0012.json +35 -29
  110. data/schemas/tlc/1.0.13/commands/M0013.json +35 -29
  111. data/schemas/tlc/1.0.13/commands/M0014.json +48 -42
  112. data/schemas/tlc/1.0.13/commands/M0015.json +48 -42
  113. data/schemas/tlc/1.0.13/commands/M0016.json +35 -29
  114. data/schemas/tlc/1.0.13/commands/M0017.json +35 -29
  115. data/schemas/tlc/1.0.13/commands/M0018.json +48 -42
  116. data/schemas/tlc/1.0.13/commands/M0019.json +61 -55
  117. data/schemas/tlc/1.0.13/commands/M0103.json +51 -45
  118. data/schemas/tlc/1.0.13/commands/M0104.json +100 -94
  119. data/schemas/tlc/1.0.13/commands/command_requests.json +1293 -1
  120. data/schemas/tlc/1.0.13/defs/guards.json +19 -0
  121. data/schemas/tlc/1.0.13/sxl.yaml +63 -63
  122. data/schemas/tlc/1.0.13/sxl_index.json +280 -298
  123. data/schemas/tlc/1.0.14/alarms/A0008.json +21 -15
  124. data/schemas/tlc/1.0.14/alarms/A0201.json +26 -20
  125. data/schemas/tlc/1.0.14/alarms/A0202.json +26 -20
  126. data/schemas/tlc/1.0.14/alarms/A0301.json +69 -63
  127. data/schemas/tlc/1.0.14/alarms/A0302.json +87 -81
  128. data/schemas/tlc/1.0.14/commands/M0001.json +66 -60
  129. data/schemas/tlc/1.0.14/commands/M0002.json +48 -42
  130. data/schemas/tlc/1.0.14/commands/M0003.json +48 -42
  131. data/schemas/tlc/1.0.14/commands/M0004.json +35 -29
  132. data/schemas/tlc/1.0.14/commands/M0005.json +48 -42
  133. data/schemas/tlc/1.0.14/commands/M0006.json +48 -42
  134. data/schemas/tlc/1.0.14/commands/M0007.json +35 -29
  135. data/schemas/tlc/1.0.14/commands/M0008.json +48 -42
  136. data/schemas/tlc/1.0.14/commands/M0010.json +35 -29
  137. data/schemas/tlc/1.0.14/commands/M0011.json +35 -29
  138. data/schemas/tlc/1.0.14/commands/M0012.json +35 -29
  139. data/schemas/tlc/1.0.14/commands/M0013.json +35 -29
  140. data/schemas/tlc/1.0.14/commands/M0014.json +48 -42
  141. data/schemas/tlc/1.0.14/commands/M0015.json +48 -42
  142. data/schemas/tlc/1.0.14/commands/M0016.json +35 -29
  143. data/schemas/tlc/1.0.14/commands/M0017.json +35 -29
  144. data/schemas/tlc/1.0.14/commands/M0018.json +48 -42
  145. data/schemas/tlc/1.0.14/commands/M0019.json +61 -55
  146. data/schemas/tlc/1.0.14/commands/M0103.json +51 -45
  147. data/schemas/tlc/1.0.14/commands/M0104.json +100 -94
  148. data/schemas/tlc/1.0.14/commands/command_requests.json +1293 -1
  149. data/schemas/tlc/1.0.14/defs/guards.json +19 -0
  150. data/schemas/tlc/1.0.14/sxl.yaml +63 -63
  151. data/schemas/tlc/1.0.14/sxl_index.json +304 -322
  152. data/schemas/tlc/1.0.15/alarms/A0008.json +21 -15
  153. data/schemas/tlc/1.0.15/alarms/A0201.json +26 -20
  154. data/schemas/tlc/1.0.15/alarms/A0202.json +26 -20
  155. data/schemas/tlc/1.0.15/alarms/A0301.json +69 -63
  156. data/schemas/tlc/1.0.15/alarms/A0302.json +87 -81
  157. data/schemas/tlc/1.0.15/commands/M0001.json +66 -60
  158. data/schemas/tlc/1.0.15/commands/M0002.json +48 -42
  159. data/schemas/tlc/1.0.15/commands/M0003.json +48 -42
  160. data/schemas/tlc/1.0.15/commands/M0004.json +35 -29
  161. data/schemas/tlc/1.0.15/commands/M0005.json +48 -42
  162. data/schemas/tlc/1.0.15/commands/M0006.json +48 -42
  163. data/schemas/tlc/1.0.15/commands/M0007.json +35 -29
  164. data/schemas/tlc/1.0.15/commands/M0008.json +48 -42
  165. data/schemas/tlc/1.0.15/commands/M0010.json +35 -29
  166. data/schemas/tlc/1.0.15/commands/M0011.json +35 -29
  167. data/schemas/tlc/1.0.15/commands/M0012.json +35 -29
  168. data/schemas/tlc/1.0.15/commands/M0013.json +35 -29
  169. data/schemas/tlc/1.0.15/commands/M0014.json +48 -42
  170. data/schemas/tlc/1.0.15/commands/M0015.json +48 -42
  171. data/schemas/tlc/1.0.15/commands/M0016.json +35 -29
  172. data/schemas/tlc/1.0.15/commands/M0017.json +35 -29
  173. data/schemas/tlc/1.0.15/commands/M0018.json +48 -42
  174. data/schemas/tlc/1.0.15/commands/M0019.json +61 -55
  175. data/schemas/tlc/1.0.15/commands/M0020.json +61 -55
  176. data/schemas/tlc/1.0.15/commands/M0021.json +35 -29
  177. data/schemas/tlc/1.0.15/commands/M0103.json +51 -45
  178. data/schemas/tlc/1.0.15/commands/M0104.json +100 -94
  179. data/schemas/tlc/1.0.15/commands/command_requests.json +1425 -1
  180. data/schemas/tlc/1.0.15/defs/guards.json +19 -0
  181. data/schemas/tlc/1.0.15/sxl.yaml +66 -66
  182. data/schemas/tlc/1.0.15/sxl_index.json +330 -350
  183. data/schemas/tlc/1.0.7/alarms/A0008.json +21 -15
  184. data/schemas/tlc/1.0.7/alarms/A0201.json +26 -20
  185. data/schemas/tlc/1.0.7/alarms/A0202.json +26 -20
  186. data/schemas/tlc/1.0.7/alarms/A0301.json +69 -63
  187. data/schemas/tlc/1.0.7/alarms/A0302.json +87 -81
  188. data/schemas/tlc/1.0.7/commands/M0001.json +66 -60
  189. data/schemas/tlc/1.0.7/commands/M0002.json +48 -42
  190. data/schemas/tlc/1.0.7/commands/M0003.json +48 -42
  191. data/schemas/tlc/1.0.7/commands/M0004.json +35 -29
  192. data/schemas/tlc/1.0.7/commands/M0005.json +48 -42
  193. data/schemas/tlc/1.0.7/commands/M0006.json +48 -42
  194. data/schemas/tlc/1.0.7/commands/M0007.json +35 -29
  195. data/schemas/tlc/1.0.7/commands/M0008.json +48 -42
  196. data/schemas/tlc/1.0.7/commands/M0010.json +35 -29
  197. data/schemas/tlc/1.0.7/commands/M0011.json +35 -29
  198. data/schemas/tlc/1.0.7/commands/M0019.json +61 -55
  199. data/schemas/tlc/1.0.7/commands/M0103.json +51 -45
  200. data/schemas/tlc/1.0.7/commands/M0104.json +100 -94
  201. data/schemas/tlc/1.0.7/commands/command_requests.json +895 -1
  202. data/schemas/tlc/1.0.7/defs/guards.json +19 -0
  203. data/schemas/tlc/1.0.7/sxl.yaml +58 -58
  204. data/schemas/tlc/1.0.7/sxl_index.json +228 -246
  205. data/schemas/tlc/1.0.8/alarms/A0008.json +21 -15
  206. data/schemas/tlc/1.0.8/alarms/A0201.json +26 -20
  207. data/schemas/tlc/1.0.8/alarms/A0202.json +26 -20
  208. data/schemas/tlc/1.0.8/alarms/A0301.json +69 -63
  209. data/schemas/tlc/1.0.8/alarms/A0302.json +87 -81
  210. data/schemas/tlc/1.0.8/commands/M0001.json +66 -60
  211. data/schemas/tlc/1.0.8/commands/M0002.json +48 -42
  212. data/schemas/tlc/1.0.8/commands/M0003.json +48 -42
  213. data/schemas/tlc/1.0.8/commands/M0004.json +35 -29
  214. data/schemas/tlc/1.0.8/commands/M0005.json +48 -42
  215. data/schemas/tlc/1.0.8/commands/M0006.json +48 -42
  216. data/schemas/tlc/1.0.8/commands/M0007.json +35 -29
  217. data/schemas/tlc/1.0.8/commands/M0008.json +48 -42
  218. data/schemas/tlc/1.0.8/commands/M0010.json +35 -29
  219. data/schemas/tlc/1.0.8/commands/M0011.json +35 -29
  220. data/schemas/tlc/1.0.8/commands/M0012.json +35 -29
  221. data/schemas/tlc/1.0.8/commands/M0013.json +35 -29
  222. data/schemas/tlc/1.0.8/commands/M0019.json +61 -55
  223. data/schemas/tlc/1.0.8/commands/M0103.json +51 -45
  224. data/schemas/tlc/1.0.8/commands/M0104.json +100 -94
  225. data/schemas/tlc/1.0.8/commands/command_requests.json +995 -1
  226. data/schemas/tlc/1.0.8/defs/guards.json +19 -0
  227. data/schemas/tlc/1.0.8/sxl.yaml +56 -56
  228. data/schemas/tlc/1.0.8/sxl_index.json +226 -244
  229. data/schemas/tlc/1.0.9/alarms/A0008.json +21 -15
  230. data/schemas/tlc/1.0.9/alarms/A0201.json +26 -20
  231. data/schemas/tlc/1.0.9/alarms/A0202.json +26 -20
  232. data/schemas/tlc/1.0.9/alarms/A0301.json +69 -63
  233. data/schemas/tlc/1.0.9/alarms/A0302.json +87 -81
  234. data/schemas/tlc/1.0.9/commands/M0001.json +66 -60
  235. data/schemas/tlc/1.0.9/commands/M0002.json +48 -42
  236. data/schemas/tlc/1.0.9/commands/M0003.json +48 -42
  237. data/schemas/tlc/1.0.9/commands/M0004.json +35 -29
  238. data/schemas/tlc/1.0.9/commands/M0005.json +48 -42
  239. data/schemas/tlc/1.0.9/commands/M0006.json +48 -42
  240. data/schemas/tlc/1.0.9/commands/M0007.json +35 -29
  241. data/schemas/tlc/1.0.9/commands/M0008.json +48 -42
  242. data/schemas/tlc/1.0.9/commands/M0010.json +35 -29
  243. data/schemas/tlc/1.0.9/commands/M0011.json +35 -29
  244. data/schemas/tlc/1.0.9/commands/M0012.json +35 -29
  245. data/schemas/tlc/1.0.9/commands/M0013.json +35 -29
  246. data/schemas/tlc/1.0.9/commands/M0019.json +61 -55
  247. data/schemas/tlc/1.0.9/commands/M0103.json +51 -45
  248. data/schemas/tlc/1.0.9/commands/M0104.json +100 -94
  249. data/schemas/tlc/1.0.9/commands/command_requests.json +995 -1
  250. data/schemas/tlc/1.0.9/defs/guards.json +19 -0
  251. data/schemas/tlc/1.0.9/sxl.yaml +56 -56
  252. data/schemas/tlc/1.0.9/sxl_index.json +226 -244
  253. data/schemas/tlc/1.1.0/alarms/A0007.json +25 -19
  254. data/schemas/tlc/1.1.0/alarms/A0008.json +21 -15
  255. data/schemas/tlc/1.1.0/alarms/A0201.json +26 -20
  256. data/schemas/tlc/1.1.0/alarms/A0202.json +26 -20
  257. data/schemas/tlc/1.1.0/alarms/A0301.json +69 -63
  258. data/schemas/tlc/1.1.0/alarms/A0302.json +87 -81
  259. data/schemas/tlc/1.1.0/alarms/A0303.json +69 -63
  260. data/schemas/tlc/1.1.0/alarms/A0304.json +87 -81
  261. data/schemas/tlc/1.1.0/commands/M0001.json +66 -60
  262. data/schemas/tlc/1.1.0/commands/M0002.json +48 -42
  263. data/schemas/tlc/1.1.0/commands/M0003.json +48 -42
  264. data/schemas/tlc/1.1.0/commands/M0004.json +35 -29
  265. data/schemas/tlc/1.1.0/commands/M0005.json +48 -42
  266. data/schemas/tlc/1.1.0/commands/M0006.json +48 -42
  267. data/schemas/tlc/1.1.0/commands/M0007.json +35 -29
  268. data/schemas/tlc/1.1.0/commands/M0008.json +48 -42
  269. data/schemas/tlc/1.1.0/commands/M0010.json +35 -29
  270. data/schemas/tlc/1.1.0/commands/M0011.json +35 -29
  271. data/schemas/tlc/1.1.0/commands/M0012.json +35 -29
  272. data/schemas/tlc/1.1.0/commands/M0013.json +35 -29
  273. data/schemas/tlc/1.1.0/commands/M0014.json +48 -42
  274. data/schemas/tlc/1.1.0/commands/M0015.json +48 -42
  275. data/schemas/tlc/1.1.0/commands/M0016.json +35 -29
  276. data/schemas/tlc/1.1.0/commands/M0017.json +35 -29
  277. data/schemas/tlc/1.1.0/commands/M0018.json +48 -42
  278. data/schemas/tlc/1.1.0/commands/M0019.json +61 -55
  279. data/schemas/tlc/1.1.0/commands/M0020.json +61 -55
  280. data/schemas/tlc/1.1.0/commands/M0021.json +35 -29
  281. data/schemas/tlc/1.1.0/commands/M0022.json +194 -188
  282. data/schemas/tlc/1.1.0/commands/M0023.json +35 -29
  283. data/schemas/tlc/1.1.0/commands/M0103.json +51 -45
  284. data/schemas/tlc/1.1.0/commands/M0104.json +100 -94
  285. data/schemas/tlc/1.1.0/commands/command_requests.json +1525 -1
  286. data/schemas/tlc/1.1.0/defs/guards.json +19 -0
  287. data/schemas/tlc/1.1.0/statuses/S0033.json +2 -2
  288. data/schemas/tlc/1.1.0/sxl.yaml +75 -74
  289. data/schemas/tlc/1.1.0/sxl_index.json +391 -398
  290. data/schemas/tlc/1.2.0/alarms/A0007.json +25 -19
  291. data/schemas/tlc/1.2.0/alarms/A0008.json +21 -15
  292. data/schemas/tlc/1.2.0/alarms/A0201.json +26 -20
  293. data/schemas/tlc/1.2.0/alarms/A0202.json +26 -20
  294. data/schemas/tlc/1.2.0/alarms/A0301.json +69 -63
  295. data/schemas/tlc/1.2.0/alarms/A0302.json +87 -81
  296. data/schemas/tlc/1.2.0/alarms/A0303.json +69 -63
  297. data/schemas/tlc/1.2.0/alarms/A0304.json +87 -81
  298. data/schemas/tlc/1.2.0/commands/M0001.json +66 -60
  299. data/schemas/tlc/1.2.0/commands/M0002.json +48 -42
  300. data/schemas/tlc/1.2.0/commands/M0003.json +48 -42
  301. data/schemas/tlc/1.2.0/commands/M0004.json +35 -29
  302. data/schemas/tlc/1.2.0/commands/M0005.json +48 -42
  303. data/schemas/tlc/1.2.0/commands/M0006.json +48 -42
  304. data/schemas/tlc/1.2.0/commands/M0007.json +35 -29
  305. data/schemas/tlc/1.2.0/commands/M0008.json +48 -42
  306. data/schemas/tlc/1.2.0/commands/M0010.json +35 -29
  307. data/schemas/tlc/1.2.0/commands/M0011.json +35 -29
  308. data/schemas/tlc/1.2.0/commands/M0012.json +35 -29
  309. data/schemas/tlc/1.2.0/commands/M0013.json +35 -29
  310. data/schemas/tlc/1.2.0/commands/M0014.json +48 -42
  311. data/schemas/tlc/1.2.0/commands/M0015.json +48 -42
  312. data/schemas/tlc/1.2.0/commands/M0016.json +35 -29
  313. data/schemas/tlc/1.2.0/commands/M0017.json +35 -29
  314. data/schemas/tlc/1.2.0/commands/M0018.json +48 -42
  315. data/schemas/tlc/1.2.0/commands/M0019.json +61 -55
  316. data/schemas/tlc/1.2.0/commands/M0020.json +61 -55
  317. data/schemas/tlc/1.2.0/commands/M0021.json +35 -29
  318. data/schemas/tlc/1.2.0/commands/M0022.json +194 -188
  319. data/schemas/tlc/1.2.0/commands/M0023.json +35 -29
  320. data/schemas/tlc/1.2.0/commands/M0103.json +51 -45
  321. data/schemas/tlc/1.2.0/commands/M0104.json +100 -94
  322. data/schemas/tlc/1.2.0/commands/command_requests.json +1525 -1
  323. data/schemas/tlc/1.2.0/defs/guards.json +19 -0
  324. data/schemas/tlc/1.2.0/statuses/S0033.json +2 -2
  325. data/schemas/tlc/1.2.0/sxl.yaml +77 -76
  326. data/schemas/tlc/1.2.0/sxl_index.json +401 -397
  327. data/schemas/tlc/1.2.1/alarms/A0007.json +25 -19
  328. data/schemas/tlc/1.2.1/alarms/A0008.json +21 -15
  329. data/schemas/tlc/1.2.1/alarms/A0201.json +26 -20
  330. data/schemas/tlc/1.2.1/alarms/A0202.json +26 -20
  331. data/schemas/tlc/1.2.1/alarms/A0301.json +69 -63
  332. data/schemas/tlc/1.2.1/alarms/A0302.json +87 -81
  333. data/schemas/tlc/1.2.1/alarms/A0303.json +69 -63
  334. data/schemas/tlc/1.2.1/alarms/A0304.json +87 -81
  335. data/schemas/tlc/1.2.1/commands/M0001.json +66 -60
  336. data/schemas/tlc/1.2.1/commands/M0002.json +48 -42
  337. data/schemas/tlc/1.2.1/commands/M0003.json +48 -42
  338. data/schemas/tlc/1.2.1/commands/M0004.json +35 -29
  339. data/schemas/tlc/1.2.1/commands/M0005.json +48 -42
  340. data/schemas/tlc/1.2.1/commands/M0006.json +48 -42
  341. data/schemas/tlc/1.2.1/commands/M0007.json +35 -29
  342. data/schemas/tlc/1.2.1/commands/M0008.json +48 -42
  343. data/schemas/tlc/1.2.1/commands/M0010.json +35 -29
  344. data/schemas/tlc/1.2.1/commands/M0011.json +35 -29
  345. data/schemas/tlc/1.2.1/commands/M0012.json +35 -29
  346. data/schemas/tlc/1.2.1/commands/M0013.json +35 -29
  347. data/schemas/tlc/1.2.1/commands/M0014.json +48 -42
  348. data/schemas/tlc/1.2.1/commands/M0015.json +48 -42
  349. data/schemas/tlc/1.2.1/commands/M0016.json +35 -29
  350. data/schemas/tlc/1.2.1/commands/M0017.json +35 -29
  351. data/schemas/tlc/1.2.1/commands/M0018.json +48 -42
  352. data/schemas/tlc/1.2.1/commands/M0019.json +61 -55
  353. data/schemas/tlc/1.2.1/commands/M0020.json +61 -55
  354. data/schemas/tlc/1.2.1/commands/M0021.json +35 -29
  355. data/schemas/tlc/1.2.1/commands/M0022.json +194 -188
  356. data/schemas/tlc/1.2.1/commands/M0023.json +35 -29
  357. data/schemas/tlc/1.2.1/commands/M0103.json +51 -45
  358. data/schemas/tlc/1.2.1/commands/M0104.json +100 -94
  359. data/schemas/tlc/1.2.1/commands/command_requests.json +1525 -1
  360. data/schemas/tlc/1.2.1/defs/guards.json +19 -0
  361. data/schemas/tlc/1.2.1/statuses/S0033.json +2 -2
  362. data/schemas/tlc/1.2.1/sxl.yaml +77 -76
  363. data/schemas/tlc/1.2.1/sxl_index.json +401 -397
  364. data/schemas/tlc/1.3.0/alarms/A0007.json +25 -19
  365. data/schemas/tlc/1.3.0/alarms/A0008.json +21 -15
  366. data/schemas/tlc/1.3.0/alarms/A0201.json +26 -20
  367. data/schemas/tlc/1.3.0/alarms/A0202.json +26 -20
  368. data/schemas/tlc/1.3.0/alarms/A0301.json +69 -63
  369. data/schemas/tlc/1.3.0/alarms/A0302.json +87 -81
  370. data/schemas/tlc/1.3.0/alarms/A0303.json +70 -64
  371. data/schemas/tlc/1.3.0/alarms/A0304.json +88 -82
  372. data/schemas/tlc/1.3.0/commands/M0001.json +66 -60
  373. data/schemas/tlc/1.3.0/commands/M0002.json +48 -42
  374. data/schemas/tlc/1.3.0/commands/M0003.json +48 -42
  375. data/schemas/tlc/1.3.0/commands/M0004.json +35 -29
  376. data/schemas/tlc/1.3.0/commands/M0005.json +48 -42
  377. data/schemas/tlc/1.3.0/commands/M0006.json +48 -42
  378. data/schemas/tlc/1.3.0/commands/M0007.json +35 -29
  379. data/schemas/tlc/1.3.0/commands/M0008.json +61 -55
  380. data/schemas/tlc/1.3.0/commands/M0010.json +35 -29
  381. data/schemas/tlc/1.3.0/commands/M0011.json +35 -29
  382. data/schemas/tlc/1.3.0/commands/M0012.json +35 -29
  383. data/schemas/tlc/1.3.0/commands/M0013.json +36 -30
  384. data/schemas/tlc/1.3.0/commands/M0014.json +48 -42
  385. data/schemas/tlc/1.3.0/commands/M0015.json +48 -42
  386. data/schemas/tlc/1.3.0/commands/M0016.json +35 -29
  387. data/schemas/tlc/1.3.0/commands/M0017.json +35 -29
  388. data/schemas/tlc/1.3.0/commands/M0018.json +48 -42
  389. data/schemas/tlc/1.3.0/commands/M0019.json +61 -55
  390. data/schemas/tlc/1.3.0/commands/M0020.json +61 -55
  391. data/schemas/tlc/1.3.0/commands/M0021.json +35 -29
  392. data/schemas/tlc/1.3.0/commands/M0022.json +195 -189
  393. data/schemas/tlc/1.3.0/commands/M0023.json +35 -29
  394. data/schemas/tlc/1.3.0/commands/M0024.json +21 -15
  395. data/schemas/tlc/1.3.0/commands/M0103.json +51 -45
  396. data/schemas/tlc/1.3.0/commands/M0104.json +100 -94
  397. data/schemas/tlc/1.3.0/commands/command_requests.json +1559 -1
  398. data/schemas/tlc/1.3.0/defs/guards.json +19 -0
  399. data/schemas/tlc/1.3.0/statuses/S0001.json +4 -4
  400. data/schemas/tlc/1.3.0/statuses/S0005.json +3 -3
  401. data/schemas/tlc/1.3.0/statuses/S0006.json +2 -2
  402. data/schemas/tlc/1.3.0/statuses/S0007.json +1 -1
  403. data/schemas/tlc/1.3.0/statuses/S0008.json +1 -1
  404. data/schemas/tlc/1.3.0/statuses/S0009.json +1 -1
  405. data/schemas/tlc/1.3.0/statuses/S0010.json +1 -1
  406. data/schemas/tlc/1.3.0/statuses/S0011.json +1 -1
  407. data/schemas/tlc/1.3.0/statuses/S0012.json +1 -1
  408. data/schemas/tlc/1.3.0/statuses/S0013.json +1 -1
  409. data/schemas/tlc/1.3.0/statuses/S0014.json +1 -1
  410. data/schemas/tlc/1.3.0/statuses/S0015.json +1 -1
  411. data/schemas/tlc/1.3.0/statuses/S0016.json +1 -1
  412. data/schemas/tlc/1.3.0/statuses/S0017.json +1 -1
  413. data/schemas/tlc/1.3.0/statuses/S0019.json +1 -1
  414. data/schemas/tlc/1.3.0/statuses/S0020.json +1 -1
  415. data/schemas/tlc/1.3.0/statuses/S0025.json +2 -2
  416. data/schemas/tlc/1.3.0/statuses/S0027.json +1 -1
  417. data/schemas/tlc/1.3.0/statuses/S0032.json +2 -2
  418. data/schemas/tlc/1.3.0/statuses/S0033.json +5 -5
  419. data/schemas/tlc/1.3.0/statuses/S0034.json +1 -1
  420. data/schemas/tlc/1.3.0/statuses/S0035.json +1 -1
  421. data/schemas/tlc/1.3.0/statuses/S0091.json +1 -1
  422. data/schemas/tlc/1.3.0/statuses/S0092.json +1 -1
  423. data/schemas/tlc/1.3.0/statuses/S0096.json +6 -6
  424. data/schemas/tlc/1.3.0/statuses/S0201.json +1 -1
  425. data/schemas/tlc/1.3.0/statuses/S0202.json +1 -1
  426. data/schemas/tlc/1.3.0/statuses/S0203.json +1 -1
  427. data/schemas/tlc/1.3.0/statuses/S0204.json +9 -9
  428. data/schemas/tlc/1.3.0/statuses/S0205.json +1 -1
  429. data/schemas/tlc/1.3.0/statuses/S0206.json +1 -1
  430. data/schemas/tlc/1.3.0/statuses/S0207.json +1 -1
  431. data/schemas/tlc/1.3.0/statuses/S0208.json +9 -9
  432. data/schemas/tlc/1.3.0/sxl_index.json +408 -402
  433. metadata +11 -1
@@ -0,0 +1,148 @@
1
+ module RSMP
2
+ class SupervisorProxy < Proxy
3
+ module Modules
4
+ # Periodic and on-change status update handling.
5
+ module StatusUpdates
6
+ PrecomputedStatusValue = Struct.new(:value)
7
+
8
+ def fetch_last_sent_status(component, code, name)
9
+ @last_status_sent&.dig component, code, name
10
+ end
11
+
12
+ def store_last_sent_status(message)
13
+ component_id = message.attribute('cId')
14
+ @last_status_sent ||= {}
15
+ @last_status_sent[component_id] ||= {}
16
+ message.attribute('sS').each { |item| store_last_sent_status_item(component_id, item) }
17
+ end
18
+
19
+ def store_last_sent_status_item(component_id, item)
20
+ @last_status_sent[component_id][item['sCI']] ||= {}
21
+ @last_status_sent[component_id][item['sCI']][item['n']] = item['s']
22
+ end
23
+
24
+ def check_on_change_update(subscription, component, code, name)
25
+ return [nil, false] unless subscription[:interval].zero?
26
+
27
+ current = current_status_value(component, code, name)
28
+ last_sent = fetch_last_sent_status component.c_id, code, name
29
+ [current, encode_status_value(code, name, current) != last_sent]
30
+ end
31
+
32
+ def current_status_value(component, code, name)
33
+ return unless component
34
+
35
+ value, quality = *(component.get_status code, name)
36
+ rsmpify_value(value, quality)
37
+ end
38
+
39
+ def encode_status_value(code, name, value)
40
+ message = { 'type' => 'StatusUpdate', 'sS' => [{ 'sCI' => code, 'n' => name }] }
41
+ type, version = RSMP::Schema.resolve_sxl(message, schemas: schemas)
42
+ descriptor = RSMP::Schema.sxl_argument_descriptor(type, version, :statuses, code, name)
43
+ descriptor ? RSMP::Message.encode_sxl_value(value, descriptor) : value
44
+ end
45
+
46
+ def interval_update_due?(subscription, now)
47
+ return true if subscription[:last_sent_at].nil?
48
+
49
+ (now - subscription[:last_sent_at]) >= subscription[:interval]
50
+ end
51
+
52
+ def check_status_subscription(subscription, component, code, name, now)
53
+ current, should_send = check_on_change_update(subscription, component, code, name)
54
+ should_send ||= interval_update_due?(subscription, now) if subscription[:interval].positive?
55
+ return [nil, false] unless should_send
56
+
57
+ subscription[:last_sent_at] = now
58
+ [current, true]
59
+ end
60
+
61
+ def status_update_timer(now)
62
+ send_status_updates status_updates_due(now)
63
+ end
64
+
65
+ def status_updates_due(now)
66
+ update_list = {}
67
+ @status_subscriptions.each_pair do |component_id, by_code|
68
+ collect_component_status_updates(update_list, component_id, by_code, now)
69
+ end
70
+ update_list
71
+ end
72
+
73
+ def collect_component_status_updates(update_list, component_id, by_code, now)
74
+ component = @site.find_component component_id
75
+ by_code.each_pair do |code, by_name|
76
+ by_name.each_pair do |name, subscription|
77
+ current, should_send = check_status_subscription(subscription, component, code, name, now)
78
+ next unless should_send
79
+
80
+ value = precomputed_status_value(subscription, current)
81
+ add_status_update(update_list, component.c_id, code, name, value)
82
+ end
83
+ end
84
+ end
85
+
86
+ def add_status_update(update_list, component_id, code, name, value)
87
+ update_list[component_id] ||= {}
88
+ update_list[component_id][code] ||= {}
89
+ update_list[component_id][code][name] = value
90
+ end
91
+
92
+ def precomputed_status_value(subscription, current)
93
+ PrecomputedStatusValue.new(current) if subscription[:interval].zero?
94
+ end
95
+
96
+ def build_status_list(component, by_code)
97
+ by_code.each_pair.with_object([]) do |(code, names), ss|
98
+ each_status_name(names) do |status_name, value|
99
+ ss << build_status_item(component, code, status_name, value)
100
+ end
101
+ end
102
+ end
103
+
104
+ def each_status_name(names, &block)
105
+ if names.respond_to?(:each_pair)
106
+ names.each_pair(&block)
107
+ else
108
+ names.each { |status_name| block.call(status_name, nil) }
109
+ end
110
+ end
111
+
112
+ def build_status_item(component, code, status_name, value)
113
+ value, quality = status_item_value(component, code, status_name, value)
114
+ { 'sCI' => code, 'n' => status_name, 's' => rsmpify_value(value, quality), 'q' => quality }
115
+ end
116
+
117
+ def status_item_value(component, code, status_name, value)
118
+ return [value.value, 'recent'] if value.is_a?(PrecomputedStatusValue)
119
+
120
+ component.get_status code, status_name
121
+ rescue UnknownStatus => e
122
+ log e.to_s, level: :warning
123
+ [nil, 'unknown']
124
+ end
125
+
126
+ def send_status_updates(update_list)
127
+ now = clock.to_s
128
+ update_list.each_pair do |component_id, by_code|
129
+ send_component_status_update(component_id, by_code, now)
130
+ end
131
+ end
132
+
133
+ def send_component_status_update(component_id, by_code, now)
134
+ component = @site.find_component component_id
135
+ update = StatusUpdate.new({
136
+ 'cId' => component_id,
137
+ 'sTs' => now,
138
+ 'sS' => build_status_list(component, by_code)
139
+ })
140
+ apply_nts_message_attributes update
141
+ send_message update
142
+ store_last_sent_status update
143
+ component.status_updates_sent
144
+ end
145
+ end
146
+ end
147
+ end
148
+ end
@@ -28,6 +28,11 @@ module RSMP
28
28
  # handle communication
29
29
  # if disconnected, then try to reconnect
30
30
  def run
31
+ if @protocol
32
+ run_accepted_connection
33
+ return
34
+ end
35
+
31
36
  loop do
32
37
  connect
33
38
  start_reader
@@ -49,6 +54,20 @@ module RSMP
49
54
  end
50
55
  end
51
56
 
57
+ def run_accepted_connection
58
+ self.state = :connected
59
+ start_reader
60
+ start_handshake
61
+ wait_for_reader
62
+ rescue RSMP::ConnectionError => e
63
+ log e, level: :error
64
+ rescue StandardError => e
65
+ distribute_error e, level: :internal
66
+ ensure
67
+ close
68
+ stop_subtasks
69
+ end
70
+
52
71
  def start_handshake
53
72
  send_version_request @site_settings['site_id'], core_versions
54
73
  end
data/lib/rsmp/schema.rb CHANGED
@@ -218,7 +218,44 @@ module RSMP
218
218
  # raises an error if the schema type/version is not found, or has no status catalogue
219
219
  def self.status_catalogue(type, version)
220
220
  sxl_catalogue(type, version, :statuses).transform_keys(&:to_sym).transform_values do |status|
221
- status.fetch('arguments', []).map(&:to_sym)
221
+ (argument_names(status['required']) + argument_names(status['optional'])).sort.map(&:to_sym)
222
+ end
223
+ end
224
+
225
+ def self.argument_names(arguments)
226
+ case arguments
227
+ when Hash
228
+ arguments.keys
229
+ when Array
230
+ arguments
231
+ else
232
+ []
233
+ end
234
+ end
235
+
236
+ def self.sxl_catalogue_item(type, version, kind, code, options = {})
237
+ version = sanitize_version(version.to_s) if options[:lenient]
238
+ catalogue = sxl_catalogue(type, version, kind)
239
+ prefix = sxl_prefix(type, version, options)
240
+ code = code.to_s
241
+ unprefixed = prefix && code.start_with?(prefix) ? code[prefix.length..] : code
242
+ catalogue[code] || catalogue[code.to_sym] ||
243
+ catalogue[unprefixed] || catalogue[unprefixed.to_sym]
244
+ end
245
+
246
+ def self.sxl_argument_descriptor(type, version, kind, code, name)
247
+ item = sxl_catalogue_item(type, version, kind, code)
248
+ return unless item
249
+
250
+ argument_descriptor(item['required'], name) || argument_descriptor(item['optional'], name)
251
+ end
252
+
253
+ def self.argument_descriptor(arguments, name)
254
+ return unless arguments
255
+
256
+ case arguments
257
+ when Hash
258
+ arguments[name] || arguments[name.to_sym]
222
259
  end
223
260
  end
224
261
 
@@ -66,8 +66,8 @@ module RSMP
66
66
 
67
67
  def handle_m0008(arg, _options = {})
68
68
  @node.verify_security_code 2, arg['securityCode']
69
- status = arg['status'] == 'True'
70
- mode = arg['mode'] == 'True'
69
+ status = arg['status']
70
+ mode = arg['mode']
71
71
  force_detector_logic status, mode
72
72
  arg
73
73
  end
@@ -10,28 +10,6 @@ module RSMP
10
10
  plan
11
11
  end
12
12
 
13
- def string_to_bool(bool_str)
14
- case bool_str
15
- when 'True'
16
- true
17
- when 'False'
18
- false
19
- else
20
- raise RSMP::MessageRejected, "Invalid boolean '#{bool}', must be 'True' or 'False'"
21
- end
22
- end
23
-
24
- def bool_string_to_digit(bool)
25
- case bool
26
- when 'True'
27
- '1'
28
- when 'False'
29
- '0'
30
- else
31
- raise RSMP::MessageRejected, "Invalid boolean '#{bool}', must be 'True' or 'False'"
32
- end
33
- end
34
-
35
13
  def bool_to_digit(bool)
36
14
  bool ? '1' : '0'
37
15
  end
@@ -43,7 +43,7 @@ module RSMP
43
43
  def handle_m0006(arg, _options = {})
44
44
  @node.verify_security_code 2, arg['securityCode']
45
45
  input = arg['input'].to_i
46
- status = string_to_bool arg['status']
46
+ status = arg['status']
47
47
  raise MessageRejected, "Input must be in the range 1-#{@inputs.size}" unless input.between?(1, @inputs.size)
48
48
 
49
49
  if status
@@ -72,6 +72,7 @@ module RSMP
72
72
  def parse_input_status(status_string)
73
73
  set = []
74
74
  clear = []
75
+ status_string = status_string.join(',') if status_string.is_a?(Array)
75
76
  status_string.split(';').each do |part|
76
77
  offset, set_bits, clear_bits = part.split(',').map(&:to_i)
77
78
  extract_input_bits(set_bits, offset, set)
@@ -136,8 +137,8 @@ module RSMP
136
137
  def handle_m0019(arg, _options = {})
137
138
  @node.verify_security_code 2, arg['securityCode']
138
139
  input = arg['input'].to_i
139
- force = string_to_bool arg['status']
140
- forced_value = string_to_bool arg['inputValue']
140
+ force = arg['status']
141
+ forced_value = arg['inputValue']
141
142
  raise MessageRejected, "Input must be in the range 1-#{@inputs.size}" unless input.between?(1, @inputs.size)
142
143
 
143
144
  if force
@@ -74,7 +74,7 @@ module RSMP
74
74
  def handle_m0005(arg, _options = {})
75
75
  @node.verify_security_code 2, arg['securityCode']
76
76
  route = arg['emergencyroute'].to_i
77
- enable = (arg['status'] == 'True')
77
+ enable = arg['status']
78
78
  @last_emergency_route = route
79
79
 
80
80
  if enable
@@ -144,7 +144,7 @@ module RSMP
144
144
  when 'intersection'
145
145
  TrafficControllerSite.make_status @intersection
146
146
  when 'status'
147
- TrafficControllerSite.make_status TrafficControllerSite.to_rmsp_bool(@function_position == 'YellowFlash')
147
+ TrafficControllerSite.make_status @function_position == 'YellowFlash'
148
148
  when 'source'
149
149
  TrafficControllerSite.make_status @function_position_source
150
150
  end
@@ -14,7 +14,7 @@ module RSMP
14
14
  # M0002 - Set current time plan
15
15
  def handle_m0002(arg, _options = {})
16
16
  @node.verify_security_code 2, arg['securityCode']
17
- if TrafficControllerSite.from_rsmp_bool?(arg['status'])
17
+ if arg['status']
18
18
  switch_plan arg['timeplan'], source: 'forced'
19
19
  else
20
20
  switch_plan 0, source: 'startup' # TODO: use clock/calender
@@ -55,7 +55,7 @@ module RSMP
55
55
  def handle_m0014(arg, _options = {})
56
56
  @node.verify_security_code 2, arg['securityCode']
57
57
  plan = find_plan arg['plan']
58
- arg['status'].split(',').each do |item|
58
+ status_items(arg['status']).each do |item|
59
59
  matched = /(\d+)-(\d+)/.match item
60
60
  band = matched[1].to_i
61
61
  value = matched[2].to_i
@@ -77,7 +77,7 @@ module RSMP
77
77
  # M0017 - Set time tables
78
78
  def handle_m0017(arg, _options = {})
79
79
  @node.verify_security_code 2, arg['securityCode']
80
- arg['status'].split(',').each do |item|
80
+ status_items(arg['status']).each do |item|
81
81
  elems = item.split('-')
82
82
  nr = elems[0].to_i
83
83
  plan = elems[1].to_i
@@ -119,6 +119,10 @@ module RSMP
119
119
  @dynamic_bands_timeout = timeout
120
120
  end
121
121
 
122
+ def status_items(status)
123
+ status.is_a?(Array) ? status : status.split(',')
124
+ end
125
+
122
126
  # S0014 - Current signal program
123
127
  def handle_s0014(_status_code, status_name = nil, _options = {})
124
128
  case status_name
@@ -48,7 +48,7 @@ module RSMP
48
48
  TrafficControllerSite.make_status([
49
49
  {
50
50
  'intersection' => '1',
51
- 'startup' => TrafficControllerSite.to_rmsp_bool(@is_starting)
51
+ 'startup' => @is_starting
52
52
  }
53
53
  ])
54
54
  end
@@ -23,13 +23,12 @@ module RSMP
23
23
  raise 'TLC main component not found' unless main
24
24
 
25
25
  security_code = security_code_for(2)
26
- active_str = active ? 'True' : 'False'
27
26
 
28
27
  command_list = [{
29
28
  'cCI' => 'M0005',
30
29
  'cO' => 'setEmergency',
31
30
  'n' => 'status',
32
- 'v' => active_str
31
+ 'v' => command_value('M0005', 'status', active)
33
32
  }, {
34
33
  'cCI' => 'M0005',
35
34
  'cO' => 'setEmergency',
@@ -39,7 +38,7 @@ module RSMP
39
38
  'cCI' => 'M0005',
40
39
  'cO' => 'setEmergency',
41
40
  'n' => 'emergencyroute',
42
- 'v' => route.to_s
41
+ 'v' => command_value('M0005', 'emergencyroute', route)
43
42
  }]
44
43
 
45
44
  send_command_and_collect(command_list, within: within).ok!
@@ -56,7 +55,7 @@ module RSMP
56
55
  'cCI' => 'M0007',
57
56
  'cO' => 'setFixedTime',
58
57
  'n' => 'status',
59
- 'v' => status.to_s
58
+ 'v' => command_value('M0007', 'status', status)
60
59
  }, {
61
60
  'cCI' => 'M0007',
62
61
  'cO' => 'setFixedTime',
@@ -64,8 +63,7 @@ module RSMP
64
63
  'v' => security_code.to_s
65
64
  }]
66
65
 
67
- confirm_status = [{ 'sCI' => 'S0009', 'n' => 'status',
68
- 's' => /^#{Regexp.escape(status.to_s)}(,#{Regexp.escape(status.to_s)})*$/ }]
66
+ confirm_status = [{ 'sCI' => 'S0009', 'n' => 'status', 's' => [boolean_value(status)] }]
69
67
  send_command_and_collect(command_list, within: within).ok!
70
68
  wait_for_status "fixed time #{status}", confirm_status, timeout: within
71
69
  end
@@ -81,7 +79,7 @@ module RSMP
81
79
  'cCI' => 'M0003',
82
80
  'cO' => 'setTrafficSituation',
83
81
  'n' => 'status',
84
- 'v' => 'True'
82
+ 'v' => command_value('M0003', 'status', true)
85
83
  }, {
86
84
  'cCI' => 'M0003',
87
85
  'cO' => 'setTrafficSituation',
@@ -91,10 +89,10 @@ module RSMP
91
89
  'cCI' => 'M0003',
92
90
  'cO' => 'setTrafficSituation',
93
91
  'n' => 'traficsituation',
94
- 'v' => situation.to_s
92
+ 'v' => command_value('M0003', 'traficsituation', situation)
95
93
  }]
96
94
 
97
- confirm_status = [{ 'sCI' => 'S0015', 'n' => 'status', 's' => situation.to_s }]
95
+ confirm_status = [{ 'sCI' => 'S0015', 'n' => 'status', 's' => integer_value(situation) }]
98
96
  send_command_and_collect(command_list, within: within).ok!
99
97
  wait_for_status "traffic situation #{situation}", confirm_status, timeout: within
100
98
  end
@@ -110,7 +108,7 @@ module RSMP
110
108
  'cCI' => 'M0003',
111
109
  'cO' => 'setTrafficSituation',
112
110
  'n' => 'status',
113
- 'v' => 'False'
111
+ 'v' => command_value('M0003', 'status', false)
114
112
  }, {
115
113
  'cCI' => 'M0003',
116
114
  'cO' => 'setTrafficSituation',
@@ -120,10 +118,10 @@ module RSMP
120
118
  'cCI' => 'M0003',
121
119
  'cO' => 'setTrafficSituation',
122
120
  'n' => 'traficsituation',
123
- 'v' => '1'
121
+ 'v' => command_value('M0003', 'traficsituation', 1)
124
122
  }]
125
123
 
126
- confirm_status = [{ 'sCI' => 'S0015', 'n' => 'status', 's' => '1' }]
124
+ confirm_status = [{ 'sCI' => 'S0015', 'n' => 'status', 's' => 1 }]
127
125
  send_command_and_collect(command_list, within: within).ok!
128
126
  wait_for_status 'traffic situation unset', confirm_status, timeout: within
129
127
  end
@@ -135,22 +133,24 @@ module RSMP
135
133
  [
136
134
  { 'cCI' => 'M0001', 'cO' => 'setValue', 'n' => 'status', 'v' => status.to_s },
137
135
  { 'cCI' => 'M0001', 'cO' => 'setValue', 'n' => 'securityCode', 'v' => security_code.to_s },
138
- { 'cCI' => 'M0001', 'cO' => 'setValue', 'n' => 'timeout', 'v' => timeout_minutes.to_s },
139
- { 'cCI' => 'M0001', 'cO' => 'setValue', 'n' => 'intersection', 'v' => '0' }
136
+ { 'cCI' => 'M0001', 'cO' => 'setValue', 'n' => 'timeout',
137
+ 'v' => command_value('M0001', 'timeout', timeout_minutes) },
138
+ { 'cCI' => 'M0001', 'cO' => 'setValue', 'n' => 'intersection',
139
+ 'v' => command_value('M0001', 'intersection', 0) }
140
140
  ]
141
141
  end
142
142
 
143
143
  def functional_position_confirm_status(status)
144
144
  case status.to_s
145
145
  when 'YellowFlash'
146
- [{ 'sCI' => 'S0011', 'n' => 'status', 's' => /^True(,True)*$/ }]
146
+ [{ 'sCI' => 'S0011', 'n' => 'status', 's' => [true] }]
147
147
  when 'Dark'
148
- [{ 'sCI' => 'S0007', 'n' => 'status', 's' => /^False(,False)*$/ }]
148
+ [{ 'sCI' => 'S0007', 'n' => 'status', 's' => [false] }]
149
149
  when 'NormalControl'
150
150
  [
151
- { 'sCI' => 'S0007', 'n' => 'status', 's' => /^True(,True)*$/ },
152
- { 'sCI' => 'S0011', 'n' => 'status', 's' => /^False(,False)*$/ },
153
- { 'sCI' => 'S0005', 'n' => 'status', 's' => 'False' }
151
+ { 'sCI' => 'S0007', 'n' => 'status', 's' => [true] },
152
+ { 'sCI' => 'S0011', 'n' => 'status', 's' => [false] },
153
+ { 'sCI' => 'S0005', 'n' => 'status', 's' => false }
154
154
  ]
155
155
  else
156
156
  []
@@ -15,7 +15,7 @@ module RSMP
15
15
  'cCI' => 'M0008',
16
16
  'cO' => 'setForceDetectorLogic',
17
17
  'n' => 'status',
18
- 'v' => status.to_s
18
+ 'v' => command_value('M0008', 'status', status)
19
19
  }, {
20
20
  'cCI' => 'M0008',
21
21
  'cO' => 'setForceDetectorLogic',
@@ -25,7 +25,7 @@ module RSMP
25
25
  'cCI' => 'M0008',
26
26
  'cO' => 'setForceDetectorLogic',
27
27
  'n' => 'mode',
28
- 'v' => mode.to_s
28
+ 'v' => command_value('M0008', 'mode', mode)
29
29
  }]
30
30
  send_command_and_collect(command_list, component: component_id, within: within).ok!
31
31
  end
@@ -41,7 +41,7 @@ module RSMP
41
41
  'cCI' => 'M0021',
42
42
  'cO' => 'setLevel',
43
43
  'n' => 'status',
44
- 'v' => status.to_s
44
+ 'v' => command_value('M0021', 'status', status)
45
45
  }, {
46
46
  'cCI' => 'M0021',
47
47
  'cO' => 'setLevel',
@@ -15,7 +15,7 @@ module RSMP
15
15
  'cCI' => 'M0006',
16
16
  'cO' => 'setInput',
17
17
  'n' => 'status',
18
- 'v' => status.to_s
18
+ 'v' => command_value('M0006', 'status', status)
19
19
  }, {
20
20
  'cCI' => 'M0006',
21
21
  'cO' => 'setInput',
@@ -25,7 +25,7 @@ module RSMP
25
25
  'cCI' => 'M0006',
26
26
  'cO' => 'setInput',
27
27
  'n' => 'input',
28
- 'v' => input.to_s
28
+ 'v' => command_value('M0006', 'input', input)
29
29
  }]
30
30
  send_command_and_collect(command_list, within: within).ok!
31
31
  end
@@ -41,7 +41,7 @@ module RSMP
41
41
  'cCI' => 'M0013',
42
42
  'cO' => 'setInput',
43
43
  'n' => 'status',
44
- 'v' => status.to_s
44
+ 'v' => command_value('M0013', 'status', status)
45
45
  }, {
46
46
  'cCI' => 'M0013',
47
47
  'cO' => 'setInput',
@@ -73,7 +73,7 @@ module RSMP
73
73
  'cCI' => 'M0020',
74
74
  'cO' => 'setOutput',
75
75
  'n' => 'status',
76
- 'v' => status.to_s
76
+ 'v' => command_value('M0020', 'status', status)
77
77
  }, {
78
78
  'cCI' => 'M0020',
79
79
  'cO' => 'setOutput',
@@ -83,12 +83,12 @@ module RSMP
83
83
  'cCI' => 'M0020',
84
84
  'cO' => 'setOutput',
85
85
  'n' => 'output',
86
- 'v' => output.to_s
86
+ 'v' => command_value('M0020', 'output', output)
87
87
  }, {
88
88
  'cCI' => 'M0020',
89
89
  'cO' => 'setOutput',
90
90
  'n' => 'outputValue',
91
- 'v' => value.to_s
91
+ 'v' => command_value('M0020', 'outputValue', value)
92
92
  }]
93
93
  send_command_and_collect(command_list, within: within).ok!
94
94
  end
@@ -98,10 +98,13 @@ module RSMP
98
98
  def force_input_command_list(input, status, value)
99
99
  security_code = security_code_for(2)
100
100
  [
101
- { 'cCI' => 'M0019', 'cO' => 'setInput', 'n' => 'status', 'v' => status.to_s },
101
+ { 'cCI' => 'M0019', 'cO' => 'setInput', 'n' => 'status',
102
+ 'v' => command_value('M0019', 'status', status) },
102
103
  { 'cCI' => 'M0019', 'cO' => 'setInput', 'n' => 'securityCode', 'v' => security_code.to_s },
103
- { 'cCI' => 'M0019', 'cO' => 'setInput', 'n' => 'input', 'v' => input.to_s },
104
- { 'cCI' => 'M0019', 'cO' => 'setInput', 'n' => 'inputValue', 'v' => value.to_s }
104
+ { 'cCI' => 'M0019', 'cO' => 'setInput', 'n' => 'input',
105
+ 'v' => command_value('M0019', 'input', input) },
106
+ { 'cCI' => 'M0019', 'cO' => 'setInput', 'n' => 'inputValue',
107
+ 'v' => command_value('M0019', 'inputValue', value) }
105
108
  ]
106
109
  end
107
110
 
@@ -110,11 +113,11 @@ module RSMP
110
113
  # S0029 is used to check the forced status, but is only available from sxl 1.0.13
111
114
  if RSMP::Proxy.version_meets_requirement?(sxl_version, '>=1.0.13')
112
115
  result << { 'sCI' => 'S0029', 'n' => 'status',
113
- 's' => /^.{#{input.to_i - 1}}#{status == 'True' ? '1' : '0'}/ }
116
+ 's' => /^.{#{input.to_i - 1}}#{boolean_value(status) ? '1' : '0'}/ }
114
117
  end
115
- if status == 'True'
118
+ if boolean_value(status)
116
119
  result << { 'sCI' => 'S0003', 'n' => 'inputstatus',
117
- 's' => /^.{#{input.to_i - 1}}#{value == 'True' ? '1' : '0'}/ }
120
+ 's' => /^.{#{input.to_i - 1}}#{boolean_value(value) ? '1' : '0'}/ }
118
121
  end
119
122
  result
120
123
  end