The command writes an encryption key into the VCI. The key is required for the PassThruSecurityConnect function to work. If the key is filled with 0xFF or 0x00, the PassThruSecurityConnect command will not work. This command is performed by the software manufacturer when preparing the VCI for sale. Running the command again may overwrite the new key.
long SetKey(unsigned long DeviceID, unsigned char* pKey )
| Code | Description |
|---|---|
| STATUS_NOERROR | Function completed successfully |
| ERR_DEVICE_NOT_CONNECTED | No connection to the VCI. Possible causes: the VCI is turned off, there is no network, or the IP address is set incorrectly. |
| ERR_INVALID_DEVICE_ID | A non-existent device identifier DeviceID was specified |
#include "j2534_lib.hpp"
unsigned long DeviceID;
unsigned long Ret;
unsigned char Key[176];
Ret = SetKey(DeviceID, Key);
if (Ret != STATUS_NOERROR)
{ // Error handling
}