Click or drag to resize

LoconetServiceTxPrioritySpeed Method

Transmits a locomotive speed control packet asynchronously with high priority.

Namespace:  RRAutoLib.Loconet
Assembly:  RRAutoLib (in RRAutoLib.dll) Version: 4.0.8678.28884
Syntax
Public Sub TxPrioritySpeed ( 
	bytSlot As Byte,
	bytSpeed As Byte,
	Optional objTag As Object = Nothing
)

Parameters

bytSlot
Type: SystemByte
Valid values are 1-120. Some command stations have less than 120 slots.
bytSpeed
Type: SystemByte
The speed value that should be assigned to the locomotive located at the bytSlot number.
objTag (Optional)
Type: SystemObject
An optional arbitrary object to be associated with the packet.
Remarks
On average, the Loconet network can handle packet transmissions no faster than one every 9-15ms. If you have a user interface, such as a slider, that generates speed changes faster than the described interval, packets can get backlogged in the transmission queues, causing sluggish performance. Unlike TxPriorityPacket(Packet, CancellationToken), this method checks the priority queue for unprocessed speed control packets before inserting a new packet. If it finds one with the same slot number, the existing packet will be updated with the new speed value. If no match is found, this method behaves similarly to TxPriorityPacket(Packet, CancellationToken) except it is not awaitable or cancelable.
Examples
The following two lines are equivalent except the latter overrides obsolete packets backlogged in the queue.
VB
'assumes LoconetService (locServ) has been previously initialized and started
locServ.TxPriorityPacket(New PkSetSlotSpeed(3, 50))
locServ.TxPrioritySpeed(3, 50)
See Also