Struct ecu_diagnostics::dynamic_diag::DynamicDiagSession
source · [−]pub struct DynamicDiagSession { /* private fields */ }
Expand description
Dynamic diagnostic session
This is used if a target ECU has an unknown diagnostic protocol.
This also contains some useful wrappers for basic functions such as reading and clearing error codes.
Implementations
sourceimpl DynamicDiagSession
impl DynamicDiagSession
sourcepub fn new_over_iso_tp<C>(
hw_device: Arc<Mutex<C>>,
channel_cfg: IsoTPSettings,
tx_id: u32,
rx_id: u32
) -> DiagServerResult<Self> where
C: Hardware + 'static,
pub fn new_over_iso_tp<C>(
hw_device: Arc<Mutex<C>>,
channel_cfg: IsoTPSettings,
tx_id: u32,
rx_id: u32
) -> DiagServerResult<Self> where
C: Hardware + 'static,
Creates a new dynamic session. This will first try with KWP2000, then if that fails, will try with UDS. If both server creations fail, then the last error will be returned.
NOTE: In order to test if the ECU supports the protocol, the ECU will be put into extended diagnostic session briefly to test if it supports the tested diagnostic protocol.
sourcepub fn as_kwp_session(&mut self) -> Option<&mut Kwp2000DiagnosticServer>
pub fn as_kwp_session(&mut self) -> Option<&mut Kwp2000DiagnosticServer>
Returns a reference to KWP2000 session. None is returned if server type is not KWP2000
sourcepub fn with_kwp<T, F: Fn(&mut Kwp2000DiagnosticServer) -> DiagServerResult<T>>(
&mut self,
f: F
) -> DiagServerResult<T>
pub fn with_kwp<T, F: Fn(&mut Kwp2000DiagnosticServer) -> DiagServerResult<T>>(
&mut self,
f: F
) -> DiagServerResult<T>
Performs operation with Kwp 2000 diagnostic server. If the type of the server is not KWP2000, then nothing happens, and DiagError::NotSupported
sourcepub fn with_uds<T, F: Fn(&mut UdsDiagnosticServer) -> DiagServerResult<T>>(
&mut self,
f: F
) -> DiagServerResult<T>
pub fn with_uds<T, F: Fn(&mut UdsDiagnosticServer) -> DiagServerResult<T>>(
&mut self,
f: F
) -> DiagServerResult<T>
Performs operation with UDS diagnostic server. If the type of the server is not UDS, then nothing happens, and DiagError::NotSupported
sourcepub fn as_uds_session(&mut self) -> Option<&mut UdsDiagnosticServer>
pub fn as_uds_session(&mut self) -> Option<&mut UdsDiagnosticServer>
Returns a reference to UDS session. None is returned if server type is not UDS
sourcepub fn enter_extended_diagnostic_mode(&mut self) -> DiagServerResult<()>
pub fn enter_extended_diagnostic_mode(&mut self) -> DiagServerResult<()>
Puts the ECU into an extended diagnostic session
sourcepub fn enter_default_diagnostic_mode(&mut self) -> DiagServerResult<()>
pub fn enter_default_diagnostic_mode(&mut self) -> DiagServerResult<()>
Puts the ECU into a default diagnostic session. This is how the ECU normally operates
sourcepub fn read_all_dtcs(&mut self) -> DiagServerResult<Vec<DTC>>
pub fn read_all_dtcs(&mut self) -> DiagServerResult<Vec<DTC>>
Reads all diagnostic trouble codes from the ECU
sourcepub fn clear_all_dtcs(&mut self) -> DiagServerResult<()>
pub fn clear_all_dtcs(&mut self) -> DiagServerResult<()>
Attempts to clear all DTCs stored on the ECU
sourcepub fn send_bytes_with_response(
&mut self,
payload: &[u8]
) -> DiagServerResult<Vec<u8>>
pub fn send_bytes_with_response(
&mut self,
payload: &[u8]
) -> DiagServerResult<Vec<u8>>
Attempts to send a payload of bytes to the ECU, and return its full response
sourcepub fn send_bytes(&mut self, payload: &[u8]) -> DiagServerResult<()>
pub fn send_bytes(&mut self, payload: &[u8]) -> DiagServerResult<()>
Attempts to send a payload of bytes to the ECU, and don’t poll for a response
Trait Implementations
sourceimpl Debug for DynamicDiagSession
impl Debug for DynamicDiagSession
sourceimpl From<Kwp2000DiagnosticServer> for DynamicDiagSession
impl From<Kwp2000DiagnosticServer> for DynamicDiagSession
sourcefn from(s: Kwp2000DiagnosticServer) -> Self
fn from(s: Kwp2000DiagnosticServer) -> Self
Converts to this type from the input type.
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.
Auto Trait Implementations
impl !RefUnwindSafe for DynamicDiagSession
impl Send for DynamicDiagSession
impl !Sync for DynamicDiagSession
impl Unpin for DynamicDiagSession
impl !UnwindSafe for DynamicDiagSession
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