Quantex GmbH
Your region: Europe

PassThruStopPeriodicMsg v4.04 v5.0

Removing a periodic message

Last updated:

Description

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)

Parameters

Return error codes

Code Description Possible causes and solutions
STATUS_NOERROR Function completed successfully
ERR_INVALID_CHANNEL_ID Invalid channel identifier
  • The channel was not opened or has already been closed
  • Solution: use the ChannelID returned by PassThruConnect
ERR_DEVICE_NOT_CONNECTED No connection to the adapter
  • The adapter is turned off or the connection has been lost
  • Solution: check the adapter power and the network connection
ERR_INVALID_DEVICE_ID Invalid device identifier
  • The DeviceID was not obtained via PassThruOpen or the device is closed
  • Solution: use the DeviceID returned by PassThruOpen
ERR_INVALID_MSG_ID Invalid message identifier
  • A message with this MsgID does not exist or has already been stopped
  • Solution: use the MsgID returned by PassThruStartPeriodicMsg
ERR_FAILED Internal error
  • An error in the DLL or the adapter firmware
  • Solution: call PassThruGetLastError() to get the details

Examples

C/C++ example

#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
}

Kotlin example (Android)

// 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}")
}

Python example

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}")

C# example

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}");
}