develop:cs-protocol-en
Table of Contents
Rocrail Client Protocol (RCP)
Communication header
All requests and responses are prefixed with a XML-Header which announce the contents.
Example
BEGIN HEADER
<xmlh> <xml size="23" name="cmd"/> <bin size="4711" name="readme.pdf"/> </xmlh>
END HEADER BEGIN XML
<cmd auto="off"/>
END XML BEGIN BIN
A6007B98FF...
END BIN
Note
After the end tag of header, </xmlh>
, no extra chars are allowed. (Even a '\0' is not allowed.)
Protocol definition
XML Header attributes
Name | Description |
---|---|
size | length in bytes of the xml or binary stream |
name | xml document name or binary file name |
Client requests
Clients can send almost everything found in the protocol definition, and the following list is not complete.
Model commands: http://www.rocrail.net/doc/rocrail-wrappers/wrapper-en.html#model
Get the complete plan
<model cmd="plan"/>
Get a list
The locomotives:
<model cmd="lclist"/>
The switches:
<model cmd="swlist"/>
Get an object
Locomotive:
<model cmd="lcprops" val="locoID"/>
Complete loco example
<xmlh><xml size="84" name="lc"/></xmlh><lc id="4711" V_raw="87" V_rawMax="100" cmd="velocity" throttleid="192.168.100.32"/>
Server responses
For every client request there is a server response.
Plan response
<plan>...</plan>
Server events
Many events are broadcasted to all clients including modifications by other clients.
Just a few example events.
Power event
Track power became high:
<state power="true"/>
Auto event
Automode is switched on:
<auto cmd="on"/>
develop/cs-protocol-en.txt · Last modified: 2022/11/11 08:19 by rjversluis