@@ -1013,6 +1013,8 @@ class UDS_RDTCI(Packet):
10131013
10141014class DTC (Packet ):
10151015 name = 'Diagnostic Trouble Code'
1016+ dtc_descriptions = {} # Customize this dictionary for each individual ECU / OEM
1017+
10161018 fields_desc = [
10171019 BitEnumField ("system" , 0 , 2 , {
10181020 0 : "Powertrain" ,
@@ -1032,7 +1034,7 @@ def extract_padding(self, s):
10321034 return '' , s
10331035
10341036
1035- class DTC_Status (Packet ):
1037+ class DTCAndStatusRecord (Packet ):
10361038 name = 'DTC and status record'
10371039 fields_desc = [
10381040 PacketField ("dtc" , None , pkt_cls = DTC ),
@@ -1043,6 +1045,26 @@ def extract_padding(self, s):
10431045 return '' , s
10441046
10451047
1048+ class DTCExtendedData (Packet ):
1049+ name = 'Diagnostic Trouble Code Extended Data'
1050+ dataTypes = ObservableDict ()
1051+
1052+ fields_desc = [
1053+ ByteEnumField ("data_type" , 0 , dataTypes ),
1054+ XByteField ("record" , 0 )
1055+ ]
1056+
1057+ def extract_padding (self , s ):
1058+ return '' , s
1059+
1060+
1061+ class DTCExtendedDataRecord (Packet ):
1062+ fields_desc = [
1063+ PacketField ("dtcAndStatus" , None , pkt_cls = DTCAndStatusRecord ),
1064+ PacketListField ("extendedData" , None , pkt_cls = DTCExtendedData )
1065+ ]
1066+
1067+
10461068class UDS_RDTCIPR (Packet ):
10471069 name = 'ReadDTCInformationPositiveResponse'
10481070 fields_desc = [
@@ -1063,7 +1085,7 @@ class UDS_RDTCIPR(Packet):
10631085 lambda pkt : pkt .reportType in [0x01 , 0x07 ,
10641086 0x11 , 0x12 ]),
10651087 ConditionalField (PacketListField ('DTCAndStatusRecord' , None ,
1066- pkt_cls = DTC_Status ),
1088+ pkt_cls = DTCAndStatusRecord ),
10671089 lambda pkt : pkt .reportType in [0x02 , 0x0A , 0x0B ,
10681090 0x0C , 0x0D , 0x0E ,
10691091 0x0F , 0x13 , 0x15 ]),
0 commit comments