WorkerStop Method

Disconnects the used PCAN Channel and stops reading and writing data.

Definition

Namespace: Peak.Can.Basic
Assembly: PCANBasic.NET (in PCANBasic.NET.dll) Version: 4.9.0
C#
public void Stop(
	bool clearQueues = false,
	bool clearBroatcasts = false,
	bool resetQueueFilters = false
)

Parameters

clearQueues  Boolean  (Optional)
Indicates if any remaining message within any receive queue should be discarded.
clearBroatcasts  Boolean  (Optional)
Indicates if defined Broadcast objects should be removed.
resetQueueFilters  Boolean  (Optional)
Indicates if defined filtering criteria within the message filter of any receive queue should be removed.

Example

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.

C#
// 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}");
}

See Also