The command writes the encryption key to the adapter. The key is required for the PassThruSecurityConnect function to work. If the key is filled with 0xFF or 0x00, then the PassThruSecurityСonnect command will not work. This command is executed by the manufacturer of the program when preparing the adapter 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 adapter. Possible reasons: The adapter is turned off, there is no network, or the IP address is not set correctly. |
ERR_INVALID_DEVICE_ID | Set a non-existent adapter 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
}