Removing a message filter
Last updated:
This function removes one of the previously installed filters.
long PassThruStopMsgFilter(unsigned long ChannelID, unsigned long FilterID)
| Code | Description | Possible causes and solutions |
|---|---|---|
| STATUS_NOERROR | Function completed successfully | — |
| ERR_DEVICE_NOT_CONNECTED | No connection to the adapter |
|
| ERR_INVALID_DEVICE_ID | Invalid device identifier |
|
| ERR_INVALID_CHANNEL_ID | Invalid channel identifier |
|
| ERR_INVALID_FILTER_ID | Invalid filter identifier |
|
| ERR_FAILED | Undefined error |
|
#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
}
// 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}")
}
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()}")
// 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}");
}