This is an old revision of the document!
Table of Contents
Protocole Client Rocrail (RCP)
Entête der communication
Toutes les requêtes et les réponses sont préfixées avec une entête XML qui annonce les contenus.
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: https://wiki.rocrail.net/rocrail-snapshot/rocrail/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"/>