The function establishes a connection with the adapter. Not with a car. One Dll can work simultaneously with several adapters. Adapters must have different IP addresses.
long PassThruOpen(void* pName, unsigned long* pDeviceID)
Definition | Description |
---|---|
STATUS_NOERROR | Function completed successfully |
ERR_DEVICE_NOT_CONNECTED | No connection to adapter. Possible reasons: The adapter is turned off, there is no network, or the IP address is not set correctly. |
ERR_DEVICE_IN_USE | The device is already in use by the program. Possible reasons: The PassThruClose function was not executed in the previous session. |
ERR_NULL_PARAMETER | PDeviceID not set |
ERR_FAILED | Defined by the J2534 standard. In the adapter, it is not used for this function. |
#include "j2534_lib.hpp"
unsigned long DeviceID;
long Ret;
Ret = PassThruOpen("192.168.1.3", &DeviceID);
if (Ret != STATUS_NOERROR)
{ // Error handling
}
// Further, DeviceID is used in the following functions.
PassThruConnect(DeviceID, ISO14230, Flags, 10400, &ChannelID);
PassThruDisconnect(ChannelID);
PassThruClose(DeviceID);