Quantex GmbH
Your region: Europe

PassThruStopMsgFilter v4.04 v5.0

Removing a message filter

Last updated:

Description

This function removes one of the previously installed filters.

long PassThruStopMsgFilter(unsigned long ChannelID, unsigned long FilterID)

Parameters

Return error codes

Code Description Possible causes and solutions
STATUS_NOERROR Function completed successfully
ERR_DEVICE_NOT_CONNECTED No connection to the adapter
  • The adapter is turned off or out of range
  • Solution: check the adapter power supply and the network connection
ERR_INVALID_DEVICE_ID Invalid device identifier
  • DeviceID was not obtained via PassThruOpen or the device is already closed
  • Solution: make sure PassThruOpen completed successfully
ERR_INVALID_CHANNEL_ID Invalid channel identifier
  • ChannelID was not obtained via PassThruConnect or the channel is already closed
  • Solution: make sure PassThruConnect completed successfully
ERR_INVALID_FILTER_ID Invalid filter identifier
  • FilterID was not obtained via PassThruStartMsgFilter or the filter has already been removed
  • Solution: use the FilterID returned by PassThruStartMsgFilter
ERR_FAILED Undefined error
  • Internal error in the library or the adapter
  • Solution: call PassThruGetLastError() to get a description

Examples

C/C++ example

#include "j2534_lib.hpp"

unsigned long ChannelID; // channel ID
unsigned long FilterID;  // filter ID returned by PassThruStartMsgFilter
long Ret;

Ret = PassThruStopMsgFilter(ChannelID, FilterID);
if (Ret != STATUS_NOERROR)
{
    // Error handling
}

Kotlin example (Android)

// channelID and filterID obtained earlier
val result = j2534.ptStopMsgFilter(channelID, filterID)
if (result.status == STATUS_NOERROR) {
    // Filter removed successfully
    Log.i("J2534", "Filter $filterID removed.")
} else {
    // Error handling
    Log.e("J2534", "Filter removal error: ${result.status}")
}

Python example

from ctypes import *

# channelID and filterID obtained earlier
ret = j2534.PassThruStopMsgFilter(channel_id, filter_id)
if ret == 0:  # STATUS_NOERROR
    print(f"Filter {filter_id} removed")
else:
    error = create_string_buffer(256)
    j2534.PassThruGetLastError(error)
    print(f"Error: {error.value.decode()}")

C# example

// channelID and filterID obtained earlier
int ret = J2534.PassThruStopMsgFilter(channelId, filterId);
if (ret == 0) // STATUS_NOERROR
{
    Console.WriteLine($"Filter {filterId} removed");
}
else
{
    var error = new StringBuilder(256);
    J2534.PassThruGetLastError(error);
    Console.WriteLine($"Error: {error}");
}