The command writes the encryption key to the VCI. The key is required for the PassThruSecurityConnect function to work. If the key is filled with 0xFF or 0x00, then the PassThruSecurityConnect command will not work. This command is executed by the manufacturer of the program when preparing the VCI for sale. A second command may overwrite the new key.
long SetKey(unsigned long DeviceID, unsigned char* pKey )
| Definition | Description |
|---|---|
| STATUS_NOERROR | Function completed successfully |
| ERR_DEVICE_NOT_CONNECTED | No connection to the VCI. Possible reasons: The VCI is turned off, there is no network, or the IP address is not set correctly. |
| ERR_INVALID_DEVICE_ID | Set a non-existent device ID DeviceID |
#include "j2534_lib.hpp"
unsigned long DeviceID;
unsigned long Ret;
unsigned char Key[176];
Ret = SetKey(DeviceID, Key);
if (Ret != STATUS_NOERROR)
{ // Error handling
}