CLSID_VIO_DIAGNOSTIC_CODES

This CLSID returns the diagnostic trouble codes generated by the vehicle’s electronic control units.

Name

Trouble codes

Access

Read, shareable or exclusive

Range

Type: VT_UNKNOWN

Input

None

Output

Type: VT_UNKNOWN (The IUnknown interface to an object that exposes the IVIO_DiagnosticItems interface.)
Measurement: VIOMEASUREMENT_COLLECTION
Units: VIOUNITS_DIAGNOSTICITEMS

Remarks

API device objects expect the following data types and sizes when sending data to and from the mini-drivers:

Mini-driver input

None

Mini-driver output

Type: LPVIODIAGNOSTICARRAY
Size: Varies
Description: See the description of the VIODIAGNOSTICITEMSARRAY structure.

Example

HRESULT hr;
IVIO_Device *pTroubleCodeDevice;
VARIANT vTroubleCodes;
IVIO_EnumDiagnosticItems *pTroubleCodes;
IVIO_EnumDiagnosticEntry *pThisCode[1];
IVIO_DataValue *pEntryValues[4];
DWORD j, cValues;
//Initialize the VARIANT.
VariantInit(&vTroubleCodes);
//Create an instance of the trouble code device and get its
//IVIO_DEVICE interface.
hr = CoCreateInstance(CLSID_VIO_TROUBLE_CODES, NULL,
                     CLSCTX_INPROC_SERVER, IID_VIODEVICE,
                     &pTroubleCodeDevice);
//Fetch the trouble codes from the vehicle.
pTroubleCodeDevice->GetData(&vTroubleCodes, 3000);
//Get the IUknown pointer to the collection of returned trouble codes.
if (SUCCEEDED(vTroubleCodes.punkVal->
   QueryInterface(IID_VIOEnumDiagnosticItems, (VOID **) 
   &pTroubleCodes)))
{//Got the enumeration interface from the VARIANT.
   do
      {
      //Retrieve the next trouble code from the enumerator.
      hr = pTroubleCode->Next(1, pThisCode, NULL);
      if (SUCCEEDED (hr))
         {//Retrieved the next entry in the collection of returned
         //trouble codes.
         pThisCode->Next(4, pEntryValues, &cValues);
         //Process the values as needed.
         //Then release the data value created in the pThisCode-> 
         //Next() call.
         for (j = 0; j < cValues; j++)
   pEntryValues[j]->Release();
   //Release the diagnostic entry enumerator.
   pThisCode->Release();
         }//End if (Got the next diagnostic code item from the
         enumerator)
      }
while (hr == S_OK);
//Verify that the enumeration interface is released.
pTroubleCodes->Release();
}//End if (Got the enumeration interface from the VARIANT)
//Free up the resources in the VARIANT returned by GetData().
VariantClear(&vTroubleCodes);
//Release the reference to the interface.
pTroubleCodeDevice->Release();