Search code examples
autosaruds

How to map internal DataElement's from the Dem to Dcm DIDs?


How to map internal DataElements from the Dem (Diagnostic Event Manager) to Dcm (Diagnostic Communication Manager) DIDs (Data Identifier)?

Let's say, I have a DemDataClass with DemDataElementUsePort set to USE_DATA_INTERNAL and DemDataElementInternalData set to DEM_AGINGCTR.

This DemDataClass is referenced in a DemDidClass as DemDidDataClassRef.

But how do I map this to the normal ReadDataByIdentifier service, which is handled in Dcm?

P.S.: I know how to implement it manually, but it sounds a bit weird that I can do it by configuration in Dem, but apparently not in Dcm.


Solution

  • The AgingCounter (and other counters) are actually DTC specific elements, and are part of the so called ExtendedDataRecord of a DTC.

    In Dem, you have to configure the DemExtendedDataClass and DemExtendedDataRecordClass and assign them to the DTCs.

    These ExtendedDataRecords are not read out as DIDs over DiagService 0x22 RBDI, but with the DiagService 0x19 RDTCI (ReadDTCInformation):

    • sub-function = 0x06 reportDTCExtDataRecordByDTCNumber)
    • sub-function = 0x10 reportMirrorMemoryDTCExtDataRecordByDTCNumber
    • sub-function = 0x16 reportDTCExtDataRecordByRecordNumber
    • sub-function = 0x19 reportUserDefMemoryDTCExtDataRecordByDTCNumber

    The Dcm will actually pick them up for each DTC, using e.g. Dem_SelectExtendedDataRecord(), Dem_GetNextExtendedDataRecord().

    The similar approach is BTW used for the FreezeFrames/SnapshotRecords (see for the according subfunctions of DiagService 0x19 RDTCI).

    Currently, I wonder, why you would do this with DIDs and 0x22-RDBI.