CBUS/VLCB interface
Interface for communicating with a CBUS/VLCB network.
Properties
id
Unique object identifier. Each object in Traintastic has a globally unique id that can be used in scripts (see world.get_object).
input_channels
$object.interface.input_channels:description$
name
Interface name
online
true if interface is online, false otherwise. Read status for more information.
output_channels
Supported output channels, a table containing output channel values.
status
Interface status object.
Methods
get_input([channel,] address)
$object.interface.get_input:description$
Parameters:
-
channel
$object.interface.get_input.parameter.channel:description$ -
address
$object.interface.get_input.parameter.address:description$
Return values
$object.interface.get_input:return_values$
get_output(channel, address)
Get an output object.
Parameters:
-
channel
Output channel, a Output channel value. -
address
Output address, valid range depends onchannel.
Return values
Single output, Pair output or Aspect output object depending on channel or nil if channel/address combination is invalid.
send(message)
Send CBUS/VLCB message.
Use this with caution!
These messages bypass Traintastic’s normal handling. You need a solid understanding of CBUS/VLCB to avoid conflicts. Side effects may occur that Traintastic is not aware of or cannot manage.
Parameters:
message
CBUS/VLCB message bytes. (1...8)
Return values
true if send, false otherwise.
send_dcc(dcc_packet [, repeat = 2])
Request the command station to send a DCC packet to the track (RDCCn).
Use this with caution!
These messages bypass Traintastic’s normal handling. You need a solid understanding of DCC to avoid conflicts. Side effects may occur that Traintastic is not aware of or cannot manage.
Parameters:
-
dcc_packet
Table containing two to five DCC packet bytes to send excluding checksum byte. -
repeat
Number of times to repeat the packet on the track. (1...255)
Return values
true if send, false otherwise.
Events
on_changed
$object.cbusinterface.on_changed:description$
Handler signature
function (value, object, name, user_data)
Arguments
-
value- $object.object.on_changed.parameter.value:description$ -
object- $object.object.on_changed.parameter.object:description$ -
name- $object.object.on_changed.parameter.name:description$ -
user_data- optional user-provided value (see Events).