Struct ecu_diagnostics::kwp2000::KwpRoutineManager
source · pub struct KwpRoutineManager<'a> { /* private fields */ }
Expand description
KWP2000 Routine execution wrapper
Implementations§
source§impl<'a> KwpRoutineManager<'a>
impl<'a> KwpRoutineManager<'a>
sourcepub fn new(
rid: RoutineID,
server: &'a mut DynamicDiagSession
) -> DiagServerResult<Self>
pub fn new( rid: RoutineID, server: &'a mut DynamicDiagSession ) -> DiagServerResult<Self>
Creates a new routine manager. Upon creation, the KWP2000 diagnostic server will automatically attempt to enter extended diagnostic session mode, which is required for routine execution and management.
§Parameters
- rid - The routine ID
- server - Reference to running KWP2000 diagnostic server
§Returns
If an error of DiagError::ParameterInvalid is returned, then it means that the value of rid
is invalid
and violates the KWP2000 specification. Other DiagError’s will come from the attempt to set the ECU
into extended diagnostic session mode.
sourcepub fn start_routine(&self, entry_options: &[u8]) -> DiagServerResult<()>
pub fn start_routine(&self, entry_options: &[u8]) -> DiagServerResult<()>
Attempts to start the routine
sourcepub fn stop_routine(
&self,
exit_options: &[u8]
) -> DiagServerResult<RoutineExitStatusByte>
pub fn stop_routine( &self, exit_options: &[u8] ) -> DiagServerResult<RoutineExitStatusByte>
Attempts to stop the routine. Note that some routines automatically exit themselves and do NOT need to be manually stopped
sourcepub fn request_routine_results(&self) -> DiagServerResult<Vec<u8>>
pub fn request_routine_results(&self) -> DiagServerResult<Vec<u8>>
Requests the results of the routine. If the routine was manually stopped prior to running this, it is best practice to check the [RoutineExitStatus] to see if the routine exited with [RoutineExitStatus::NormalExitWithResults] first.