Skip to content

Commit

Permalink
fix: Enhance serialization logic to support additional data types
Browse files Browse the repository at this point in the history
  • Loading branch information
CoffeSiberian committed Dec 22, 2024
1 parent befccfe commit b998268
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/decoder/bsii_serializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,22 @@ fn serialize_single_value(data: &BsiiDataSegment) -> String {
fn serialize_single_value_string(data: &BsiiDataSegment) -> String {
let value = &data.value[0];

let value_compare = if value.is_empty() {
"\"\"".to_string()
} else {
value.to_string()
let value_compare = match value {
/*
Support for external decryptors (more data types possible)
*/
v if data.name == "part_type" && v == "vehicle" => "unknown".to_string(),
v if data.name == "type" && v == "parking" => "spot".to_string(),
v if data.name == "setup" && v == "low_beam" => "candela_hue_saturation".to_string(),
v if data.name == "setup" && v == "parking" => "lumen_hue_saturation".to_string(),
v if data.name == "dir_type" && v == "parking" => "wide".to_string(),
v if data.name == "dir_type" && v == "low_beam" => "narrow".to_string(),
v if data.name == "cut_direction" && v.is_empty() => "forward".to_string(),
/*
Standard types
*/
v if v.is_empty() => "\"\"".to_string(),
_ => value.to_string(),
};

format!("{}{}: {}\n", IDENT, data.name, value_compare)
Expand Down

0 comments on commit b998268

Please sign in to comment.