Click or drag to resize

LoconetService Class

The main class for providing Loconet services and communication.
Inheritance Hierarchy
SystemObject
  RRAutoLib.LoconetLoconetService

Namespace:  RRAutoLib.Loconet
Assembly:  RRAutoLib (in RRAutoLib.dll) Version: 4.0.8678.28884
Syntax
Public NotInheritable Class LoconetService

The LoconetService type exposes the following members.

Constructors
  NameDescription
Public methodLoconetService
Initializes a new instance of the LoconetService class
Top
Properties
  NameDescription
Public propertyCode exampleBaudRate
Gets or sets the baud rate speed of the Loconet interface.
Public propertyCode exampleComPort
Gets or sets the communication port number of the Loconet interface.
Public propertyElapsedTime
Gets the elapsed time since the Loconet service was started.
Public propertyCode exampleFlowControl
Gets or sets whether flow control should be used with the Loconet interface.
Public propertyIsStarted
Indicates whether the Loconet service has been started.
Public propertyCode exampleSyncContext
Gets or sets the dispatcher that will be responsible for thread synchronization.
Top
Methods
  NameDescription
Public methodCode exampleStart
Starts the Loconet service and connects to the serial port.
Public methodCode exampleStop
Stops the Loconet service and disconnects from the serial port.
Public methodCode exampleTxPacket
Transmits a packet asynchronously with normal priority.
Public methodTxPriorityPacket
Transmits a packet asynchronously with high priority.
Public methodCode exampleTxPrioritySpeed
Transmits a locomotive speed control packet asynchronously with high priority.
Top
Events
  NameDescription
Public eventCode exampleRxPacketOnSyncThread
Occurs when a Loconet packet is received.
Public eventRxPacketOnWorkerThread
Occurs when a Loconet packet is received.
Top
Remarks

This service creates a connection to a given serial port and maintains a transmission thread, separate from the calling thread. Events are executed on either a pool of worker threads or can be synchronized to a given thread. In most cases this will be the UI thread. (see: SyncContext for event synchronization).

There are two transmission queues: a normal and a priority queue. Packets placed in the priority queue preempt the ones in the normal queue. All packet transmissions are asynchronous and they can either be awaited on, or used in a fire and forget fashion.

All methods implemented by this class are thread safe.

Examples
See Also