Add the remaining service $00 PIDs up to $20
Also restructure the code to implement get_dtcs and get_dtc_info by implementing GetObd2Values on the data types they return. This brings them in line with every other getter function besides get_vin.
This commit is contained in:
parent
5b20ac0ab9
commit
13b9041511
5 changed files with 344 additions and 84 deletions
|
@ -1,4 +1,11 @@
|
|||
macro_rules! trait_func {
|
||||
{
|
||||
$(#[$attr:meta])*
|
||||
fn $name:ident($service:expr) -> $retrieve_type:ty;
|
||||
} => {
|
||||
$(#[$attr])*
|
||||
fn $name(&mut self) -> Result<Vec<$retrieve_type>>;
|
||||
};
|
||||
{
|
||||
$(#[$attr:meta])*
|
||||
fn $name:ident($service:expr, $pid:expr) -> $retrieve_type:ty;
|
||||
|
@ -23,6 +30,14 @@ macro_rules! trait_func {
|
|||
}
|
||||
|
||||
macro_rules! impl_func {
|
||||
{
|
||||
$(#[$attr:meta])*
|
||||
fn $name:ident($service:expr) -> $retrieve_type:ty;
|
||||
} => {
|
||||
fn $name(&mut self) -> Result<Vec<$retrieve_type>> {
|
||||
<$retrieve_type>::get_obd2_val_mode(self, $service)
|
||||
}
|
||||
};
|
||||
{
|
||||
$(#[$attr:meta])*
|
||||
fn $name:ident($service:expr, $pid:expr) -> $retrieve_type:ty;
|
||||
|
@ -69,7 +84,7 @@ macro_rules! func {
|
|||
|
||||
$(
|
||||
$(#[$attr_inner:meta])*
|
||||
fn $name:ident$(<$retrieve_type:ty>)?($service:expr, $pid:expr$(, $map:expr)?) -> $output:ty;
|
||||
fn $name:ident$(<$retrieve_type:ty>)?($service:expr$(, $pid:expr$(, $map:expr)?)?) -> $output:ty;
|
||||
)*
|
||||
} => {
|
||||
$(#[$attr])*
|
||||
|
@ -85,10 +100,10 @@ macro_rules! func {
|
|||
///
|
||||
#[doc=concat!(
|
||||
"Details: service ", $service,
|
||||
", PID ", $pid,
|
||||
$(", PID ", $pid,)?
|
||||
", read type: `", decode_type!($output $(, $retrieve_type)?), "`"
|
||||
)]
|
||||
fn $name$(<$retrieve_type>)?($service, $pid$(, $map)?) -> $output;
|
||||
fn $name$(<$retrieve_type>)?($service$(, $pid$(, $map)?)?) -> $output;
|
||||
}
|
||||
)*
|
||||
}
|
||||
|
@ -102,7 +117,7 @@ macro_rules! func {
|
|||
$(
|
||||
impl_func! {
|
||||
$(#[$attr_inner])*
|
||||
fn $name$(<$retrieve_type>)?($service, $pid$(, $map)?) -> $output;
|
||||
fn $name$(<$retrieve_type>)?($service$(, $pid$(, $map)?)?) -> $output;
|
||||
}
|
||||
)*
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue