LoconetService Class |
Namespace: RRAutoLib.Loconet
The LoconetService type exposes the following members.
Name | Description | |
---|---|---|
LoconetService | Initializes a new instance of the LoconetService class |
Name | Description | |
---|---|---|
BaudRate | Gets or sets the baud rate speed of the Loconet interface. | |
ComPort | Gets or sets the communication port number of the Loconet interface. | |
ElapsedTime | Gets the elapsed time since the Loconet service was started. | |
FlowControl | Gets or sets whether flow control should be used with the Loconet interface. | |
IsStarted | Indicates whether the Loconet service has been started. | |
SyncContext | Gets or sets the dispatcher that will be responsible for thread synchronization. |
Name | Description | |
---|---|---|
Start | Starts the Loconet service and connects to the serial port. | |
Stop | Stops the Loconet service and disconnects from the serial port. | |
TxPacket | Transmits a packet asynchronously with normal priority. | |
TxPriorityPacket | Transmits a packet asynchronously with high priority. | |
TxPrioritySpeed | Transmits a locomotive speed control packet asynchronously with high priority. |
Name | Description | |
---|---|---|
RxPacketOnSyncThread | Occurs when a Loconet packet is received. | |
RxPacketOnWorkerThread | Occurs when a Loconet packet is received. |
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.