END_TEST START_TEST(test_j2534_PassThruOpen) { unsigned long *pDeviceCount = 0; unsigned long *pDeviceId = 1; long rc; rc = PassThruScanForDevices(&pDeviceCount); if(rc != STATUS_NOERROR) { char errmsg[80] = "\0"; PassThruGetLastError(&errmsg); printf("PassThruGetLastError: %s", errmsg); } rc = PassThruOpen("J2534-1:ecutools", pDeviceId); if(rc != STATUS_NOERROR) { char errmsg[80] = "\0"; PassThruGetLastError(&errmsg); printf("PassThruGetLastError: %s", errmsg); } ck_assert_int_eq(pDeviceId, 1); }
/* ******************************************************************************* ** Log2534Error - Function to lookup J2534 function error descriptions ** and send to console and log file. ******************************************************************************* */ void Log2534Error(char *LogString, unsigned long RetVal, char *FunctionName) { char PrintBuffer[240]; char ErrorBuffer[240]; char LogBuffer[1024]; if (FunctionName != NULL && RetVal != STATUS_NOERROR) { PassThruGetLastError(ErrorBuffer); sprintf(PrintBuffer, "FAILURE: %s %s (%s returned %ld)\n", LogString, ErrorBuffer, FunctionName, RetVal); } else { sprintf(PrintBuffer, "INFORMATION: %s\n", LogString); } sprintf(LogBuffer, PrintBuffer); fputs(LogBuffer, ghLogFile); fflush(ghLogFile); printf("%s", PrintBuffer); }