Worker Constructor

Initializes a PCAN-Basic Worker object with its default values.

Definition

Namespace: Peak.Can.Basic
Assembly: PCANBasic.NET (in PCANBasic.NET.dll) Version: 4.9.0
C#
public Worker()

Remarks

As default, the Worker is configured to use the first connected PCAN USB interface, using classic CAN as protocol, and 500 kBit/s as bit rate.

A single receive queue is used, which is full open at connection time.

  Note

A Worker object can handle up to 'ReceiveQueuesCount' receive queues. Incoming messages are processed by all queues, so that the same message can be found in more than one queue, if its filter is configured to accept the message.

Only one receive queue is active by default when the object is created, and its filter is configured to receive any message.

Example

The following example shows the initialization of a Worker instance, using its default constructor.

In case of failure, an error messages is written to the console output using English as output language.

C#
// Create the object using the default configuration
//
Worker myWorker = new Worker();

// Show information about the object
//
Console.WriteLine("Worker object created.");
Console.WriteLine($"  Channel: {myWorker.Channel}");
Console.WriteLine($"  Protocol: {myWorker.TransmissionProtocol}");
Console.WriteLine($"  Bit rate: {myWorker.BitrateCan}");

See Also