User Tools

Site Tools


cs-protocol-en

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cs-protocol-en [2018/11/12 08:56] (current)
Line 1: Line 1:
 +======Rocrail Client Protocol (RCP)======
 +  * [[rocrail-server-scripting-en|RCP Scripting]]
 + \\
 +
 +=====Communication header=====
 +All requests and responses are prefixed with a XML-Header which announce the contents.\\
 +
 +====Example====
 +//BEGIN HEADER//
 +<code xml>
 +<​xmlh>​
 +  <xml size="​23"​ name="​cmd"/>​
 +  <bin size="​4711"​ name="​readme.pdf"/>​
 +</​xmlh>​
 +</​code>​
 +//END HEADER//
 +//BEGIN XML//
 +<code xml>
 +<cmd auto="​off"/>​
 +</​code>​
 +//END XML//
 +//BEGIN BIN//
 +<​code>​
 +A6007B98FF...
 +</​code>​
 +//END BIN//
 +
 +===Note===
 +After the end tag of header, ''</​xmlh>'',​ no extra chars are allowed. (Even a '​\0'​ is not allowed.)
 +
 + \\
 +===== Protocol definition =====
 +  * http://​www.rocrail.net/​doc/​rocrail-wrappers/​wrapper-en-index.html
 +
 +===== 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 ====
 +<code xml>
 +<model cmd="​plan"/>​
 +</​code>​
 +==== Get a list ====
 +The locomotives:​
 +<code xml>
 +<model cmd="​lclist"/>​
 +</​code>​
 +The switches:
 +<code xml>
 +<model cmd="​swlist"/>​
 +</​code>​
 +==== Get an object ====
 +Locomotive:
 +<code xml>
 +<model cmd="​lcprops"​ val="​locoID"/>​
 +</​code>​
 +
 +
 + \\
 +==== Complete loco example ====
 +<code xml>
 +<​xmlh><​xml size="​84"​ name="​lc"/></​xmlh><​lc id="​4711"​ V_raw="​87"​ V_rawMax="​100"​ cmd="​velocity"​ throttleid="​192.168.100.32"/>​
 +</​code>​
 +
 + \\
 +===== Server responses =====
 +For every client request there is a server response.\\
 + \\
 +==== Plan response ====
 +<code xml>
 +<​plan>​...</​plan>​
 +</​code>​
 +
 + \\
 +===== 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:
 +<code xml>
 +<state power="​true"/>​
 +</​code>​
 +==== Auto event ====
 +Automode is switched on:
 +<code xml>
 +<auto cmd="​on"/>​
 +</​code>​
 +
 +
  
cs-protocol-en.txt ยท Last modified: 2018/11/12 08:56 (external edit)