flync_4_diagnostics

Diagnostics Configuration

Note

Any diagnostics-related configuration is placed in the directory 📁 communication/diagnostics/, with one sub-directory per diagnostic protocol. This is a non-mandatory directory for the FLYNC configuration.

Everything FLYNC models today is UDS (ISO 14229) carried over DoIP (ISO 13400), so there are two sub-configurations:

  • 📁 diagnostics/doip/ - the DoIP transport: its timing profiles. The DoIP logical address of a diagnostic entity lives on the doip_server socket deployment.

  • 📁 diagnostics/uds/ - the UDS servers plus the system-wide DID, routine, and DTC catalogs they draw from.

class DiagnosticsConfig

Bases: FLYNCBaseModel

Root object of a system’s diagnostics configuration, one folder per diagnostic protocol.

Everything FLYNC models today is UDS (ISO 14229) carried over DoIP (ISO 13400), so the two sub-configs are doip for the transport and uds for the diagnostic services; a further protocol would be added as a sibling folder.

Parameters

versionLiteral[“0.14”], optional

The version of this config. Defaults to "0.14".

doipDoIPConfig, optional

DoIP transport configuration, loaded from diagnostics/doip/. Absent when that directory does not exist.

udsUDSConfig, optional

UDS configuration - servers plus the DID/routine/DTC catalogs - loaded from diagnostics/uds/. Absent when that directory does not exist.

DoIP

class DoIPConfig

Bases: FLYNCBaseModel

The system-wide DoIP (ISO 13400) transport configuration.

Parameters

versionLiteral[“0.14”], optional

The version of this config. Defaults to "0.14".

timingsDoIPTimingProfileSet

DoIP timing profiles, loaded from doip/timings.flync.yaml. Required: a doip/ folder without that file describes no transport at all.

DoIP Timings

Expand for a YAML example - 📄 doip/timings.flync.yaml

Note

This file contains the DoIP protocol timers (ISO 13400) that can be imported by a DoIP deployment’s doip_timings_profile.

profiles:
  - profile_id: "doip_default"
    a_doip_ctrl: 2000
    t_tcp_general_inactivity: 300000
    t_tcp_initial_inactivity: 2000
    t_tcp_alive_check: 500
    a_doip_announce_num: 3
    a_doip_announce_interval: 500
    a_doip_announce_wait: 500

defaults: []
class DoIPTimingProfileSet

Bases: FLYNCBaseModel

Container of DoIP timing profiles, loaded from doip/timings.flync.yaml.

Parameters

profileslist of DoIPTimingProfile, optional

Timing profiles available for use by DoIP deployments.

defaultslist of DoIPTimingProfile, optional

Timing profiles used as system-wide defaults.

class DoIPTimingProfile

Bases: DoIPTimings

A named, reusable set of DoIP timers, referenced by a DoIP socket deployment.

Parameters

profile_idstr

Unique identifier of this timing profile.

a_doip_ctrlint, optional

Maximum time in ms to wait for a diagnostic response over DoIP (A_DoIP_Ctrl). Defaults to 2000.

t_tcp_general_inactivityint, optional

General inactivity timeout in ms for an open DoIP TCP connection. Defaults to 300000.

t_tcp_initial_inactivityint, optional

Timeout in ms for the first diagnostic message after a TCP connection is opened. Defaults to 2000.

t_tcp_alive_checkint, optional

Timeout in ms to wait for a response to an alive check request. Defaults to 500.

a_doip_announce_numint, optional

Number of vehicle announcement messages sent after DoIP entity power-up. Defaults to 3.

a_doip_announce_intervalint, optional

Interval in ms between successive vehicle announcement messages. Defaults to 500.

a_doip_announce_waitint, optional

Initial delay in ms before the first vehicle announcement message is sent. Defaults to 500.

class DoIPTimings

Bases: FLYNCBaseModel

DoIP protocol timers, as defined by ISO 13400.

Parameters

a_doip_ctrlint, optional

Maximum time in ms to wait for a diagnostic response over DoIP (A_DoIP_Ctrl). Defaults to 2000.

t_tcp_general_inactivityint, optional

General inactivity timeout in ms for an open DoIP TCP connection. Defaults to 300000.

t_tcp_initial_inactivityint, optional

Timeout in ms for the first diagnostic message after a TCP connection is opened. Defaults to 2000.

t_tcp_alive_checkint, optional

Timeout in ms to wait for a response to an alive check request. Defaults to 500.

a_doip_announce_numint, optional

Number of vehicle announcement messages sent after DoIP entity power-up. Defaults to 3.

a_doip_announce_intervalint, optional

Interval in ms between successive vehicle announcement messages. Defaults to 500.

a_doip_announce_waitint, optional

Initial delay in ms before the first vehicle announcement message is sent. Defaults to 500.

DoIP Deployment

Hint

DoIP deployments are directly configured in a socket. For further details on the configuration go to: Socket Config.

class DoIPServerDeployment

Bases: FLYNCBaseModel

Deploys a DoIP entity (server) that answers UDS diagnostic requests on this socket.

Belongs on a SocketTCP only - DoIP diagnostic messaging (ISO 13400) runs over TCP.

Parameters

deployment_type : Literal[“doip_server”]

namestr

Name of the deployment, typically the ECU or diagnostic entity it represents.

logical_addressint

The 16-bit DoIP logical address of this diagnostic entity. Must be unique across the whole system.

uds_serverstr

Name of the UDSServer (access profiles, supported services, DIDs, DTCs) exposed by this entity.

doip_timings_profilestr, optional

Name of the DoIPTimingProfile used by this entity. None uses the system default profile.

class DoIPDiscoveryDeployment

Bases: FLYNCBaseModel

Deploys the DoIP discovery endpoint: vehicle identification requests and, optionally, vehicle announcement messages, as specified by ISO 13400.

Belongs on a SocketUDP only - DoIP discovery runs over UDP.

Parameters

deployment_type : Literal[“doip_discovery”]

namestr, optional

Name of the deployment, used to identify it in validation messages.

vehicle_identificationbool, optional

Whether this endpoint answers VehicleIdentificationRequest messages. Defaults to True.

vehicle_announcementbool, optional

Whether this endpoint sends VehicleAnnouncementMessages on power-up. Defaults to True.

doip_timings_profilestr, optional

Name of the DoIPTimingProfile used for the announcement timers. None uses the system default profile.

UDS

class UDSConfig

Bases: FLYNCBaseModel

The system-wide UDS (ISO 14229) configuration: the UDS servers and the catalogs they draw their DIDs, routines, and DTCs from.

Parameters

versionLiteral[“0.14”], optional

The version of this config. Defaults to "0.14".

timingsUDSTimingProfileSet

UDS timing profiles, loaded from uds/timings.flync.yaml. Required: every UDS server references one of these profiles.

serverslist of UDSServer, optional

UDS servers, one per file under uds/servers/.

didslist of DataIdentifier, optional

DID catalog, one per file under uds/dids/.

routineslist of Routine, optional

Routine catalog, one per file under uds/routines/.

dtcslist of DiagnosticTroubleCode, optional

DTC catalog, one per file under uds/dtcs/.

UDS Timings

Expand for a YAML example - 📄 uds/timings.flync.yaml

Note

This file contains the UDS server timers (ISO 14229-2) that can be imported by a UDS server’s uds_timings_profile.

profiles:
  - profile_id: "uds_default"
    p2_server: 50
    p2_star_server: 5000
    s3_server: 5000

defaults: []
class UDSTimingProfileSet

Bases: FLYNCBaseModel

Container of UDS timing profiles, loaded from uds/timings.flync.yaml.

Parameters

profileslist of UDSTimingProfile, optional

Timing profiles available for use by UDS servers.

defaultslist of UDSTimingProfile, optional

Timing profiles used as system-wide defaults.

class UDSTimingProfile

Bases: UDSTimings

A named, reusable set of UDS server timings, referenced by a UDSServer.

Parameters

profile_idstr

Unique identifier of this timing profile.

p2_serverint, optional

Default UDS server response time in ms (P2_server). Defaults to 50.

p2_star_serverint, optional

Enhanced UDS server response time in ms after a pending response (P2*_server). Defaults to 5000.

s3_serverint, optional

Time in ms the server keeps a non-default diagnostic session active without tester presence (S3_server). Defaults to 5000.

class UDSTimings

Bases: FLYNCBaseModel

UDS server timing parameters, as defined by ISO 14229-2.

Parameters

p2_serverint, optional

Default UDS server response time in ms (P2_server). Defaults to 50.

p2_star_serverint, optional

Enhanced UDS server response time in ms after a pending response (P2*_server). Defaults to 5000.

s3_serverint, optional

Time in ms the server keeps a non-default diagnostic session active without tester presence (S3_server). Defaults to 5000.

UDS Server

Expand for a YAML example - 📁 uds/servers/

Note

Each file describes one UDS server (ISO 14229 server side, typically one ECU): the timings profile it uses, the access profiles (session + security-level bundles), the supported UDS services, and the DIDs/DTCs it offers. Referenced by name from a doip_server socket deployment, which adds the DoIP logical address.

uds_timings_profile: uds_default

access_profiles:
- name: standard_service
  default: true
  sessions:
  - default
  - extended
  - programming
- name: programming_level3
  sessions:
  - programming
  security_level: 3
- name: extended_only
  sessions:
  - extended

services:
- service: diagnostic_session_control
  sid: 0x10
  sessions:
  - name: default
    id: 0x01
    p2: 50ms
    p2_star: 5000ms
  - name: extended
    id: 0x03
    p2: 50ms
    p2_star: 5000ms
  - name: programming
    id: 0x02
    p2: 50ms
    p2_star: 10000ms

- service: ecu_reset
  sid: 0x11
  reset_types:
  - hard_reset
  - key_off_on_reset
  - soft_reset
  - enable_rapid_power_shutdown
  power_down_time: 5

- service: clear_diagnostic_information
  sid: 0x14
  access_profile: extended_only
  dtc_groups:
  - name: all
    id: 0xFFFFFF
  - name: powertrain
    id: 0x010000

- service: read_dtc_information
  sid: 0x19
  report_types:
  - report_dtc_by_status_mask
  - report_supported_dtc
  - report_dtc_snapshot_record_by_dtc_number
  # test_failed | pending_dtc | confirmed_dtc | warning_indicator_requested
  dtc_status_availability_mask: 0x8D
  snapshot_record_numbers:
  - 0x01

- service: read_data_by_identifier
  sid: 0x22
  max_dids_per_request: 4

- service: security_access
  sid: 0x27
  security_levels:
  - security_level: Locked
  - security_level: 3

- service: write_data_by_identifier
  sid: 0x2E

- service: input_output_control_by_identifier
  sid: 0x2F
  access_profile: extended_only

- service: routine_control
  sid: 0x31
  access_profile: extended_only
  routines:
  - EraseMemory

- service: request_download
  sid: 0x34
  access_profile: programming_level3
  max_block_length: 1026
  memory_address_length: 4
  memory_size_length: 4
  memory_regions:
  - name: application
    address: 0x08040000
    size: 0x000C0000
    description: "Application flash bank."

- service: transfer_data
  sid: 0x36
  access_profile: programming_level3

- service: request_transfer_exit
  sid: 0x37
  access_profile: programming_level3

- service: tester_present
  sid: 0x3E

- service: control_dtc_setting
  sid: 0x85
  subfunctions:
  - id: 0x01
    name: "on"
  - id: 0x02
    name: "off"

dids:
- VehicleIdentificationNumber
- EngineOilTemperature
- EngineTorqueLimit
- CoolingFanControl

dtcs:
- EngineOverheat
class UDSServer

Bases: FLYNCBaseModel

A named UDS server (ISO 14229 server side, typically one ECU).

Stored one per file under communication/diagnostics/uds/servers/; the file name provides name. Referenced by name from a doip_server socket deployment, which adds the DoIP logical address and DoIP timings of the transport.

Parameters

namestr

Name of the UDS server, implied from the file name on disk.

uds_timings_profilestr

Name of the UDSTimingProfile used by this server.

access_profileslist of AccessProfile, optional

Named session/security-level bundles referenced by services, DIDs, and routines.

serviceslist of DiagnosticSessionControlService or EcuResetService or ClearDiagnosticInformationService or ReadDTCInformationService or ReadDataByIdentifierService or SecurityAccessService or RoutineControlService or RequestDownloadService or RequestUploadService or GenericUDSService, optional

The UDS services supported by this server, selected by their sid.

didslist of str, optional

Names of the DataIdentifier entries (from communication/diagnostics/uds/dids/) offered by this server.

dtcslist of str, optional

Names of the DiagnosticTroubleCode entries (from communication/diagnostics/uds/dtcs/) reported by this server.

descriptionstr, optional

Human-readable description of the UDS server.

class AccessProfile

Bases: FLYNCBaseModel

A named, reusable bundle of the sessions (and optional security level) required to access a service, DID, or routine.

Parameters

namestr

Name of the access profile, unique within its UDS server.

defaultbool, optional

Whether this is the server’s default access profile. Exactly one access profile of a UDS server must set this. Defaults to False.

sessionslist of str

Names of the sessions (declared in the diagnostic_session_control service) in which access is granted.

security_levelint or Literal[“Locked”], optional

Security level (declared in the security_access service) that must be unlocked. None means no security access is required.

UDS Services

Every UDS service is a GenericUDSService; the services that carry structure of their own inherit from it. Which class a services entry becomes is decided by its sid, so a service id FLYNC does not model in detail - an OEM-specific one, for instance - still loads as the generic service.

Note

A service id standardized by ISO 14229-1 must use its canonical service name even when it has no dedicated model, so a typo is caught for every UDS service rather than only the modeled ones. The names are listed in CANONICAL_SERVICE_NAMES.

Services that carry no configuration of their own - WriteDataByIdentifier (0x2E), TransferData (0x36), RequestTransferExit (0x37), TesterPresent (0x3E) - stay the generic service on purpose: what they would hold already lives elsewhere, e.g. a DID’s writability on DataIdentifier. The UDS server still checks that they are coherent with the catalogs they act on.

Sub-function values are accepted either as the ISO 14229-1 snake_case name or as the raw number, so supplier- and manufacturer-specific sub-functions still load:

ResetType

The EcuReset (0x11) resetType values standardized by ISO 14229-1. Values 0x40-0x5F are system-supplier specific and are written as plain integers instead.

alias of Literal[‘hard_reset’, ‘key_off_on_reset’, ‘soft_reset’, ‘enable_rapid_power_shutdown’, ‘disable_rapid_power_shutdown’]

DTCReportType

The ReadDTCInformation (0x19) reportType values standardized by ISO 14229-1.

alias of Literal[‘report_number_of_dtc_by_status_mask’, ‘report_dtc_by_status_mask’, ‘report_dtc_snapshot_identification’, ‘report_dtc_snapshot_record_by_dtc_number’, ‘report_dtc_stored_data_by_record_number’, ‘report_dtc_ext_data_record_by_dtc_number’, ‘report_number_of_dtc_by_severity_mask_record’, ‘report_dtc_by_severity_mask_record’, ‘report_severity_information_of_dtc’, ‘report_supported_dtc’, ‘report_first_test_failed_dtc’, ‘report_first_confirmed_dtc’, ‘report_most_recent_test_failed_dtc’, ‘report_most_recent_confirmed_dtc’, ‘report_mirror_memory_dtc_by_status_mask’, ‘report_mirror_memory_dtc_ext_data_record_by_dtc_number’, ‘report_number_of_mirror_memory_dtc_by_status_mask’, ‘report_number_of_emissions_obd_dtc_by_status_mask’, ‘report_emissions_obd_dtc_by_status_mask’, ‘report_dtc_fault_detection_counter’, ‘report_dtc_with_permanent_status’, ‘report_dtc_ext_data_record_by_record_number’, ‘report_user_def_memory_dtc_by_status_mask’, ‘report_user_def_memory_dtc_snapshot_record_by_dtc_number’, ‘report_user_def_memory_dtc_ext_data_record_by_dtc_number’, ‘report_supported_dtc_ext_data_record’, ‘report_wwh_obd_dtc_by_mask_record’, ‘report_wwh_obd_dtc_with_permanent_status’, ‘report_dtc_information_by_dtc_readiness_group_identifier’]

DTCStatusBit

The bits of the ISO 14229-1 DTCStatusAvailabilityMask, least significant bit first.

alias of Literal[‘test_failed’, ‘test_failed_this_operation_cycle’, ‘pending_dtc’, ‘confirmed_dtc’, ‘test_not_completed_since_last_clear’, ‘test_failed_since_last_clear’, ‘test_not_completed_this_operation_cycle’, ‘warning_indicator_requested’]

IOControlParameter

The InputOutputControlByIdentifier (0x2F) inputOutputControlParameter values standardized by ISO 14229-1. Values 0x04-0xFF are vehicle-manufacturer specific.

alias of Literal[‘return_control_to_ecu’, ‘reset_to_default’, ‘freeze_current_state’, ‘short_term_adjustment’]

class GenericUDSService

Bases: FLYNCBaseModel

Base class of every UDS service, and the service model used for any service without dedicated structure of its own (e.g. WriteDataByIdentifier, TesterPresent, ControlDTCSetting, TransferData).

Parameters

servicestr

Name of the service, e.g. "tester_present". Pinned to the ISO 14229-1 name whenever sid is a standardized service id.

sidint

The UDS service identifier, e.g. 0x3E.

access_profilestr, optional

Name of the access profile required to use this service. None means the owning UDS server’s default access profile applies.

subfunctionslist of UDSSubfunction, optional

Sub-function values supported by this service.

option_recorddict, optional

Free-form option record for services that carry one (e.g. ControlDTCSetting).

class DiagnosticSessionControlService

Bases: GenericUDSService

DiagnosticSessionControl (0x10): declares the sessions offered by the UDS server.

Parameters

service : Literal[“diagnostic_session_control”]

sid : Literal[0x10]

access_profilestr, optional

Name of the access profile required to use this service. None means the owning UDS server’s default access profile applies.

subfunctionslist of UDSSubfunction, optional

Sub-function values supported by this service.

option_recorddict, optional

Free-form option record for services that carry one.

sessionslist of DiagnosticSessionDefinition, optional

Diagnostic sessions offered by this service.

class DiagnosticSessionDefinition

Bases: FLYNCBaseModel

A diagnostic session offered by the diagnostic_session_control service.

The session named "default" is the session the ECU starts in after reset; exactly one session of a DiagnosticSessionControlService must use that name.

Parameters

namestr

Name of the session, e.g. "extended".

idint

The 8-bit session sub-function value, e.g. 0x03 for the extended session.

p2int, optional

Server response time in ms for this session (P2_server). None falls back to the owning server’s UDS timing profile.

p2_starint, optional

Enhanced server response time in ms for this session (P2*_server). None falls back to the owning server’s UDS timing profile.

class EcuResetService

Bases: GenericUDSService

EcuReset (0x11): declares the reset types the UDS server accepts.

Parameters

service : Literal[“ecu_reset”]

sid : Literal[0x11]

access_profilestr, optional

Name of the access profile required to use this service. None means the owning UDS server’s default access profile applies.

subfunctionslist of UDSSubfunction, optional

Sub-function values supported by this service.

option_recorddict, optional

Free-form option record for services that carry one.

reset_typeslist of Literal[“hard_reset”, “key_off_on_reset”, “soft_reset”, “enable_rapid_power_shutdown”, “disable_rapid_power_shutdown”] or int, optional

Reset types this service accepts. An int carries a system-supplier specific reset type (0x40-0x5F) that ISO 14229-1 does not name.

power_down_timeint, optional

Minimum standby time in seconds the server reports for enable_rapid_power_shutdown. 0xFF is reserved by ISO 14229-1 for “failure or time not available”, so the configurable maximum is 0xFE.

class SecurityAccessService

Bases: GenericUDSService

SecurityAccess (0x27): declares the security levels offered by the UDS server.

Parameters

service : Literal[“security_access”]

sid : Literal[0x27]

access_profilestr, optional

Name of the access profile required to use this service. None means the owning UDS server’s default access profile applies.

subfunctionslist of UDSSubfunction, optional

Sub-function values supported by this service.

option_recorddict, optional

Free-form option record for services that carry one.

security_levelslist of SecurityLevelDeclaration, optional

Security levels offered by this service.

class SecurityLevelDeclaration

Bases: FLYNCBaseModel

Declares one security level made available by the security_access service.

Parameters

security_levelint or Literal[“Locked”]

Identifier of the security level. "Locked" represents no security access granted.

class RoutineControlService

Bases: GenericUDSService

RoutineControl (0x31): declares the routines offered by the UDS server.

Parameters

service : Literal[“routine_control”]

sid : Literal[0x31]

access_profilestr, optional

Name of the access profile required to use this service. None means the owning UDS server’s default access profile applies.

subfunctionslist of UDSSubfunction, optional

Sub-function values supported by this service.

option_recorddict, optional

Free-form option record for services that carry one.

routineslist of str, optional

Names of the Routine entries (from communication/diagnostics/uds/routines/) offered by this service.

class ClearDiagnosticInformationService

Bases: GenericUDSService

ClearDiagnosticInformation (0x14): declares the clearable DTC groups.

Parameters

service : Literal[“clear_diagnostic_information”]

sid : Literal[0x14]

access_profilestr, optional

Name of the access profile required to use this service. None means the owning UDS server’s default access profile applies.

subfunctionslist of UDSSubfunction, optional

Sub-function values supported by this service.

option_recorddict, optional

Free-form option record for services that carry one.

dtc_groupslist of DTCGroup, optional

DTC groups (masks) that ClearDiagnosticInformation may clear.

memory_selectionslist of int, optional

User-defined memories this service can clear, as the optional MemorySelection byte added by ISO 14229-1:2020. Empty means the primary memory only.

class DTCGroup

Bases: FLYNCBaseModel

A named group (mask) of DTCs, used by ClearDiagnosticInformation.

Parameters

namestr

Name of the group, e.g. "powertrain".

idint

The 3-byte DTC group mask, e.g. 0xFFFFFF for “all groups”.

class ReadDTCInformationService

Bases: GenericUDSService

ReadDTCInformation (0x19): declares the DTC report types and the status bits the UDS server supports.

Parameters

service : Literal[“read_dtc_information”]

sid : Literal[0x19]

access_profilestr, optional

Name of the access profile required to use this service. None means the owning UDS server’s default access profile applies.

subfunctionslist of UDSSubfunction, optional

Sub-function values supported by this service.

option_recorddict, optional

Free-form option record for services that carry one.

report_typeslist of DTCReportType or int, optional

Report types (sub-functions) this service supports. An int carries a report type ISO 14229-1 does not name.

dtc_status_availability_maskint, optional

The DTCStatusAvailabilityMask the server reports: which DTC status bits it maintains, e.g. 0x7F. Use status_mask_from_bits() and status_mask_bits() to convert between the byte and the DTCStatusBit names an OEM specification lists.

memory_selectionslist of int, optional

User-defined memory numbers addressable by the report_user_def_memory_* report types. Empty means the primary memory only.

snapshot_record_numberslist of int, optional

DTC snapshot (freeze frame) record numbers the server stores.

ext_data_record_numberslist of int, optional

DTC extended data record numbers the server stores.

class ReadDataByIdentifierService

Bases: GenericUDSService

ReadDataByIdentifier (0x22): reads the DIDs its UDS server offers.

Which DIDs those are is not repeated here - it is the server’s dids list, filtered by each DataIdentifier’s access. This service only adds what the server itself declares about the request.

Parameters

service : Literal[“read_data_by_identifier”]

sid : Literal[0x22]

access_profilestr, optional

Name of the access profile required to use this service. None means the owning UDS server’s default access profile applies.

subfunctionslist of UDSSubfunction, optional

Sub-function values supported by this service.

option_recorddict, optional

Free-form option record for services that carry one.

max_dids_per_requestint, optional

Largest number of data identifiers the server accepts in one request. None means the server declares no limit.

class UDSSubfunction

Bases: FLYNCBaseModel

A named sub-function value of a UDS service.

Parameters

idint

The sub-function identifier.

namestr

Human-readable name of the sub-function.

Block Transfer

class TransferSetupService

Bases: GenericUDSService

Common base of the block transfer set-up services RequestDownload (0x34) and RequestUpload (0x35), which share their whole parameter set.

This class is not selectable on its own - it carries no sid of its own and is not a member of UDSServiceEntry.

Parameters
servicestr

Name of the service. Narrowed by the concrete subclasses.

sidint

The UDS service identifier. Narrowed by the concrete subclasses.

access_profilestr, optional

Name of the access profile required to use this service. None means the owning UDS server’s default access profile applies.

subfunctionslist of UDSSubfunction, optional

Sub-function values supported by this service.

option_recorddict, optional

Free-form option record for services that carry one.

max_block_lengthint

The maxNumberOfBlockLength the server reports: the largest TransferData request it accepts, including the service id and block sequence counter.

memory_address_lengthint, optional

Number of bytes of the memoryAddress parameter - the low nibble of the addressAndLengthFormatIdentifier. Defaults to 4.

memory_size_lengthint, optional

Number of bytes of the memorySize parameter - the high nibble of the addressAndLengthFormatIdentifier. Defaults to 4.

data_format_identifierslist of int, optional

The dataFormatIdentifier values the server accepts. Defaults to [0x00], i.e. neither compressed nor encrypted.

memory_regionslist of TransferMemoryRegion, optional

Memory regions this service may address.

class RequestDownloadService

Bases: TransferSetupService

RequestDownload (0x34): sets up a transfer from the tester into the UDS server.

Parameters

service : Literal[“request_download”]

sid : Literal[0x34]

access_profilestr, optional

Name of the access profile required to use this service. None means the owning UDS server’s default access profile applies.

subfunctionslist of UDSSubfunction, optional

Sub-function values supported by this service.

option_recorddict, optional

Free-form option record for services that carry one.

max_block_lengthint

The maxNumberOfBlockLength the server reports.

memory_address_lengthint, optional

Number of bytes of the memoryAddress parameter. Defaults to 4.

memory_size_lengthint, optional

Number of bytes of the memorySize parameter. Defaults to 4.

data_format_identifierslist of int, optional

The dataFormatIdentifier values the server accepts. Defaults to [0x00].

memory_regionslist of TransferMemoryRegion, optional

Memory regions this service may write to.

class RequestUploadService

Bases: TransferSetupService

RequestUpload (0x35): sets up a transfer from the UDS server to the tester.

Parameters

service : Literal[“request_upload”]

sid : Literal[0x35]

access_profilestr, optional

Name of the access profile required to use this service. None means the owning UDS server’s default access profile applies.

subfunctionslist of UDSSubfunction, optional

Sub-function values supported by this service.

option_recorddict, optional

Free-form option record for services that carry one.

max_block_lengthint

The maxNumberOfBlockLength the server reports.

memory_address_lengthint, optional

Number of bytes of the memoryAddress parameter. Defaults to 4.

memory_size_lengthint, optional

Number of bytes of the memorySize parameter. Defaults to 4.

data_format_identifierslist of int, optional

The dataFormatIdentifier values the server accepts. Defaults to [0x00].

memory_regionslist of TransferMemoryRegion, optional

Memory regions this service may read from.

class TransferMemoryRegion

Bases: FLYNCBaseModel

A memory region a block transfer service may address.

Parameters
namestr

Name of the region, e.g. "application".

addressint

Start address of the region.

sizeint

Size of the region in bytes.

descriptionstr, optional

Human-readable description of the region.

DIDs, Routines, and DTCs

Expand for a YAML example - 📄 uds/dids/VehicleIdentificationNumber.flync.yaml
did: 0xF190
access: read
read_data:
  byte_length: 17
  fields:
  - name: vin
    type: ascii
    bit_offset: 0
    bit_length: 136
description: "The vehicle identification number (VIN)."
class DataIdentifier

Bases: FLYNCBaseModel

A UDS Data Identifier, readable with ReadDataByIdentifier (0x22) and/or writable with WriteDataByIdentifier (0x2E).

Stored one per file under communication/diagnostics/uds/dids/; the file name provides name.

Parameters

namestr

Name of the DID, implied from the file name on disk.

didint

The 16-bit data identifier, e.g. 0xF190.

accessLiteral[“read”, “write”, “read_write”], optional

How the DID may be accessed. Defaults to "read".

read_dataDiagDataRecord, optional

Layout of the positive response to ReadDataByIdentifier. Required when the DID is readable.

write_dataDiagDataRecord, optional

Layout of the WriteDataByIdentifier request data. Required when the DID is writable. When omitted for a "read_write" DID the layout of read_data applies.

io_controlDIDIOControl, optional

Declares that InputOutputControlByIdentifier (0x2F) may control this DID. None means the DID is not IO-controllable.

access_profilestr, optional

Name of the access profile (declared by the UDS server offering this DID) required to access the DID. None means that server’s default access profile applies.

descriptionstr, optional

Human-readable description of the DID.

class DIDIOControl

Bases: FLYNCBaseModel

Declares that a DID can be controlled with InputOutputControlByIdentifier (0x2F), and with which control parameters.

Parameters

supported_parameterslist of Literal[“return_control_to_ecu”, “reset_to_default”, “freeze_current_state”, “short_term_adjustment”] or int, optional

The inputOutputControlParameter values accepted for this DID. An int carries a vehicle-manufacturer specific parameter (0x04-0xFF). Defaults to ["short_term_adjustment"].

control_stateDiagDataRecord, optional

Layout of the controlState record sent with short_term_adjustment. Required when that parameter is supported.

descriptionstr, optional

Human-readable description of the control behavior.

class Routine

Bases: FLYNCBaseModel

A UDS Routine, invoked via RoutineControl (0x31).

Stored one per file under communication/diagnostics/uds/routines/; the file name provides name.

Parameters

namestr

Name of the routine, implied from the file name on disk.

ridint

The 16-bit routine identifier, e.g. 0x0203.

supported_sub_functionslist of Literal[“start”, “stop”, “request_results”], optional

Which RoutineControl sub-functions the routine implements. Defaults to ["start"].

start_requestDiagDataRecord, optional

Request data layout for RoutineControl startRoutine. Required when "start" is supported.

start_responseDiagDataRecord, optional

Positive response data layout for startRoutine.

stop_requestDiagDataRecord, optional

Request data layout for stopRoutine. Required when "stop" is supported.

stop_responseDiagDataRecord, optional

Positive response data layout for stopRoutine.

request_results_responseDiagDataRecord, optional

Positive response data layout for requestRoutineResults. Required when "request_results" is supported.

access_profilestr, optional

Name of the access profile (declared by the UDS server offering this routine) required to invoke it. None means that server’s default access profile applies.

descriptionstr, optional

Human-readable description of the routine.

class DiagnosticTroubleCode

Bases: FLYNCBaseModel

A UDS Diagnostic Trouble Code (DTC), reported via ReadDTCInformation (0x19) and cleared via ClearDiagnosticInformation (0x14).

Stored one per file under communication/diagnostics/uds/dtcs/; the file name provides name.

Parameters

namestr

Name of the DTC, implied from the file name on disk.

dtcint

The 3-byte DTC number, e.g. 0x010203.

formatLiteral[“iso_14229_1”, “saej1939_73”, “iso_11992_4”], optional

Format of dtc as reported by ReadDTCInformation. Defaults to "iso_14229_1".

severityLiteral[“no_severity”, “maintenance_only”, “check_at_next_halt”, “check_immediately”], optional

UDS DTC severity mask. Defaults to "no_severity".

functional_unitint, optional

The DTCFunctionalUnit reported together with severity by ReadDTCInformation sub-function 0x09. None means the server reports no functional unit for this DTC.

snapshot_recordslist of DTCRecord, optional

Snapshot (freeze frame) records the server stores for this DTC, reported by ReadDTCInformation sub-function 0x04.

extended_data_recordslist of DTCRecord, optional

Extended data records the server stores for this DTC, reported by ReadDTCInformation sub-functions 0x06 and 0x16.

failure_typestr, optional

Free-text classification of the underlying failure, e.g. "short_to_ground".

descriptionstr, optional

Human-readable description of the DTC.

class DTCRecord

Bases: FLYNCBaseModel

A numbered data record ReadDTCInformation reports for a DTC.

Snapshot (freeze frame) records and extended data records have the same shape, so both are described by this class; which kind a record is follows from the list it appears in - DiagnosticTroubleCode.snapshot_records or DiagnosticTroubleCode.extended_data_records.

Parameters

record_numberint

Number identifying this record, i.e. the DTCSnapshotRecordNumber for a snapshot record and the DTCExtDataRecordNumber for an extended data record.

dataDiagDataRecord

Layout of the data the record carries.

descriptionstr, optional

Human-readable description of the record.

DID/Routine Payload Datatypes

Note

DID and routine payloads are described with a diagnostics-local field/record model, independent of the SOME/IP and signal type systems.

class DiagDataRecord

Bases: FLYNCBaseModel

An ordered, non-overlapping set of fields making up one UDS payload.

Parameters
byte_lengthint

Total length of the record in bytes.

fieldslist of DiagField, optional

Fields contained in the record. May be empty for a record whose contents are not modeled in detail.

descriptionstr, optional

Human-readable description of the record.

class DiagField

Bases: FLYNCBaseModel

A single field inside a diagnostic data record.

Parameters
namestr

Name of the field, unique within its record.

typeDiagPrimitiveType

Primitive type of the field.

bit_offsetint

Offset of the field’s first bit from the start of the record. Bit 0 is the most significant bit of the first byte.

bit_lengthint, optional

Width of the field in bits. Required for the variable-width types ascii and bytes; for every other type it defaults to the type’s fixed width and, when given explicitly, must match it.

endiannessLiteral[“BE”, “LE”], optional

Byte order of the field. Defaults to big-endian ("BE"), which is what UDS uses.

scalingDiagScaling, optional

Raw-to-physical conversion for this field.

value_rangeValueRange, optional

Inclusive range of valid raw values.

value_tablelist of ValueTable, optional

Enumeration of named raw values.

descriptionstr, optional

Human-readable description of the field.

class DiagScaling

Bases: FLYNCBaseModel

Linear conversion from the raw transmitted value to the physical value.

physical = raw * factor + offset

Parameters
factorfloat, optional

Multiplier applied to the raw value. Defaults to 1.0.

offsetfloat, optional

Constant added after scaling. Defaults to 0.0.

unitstr, optional

Physical unit of the scaled value, e.g. "km/h".