@@ -907,6 +907,7 @@ impl<S: EcuGateway, R: DiagServiceResponse, T: EcuManager<Response = R>> UdsMana
907907 dtc_code : DtcCode ,
908908 include_schema : bool ,
909909 memory_selection : Option < u8 > ,
910+ scope : & str ,
910911 ) -> Result < ( Option < ExtendedDataRecords > , Option < serde_json:: Value > ) , DiagServiceError > {
911912 fn extract_schema_properties ( schema_desc : & SchemaDescription ) -> Option < serde_json:: Value > {
912913 // todo after solving #54: we are missing the 'Selector' and the case name here
@@ -919,15 +920,20 @@ impl<S: EcuGateway, R: DiagServiceResponse, T: EcuManager<Response = R>> UdsMana
919920 schema. map ( |schema| serde_json:: Value :: Object ( schema. clone ( ) ) )
920921 }
921922
923+ let ext_data_service_type = if DtcReadInformationFunction :: UserMemoryDtcByStatusMask
924+ . default_scope ( )
925+ . eq_ignore_ascii_case ( scope)
926+ {
927+ DtcReadInformationFunction :: UserMemoryDtcExtDataRecordByDtcNumber
928+ } else {
929+ DtcReadInformationFunction :: FaultMemoryExtDataRecordByDtcNumber
930+ } ;
922931 let ( extended_data_response, _scope, schema_desc) = self
923932 . request_extended_data (
924933 ecu_name,
925934 security_plugin,
926935 dtc_code,
927- vec ! [
928- DtcReadInformationFunction :: FaultMemoryExtDataRecordByDtcNumber ,
929- DtcReadInformationFunction :: UserMemoryDtcExtDataRecordByDtcNumber ,
930- ] ,
936+ vec ! [ ext_data_service_type] ,
931937 memory_selection,
932938 include_schema,
933939 )
@@ -995,6 +1001,7 @@ impl<S: EcuGateway, R: DiagServiceResponse, T: EcuManager<Response = R>> UdsMana
9951001 dtc_code : DtcCode ,
9961002 include_schema : bool ,
9971003 memory_selection : Option < u8 > ,
1004+ scope : & str ,
9981005 ) -> Result < ( Option < ExtendedSnapshots > , Option < serde_json:: Value > ) , DiagServiceError > {
9991006 fn extract_schema_properties ( schema_desc : & SchemaDescription ) -> Option < serde_json:: Value > {
10001007 let param_properties = schema_desc. get_param_properties ( ) ?;
@@ -1013,16 +1020,20 @@ impl<S: EcuGateway, R: DiagServiceResponse, T: EcuManager<Response = R>> UdsMana
10131020 Some ( serde_json:: Value :: Object ( schema) )
10141021 }
10151022 }
1016-
1023+ let snapshot_service_type = if DtcReadInformationFunction :: UserMemoryDtcByStatusMask
1024+ . default_scope ( )
1025+ . eq_ignore_ascii_case ( scope)
1026+ {
1027+ DtcReadInformationFunction :: UserMemoryDtcSnapshotRecordByDtcNumber
1028+ } else {
1029+ DtcReadInformationFunction :: FaultMemorySnapshotRecordByDtcNumber
1030+ } ;
10171031 let ( snapshot_data_response, _scope, schema_desc) = self
10181032 . request_extended_data (
10191033 ecu_name,
10201034 security_plugin,
10211035 dtc_code,
1022- vec ! [
1023- DtcReadInformationFunction :: FaultMemorySnapshotRecordByDtcNumber ,
1024- DtcReadInformationFunction :: UserMemoryDtcSnapshotRecordByDtcNumber ,
1025- ] ,
1036+ vec ! [ snapshot_service_type] ,
10261037 memory_selection,
10271038 include_schema,
10281039 )
@@ -2195,13 +2206,33 @@ impl<S: EcuGateway, R: DiagServiceResponse, T: EcuManager<Response = R>> UdsEcu
21952206 ) -> Result < DtcExtendedInfo , DiagServiceError > {
21962207 let dtc_code = decode_dtc_from_str ( sae_dtc) ?;
21972208
2209+ let mut dtc_by_mask: HashMap < DtcCode , DtcRecordAndStatus > = self
2210+ . ecu_dtc_by_mask (
2211+ ecu_name,
2212+ security_plugin,
2213+ None ,
2214+ None ,
2215+ None ,
2216+ memory_selection,
2217+ )
2218+ . await ?;
2219+
2220+ let record_and_status =
2221+ dtc_by_mask
2222+ . remove ( & dtc_code)
2223+ . ok_or ( DiagServiceError :: InvalidRequest ( format ! (
2224+ "DTC {sae_dtc} not found in ECU {ecu_name}"
2225+ ) ) ) ?;
2226+
2227+ let scope = & record_and_status. scope . clone ( ) ;
21982228 let ( snapshots, snapshot_schema) = if include_snapshot {
21992229 self . map_snapshots (
22002230 ecu_name,
22012231 security_plugin,
22022232 dtc_code,
22032233 include_schema,
22042234 memory_selection,
2235+ scope,
22052236 )
22062237 . await ?
22072238 } else {
@@ -2215,30 +2246,13 @@ impl<S: EcuGateway, R: DiagServiceResponse, T: EcuManager<Response = R>> UdsEcu
22152246 dtc_code,
22162247 include_schema,
22172248 memory_selection,
2249+ scope,
22182250 )
22192251 . await ?
22202252 } else {
22212253 ( None , None )
22222254 } ;
22232255
2224- let mut dtc_by_mask = self
2225- . ecu_dtc_by_mask (
2226- ecu_name,
2227- security_plugin,
2228- None ,
2229- None ,
2230- None ,
2231- memory_selection,
2232- )
2233- . await ?;
2234-
2235- let record_and_status =
2236- dtc_by_mask
2237- . remove ( & dtc_code)
2238- . ok_or ( DiagServiceError :: InvalidRequest ( format ! (
2239- "DTC {sae_dtc} not found in ECU {ecu_name}"
2240- ) ) ) ?;
2241-
22422256 Ok ( DtcExtendedInfo {
22432257 record_and_status,
22442258 extended_data_records : extended_records,
0 commit comments