public void Start(
bool ignoreBitrateCheck = false,
bool deactivateReading = false,
bool deactivateBroadcasting = false
)
Public Sub Start (
Optional ignoreBitrateCheck As Boolean = false,
Optional deactivateReading As Boolean = false,
Optional deactivateBroadcasting As Boolean = false
)
public:
void Start(
bool ignoreBitrateCheck = false,
bool deactivateReading = false,
bool deactivateBroadcasting = false
)
About reading:
A Worker object can handle multiple receive queues. Only one receive queue is active by default when the object is created, and its filter is configured to receive any message.
The reading process is executed in an additional thread, making use of the event notification mechanism to fetch CAN messages. Fetched messages can be dequeued for their further processing using the Dequeue method. If needed, messages stored in one or all receive queues may be discarded using the methods ClearReceiveQueue and ClearAllReceiveQueues respectively.
Each receive queue has its own message filter. This message filter can be configured using several filtering criteria, in form of FilteringCriterion data, by using the AddFilter method. The message filtering in a receive queue can also be temporarily disabled/enabled at any time by using the SetFilteringState method. A specific filtering criterion, or all of them, can be removed using the methods RemoveFilter and ClearFilters respectively.
About writing:
There are two approaches for sending messages to the connected CAN network:
Using a Broadcast message, which periodically places a configured CAN message in the connected Channel's transmit queue for immediate sending.
New Broadcast items can be configured using the AddBroadcast method. The processing of current registered Broadcast items can be stopped and resumed again using the methods PauseBroadcast and ResumeBroadcast respectively. A specific Broadcast item, or all of them, can be removed using the methods RemoveBroacast and ClearBroadcasts respectively.
The following example shows the activation and deactivation of a Worker object.
In case of failure, an error messages is written to the console output using English as output language.
// Create the object using the default configuration
//
Worker myWorker = new Worker();
try
{
// Activate the worker object
//
myWorker.Start();
Console.WriteLine("The Worker object was activated successfully.");
// Deactivate the worker object, when it is no longer needed
//
myWorker.Stop();
Console.WriteLine("The Worker object was deactivated.");
}
catch(Exception ex)
{
Console.WriteLine($"An exception occurred by activating the Worker object. {ex.Message}");
}
' Create the object using the default configuration
'
Dim myWorker As Worker = New Worker()
Try
' Activate the worker object
'
myWorker.Start()
Console.WriteLine("The Worker object was activated successfully.")
' Deactivate the worker object, when it is no longer needed
'
myWorker.Stop()
Console.WriteLine("The Worker object was deactivated.")
Catch ex As Exception
Console.WriteLine($"An exception occurred by activating the Worker object. {ex.Message}")
End Try
// Create the object using the default configuration
//
Worker^ myWorker = gcnew Worker();
try
{
// Activate the worker object
//
myWorker->Start(false, false, false);
Console::WriteLine("The Worker object was activated successfully.");
// Deactivate the worker object, when it is no longer needed
//
myWorker->Stop(false, false, false);
Console::WriteLine("The Worker object was deactivated.");
}
catch(Exception^ ex)
{
Console::WriteLine("An exception occurred by activating the Worker object. {0}", ex->Message);
}
DllNotFoundException | The underlying PCANBasic.dll library could not be found. |
PcanBasicException | The execution of a PCAN-Basic related operation ended with an unexpected result. |