long result;
//wait for RQST PG (sent form SA=0x01 to DA=0xAA) for 2000 ms
result = TestWaitForJ1939PG(0xEA00, 0x01, 0xAA, 2000);
if (result == 1)
{
pg RQST pgRQST; //PG RQST has to be defined in the attached DBC file
result = TestGetWaitJ1939PGData(pgRQST);
if (result == 0)// obtain the received RQST PG
{
if (pgRQST.ParameterGroupNumber == 0x1234) //check content of the received PG
{
TestStepPass("Validation", "Request for PGN 0x1234 occurred");
// do something, e.g. send response...
}
}
else
{
TestStepFail("Validation", "Failed to get data of received PG RQST: unexpected error %d", result);
}
}
else if(result == 0)
{
TestStepFail("Validation", "Expected PG RQST is not received within 2000 ms");
}
else
{
TestStepFail("Validation", "TestWaitForJ1939PG(0xEA00, 0x01, 0xAA, 2000): unexpected error %d", result);
}