Removing a periodic message
Last updated:
Stops the transmission of a periodic message and releases the resources associated with it. After the call, the MsgID identifier becomes invalid.
long PassThruStopPeriodicMsg(unsigned long ChannelID, unsigned long MsgID)
PassThruStartPeriodicMsg.| Code | Description | Possible causes and solutions |
|---|---|---|
| STATUS_NOERROR | Function completed successfully | — |
| ERR_INVALID_CHANNEL_ID | Invalid channel identifier |
|
| ERR_DEVICE_NOT_CONNECTED | No connection to the adapter |
|
| ERR_INVALID_DEVICE_ID | Invalid device identifier |
|
| ERR_INVALID_MSG_ID | Invalid message identifier |
|
| ERR_FAILED | Internal error |
|
#include "j2534_lib.hpp"
unsigned long ChannelID; // Channel ID
unsigned long MsgID; // Message ID returned by PassThruStartPeriodicMsg
long Ret;
Ret = PassThruStopPeriodicMsg(ChannelID, MsgID);
if (Ret != STATUS_NOERROR)
{
// Error handling
}
// channelID and msgID obtained earlier
val result = j2534.ptStopPeriodicMsg(channelID, msgID)
if (result.status == STATUS_NOERROR) {
// Periodic message stopped successfully
Log.i("J2534", "Periodic message stopped, MsgID: $msgID")
} else {
// Error handling
Log.e("J2534", "Failed to stop periodic message: ${result.status}")
}
import ctypes
# Load the library
j2534 = ctypes.CDLL("libj2534_v04_04.so") # Linux
# j2534 = ctypes.WinDLL("j2534sd_v04_04_x64.dll") # Windows
# channel_id and msg_id obtained earlier
ret = j2534.PassThruStopPeriodicMsg(channel_id, msg_id)
if ret == 0: # STATUS_NOERROR
print(f"Periodic message stopped, MsgID: {msg_id}")
using System;
using System.Runtime.InteropServices;
// channelId and msgId obtained earlier
int ret = J2534.PassThruStopPeriodicMsg(channelId, msgId);
if (ret == 0) // STATUS_NOERROR
{
Console.WriteLine($"Periodic message stopped, MsgID: {msgId}");
}