My code:
Code: Select all
string TC_UDS_266()
{
string s;
TPUDSStatus r;
unique_ptr<PUDSClass> pcan(new PUDSClass());
if (pcan->openDevice(PUDS_USBBUS1, PUDS_BAUD_250K) != PUDS_ERROR_OK)
{
cout << "UDS-266: failed to initialize" << endl;
return "UDS-266: FAILED";
}
cout << "initialized" << endl;
TPUDSMsg requestConfirmation;
TPUDSMsg response;
memset(&requestConfirmation, 0, sizeof(TPUDSMsg));
memset(&response, 0, sizeof(TPUDSMsg));
WORD bufferLength = 2;
BYTE buffer[bufferLength] = {};
buffer[0] = '00';
buffer[1] = '04';
r = pcan->SvcReadDataByPeriodicIdentifier(&pcan->request, 0x01, buffer, bufferLength);
if (r == PUDS_ERROR_OK)
r = pcan->WaitForService(&response, &requestConfirmation);
if (r == PUDS_ERROR_OK)
{
cout << "Response was received" << endl;
//cout << "SID: " << response.DATA.POSITIVE.SI << endl;
s = "UDS-266: PASSED";
}
else
{
cout << "An error occured" << endl;
s = "UDS-266: FAILED";
}
return s;
}
Send: [04 2A 01 30 34]
Received: [03 7F 2A 7F]
The response is ok, since this service is no allowed in default session, but I can't understand why it sends "... 30 34]" and not "...00 04]". Even if I set buffer (PIDs) to ["A0", "B4"], it still sends "30" and "34".
