Diagnostic Messages
Implementation related to diagnostic messages is located in uds.message
sub-package.
UDS Message Implementation
- Diagnostic messages implementation is divided into two parts:
UDS Message - storage for a new diagnostic message definition
UDS Message Record - storage for historic information of a diagnostic message that was either received or transmitted
UDS Message
UdsMessage
class is meant to provide containers for a new
diagnostic messages information.
Once a diagnostic message object is created, it stores all diagnostic message information that were provided by a user.
One can use these objects to execute complex operations (provided in other subpackages of uds
)
such as diagnostic messages transmission or segmentation.
Note
All UdsMessage
attributes are validated on each value change,
therefore a user will face an exception if one tries to set an invalid (e.g. incompatible with the annotation)
value to any of these attributes.
Example code:
import uds # example how to create an object uds_message = uds.message.UdsMessage(payload=[0x10, 0x03], addressing_type=uds.transmission_attributes.AddressingType.PHYSICAL) # raw message attribute reassignment uds_message.payload = (0x62, 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF) # addressing attribute reassignment uds_message.addressing_type = uds.transmission_attributes.AddressingType.FUNCTIONAL
UDS Message Record
UdsMessageRecord
class is meant to provide containers for historic information
of diagnostic messages that were either transmitted or received.
Note
A user should not create objects of this class in normal cases, but one would probably use them quite
often as they are returned by other layers of uds
package.
Warning
All UdsMessageRecord
attributes are read only
(they are set only once upon an object creation) as they store historic data and history cannot be changed
(can’t it, right?).
A user will face an exception if one tries to modify any attribute.
UDS Messages Data
Implementation of data parameters that are part of diagnostic messages data.
- UDS data parameters:
Service Identifiers - are implemented by:
Service Identifiers
Implementation of Service Identifier (SID) values.
RequestSID
Enum RequestSID
contains definitions of request
Service Identifiers values.
Warning
RequestSID
does not contain definition for every
POSSIBLE_REQUEST_SIDS
value as some Request SID values are reserved for
further extension by UDS specification and others are ECU specific (defined by ECU’s manufacturer).
Note
Use add_member()
method on
RequestSID
class to add Request SID value.
Example code:
import uds # check if a value (0xBA in the example) is a Request SID value uds.message.RequestSID.is_request_sid(0xBA) # check if there is member defined for the value uds.message.RequestSID.is_member(0xBA) # example how to add a new Request SID value new_member = uds.message.RequestSID.add_member("NewRequestSIDMemberName", 0xBA) # check if the value was added as a new member uds.message.RequestSID.is_member(new_member) uds.message.RequestSID.is_member(0xBA)
ResponseSID
Enum ResponseSID
contains definitions of response
Service Identifiers values.
Warning
ResponseSID
does not contain definition for every
POSSIBLE_RESPONSE_SIDS
value as some Response SID values are reserved for
further extension by UDS specification and other are ECU specific (defined by ECU’s manufacturer).
Note
Use add_member()
method on
ResponseSID
class to add Response SID.
Example code:
import uds # check if a value (0xFA in the example) is a Response SID value uds.message.ResponseSID.is_response_sid(0xFA) # check if there is member defined for the value uds.message.ResponseSID.is_member(0xFA) # example how to add a new Response SID value new_member = uds.message.ResponseSID.add_member("NewResponseSIDMemberName", 0xFA) # check if the value was added as a new member uds.message.ResponseSID.is_member(new_member) uds.message.ResponseSID.is_member(0xFA)
Negative Response Codes
Enum NRC
contains definitions of all common (defined by ISO 14229)
Negative Response Codes values.
Warning
NRC
does not contain definition for every possible NRC value as some of them are
reserved for further extension by UDS specification and other are ECU specific (defined by ECU’s manufacturer).
Note
Use add_member()
method on
NRC
class to add NRC value that is specific for the system that you communicate with.
Example code:
import uds # check if a value (0xF0 in the example) is a NRC value uds.message.NRC.is_member(0xF0) # example how to add a new NRC value new_member = uds.message.NRC.add_member("NewNRCMemberName", 0xF0) # check if the value was added as a new member uds.message.NRC.is_member(new_member) uds.message.NRC.is_member(0xF0)