pub struct Kwp2000DiagnosticServer { /* private fields */ }
Expand description

Kwp2000 Diagnostic server

Implementations

Executes a DTC clear command on the ECU, given a range of DTCs to clear

Performs an ECU Reset operation

Params

Tells the ECU to switch off its normal communication paths with other ECUs. Normally message transmission will be resumed if the ECU looses power, or if Kwp2000DiagnosticServer::enable_normal_message_transmission is called.

NOTE: Calling this function can make a car go wild as it can no longer talk to the ECU being sent this command. Use with CAUTION!

Tells the ECU to re-enable its normal communication paths with other ECUs.

Reads ECU data using a given identifier

Parameters
  • identifier - A 16 bit identifier to recall data from on the ECU
Returns

If successful, this function returns the raw data stored at this identifier, without the identifier ID on the response itself.

Reads development data from the ECU. NOT IMPLEMENTED YET (Will return DiagError::NotImplemented)

Reads the ECU Serial number.

This function returns the bytes of just the serial number of the ECU, which can be interpreted as either ASCII (Daimler ECUs), or Model line specification (Varies from OEM to OEM)

Reads DBCom data from the ECU. NOT IMPLEMENTED YET (Will return DiagError::NotImplemented)

Reads the Operating system version on the ECU. NOT IMPLEMENTED YET (Will return DiagError::NotImplemented)

Reads reprogramming fault report. The format is binary. This is to be interpreted by GSP/SDE.

Reads vehicle information from the ECU. NOT IMPLEMENTED YET (Will return DiagError::NotImplemented)

Reads flash data from block 1. NOT IMPLEMENTED YET (Will return DiagError::NotImplemented)

Reads flash data from block 2. NOT IMPLEMENTED YET (Will return DiagError::NotImplemented)

Reads general diagnostic parameter data from the ECU (SDCOM). NOT IMPLEMENTED YET (Will return DiagError::NotImplemented)

Reads global diagnostic parameter data from the ECU. NOT IMPLEMENTED YET (Will return DiagError::NotImplemented)

Reads the ECU’s current configuration status. NOT IMPLEMENTED YET (Will return DiagError::NotImplemented)

Reads ECU protocol information. NOT IMPLEMENTED YET (Will return DiagError::NotImplemented)

Reads data from a custom local identifier

Supported local identifier ranges
  • 0x01-0x7F - Record local identifier
  • 0xA0-0xDF - Record local identifier
  • 0xF0-0xF9 - Dynamically defined local identifier
Important notes:
  1. If the ECU supports commands for identification purposes, then asking for an identifier in the range of 0x86-0x9F will return ECU ident data.

Returns a list of stored DTCs on the ECU in ISO15031-6 format

Returns a list of all supported DTCs on the ECU regardless of their status in ISO15031-6 format

Returns a list of stored DTCs on the ECU in KWP2000 format

Returns a list of all supported DTCs on the ECU regardless of their status, in KWP2000 format.

NOTE: Internally, this function will call Kwp2000DiagnosticServer::read_extended_supported_dtcs in a loop in order to read all DTCs regardless of transport layer limitations

Asks the ECU to report its most recent DTCs that has been stored. Only one DTC is returned if stored, otherwise no DTC is returned.

Upon execution of Kwp2000DiagnosticServer::read_supported_dtcs or Kwp2000DiagnosticServer::read_supported_dtcs_iso15031, if the transport layer restricts the number of DTCs that can be read, or the number of DTCs exceeds 255, then this function will return the number of remaining supported of DTCs to read. Kwp2000DiagnosticServer::read_supported_dtcs or Kwp2000DiagnosticServer::read_supported_dtcs_iso15031 should be executed to read the rest of the DTCs again within the ECUs P3-MAX time window

Reads Daimler ECU identification from ECU

Reads Daimler and MMC ECU identification from ECU

Reads the original VIN programmed onto the ECU from the manufacturer

Reads the unique diagnostic variant code of the ECU

Reads the current VIN stored on the ECU

Reads the OBD Calibration ID from the ECU.

Reads the calibration verification number from the ECU

Reads module information from the ECU’s code block

Reads module information from the ECU’s data block

Reads code identification information from the ECU’s code block

Reads code identification information from the ECU’s data block

Reads code identification information from the ECU’s boot block

Reads code identification information from the ECU’s boot block

Reads the contents of RAM memory on the ECU given a 3 byte address, and 1 byte size. The maximum value for address is 0xFFFFFF, any larger values will be clamped.

NOTE: This function is ONLY indented for ECU development. In production ECUs, use Kwp2000DiagnosticServer::read_custom_local_identifier instead

Reads the status of a given DTC.

This function returns bytes rather than a processed result as the environmental data varies from DTC to DTC and from ECU to ECU, so it is impossible to know what the data returned actually means.

Returns

This function if successful will return the full ECUs response message without any additional processing.

The first 4 bytes of the response are as follows:

  1. DTC Number (Stored on ECU)
  2. DTC High byte
  3. DTC Low byte
  4. Status of DTC

Requests a seed from the ECU

Parameters
  • server - The KWP2000 server
  • access_mode - The access mode. Only odd numbers between 0x01-0x7F are supported for the access level!
Returns

This function will return an error if the access_mode parameter is not a valid mode! If the function succeeds, then just the ECUs key response is returned

Attempts to unlock the access mode to the ECU, using a computed key using the seed provided with Kwp2000DiagnosticServer::request_seed

Parameters
  • server - The KWP2000 server
  • access_mode - The access mode. Only odd numbers between 0x01-0x7F are supported for the access level!
Returns

This function will return an error if the access_mode parameter is not a valid mode! The access_mode should be THE SAME as what was provided to Kwp2000DiagnosticServer::request_seed

Sets the ECU into a diagnostic mode

Parameters
  • server - The KWP2000 Diagnostic server
  • mode - The SessionType to put the ECU into

Creates a new KWP2000 over an ISO-TP connection with the ECU

On startup, this server will configure the channel with the necessary settings provided in both settings and channel_cfg

Parameters
  • settings - KWP2000 Server settings
  • channel - ISO-TP communication channel with the ECU
  • channel_cfg - The settings to use for the ISO-TP channel
  • event_handler - Handler for logging events happening within the server. If you don’t want to create your own handler, use Kwp2000VoidHandler

Returns the current settings used by the KWP2000 Server

Trait Implementations

Formats the value using the given formatter. Read more

Send a command to the ECU, and receive its response

Parameters
  • sid - The Service ID of the command
  • args - The arguments for the service
Returns

If the function is successful, and the ECU responds with an OK response (Containing data), then the full ECU response is returned. The response will begin with the sid + 0x40

Send a command to the ECU, but don’t receive a response

Parameters
  • sid - The Service ID of the command
  • args - The arguments for the service

Sends an arbitrary byte array to the ECU, and does not query response from the ECU

Sends an arbitrary byte array to the ECU, and polls for the ECU’s response

Sets the command retry counter

Sets the command retry interval

Returns true if the internal KWP2000 Server is running

Executes the destructor for this type. Read more

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.