Table of Contents
Services
Rocrail Service tab.
HTTP Service
Port
The port must differ from the client service port to avoid conflicts.
Clock Service
Use this service if a faster clock is wanted and/or all clients must be synchronized.
Divider
The time divider is used to setup the clock speed: 1…100. (Example: A divider of 10 will run the model time 10 times faster than real time.)
The next field is the Client update frequency in model minutes: 1…60. Default is every model minute.
Hour/Minute
This is the start time for the clock service.
The computer time is used if the values are set to 24:60.
Semi real time
With this option all fast clock options are available if the divider is set to one. (Otherwise clock commands are rejected.)
Note: The clock will no longer be in sync with the hardware computer clock.
Stop clock at power off
Stop the fast clock in case of a power off event. (Short cut)
Client Service
This is the port at which Rocview clients must connect to become all data and events needed to function.
Client Port
The official assigned port by IANA is 8051.
Only first can control
Prevent secondary clients controlling the Rocrail server; only the first one connected has control.
A better solution is the use of Control or Slave Code.
Control code
The client must provide this control code to get write access if set.
- This overrules the "Only first can control" option.
- Leave blank for normal use.
- Supported Mobile Clients:
- Rocweb
- andRoc
WIO Watchdog
Enables monitoring of WIO reachability. The timeout ist defined in units of 10 ms.
Default: 700 x 10 ms = 7 seconds.
WIOs are sending every 4 seconds an alive message.
Exclude
Excluding none relevant WIOs can be done as CSV list with IDs.
Ranges are also allowed like: 45-55
Slave code
If the slave code is set, and a connected client cannot provide this code, the following selected features will be rejected:
- System (Includes automatic and power commands.)
- Shutdown Server
- Switches
- Signals
- Outputs
- Routes
- Locomotives
SRCP Service
Optional service for SRCP Clients like J-Man or spdrs60.
The objects addressed by those clients must be defined in the Rocrail track plan.
Device
Optional serial device to service SRCP.
Line settings are fixed:
- 115200 bps
- 8N1
SNMP Service
Activates the SNMP v1/2c Agent in the Rocrail server.
By default port 161 is used for the SNMP service which requires extra user privilege:
OSNMP 0658 SNMP bind OSocket 0513 bind() failed [13] [Permission denied]
Config
<SnmpService port="161" trapport="162" traphost="192.168.100.77"/>
GetRequest example
Direct ObjectID:
$ snmpget -v 2c -c public localhost 1.3.6.1.2.1.1.1.0 iso.3.6.1.2.1.1.1.0 = STRING: "Rocrail 2.0.2508 Sunrise"
Symbolic OjectID:
$ snmpget -v2c -c public localhost SNMPv2-MIB::sysDescr.0 SNMPv2-MIB::sysDescr.0 = STRING: Rocrail 2.0.2508 Sunrise $ snmpget -v2c -c public localhost SNMPv2-MIB::sysUpTime.0 SNMPv2-MIB::sysUpTime.0 = Timeticks: (3443) 0:00:34.43
Supported commands
- GetRequest
- GetNextRequest
- SetRequest
- BulkRequest
- Trap
IANA
MIB
Free MIB Browser
Traps
- Cold boot
- Link up: new client connection
- Link down: client disconnected
- User:
- Shutdown
- Exception
@Box
The location of the @Box.
MQTT Service
Clients can use the MQTT Broker to communicate with the Rocrail Server.
MQTT Topic | Description |
---|---|
rocrail/service/info | All server broadcasts are published with this topic name. |
rocrail/service/client | Clients can publish commands with this topic. A valid support key is necessary; Without key only 5 demo minutes. |
rocrail/service/field | Clients can publish hardware events with this topic. |
rocrail/service/command | Command station commands for User Libraries. |
The payload of the MQTT messages are in RCP Format.
The Rocrail Server uses the MQTT V3.1 Protocol.
Hostname
The DNS name or TCPIP address of the MQTT Broker.
Port
The service port number of the MQTT Broker.
The default port number used by Mosquitto is 1883.
Group
Topic grouping
Use the Item Names in the Broadcast Topic.
User CS Libraries
With both topics, field and command, it is possible to implement a user defined CS library without Rocrail Source dependencies.
Clients
Only Quality of Service 1 is supported.
Clients may use QoS 0, but we strongly recommend QoS 1.
The only known Client for this service is the command line utility of Mosquitto:
mosquitto_pub -p 60123 -t rocrail/service/client -m "<sys cmd=\"stop\"/>" -q 1
Broker response:
1467710159: New connection from 127.0.0.1. 1467710159: New client connected from 127.0.0.1 as mosq_pub_2323_rob-Virt. 1467710159: Sending CONNACK to mosq_pub_2323_rob-Virt (0) 1467710159: Received PUBLISH from mosq_pub_2323_rob-Virt (d0, q1, r0, m1, 'rocrail/service/client', ... (17 bytes)) 1467710159: Sending PUBACK to mosq_pub_2323_rob-Virt (Mid: 1) 1467710159: Sending PUBLISH to RocrailService (d0, q1, r0, m1, 'rocrail/service/client', ... (17 bytes)) 1467710159: Received DISCONNECT from mosq_pub_2323_rob-Virt 1467710159: Received PUBACK from RocrailService (Mid: 1) 1467710159: Received PUBLISH from RocrailService (d0, q1, r0, m3, 'rocrail/service/info', ... (51 bytes)) 1467710159: Sending PUBACK to RocrailService (Mid: 3) 1467710159: Received PUBLISH from RocrailService (d0, q1, r0, m4, 'rocrail/service/info', ... (175 bytes)) 1467710159: Sending PUBACK to RocrailService (Mid: 4) 1467710160: Received PUBLISH from RocrailService (d0, q1, r0, m5, 'rocrail/service/info', ... (60 bytes)) 1467710160: Sending PUBACK to RocrailService (Mid: 5)
Discovery
An UDP Multicast discovery service is also available for other devices which wants to use the same broker.
Host | 224.0.0.1 |
Port | 8051 |
The device must send a message withe the following content:
BROKER-GET |
It will get the following reply:
BROKER-HOST:<hostname> BROKER-PORT:<port#> |
Both lines ends with a linefeed: \n
Last Will
If the Rocrail MQTT-Broker connection get lost, the Last Will can be observed in topic rocrail/service/info
:
<exception text="abend"/>
Location
Location information for calculating sunrise and sunset.
Example
mDNS
See also: mDNS Information
Enable
Activate mDNS for the Rocrail as service.
This can be used for looking up the Rocrail Server in a client like Rocview.
Note: Uncheck this option if multicast is blocked or unwanted.