Advanced properties of diagnostics-related objects

UDS result objects

class DiagResult(responseObj, errCode, responseTime, pendingCount, busyCount)
GetResponse()

Returns the diagnostics response.

Returns:

Diagnostics response or None if no response was received.

Return type:

ByteStream

GetErrCode()

Returns the error code. The error codes and their meaning can be found in the table below.

Returns:

Error code

Return type:

int

Error code

Error message

0

”Ok”

1

”Timeout in transport layer”

2

”Received negative response”

3

”No active diagnostics session”

4

”Timeout waiting for diagnostics response”

5

”Transmission error”

6

”Unexpected response”

7

”Still waiting for response”

8

”Transport error”

9

”Application error”

GetErrMsg()

Returns a textual representation of the error code.

Returns:

Error message

Return type:

str

GetResponseTime()

Returns the time between sending the request and receiving the response in ms.

Returns:

Time until response was received in ms

Return type:

int

GetPendingCount()

Returns the number of received RCRRP messages (Request correctly received, but response is pending).

Returns:

Number of received RCRRP messages

Return type:

int

GetBusyCount()

Returns the number of received BRR messages (Busy, repeat request).

Returns:

Number of received BRR messages

Return type:

int

GetTpInfo()

Provides the following protocol-specific information:

  • CAN: CanId of the response

  • FlexRay, DoIP, DoSoAd: source address of the response

DoIP example: {‘sourceAddress’: ByteStream(‘01:00’)}

Returns:

Transport protocol specific information.

Return type:

dict

GetServiceId()

Returns the service ID of the diagnostic response.

Returns:

Service ID of the diagnostic response

Return type:

int

DiagService

class DiagServiceResult
GetDecodedResponse()

Returns the decoded response of the original raw response.

Returns:

Decoded response

Return type:

dict | NotPresent

ObdOnUdsService

class ObdOnUdsServiceResult
GetDecodedResponse()

Returns the decoded response of the original raw response.

Returns:

Decoded response

Return type:

dict | NotPresent

Authentication

class AuthenticationConfigurationResult

Bases: AuthenticationResult

class AuthenticationDeauthenticateResult

Bases: AuthenticationResult

class AuthenticationProofOfOwnershipResult

Bases: AuthenticationResult

GetSessionKeyInfo()

If present, this value shall contain session key information, e.g. the encrypted session key(s) for securing further communication in the actual session and/or proof value(s) (e.g. a hash value) for the validation of the session key(s) on the client side.

NOTE 1 This information is linked to the contents of the request message data-parameter communicationConfiguration. The format of this parameter as well as the creation of the session key(s) and the computation of the proof value(s) are up to the vehicle manufacturer choice.

Return type:

ByteStream

class AuthenticationResult

Bases: DiagResult

ReturnValue

This parameter returns the result of the procedure on the server.

class AuthenticationVerifyCertificateUnidirectionalResult

Bases: AuthenticationResult

GetChallengeServer()

The challenge contains vehicle manufacturer specific formatted server data (eventually containing randomized information) or is a random number. This parameter record is to transmit the challenge to the client.

Return type:

ByteStream

GetEphemeralPublicKeyServer()

Ephemeral public key generated by the server for Diffie-Hellman key agreement.

Return type:

ByteStream

UploadDownloadFunctionalUnit

class RequestDownloadResult

Bases: DiagResult

GetLengthFormatIdentifier()

This parameter returns the length of the following maxNumberOfBlockLength in bytes.

Return type:

int

GetMaxNumberOfBlockLength()

This parameter returns the maxNumberOfBlockLength field of the UDS response. It specifies the maximal length of bytes the client is allowed to send in each TransferData message. This length reflects the complete message length, including the service identifier and the data-parameters present in the TransferData request message.

Return type:

ByteStream

GetMaxNumberOfBlockLengthAsInt()

This parameter returns the maxNumberOfBlockLength field of the UDS response, interpreted as an integer value.

Return type:

int

GetNumberOfBlockLengthParameterLength()

This parameter returns the length of the maxNumberOfBlockLength field within the UDS response.

Return type:

int

class TransferDataBlockResult

Bases: DiagResult

GetBlockSequenceCounter()

This parameter returns the block sequence counter of the UDS response as a decimal integer value.

Return type:

int

class TransferDataResult
GetAllBlockResults()

Returns all responses from each transfer data block as list.

Return type:

list<TransferDataBlockResult>

GetErrCode()

Returns the error code of the last received response.

Return type:

int

GetErrMsg()

Returns the error message of the last received response

Return type:

str

GetResponse()

Returns the last received response of the transfer data blocks

Return type:

ByteStream

DiagnosticSessionControl

class DiagnosticSessionControlResult

Bases: DiagResult

GetP2ServerMax1()

Returns the default P2Server_max timing supported by the server for the activated diagnostic session.

Return type:

int

GetP2ServerMax2()

Returns the enhanced (NRC 0x78) P2 Server_max supported by the server for the activated diagnostic session.

Return type:

int

GetSubfunction()

Returns the subfunction the service has been called with.

Return type:

int

ECUReset

class ECUResetResult

Bases: DiagResult

This class represents the result of a successful ECUReset (0x11) call, consisting of the data record.

GetPowerDownTime()

Returns the minimum time the server will remain in the power down sequence in seconds. 0xFF indicates a failure or time not available.

Returns:

Power down time

Return type:

int

InputOutputControlByIdentifier

class InputOutputControlByIdentifierResult

Bases: DiagResult

Result of a successful InputOutputControlByIdentifier (0x2F) call, consisting of ID and data. Only one set of (ID, data) is supported.

GetDataIdentifier()

Returns the data identifier.

Returns:

Data identifier

Return type:

int

GetIoCtrlParam()

Returns the inputOutputControlParameter.

Returns:

inputOutputControlParameter

Return type:

int

GetData()

Returns the data record.

Returns:

Data record

Return type:

ByteStream

ReadDataByIdentifier

class DataRecordDiagResult

Bases: DiagResult

Result of a successful ReadDataByIdentifier (0x22) call, consisting of ID and data. Only one set of (ID, data) is supported.

GetDataIdentifier()

Returns the data identifier.

Returns:

Data identifier

Return type:

int

GetData()

Returns the data record.

Returns:

Data record

Return type:

ByteStream

ReadDTCInformation

class DTCListDiagResult

Bases: list, DiagResult

This class represents the result of calling a diagnostic service whose response is expected to contain a DTC status availability mask and a list of DTCs and status codes, e.g. ReadDTCInformation.reportDTCByStatusMask.

Beside the methods and properties documented below, you can also use it just like a list. The list elements are of type DTCAndStatusRecord.

GetDTCStatusAvailabilityMask()

Returns the status availability mask as stated in the ECU’s response

Returns:

Status availability mask

Return type:

int

DTCStatusAvailabilityMask

Returns the status availability mask as stated in the ECU’s response

Returns:

Status availability mask

Return type:

int

class DTCNumber

Bases: object

This object represents a DTC.

GetNumber()

Returns the 3 byte DTC number

Returns:

DTC number

Return type:

int

GetShortName()

Returns the short name

Returns:

DTC name

Return type:

str

SetShortName(name)

Set the short name

Parameters:
name : str

DTC name

GetShortNumber()

Returns the 2 byte DTC number

Returns:

DTC number

Return type:

int

GetDefinition()

Returns the J2012 Representation (also known as P code) including the Failure Type Byte

Returns:

J2012 representation

Return type:

str

GetShortDefinition()

Returns the J2012 Representation (also known as P code) without Failure Type Byte

Returns:

J2012 representation

Return type:

str

GetFTB()

Returns the Failure Type Byte

Returns:

Failure type byte

Return type:

int

GetDescription()

Returns the description of the DTC, if known; else None

Returns:

DTC description

Return type:

str

SetDescription(description)

Set the description

Parameters:
description : str

DTC description

class DTCAndStatusRecord

Bases: DTCNumber

This object represents the DTC number itself and the status code of the DTC.

GetStatus()

Returns the DTC status code

Returns:

DTC status code

Return type:

int

class DTCNumberDiagResult

Bases: DiagResult

This class represents the result of calling a diagnostic service whose response is expected to contain a DTC status availability mask, a DTC format identifier and the DTC count, e.g. ReadDTCInformation.reportNumberOfDTCByStatusMask.

GetDTCStatusAvailabilityMask()

Returns the status availability mask as stated in the ECU’s response

Returns:

Status availability mask

Return type:

int

GetDTCFormatIdentifier()

Returns the DTC format identifier

Returns:

DTC format identifier

Return type:

int

GetDTCCount()

Returns the DTC count

Returns:

DTC count

Return type:

int

class DTCSnapshotIdentification

Bases: object

This object represents a single DTC snapshot identification list entry consisting of the DTC number and the according snapshot number.

GetDTC()

Returns the DTC number

Returns:

DTC number

Return type:

int

GetSnapshotNumber()

Returns the snapshot number

Returns:

Snapshot number of the DTC

Return type:

int

class DTCSnapshotIdentificationDiagResult

Bases: DiagResult

This class represents the result of calling a diagnostic service whose response is expected to contain a list of DTC numbers and according snapshot numbers, e.g. ReadDTCInformation.reportDTCSnapshotIdentification.

GetDTCSnapshotList()

Returns the snapshot list.

Returns:

List of DTCs and corresponding snapshot numbers

Return type:

list<DTCSnapshotIdentification>

class DTCSnapshotRecordDiagResult

Bases: DiagResult

This class represents the result of a successful ReportDTCSnapshotRecordByDTCNumber (0x1904) call, consisting of the DTC number, the DTC status, the DTC snapshot records as raw data and, if the according option was chosen when the job ReportDTCSnapshotRecordByDTCNumber called, the snapshot data in an interpreted form. The latter is only possible if the values of the DIDs containing within the snapshot have a fixed length.

GetDTCAndStatusRecord()

Returns the DTCAndStatusRecord contained in the response.

Returns:

Object containig DTC number (3 bytes) and status information

Return type:

DTCAndStatusRecord

GetDTCSnapshotData()

Returns a list containing the DTC snapshot data.

Returns:

List containing the DTC snapshot data

Return type:

list<DTCSnapshotDataEntry>

GetDTCSnapshotDataRaw()

Returns the DTC snapshot data as ByteStream.

Returns:

DTC snapshot data

Return type:

ByteStream

class DTCSnapshotDataEntry

Bases: object

This class represents a DTC snapshot data entry consisting of the occurrence number of the snapshot, the number of DataIdentifiers it contains and the associated recorded snapshot data.

GetDTCSnapshotRecordNumber()

Returns the DTC snapshot record number.

Returns:

DTC snapshot record number

Return type:

int

GetDTCSnapshotRecordNumberOfIdentifiers()

Returns the number of data identifiers contained in the snapshot data.

Returns:

Number of identifiers

Return type:

int

GetDTCSnapshotRecord()

Returns a list representing the snapshot data record. Each snapshot data record entry consists of the data identifier and its value.

Returns:

List containing the DTC snapshot record entries.

Return type:

list<DTCSnapshotRecordEntry>

class DTCSnapshotRecordEntry

Bases: object

This class represents a DTC snapshot record entry consisting of the data identifier and its value.

GetDID()

Returns the data identifier.

Returns:

Data identifier

Return type:

int

GetValue()

Returns the value of the data identifier.

Returns:

Value of the data identifier

Return type:

ByteStream

class DTCFaultCounter

Bases: object

This object represents a single DTC fault counter list entry consisting of the DTC number and the according fault counter.

GetDTC()

Returns the DTC number

Returns:

DTC number

Return type:

int

GetFaultCounter()

Returns the fault counter

Returns:

Fault counter of the DTC

Return type:

int

class DTCFaultCounterDiagResult

Bases: DiagResult

This class represents the result of calling a diagnostic service whose response is expected to contain a list of DTCs and fault counters, e.g. ReadDTCInformation.reportDTCFaultDetectionCounter.

GetDTCFaultList()

Returns the list of DTC faults

Returns:

List of DTCs and corresponding fault counter

Return type:

list<DTCFaultCounter>

class UserDTCListDiagResult

Bases: DTCListDiagResult

This class represents the result of calling a diagnostic service whose response is expected to contain a memory selection, DTC status availability mask and a list of DTCs and status codes, e.g. ReadDTCInformation.reportUserDefMemoryDTCByStatusMask.

GetDTCMemorySelection()

Returns the user DTC memory selection as stated in the ECU’s response

Returns:

Memory selection

Return type:

int

DTCMemorySelection

Returns the user DTC memory selection as stated in the ECU’s response

Returns:

Memory selection

Return type:

int

ReadMemoryByAddress

class MemoryDiagResult

Bases: DiagResult

This class represents the result of a successful readMemoryByAddress (0x23) call, consisting of the data record.

GetDataRecord()

Returns the data record

Returns:

Data record

Return type:

BitStream

RoutineControl

class RoutineDiagResult

Bases: DiagResult

This class represents the result of a successful RoutineControl (0x31) call, consisting of the routine info and the routine status record.

GetRoutineControlType()

Returns the routine control type

Returns:

Routine Control Type

Return type:

int

GetRoutineId()

Returns the routine id

Returns:

Routine Id

Return type:

int

GetRoutineInfo()

Returns the routine info

Returns:

Routine Info

Return type:

BitStream

GetStatusRecord()

Returns the status record

Returns:

Status record

Return type:

ByteStream

SecurityAccess

class SecurityAccessDiagResult

Bases: DiagResult

This class represents the result of a successful SecurityAccess (0x27) call with the subfunction requestKey. The result contains at least the seed received from the ECU. If a Seed&Key library was specified when the SecurityAccessRequestSeed job was called, the result also contains the key calculated by the Seed&Key library.

GetSecuritySeed()

Returns the security seed of the ECU’s response

Returns:

Security seed

Return type:

ByteStream

GetGeneratedKey()

Returns the security key that was generated by the Seed&Key library, if the path to the Seed&Key library was set in the parameter SeedAndKeyLibraryPath of job SecurityAccessRequestSeed. The value can be used as parameter SecurityKey of the job SecurityAccessSendKey to unlock the ECU. If no Seed&Key library was specified, None is returned.

Returns:

Generated security key

Return type:

ByteStream

WriteDataByIdentifier

class WriteDataByIdentifierResult

Bases: DiagResult

Result of a successful WriteDataByIdentifier (0x2E) call, consisting of ID.

GetDataIdentifier()

Returns the data identifier.

Returns:

Data identifier

Return type:

int

WriteMemoryByAddress

class WriteMemoryByAddressResult

Bases: DiagResult

Result of a successful writeMemoryByAddress (0x3D) call, consisting of MemoryAddress and MemorySize.

GetMemoryAddress()

Returns the echo of the memory address.

Returns:

Memory address

Return type:

int

GetMemorySize()

Returns the echo of the memory size.

Returns:

Memory size

Return type:

int

NegativeResponse

class NegativeResponse

Bases: DiagResult

Representation of a negative UDS response.

GetUDSErrMsg()

Returns the UDS error message.

Returns:

UDS error message

Return type:

str

GetNRC()

Returns the negative response code.

Returns:

negative response code

Return type:

int

class UndefinedResponse

Bases: object

Im Fall, dass als Ergebniss eines Diagnoserequests ‘Undefined’ vorliegt (z.b. manueller Testabbruch) kann dies für eine schönere Meldung im Testreport in UndefinedReponse umgewandelt werden.

KWP2000 result objects

ClearDTC

class ClearDTCResult

Bases: DiagResult

Result of a successful ClearDTC (0x14) call, consisting of the optional DTC group.

GetGroupOfDTCs()

Returns the DTC group.

Returns:

DTC group

Return type:

ByteStream

ECUReset

class ECUResetResult

Bases: DiagResult

This class represents the result of a successful ECUReset (0x11) call, consisting of the reset status.

GetResetStatus()

Returns the optional Reset Status returned by the ECU.

Returns:

Reset status

Return type:

ByteStream

InputOutputControlByCommonIdentifier

class InputOutputControlByCommonIdentifierResult

Bases: DiagResult

Result of a successful InputOutputControlByCommonIdentifier (0x2F) call, consisting of ID and data. Only one set of (ID, data) is supported.

GetDataIdentifierHighByte()

Returns the InputOutputCommonIdentifier (High Byte).

Returns:

InputOutputCommonIdentifier (High Byte)

Return type:

int

GetDataIdentifierLowByte()

Returns the InputOutputCommonIdentifier (Low Byte).

Returns:

InputOutputCommonIdentifier (Low Byte)

Return type:

int

GetControlStatus()

Returns the ControlStatus.

Returns:

ControlStatus

Return type:

ByteStream

InputOutputControlByLocalIdentifier

class InputOutputControlByLocalIdentifierResult

Bases: DiagResult

Result of a successful InputOutputControlByLocalIdentifier (0x30) call, consisting of ID and data. Only one set of (ID, data) is supported.

GetDataIdentifier()

Returns the data identifier.

Returns:

Data identifier

Return type:

int

GetControlStatus()

Returns the ControlStatus.

Returns:

ControlStatus

Return type:

ByteStream

ReadDataByCommonIdentifier

class ReadDataByCommonIdentifierResult

Bases: DiagResult

Result of a successful ReadDataByLocalIdentifier (0x22) call, consisting of ID and data. Only one set of (ID, data) is supported.

GetDataIdentifierHighByte()

Returns the RecordCommonIdentifier (High Byte).

Returns:

RecordCommonIdentifier (High Byte)

Return type:

int

GetDataIdentifierLowByte()

Returns the RecordCommonIdentifier (Low Byte).

Returns:

RecordCommonIdentifier (Low Byte)

Return type:

int

GetData()

Returns the record value.

Returns:

record value

Return type:

ByteStream

ReadDataByLocalIdentifier

class ReadDataByLocalIdentifierResult

Bases: DiagResult

Result of a successful ReadDataByLocalIdentifier (0x21) call, consisting of ID and data. Only one set of (ID, data) is supported.

GetDataIdentifier()

Returns the RecordLocalIdentifier.

Returns:

RecordLocalIdentifier

Return type:

int

GetData()

Returns the record value.

Returns:

record value

Return type:

ByteStream

ReadDTCInformation

class ReadDiagnosticTroubleCodesDiagResult

Bases: DiagResult

This class represents the result of a successful ReadDiagnosticTroubleCodes (0x13) call, consisting of the number and list of DTCs.

GetDTCCount()

Returns the DTC count

Returns:

DTC count

Return type:

int

GetDTCFaultList()

Returns the list of DTC faults

Returns:

List of DTCs

Return type:

list<DTCNumber>

class ReadDiagnosticTroubleCodesAndStatusDiagResult

Bases: DiagResult

This class represents the result of a successful ReadDiagnosticTroubleCodesByStatus (0x18) or ReadStatusOfDiagnosticTroubleCodes (0x17) call, consisting of the number and list of DTCs and status.

GetDTCCount()

Returns the DTC count

Returns:

DTC count

Return type:

int

GetDTCFaultList()

Returns the list of DTC faults

Returns:

List of DTCs and corresponding status

Return type:

list<DTCAndStatusRecord>

ReadECUIdentification

class ReadECUIdentificationResult

Bases: DiagResult

Result of a successful ReadECUIdentification (0x1A) call, consisting of ID and data. Only one set of (ID, data) is supported.

GetDataIdentifier()

Returns the data identifier.

Returns:

Data identifier

Return type:

int

GetData()

Returns the ECU identification parameters.

Returns:

ECU identification parameters

Return type:

ByteStream

RoutineControl

class RoutineByLocalIdentifierDiagResult

Bases: DiagResult

This class represents the result of a successful RoutineByLocalIdentifier call

GetRoutineId()

Returns the routine id

Returns:

Routine Id

Return type:

int

GetStatusRecord()

Returns the status record

Returns:

Status record

Return type:

ByteStream

class StartRoutineByLocalIdentifierDiagResult

Bases: RoutineByLocalIdentifierDiagResult

This class represents the result of a successful StartRoutineByLocalIdentifier (0x31) call, consisting of the routine entry status.

GetEntryStatus()

Returns the entry status

Returns:

Entry status

Return type:

ByteStream

class StopRoutineByLocalIdentifierDiagResult

Bases: RoutineByLocalIdentifierDiagResult

This class represents the result of a successful StopRoutineByLocalIdentifier (0x32) call, consisting of the routine exit status.

GetExitStatus()

Returns the exit status

Returns:

exit status

Return type:

ByteStream

class RequestRoutineByLocalIdentifierDiagResult

Bases: RoutineByLocalIdentifierDiagResult

This class represents the result of a successful RequestRoutineByLocalIdentifier (0x33) call, consisting of the routine results.

GetRoutineResults()

Returns the routine results

Returns:

Routine results

Return type:

ByteStream

WriteDataByCommonIdentifier

class WriteDataByCommonIdentifierResult

Bases: DiagResult

Result of a successful WriteDataByCommonIdentifier (0x3B) call, consisting of ID.

GetDataIdentifierHighByte()

Returns the RecordCommonIdentifier (High Byte).

Returns:

RecordCommonIdentifier (High Byte)

Return type:

int

GetDataIdentifierLowByte()

Returns the RecordCommonIdentifier (Low Byte).

Returns:

RecordCommonIdentifier (Low Byte)

Return type:

int

WriteDataByLocalIdentifier

class WriteDataByLocalIdentifierResult

Bases: DiagResult

Result of a successful WriteDataByLocalIdentifier (0x3B) call, consisting of ID.

GetDataIdentifier()

Returns the data identifier.

Returns:

Data identifier

Return type:

int

J1939

class J1939Message

A J1939 message.

priority

The priority of the message

Type:

int

pduFormat

The PDU format of the message

Type:

int

pduSpecific

The PDU specific part of the message. This could be either the destination address (PDU format < 0xf0) or the group extension.

Type:

int

sourceAddress

The source address of the message

Type:

int

tla

The three letter acronym of the DTC

Type:

str

payload

The payload of the message

Type:

ByteStream

timestamp

Timestamp of the message (only available in the trace analysis). If the message consists of multiple frames, the timestamp of the first incoming message is used.

Type:

float / None

class J1939DTCList

Container for J1939DTCs.

Class var TYPE_DM1:

active DTC

Class var TYPE_DM2:

previously active DTC

Check(sourceAddress, dtcSet=None, conjunction='AND', dtcNotSet=None, dtcType=None)

Check if a set of DTCs from a specific sender is included.

Examples:

  • Check that there is no DTC on ECU “ABC”

    dtcList.Check("ABC", conjunction="ONLY")

  • Check that active DTCs 203.04 and 123.03 are set on ECU “ABC”

    dtcList.Check("ABC", ["203.04", "123.03"], "AND", dtcType="Active")

Parameters:
sourceAddress

SourceAddress (int), TLA (string) or “ALL” (the source isn’t checked)

dtcSet=None

List of DTCs which should be included, e.g. [“2001.11”, “2003.14”]

conjunction='AND'

Possibilities for checking the dtcSet:

”AND”: all DTCs from dtcSet must be included, others are allowed

”ONLY”: all DTCs from dtcSet must be included, others are forbidden

”OR”: at least one DTC from dtcSet must be included, others are allowed

dtcNotSet=None

List of DTCs which may not be included, e.g. [“2001.11”, “2003.14”]

dtcType=None

DTC-Type (“Active”, “Previously Active”) or None (type is ignored)

Returns:

Expectation fulfilled

Return type:

bool

class J1939DTC

A J1939 Diagnostic response.

Class var TYPE_DM1:

active DTC

Class var TYPE_DM2:

previously active DTC

sourceAddress

The source address of the DTC

Type:

int

tla

The three letter acronym of the DTC

Type:

str

spn

The suspect parameter number of the DTC

Type:

int

fmi

The failure mode identifier of the DTC

Type:

int

dtc

Combination of SPN and FMI (format: <spn>.<fmi>)

Type:

str

count

The occurrence count of the DTC

Type:

int

type

The DTC type (TYPE_DM1 “Active” / TYPE_DM2 “Previously Active”)

Type:

str

timestamp

Timestamp of the DTC (only available in the trace analysis) If the message consists of multiple frames, the timestamp of the first incoming message is used.

Type:

float / None