LoDi-Shift-Commander API
Documentation

Device API

LoDi-Shift-Commander API

Introduction

The device type is always 0x09 on the LoDi-Shift-Commander.

Basic commands

GetVersion

This command returns the device identifier and the FW version of the device.

Packet typeCommandPacket number
0x200x0F0x00 .. 0xFF
Packet typeCommandPacket numberDevice typeMajorMinorPatch
0x210x0F0x00 .. 0xFF0x09

The firmware version is made up of the three parts major, minor and patch. It is shown in the format "v<major>.<minor>.<patch>". Example: "v01.01.01"

This command reads the settings of the LoDi-Shift-Commander.

The major version only changes when completely new hardware with different characteristics and a different feature set is released.

The minor version changes when the API is extended. Individual commands may also become incompatible.

The patch version changes for general bug fixes that do not touch the API.

DeviceConfigGet

Bus config

Packet typeCommandPacket number
0x200x640x00 .. 0xFF
Packet typeCommandPacket numberMaxAktivWeichenWeichenStartThe bus config field holds the configuration of the bus. It is split into several bits.
0x210x640x00 .. 0xFF0 .. 10 .. 100 .. 2

Bit 0: bus 1 active

  • 0: bus 1 inactive
  • 1: bus 1 active
  • 0: bus 2 inactive
  • 1: bus 2 active
  • 0: light bus (96 outputs)
  • 1: switching bus (384 outputs)
  • The MaxAktivWeichen field defines how many turnouts may be thrown at the same time. This avoids overloading the power supply when solenoid accessories are used.

0: no limit

  • >0: the number of turnouts set can be active at once. Otherwise execution waits until the other turnouts have finished throwing.
  • The WeichenStart entry sets how the turnouts are initialised at switch-on.

0: the turnouts are not initialised

  • 1: the turnouts are set to their last state.
  • 2: every turnout state is cycled through once. After that the last state known before switch-off is set.
  • OperatorNameGet

Reads the name of a LoDi-Operator.

BusNr

Packet typeCommandPacket numberOperatorPosCharacter n
0x200x730x00 .. 0xFF1..20..47
Packet typeCommandPacket numberLengthCharacter 1..BusNr names the bus to use. Within that bus, OperatorPos determines whose operator name is read. Each LoDi-Operator counts as one device.
0x210x730x00 .. 0xFF0 .. 16

The length determines the number of characters that follow.

Switching commands

CommandListGet

Reads the list of every command the LoDi-Shift-Commander supports.

KommandoNr

Packet typeCommandPacket number
0x200x610x00 .. 0xFF
Packet typeCommandPacket numberCountStatesOutputsCategoryThe count field carries the number of possible commands. It determines how many command descriptions follow.
0x210x610x00 .. 0xFF0 .. 2551 .. 161 .. 100 .. 3

The KommandoNr field is the identifier of the command.

The states entry says how many states, counted from 0, the command can take. A simple turnout typically has 2 states; signals may well have 10 or more.

Outputs describes how many hardware outputs the command occupies. A simple turnout occupies two, signals quite possibly 6 and more.

The category field returns the classification of the command. The following values are possible:

0: turnouts – turnouts are initialised at start-up if the device is set to do so

  • 1: signals – every track signal, light or semaphore
  • 2: effects – every lighting effect
  • 3: special – every special decoder command, such as those for the LoDi-Light-Operator
  • CommandNameGet

Reads the name of a command together with additional information.

The KommandoNr field holds the identifier of the command to be read.

Packet typeCommandPacket numberStates
0x200x620x00 .. 0xFF0 .. 255

Character 0

Packet typeCommandPacket numberLengthThe length field determines the number of characters that follow in character 0 to character n. The resulting string is to be read as follows:..BusNr names the bus to use. Within that bus, OperatorPos determines whose operator name is read. Each LoDi-Operator counts as one device.
0x210x620x00 .. 0xFF

<command name>|<colour of output 1>|..|<colour of output n>

The colours are defined as follows:

ws: white

  • rt: red
  • gn: green
  • ge: yellow
  • bl: blue
  • The colours are assigned to the respective outputs. They mainly serve the display.

For some commands only the command name is returned, without additional colour information.

Example:

"DB BS|rt|gn" -> Deutsche Bahn block signal with the colours red and green

NodeConfigGet

Reads the configuration of every node from the LoDi-Shift-Commander.

GlobDelay

Packet typeCommandPacket number
0x200x660x00 .. 0xFF
Packet typeCommandPacket numberAusgangHiCountAusgangLoDelayStatesGlobDelay gives the duration of a command when delay is set to 0. The duration is read in steps of 20 ms, so a value of 10 means 200 ms. What it does exactly depends on the command.
0x210x660x00 .. 0xFF0 .. 2500 .. 2550 .. 255

The count field gives the number of node records that follow. Each record is four bytes long. The index of the record determines the address of the node. Counting starts at 0 (the display adds 1).

AusgangHi and AusgangLo together give the first output the node addresses. The output number is calculated as follows:

Output = AusgangHi*256 + AusgangLo

The KommandoNr entry determines the command to be carried out. If the command is 0, there is no function at this address.

NodeNameGet

Reads the name of one or more nodes.

Nodes

Packet typeCommandPacket numberCountThe count field says how many nodes are read. The nodes (addresses) may be given in any order.
0x200x710x00 .. 0xFF0 .. 2550 .. 255
Packet typeCommandPacket numberCountLengthCharacter 1..BusNr names the bus to use. Within that bus, OperatorPos determines whose operator name is read. Each LoDi-Operator counts as one device.
0x210x710x00 .. 0xFF0 .. 2550..16

The reply carries as many names as the count says, in the order of the request, each preceded by its length and followed by that many characters.

NodeStatusGet

Reads the current (permanently stored) state of every node from the LoDi-Shift-Commander.

The count field gives the number of status fields that follow. Only as many status fields are sent as the highest occupied address needs. Each status field corresponds to one address; counting starts at address 0.

Packet typeCommandPacket number
0x200x6A0x00 .. 0xFF
Packet typeCommandPacket numberCountStatus
0x210x6A0x00 .. 0xFF0 .. 2550..15

NodeStatusSend

Sets the state of one or more nodes (addresses) — that is, throws turnouts, sets signals and so on.

State

Packet typeCommandPacket numberCountThe count field says how many nodes are read. The nodes (addresses) may be given in any order.The count field gives the number of node/state pairs that follow.
0x200x6C0x00 .. 0xFF0 .. 2550 .. 2550 .. 15
Packet typeCommandPacket number
0x210x6C0x00 .. 0xFF

Every node (every address) can take a state from 0 to 15.

Example for address 5: 0x20 0x6C 0xXX 0x01 0x05 0x01

The Shift-Commander then sends a confirmation: 0x21 0x6C 0xXX

Example for sending several addresses (1,2,3,4): 0x20 0x6C 0xXX 0x04 0x01 0x01 0x02 0x01 0x03 0x01 0x04 0x01

Notes:

Example for sending several addresses (1,2,3,4): 0x20 0x6C 0xXX 0x04 0x01 0x01 0x02 0x01 0x03 0x01 0x04 0x01

There is no need to delay sending turnout commands. The LoDi-Shift-Commander makes sure that not too many turnouts throw at once.

  • The state that was set is stored permanently and is therefore known to the LoDi-Shift-Commander after the next switch-on.
  • OutputsGet

Reads the status of every output.

AnzahlHigh

Packet typeCommandPacket number
0x200x600x00 .. 0xFF
Packet typeCommandPacket numberAnzahlLowThe fields AnzahlHigh and AnzahlLow together give the number of output states that follow.The count field gives the number of node/state pairs that follow.
0x210x600x00 .. 0xFF0 .. 255

Count = AnzahlHigh*256 + AnzahlLow

How many outputs follow depends on the setting of bus 2. If both buses are set to light bus, 192 output states are transmitted. If bus 2 is set to switching bus, 480 outputs are transmitted.

Bus 1 starts at the first byte and ends at the 96th. Bus 2 starts at the 100th byte.

The state field holds the internal output state. It is to be read as follows:

Value <= 100: output is on.

  • Value between 100 and 164: output is dimmed.
  • Value >= 164: output is off.
  • Room lighting control

The room lighting control is in principle just another LoDi-Operator, only with a few extra functions. The LoDi-Operator 4-C-LED can be switched with NodeStatusSend in exactly the same way.

The states are assigned as follows:

0: lighting off

  • 1: light curve 1
  • 2: light curve 2
  • 3: light curve 3
  • 8: flash
  • 9: double flash
  • 10: random flashing
  • 11: passing clouds
  • The LoDi-Shift-Commander simulates a 24-hour day. The simulated time is transmitted to every LoDi-Operator 4-C-LED at regular intervals. The operators are also able to keep counting the time themselves without that synchronisation.

TimeSpeedSet

Sets the speed at which time passes, as a multiple of normal time.

Factor

Packet typeCommandPacket numberThe factor field gives the time acceleration as a multiple of normal time. A value of 0 stops time.
0x200x760x00 .. 0xFF0 .. 250
Packet typeCommandPacket number
0x210x760x00 .. 0xFF

At a value of 120, an hour is only 30 seconds long.

TimeGet

Reads the current simulated time.

ZeitHigh

Packet typeCommandPacket number
0x200x780x00 .. 0xFF
Packet typeCommandPacket numberZeitLowThe current time is counted in steps of 2 seconds. It is calculated as follows:
0x210x780x00 .. 0xFF

Time = ZeitHigh256 + ZeitLow*

An hour is 1800 time units long. The highest value for the time is 43199.

A time of 36000 therefore corresponds to 20:00.

TimeSet

Sets the current simulated time.

LoDi-Shift-Commander API Service

Packet typeCommandPacket numberZeitLowThe current time is counted in steps of 2 seconds. It is calculated as follows:
0x200x770x00 .. 0xFF
Packet typeCommandPacket number
0x210x770x00 .. 0xFF

Time = ZeitHigh256 + ZeitLow*

An hour is 1800 time units long. The highest value for the time is 43199.