|
1 | 1 | use std::{ops::Not, os::unix::fs::MetadataExt, path::PathBuf, thread}; |
2 | 2 |
|
| 3 | +use parsers::dlt::DltFilterConfig; |
3 | 4 | use stypes::{ |
4 | 5 | DltParserSettings, FileFormat, ObserveOptions, ObserveOrigin, ParserType, SomeIpParserSettings, |
5 | 6 | Transport, |
@@ -142,7 +143,7 @@ impl HostService { |
142 | 143 | FileFormat::Text => ParserConfig::Text, |
143 | 144 | FileFormat::Binary => { |
144 | 145 | if extension.is_some_and(|ext| ext.eq_ignore_ascii_case("dlt")) { |
145 | | - ParserConfig::Dlt(DltParserConfig::new(true)) |
| 146 | + ParserConfig::Dlt(DltParserConfig::new(true, Some(file_path.clone()))) |
146 | 147 | } else { |
147 | 148 | return Err(HostError::InitSessionError(InitSessionError::Other( |
148 | 149 | "File extension is not supported".to_owned(), |
@@ -192,7 +193,7 @@ impl HostService { |
192 | 193 | }; |
193 | 194 |
|
194 | 195 | let parser = match parser { |
195 | | - ParserNames::Dlt => ParserConfig::Dlt(DltParserConfig::new(false)), |
| 196 | + ParserNames::Dlt => ParserConfig::Dlt(DltParserConfig::new(false, None)), |
196 | 197 | ParserNames::SomeIP => ParserConfig::SomeIP(SomeIpParserConfig::default()), |
197 | 198 | ParserNames::Text => ParserConfig::Text, |
198 | 199 | ParserNames::Plugins => todo!(), |
@@ -241,8 +242,67 @@ impl HostService { |
241 | 242 | .collect() |
242 | 243 | }); |
243 | 244 |
|
| 245 | + let (app_ids, app_id_count) = |
| 246 | + if !config.dlt_tables.app_table.selected_ids.is_empty() { |
| 247 | + ( |
| 248 | + Some( |
| 249 | + config |
| 250 | + .dlt_tables |
| 251 | + .app_table |
| 252 | + .selected_ids |
| 253 | + .iter() |
| 254 | + .cloned() |
| 255 | + .collect::<Vec<String>>(), |
| 256 | + ), |
| 257 | + config.dlt_tables.app_table.selected_ids.len() as i64, |
| 258 | + ) |
| 259 | + } else { |
| 260 | + (None, 0) |
| 261 | + }; |
| 262 | + |
| 263 | + let (context_ids, context_id_count) = |
| 264 | + if !config.dlt_tables.ctx_table.selected_ids.is_empty() { |
| 265 | + ( |
| 266 | + Some( |
| 267 | + config |
| 268 | + .dlt_tables |
| 269 | + .ctx_table |
| 270 | + .selected_ids |
| 271 | + .iter() |
| 272 | + .cloned() |
| 273 | + .collect::<Vec<String>>(), |
| 274 | + ), |
| 275 | + config.dlt_tables.ctx_table.selected_ids.len() as i64, |
| 276 | + ) |
| 277 | + } else { |
| 278 | + (None, 0) |
| 279 | + }; |
| 280 | + |
| 281 | + let ecu_ids = if !config.dlt_tables.ecu_table.selected_ids.is_empty() { |
| 282 | + Some( |
| 283 | + config |
| 284 | + .dlt_tables |
| 285 | + .ecu_table |
| 286 | + .selected_ids |
| 287 | + .iter() |
| 288 | + .cloned() |
| 289 | + .collect::<Vec<String>>(), |
| 290 | + ) |
| 291 | + } else { |
| 292 | + None |
| 293 | + }; |
| 294 | + |
| 295 | + let filter_config = DltFilterConfig { |
| 296 | + min_log_level: Some(config.log_level as u8), |
| 297 | + app_ids: app_ids, |
| 298 | + ecu_ids: ecu_ids, |
| 299 | + context_ids: context_ids, |
| 300 | + app_id_count: app_id_count, |
| 301 | + context_id_count: context_id_count, |
| 302 | + }; |
| 303 | + |
244 | 304 | let dlt_config = DltParserSettings { |
245 | | - filter_config: None, |
| 305 | + filter_config: Some(filter_config), |
246 | 306 | fibex_file_paths, |
247 | 307 | with_storage_header: config.with_storage_header, |
248 | 308 | tz: config.timezone, |
|
0 commit comments