Struct ecu_diagnostics::uds::UdsDiagnosticServer
source · [−]pub struct UdsDiagnosticServer { /* private fields */ }
Expand description
UDS Diagnostic server
Implementations
sourceimpl UdsDiagnosticServer
impl UdsDiagnosticServer
sourcepub fn clear_diagnostic_information(
&mut self,
dtc_mask: u32
) -> DiagServerResult<()>
pub fn clear_diagnostic_information(
&mut self,
dtc_mask: u32
) -> DiagServerResult<()>
Clears diagnostic information (DTCs) from the ECU.
Parameters
- server - The UDS Diagnostic server
- dtc_mask - Mask of DTCs to clear. Only the lower 3 bytes are used (from 0x00000000 - 0x00FFFFFF)
sourceimpl UdsDiagnosticServer
impl UdsDiagnosticServer
sourcepub fn control_communication(
&mut self,
communication_type: EcuCommunicationType,
subnet: Subnet,
comm_level: CommunicationLevel
) -> DiagServerResult<()>
pub fn control_communication(
&mut self,
communication_type: EcuCommunicationType,
subnet: Subnet,
comm_level: CommunicationLevel
) -> DiagServerResult<()>
Modifies ECU communication settings. These settings persist until the ECU is power cycled
Parameters
- server - The UDS diagnostic server
- communication_type - Communication layer to modify
- Subnet - The subnet the ECU communicates with to modify
- comm_level - Communication level
sourceimpl UdsDiagnosticServer
impl UdsDiagnosticServer
sourcepub fn set_session_mode(
&mut self,
session_mode: UDSSessionType
) -> DiagServerResult<()>
pub fn set_session_mode(
&mut self,
session_mode: UDSSessionType
) -> DiagServerResult<()>
Requests the ECU to go into a specific diagnostic session mode
sourceimpl UdsDiagnosticServer
impl UdsDiagnosticServer
sourcepub fn ecu_hard_reset(&mut self) -> DiagServerResult<()>
pub fn ecu_hard_reset(&mut self) -> DiagServerResult<()>
Asks the ECU to perform a hard reset. See ResetType::HardReset for more details
Parameters
- server - The UDS Diagnostic server
sourcepub fn ecu_key_off_on_reset(&mut self) -> DiagServerResult<()>
pub fn ecu_key_off_on_reset(&mut self) -> DiagServerResult<()>
Asks the ECU to perform a key off/on reset. See ResetType::KeyOffReset for more details
Parameters
- server - The UDS Diagnostic server
sourcepub fn ecu_soft_reset(&mut self) -> DiagServerResult<()>
pub fn ecu_soft_reset(&mut self) -> DiagServerResult<()>
Asks the ECU to perform a soft reset. See ResetType::SoftReset for more details
Parameters
- server - The UDS Diagnostic server
sourcepub fn enable_rapid_power_shutdown(&mut self) -> DiagServerResult<u8>
pub fn enable_rapid_power_shutdown(&mut self) -> DiagServerResult<u8>
Asks the ECU to enable rapid power shutdown mode. See ResetType::EnableRapidPowerShutDown for more details
Parameters
- server - The UDS Diagnostic server
Returns
If successful, this function will return the minimum time in seconds that the ECU will remain in the power-down sequence
sourcepub fn disable_rapid_power_shutdown(&mut self) -> DiagServerResult<()>
pub fn disable_rapid_power_shutdown(&mut self) -> DiagServerResult<()>
sourceimpl UdsDiagnosticServer
impl UdsDiagnosticServer
sourcepub fn get_number_of_dtcs_by_status_mask(
&mut self,
status_mask: u8
) -> DiagServerResult<(u8, DTCFormatType, u16)>
pub fn get_number_of_dtcs_by_status_mask(
&mut self,
status_mask: u8
) -> DiagServerResult<(u8, DTCFormatType, u16)>
Returns the number of DTCs stored on the ECU matching the provided status_mask
Returns
Returns a tuple of the given information:
- (u8) - DTCStatusAvailabilityMask
- (DTCFormatType) - Format of the DTCs
- (u16) - Number of DTCs which match the status mask
sourcepub fn get_dtcs_by_status_mask(
&mut self,
status_mask: u8
) -> DiagServerResult<Vec<DTC>>
pub fn get_dtcs_by_status_mask(
&mut self,
status_mask: u8
) -> DiagServerResult<Vec<DTC>>
Returns a list of DTCs stored on the ECU matching the provided status_mask
sourcepub fn get_mirror_memory_dtcs_by_status_mask(
&mut self,
status_mask: u8
) -> DiagServerResult<Vec<DTC>>
pub fn get_mirror_memory_dtcs_by_status_mask(
&mut self,
status_mask: u8
) -> DiagServerResult<Vec<DTC>>
Returns a list of DTCs out of the DTC mirror memory who’s status_mask matches the provided mask
sourcepub fn get_number_of_mirror_memory_dtcs_by_status_mask(
&mut self,
status_mask: u8
) -> DiagServerResult<(u8, DTCFormatType, u16)>
pub fn get_number_of_mirror_memory_dtcs_by_status_mask(
&mut self,
status_mask: u8
) -> DiagServerResult<(u8, DTCFormatType, u16)>
Returns the number of DTCs in DTC mirror memory who’s status_mask matches the provided mask
Returns
Returns a tuple of the given information:
- (u8) - DTCStatusAvailabilityMask
- (DTCFormatType) - Format of the DTCs
- (u16) - Number of DTCs which match the status mask
Returns the number of OBD emissions related DTCs stored on the ECU who’s status mask matches the provided masks
Returns
Returns a tuple of the given information:
- (u8) - DTCStatusAvailabilityMask
- (DTCFormatType) - Format of the DTCs
- (u16) - Number of DTCs which match the status mask
Returns a list of OBD emissions related DTCs stored on the ECU who’s status mask matches the provided mask
sourcepub fn get_dtc_snapshot_record_by_dtc_number(
&mut self,
dtc_mask_record: u32,
snapshot_record_number: u8
) -> DiagServerResult<u32>
pub fn get_dtc_snapshot_record_by_dtc_number(
&mut self,
dtc_mask_record: u32,
snapshot_record_number: u8
) -> DiagServerResult<u32>
sourcepub fn get_dtc_snapshot_identification(&mut self) -> DiagServerResult<u32>
pub fn get_dtc_snapshot_identification(&mut self) -> DiagServerResult<u32>
Returns all DTC snapshot identifications (DTC number(s) and DTCSnapshot record number(s))
sourcepub fn get_dtc_snapshot_record_by_record_number(
&mut self,
snapshot_record_number: u8
) -> DiagServerResult<u32>
pub fn get_dtc_snapshot_record_by_record_number(
&mut self,
snapshot_record_number: u8
) -> DiagServerResult<u32>
Returns a list of snapshot records based on the mask of snapshot_record_number (0xFF for all records)
sourcepub fn get_dtc_extended_data_record_by_dtc_number(
&mut self,
dtc: u32,
extended_data_record_number: u8
) -> DiagServerResult<Vec<u8>>
pub fn get_dtc_extended_data_record_by_dtc_number(
&mut self,
dtc: u32,
extended_data_record_number: u8
) -> DiagServerResult<Vec<u8>>
Returns the DTCExtendedData record(s) associated with the provided DTC mask and record number. For the record_number, 0xFE implies all OBD records. and 0xFF implies all records.
Returns
This function will return the ECUs full response if successful
sourcepub fn get_mirror_memory_dtc_extended_data_record_by_dtc_number(
&mut self,
dtc: u32,
extended_data_record_number: u8
) -> DiagServerResult<Vec<u8>>
pub fn get_mirror_memory_dtc_extended_data_record_by_dtc_number(
&mut self,
dtc: u32,
extended_data_record_number: u8
) -> DiagServerResult<Vec<u8>>
Returns a list of extended data records stored in DTC mirror memory for a given DTC. 0xFF for extended_data_record means return all extended data records.
Returns
This function will return the ECUs full response if successful
sourcepub fn get_number_of_dtcs_by_severity_mask_record(
&mut self,
severity_mask: u8,
status_mask: u8
) -> DiagServerResult<u32>
pub fn get_number_of_dtcs_by_severity_mask_record(
&mut self,
severity_mask: u8,
status_mask: u8
) -> DiagServerResult<u32>
Returns the number of DTCs stored on the ECU that match the provided severity and status mask
sourcepub fn get_dtcs_by_severity_mask_record(
&mut self,
severity_mask: u8,
status_mask: u8
) -> DiagServerResult<Vec<DTC>>
pub fn get_dtcs_by_severity_mask_record(
&mut self,
severity_mask: u8,
status_mask: u8
) -> DiagServerResult<Vec<DTC>>
Returns a list of DTCs who’s severity mask matches the provided mask
sourcepub fn get_severity_information_of_dtc(
&mut self,
dtc: u32
) -> DiagServerResult<u32>
pub fn get_severity_information_of_dtc(
&mut self,
dtc: u32
) -> DiagServerResult<u32>
Returns the severity status of a provided DTC
sourcepub fn get_supported_dtc(&mut self) -> DiagServerResult<Vec<DTC>>
pub fn get_supported_dtc(&mut self) -> DiagServerResult<Vec<DTC>>
Returns a list of all DTCs that the ECU can return
sourcepub fn get_first_test_failed_dtc(&mut self) -> DiagServerResult<Option<DTC>>
pub fn get_first_test_failed_dtc(&mut self) -> DiagServerResult<Option<DTC>>
Returns the first failed DTC to be detected since the last DTC clear operation
sourcepub fn get_first_confirmed_dtc(&mut self) -> DiagServerResult<Option<DTC>>
pub fn get_first_confirmed_dtc(&mut self) -> DiagServerResult<Option<DTC>>
Returns the first confirmed DTC to be detected since the last DTC clear operation
sourcepub fn get_most_recent_test_failed_dtc(
&mut self
) -> DiagServerResult<Option<DTC>>
pub fn get_most_recent_test_failed_dtc(
&mut self
) -> DiagServerResult<Option<DTC>>
Returns the most recent DTC to be detected since the last DTC clear operation
sourcepub fn get_most_recent_confirmed_dtc(&mut self) -> DiagServerResult<Option<DTC>>
pub fn get_most_recent_confirmed_dtc(&mut self) -> DiagServerResult<Option<DTC>>
Returns the most recent DTC to be detected since the last DTC clear operation
sourcepub fn get_dtc_fault_detection_counter(
&mut self
) -> DiagServerResult<Vec<(u32, u8)>>
pub fn get_dtc_fault_detection_counter(
&mut self
) -> DiagServerResult<Vec<(u32, u8)>>
Returns the current number of ‘pre-failed’ DTCs on the ECU, which have not yet been confirmed as being either ‘pending’ or ‘confirmed’
Returns
This function will return a vector of information, where each element is a tuple containing the following values:
- (u32) - DTC Code
- (u8) - Fault detection counter
sourcepub fn get_dtc_with_permanent_status(&mut self) -> DiagServerResult<Vec<DTC>>
pub fn get_dtc_with_permanent_status(&mut self) -> DiagServerResult<Vec<DTC>>
Returns a list of DTCs that have a permanent status
sourceimpl UdsDiagnosticServer
impl UdsDiagnosticServer
sourcepub fn request_seed(&mut self) -> DiagServerResult<Vec<u8>>
pub fn request_seed(&mut self) -> DiagServerResult<Vec<u8>>
Requests a seed from the ECU for security access.
Once the key is calculated from the response seed, run UdsDiagnosticServer::send_key to send the computed key to the ECU
Parameters
- server - The UDS Diagnostic server
Returns
Returns the security key’s seed
sourcepub fn send_key(&mut self, key: &[u8]) -> DiagServerResult<()>
pub fn send_key(&mut self, key: &[u8]) -> DiagServerResult<()>
Sends the computed key to the ECU.
If this function is successful, then the ECU has now allows access to security protected memory regions and functions
Parameters
- server - The UDS Diagnostic server
- key - The computed key to send to the ECU
sourceimpl UdsDiagnosticServer
impl UdsDiagnosticServer
sourcepub fn new_over_iso_tp<C, E>(
settings: UdsServerOptions,
server_channel: C,
channel_cfg: IsoTPSettings,
event_handler: E
) -> DiagServerResult<Self> where
C: IsoTPChannel + 'static,
E: ServerEventHandler<UDSSessionType> + 'static,
pub fn new_over_iso_tp<C, E>(
settings: UdsServerOptions,
server_channel: C,
channel_cfg: IsoTPSettings,
event_handler: E
) -> DiagServerResult<Self> where
C: IsoTPChannel + 'static,
E: ServerEventHandler<UDSSessionType> + 'static,
Creates a new UDS 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 - UDS 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 UdsVoidHandler
sourcepub fn get_settings(&self) -> UdsServerOptions
pub fn get_settings(&self) -> UdsServerOptions
Returns the current settings used by the UDS Server
Trait Implementations
sourceimpl Debug for UdsDiagnosticServer
impl Debug for UdsDiagnosticServer
sourceimpl DiagnosticServer<UDSCommand> for UdsDiagnosticServer
impl DiagnosticServer<UDSCommand> for UdsDiagnosticServer
sourcefn execute_command_with_response(
&mut self,
sid: UDSCommand,
args: &[u8]
) -> DiagServerResult<Vec<u8>>
fn execute_command_with_response(
&mut self,
sid: UDSCommand,
args: &[u8]
) -> DiagServerResult<Vec<u8>>
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
sourcefn execute_command(
&mut self,
sid: UDSCommand,
args: &[u8]
) -> DiagServerResult<()>
fn execute_command(
&mut self,
sid: UDSCommand,
args: &[u8]
) -> DiagServerResult<()>
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
sourcefn set_repeat_count(&mut self, count: u32)
fn set_repeat_count(&mut self, count: u32)
Sets the command retry counter
sourcefn set_repeat_interval_count(&mut self, interval_ms: u32)
fn set_repeat_interval_count(&mut self, interval_ms: u32)
Sets the command retry interval
sourcefn send_byte_array(&mut self, arr: &[u8]) -> DiagServerResult<()>
fn send_byte_array(&mut self, arr: &[u8]) -> DiagServerResult<()>
Sends an arbitrary byte array to the ECU, and does not query response from the ECU
sourcefn send_byte_array_with_response(
&mut self,
arr: &[u8]
) -> DiagServerResult<Vec<u8>>
fn send_byte_array_with_response(
&mut self,
arr: &[u8]
) -> DiagServerResult<Vec<u8>>
Sends an arbitrary byte array to the ECU, and polls for the ECU’s response
sourcefn is_server_running(&self) -> bool
fn is_server_running(&self) -> bool
Returns if the diagnostic server is running or not
sourceimpl Drop for UdsDiagnosticServer
impl Drop for UdsDiagnosticServer
sourceimpl From<UdsDiagnosticServer> for DynamicDiagSession
impl From<UdsDiagnosticServer> for DynamicDiagSession
sourcefn from(s: UdsDiagnosticServer) -> Self
fn from(s: UdsDiagnosticServer) -> Self
Converts to this type from the input type.
impl Send for UdsDiagnosticServer
impl Sync for UdsDiagnosticServer
Auto Trait Implementations
impl !RefUnwindSafe for UdsDiagnosticServer
impl Unpin for UdsDiagnosticServer
impl !UnwindSafe for UdsDiagnosticServer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more