variables {
// Access modes for diagGet/SetParameter
const long cParamAccessNumerical = 0;
const long cParamAccessPhysical = 1;
const long cParamAccessCoded = 2;
// Parameter values
const double cPhysicalValue = 14.2;
const double cCodedValue = 11259375; // = 0xABCDEF
}
on key 's'
{
diagRequest Door.WindowLiftRoughPosition_Write req;
req.SetParameter("WindowLiftRoughPosition", "100,00%"); // set parameter to the symbolically-specified value
req.SendRequest();
}
on key 'p'
{
diagRequest ECU.Value1_Write req;
diagSetParameter(req, cParamAccessPhysical, "PhysicalValue", cPhysicalValue);
req.SendRequest(); // Parameter will be transmitted as 40 2C 66 66 66 66 66 66 (64bit double, Motorola format)
}
on key 'n'
{
diagRequest ECU.Value2_Write req;
double numericalValue; // E.g. numerical value 142 would represent the same value as gPhysicalValue=14.2
numericalValue=cPhysicalValue*10; // Based on formula, e.g. 142 * 1/10 = 14.2 (14.2 = physical value, 142 = numerical value)
diagSetParameter(req, cParamAccessNumerical, "NumericalValue", numericalValue); // Set numerical value (e.g.: 142 equals 142 * 1/10 Volt = 14.2 Volt)
req.SendRequest(); // Parameter will be transmitted as 0x40 0x61 0xBF 0xFF 0xFF 0xFF 0xFF 0xFF (64bit double, Motorola format)
}
on key 'c'
{
diagRequest ECU.Value3_Write req;
diagSetParameter(req, cParamAccessCoded, "Value_Uint32", cCodedValue); // Set coded value, not considering the byte order from diagnostic description (big or little endian)
req.SendRequest(); // Parameter will be transmitted as 0x00 0xAB 0xCD 0xEF both for 32bit little endian parameters (Intel) and 32bit big endian parameters (Motorola)
}