Worker(PcanChannel, Bitrate, Boolean) Constructor
Initializes a PCAN-Basic
Worker object.
Namespace: Peak.Can.BasicAssembly: PCANBasic.NET (in PCANBasic.NET.dll) Version: 4.9.0
public Worker(
PcanChannel canChannel,
Bitrate bitrate,
bool closedFilter = false
)
Public Sub New (
canChannel As PcanChannel,
bitrate As Bitrate,
Optional closedFilter As Boolean = false
)
public:
Worker(
PcanChannel canChannel,
Bitrate bitrate,
bool closedFilter = false
)
Parameters
- canChannel PcanChannel
- The handle of a PCAN Channel to use for CAN communication.
- bitrate Bitrate
- The speed for the classic CAN 2.0A/B communication as a BTR0/BTR1 code. Default is 500 kBit/s (Pcan500).
- closedFilter Boolean (Optional)
- When true, the filter of the first receive queue is set to discard all. Otherwise, any message will be received.
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 con figured 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.
The following example shows the initialization of a Worker instance, using as bit rate 250 kBit/s on the first PCAN-PCI Channel.
In case of failure, an error messages is written to the console output using English as output language.
// Create the object using a custom configuration
//
Worker myWorker = new Worker(PcanChannel.Pci01, Bitrate.Pcan250);
// 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}");
' Create the object using a custom configuration
'
Dim myWorker As Worker = New Worker(PcanChannel.Pci01, Bitrate.Pcan250)
' 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}")
// Create the object using a custom configuration
//
Worker^ myWorker = gcnew Worker(PcanChannel::Pci01, Bitrate::Pcan250, false);
// Show information about the object
//
Console::WriteLine("Worker object created.");
Console::WriteLine(" Channel: {0}", myWorker->Channel);
Console::WriteLine(" Protocol: {0}", myWorker->TransmissionProtocol);
Console::WriteLine(" Bit rate: {0}", myWorker->BitrateCan);