Protocol over new hostside stdin and to multiplexer: U< possibly-asynchronous messages from realtime R< ditto, but saved for replay too S messages to simulation log D< static data printed by topology-dump C> commands (reflected to other clients) L> commands implemented by multiplexer and not reflected to other clients O< framming output from commands Messages from the multiplexer to its clients are always prefixed with a relevance character, shown as ? below. In messages from realtime, the ? is absent. ? may be - result of command by another client + result of command by us & asynchronous, not related to a specific command = related to this actual multiplexer client connection | result of replay ====================================================================== POSSIBLY-ASYNCHRONOUS REPORTING OF MESSAGES TO/FROM (MASTER) PIC U< ?picioh out [...] In principle, all output to PICs, in raw form, but subject to suppression U< ?picioh in junk [...] U< ?picioh in aargh [...] U< ?picioh in hello [...] U< ?picioh in off [...] U< ?picioh in toolong [...] U< ?picioh in msg [...] R< ?picio out polarity <[[,...]]> literal < and > bracket segs U< ?picio out unknown data printed in assoc'd picioh U< ?picio in [] U< ?picio out [] U< ?detect 0|1 decoded `picio in detect[01]' U< ?detect-flap Suppression (see parse-proto-spec and realtime.c:serial_transmit) nmra data/done ping/ special in other out detect pong (see above) msg in (also in-info) -v0 suppressed suppressed raw with type cooked -v1 suppressed only unignored raw with type cooked -v2 suppressed cooked raw with type cooked -v3 both both raw with type both POSSIBLY-ASYNCHRONOUS REPORTING OF INTERNAL STATE CHANGES ETC. U< ?resolving R< ?resolution inexplicable R< ?resolution mispositioned head|tail R< ?resolution movpos-change-failed / R< ?resolution problems R< ?stastate U< ?warning [ ] : U< ?warning watchdog : PIC watchdog timer triggered U< ?warning spurious : spurious short circuit (fault) etc. U< ?warning realtime-failed reason SIG*|exit*|E*|... : U< ?warning realtime-failed stderr : U< ?warning realtime-failed stderr-unreadable : U< ?warning save-dump-failed [ []] : U< ?info save-dump U< ?train signalling-problem .... U< ?train signalling-problem |- : R< ?train at [-]:+- forwards|backwards R< ?train has [-][/].... is * for det_expected ! for foredetect @ for det_ignore R< ?train speed commanding R< ?movpos feat point|relay R< ?movpos position moving R< ?movpos position stable may be ? for unknown U< ?debug : U< ?info [] : U< ?info movfeat-collapsing-unknown : will set previously [etc.] MESSAGES TO SIMULATION LOG S picioh in suppressed [...] S picioh in suppressed-detect [...] S command-in .... S timestamp . S timer-event . S 0|1 detection, same segment as last suppressed-detect ====================================================================== COMMANDS AND RESPONSES C> [...] results in: O< ?nak [] [: ] O< ?executing [...] consequential messages including picio, signalling problems etc. which may be U< R< then one of these O< ?ack ok O< ?ack O< ?ack [] : ... O< ?ack SignallingPredictedProblem \ |- : ... O< ?ack CommandPreconditionsViolated direction response to speed command which specified a direction, if the train is actually facing the other direction when these come through the multiplexer, everything which is a result of _other_ clients' activities, between and inclusive, is prefixed with `-' if they are not due to this client or `+' if they are. Some commands have ! at the start of their name - that means they are privileged. ====================================================================== MULTIPLEXER FACILITIES U< =connected } on U< =permission normal|super } initial or } connection U< =denied } and later perhaps U< =failed : } regardless of U< =failed client-io : } selected message patterns } and then connection closed There is no need to ask to quit - just send eof L> select [~]... first match wins; ~ discards the message. in pattern -+./:=0-9a-zA-Z match themselves _ matches nonempty sequence of whitespace * matches any non-whitespace ? matches any single character _ is matched against if no match, it is as if the following patterns were appended ~-* ~&* ~+debug * default, on initial connection, is ?info ?warning (plus the above) L> replay [[~]...] if none, uses result from select O< +executing replay R< | O< +ack replay ok L> select-replay [~]... like select and replay combined MULTIPLEXER-IMPLEMENTED FUNCTIONALITY AFFECTING WHOLE SYSTEM C> [!] ... O< ?nak|executing...ack... as above C> !realtime auto set automatic restarting; starts if applicable C> !realtime kill kill current instance, if auto awaits off C> !realtime restart kill and restart C> !realtime stop } set manual mode, stop C> !realtime start } set manual mode, start as specified, C> !realtime start-manual } restarting if already running C> !save-dump ====================================================================== CHIEF COMMANDS speed [forwards|backwards] !speed noop [...] adjunct -|+|^ |* [[-|+|^] ...] !nmrafeat | -|+|^ [[-|+|^] ...] route [] route |- |- [] any suitable movposcomb route+ change even segments owned by a train's route route++ even queue changes for segments currently under a train !route just do it, don't ask safety system movfeat [] movfeat+ } see route+ movfeat++ } see route++ !movfeat } see !route direction forwards|backwards|change !invert [ ...] each one named is toggled DIRECT NMRA AND PIC INSTRUCTIONS Example (always the same msg): C> !nmra [] [...]] nmra speed28 3 13 1 C> !nmra [] [=] nmra =0348 C> !nmra [] [:] nmra :03484b C> !nmra [] [_] nmra _7f7f00644197 in each case (if present) is * or % and indicates that the message should be put in the retransmission cycle, and cancels any previous message with the same . may be empty. * indicates urgent C> !nmra cancels the relevant retransmission. Example (always the same msg): C> !pic = pic =a003 C> !pic [] pic point 3 the latter for commands with no `...' in README.protocol only Keen readers will observe that !pic = and !nmra _ do exactly the same. ====================================================================== TOPOLOGY DUMP D< topology segment i|n D< topology movfeat point|relay D< topology movposcomb |- \ [-]|- [-]|- D< topology movfeatfixed