The command writes an encryption key into the adapter. 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 adapter 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 adapter. Possible causes: the adapter is turned off, there is no network, or the IP address is set incorrectly. |
| ERR_INVALID_DEVICE_ID | A non-existent adapter 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
}