WorkerClearFilters(Int32) Method

Removes all filtering criteria from the message filter of the specified receive queue.

Definition

Namespace: Peak.Can.Basic
Assembly: PCANBasic.NET (in PCANBasic.NET.dll) Version: 4.9.0
C#
public void ClearFilters(
	int queueIndex
)

Parameters

queueIndex  Int32
Zero-based index that identifies the receive queue whose filter criteria are to be removed.

Example

The following example shows how to remove all filtering criteria from the message filter of the second receive queue (index 1).

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

// Set the filter of the second receive queue (index 1) to receive only echo messages with ID 0x15
//
FilteringCriterion criterion = new FilteringCriterion();
criterion.SetMessageType(MessageType.Echo, FilterBehavior.Include);
if (myWorker.AddFilter(1, criterion))
{
    criterion.SetSingleId(0x15, FilterMode.Extended);
    if (myWorker.AddFilter(1, criterion))
        Console.WriteLine("Receiving only Echo messages with extended ID equals to 0x15...");
    else
        Console.WriteLine("The given filter is already registered.");
}
else
    Console.WriteLine("The given filter is already registered.");

// All filtering criteria from the message filter of the second receive queue (index 1) are removed 
//
myWorker.ClearFilters(1);
Console.WriteLine("All filtering criteria were removed.");

Exceptions

IndexOutOfRangeExceptionThe queueIndex parameter value is out of range. This must be in the range [0...ReceiveQueuesCount-1].

See Also