public bool RemoveFilter(
FilteringCriterion filter
)
Public Function RemoveFilter (
filter As FilteringCriterion
) As Boolean
public:
bool RemoveFilter(
FilteringCriterion filter
)
The following example shows how to configure the message filter of the default receive queue (index 0) to receive only echo messages with extended ID 0x15. After this, the filtering criteria for the CAN identifier is removed, so that any echo message can be received.
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();
// Set the filter of the default receive queue (index 0) to receive only echo messages with ID 0x15
//
FilteringCriterion criterion = new FilteringCriterion();
criterion.SetMessageType(MessageType.Echo, FilterBehavior.Include);
if (myWorker.AddFilter(criterion))
{
criterion.SetSingleId(0x15, FilterMode.Extended);
if (myWorker.AddFilter(criterion))
{
Console.WriteLine("Receiving only Echo messages with extended ID equals to 0x15...");
// Remove the filter for ID 0x15, to receive echo messages with any ID
//
if(myWorker.RemoveFilter(criterion))
Console.WriteLine("Receiving now any Echo message...");
else
Console.WriteLine("The specified criterion could not be found.");
}
else
Console.WriteLine("The given filter is already registered.");
}
else
Console.WriteLine("The given filter is already registered.");
' Create the object using the default configuration
'
Dim myWorker As Worker = New Worker()
' Set the filter of the default receive queue (index 0) to receive only echo messages with ID 0x15
'
Dim criterion As FilteringCriterion = New FilteringCriterion()
criterion.SetMessageType(MessageType.Echo, FilterBehavior.Include)
If myWorker.AddFilter(criterion) Then
criterion.SetSingleId(&H15, FilterMode.Extended)
If myWorker.AddFilter(criterion) Then
Console.WriteLine("Receiving only Echo messages with extended ID equals to 0x15...")
' Remove the filter for ID 0x15, to receive echo messages with any ID
'
If myWorker.RemoveFilter(criterion) Then
Console.WriteLine("Receiving now any Echo message...")
Else
Console.WriteLine("The specified criterion could not be found.")
End If
Else
Console.WriteLine("The given filter is already registered.")
End If
Else
Console.WriteLine("The given filter is already registered.")
End If
// Create the object using the default configuration
//
Worker^ myWorker = gcnew Worker();
// Set the filter of the default receive queue (index 0) to receive only echo messages with ID 0x15
//
FilteringCriterion criterion;
criterion.SetMessageType(MessageType::Echo, FilterBehavior::Include);
if (myWorker->AddFilter(criterion))
{
criterion.SetSingleId(0x15, FilterMode::Extended, FilterBehavior::Include);
if (myWorker->AddFilter(criterion))
{
Console::WriteLine("Receiving only Echo messages with extended ID equals to 0x15...");
// Remove the filter for ID 0x15, to receive echo messages with any ID
//
if (myWorker->RemoveFilter(criterion))
Console::WriteLine("Receiving now any Echo message...");
else
Console::WriteLine("The specified criterion could not be found.");
}
else
Console::WriteLine("The given filter is already registered.");
}
else
Console::WriteLine("The given filter is already registered.");