User Tools

Site Tools


develop:cs-protocol-fr

This is an old revision of the document!


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.

Exemple

ENTÊTE DU DÉBUT

<xmlh>
  <xml size="23" name="cmd"/>
  <bin size="4711" name="readme.pdf"/>
</xmlh>

FIN ENTÊTE DÉBUT XML

<cmd auto="off"/>

FIN XML DEBUT BIN

A6007B98FF...

FIN BIN

Note

Après la balise de fin de l'entête, </xmlh>, aucun caractère supplémentaire n'est autorisé. (Même un '\0' n'est pas autorisé.)


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"/>
develop/cs-protocol-fr.1748425415.txt.gz · Last modified: 2025/05/28 11:43 by phil45