Skip to content

Commit

Permalink
chore(directb2s): add missing fields (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
francisdb authored Dec 5, 2024
1 parent 555fcb4 commit d2f3e3c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
24 changes: 22 additions & 2 deletions src/directb2s/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ pub struct AnimationStep {
pub off: String,
#[serde(rename = "@WaitLoopsAfterOff")]
pub wait_loops_after_off: String,
#[serde(rename = "@PulseSwitch", skip_serializing_if = "Option::is_none")]
pub pulse_switch: Option<String>,
}

#[derive(Debug, Deserialize, Serialize)]
Expand All @@ -139,6 +141,10 @@ pub struct Animation {
pub loops: String,
#[serde(rename = "@IDJoin")]
pub id_join: String,
#[serde(rename = "@RandomQuality", skip_serializing_if = "Option::is_none")]
pub random_quality: Option<String>,
#[serde(rename = "@RandomStart", skip_serializing_if = "Option::is_none")]
pub random_start: Option<String>,
#[serde(rename = "@StartAnimationAtBackglassStartup")]
pub start_animation_at_backglass_startup: String,
#[serde(
Expand Down Expand Up @@ -169,8 +175,8 @@ pub struct Animation {
skip_serializing_if = "Option::is_none"
)]
pub run_animation_til_end: Option<String>,
#[serde(rename = "AnimationStep")]
pub animation_step: Vec<AnimationStep>,
#[serde(rename = "AnimationStep", skip_serializing_if = "Option::is_none")]
pub animation_step: Option<Vec<AnimationStep>>,
}

#[derive(Debug, Deserialize, Serialize)]
Expand Down Expand Up @@ -466,6 +472,18 @@ pub struct DMDDefaultLocation {
pub loc_y: String,
}

#[derive(Debug, Deserialize, Serialize)]
pub struct VRDMDLocation {
#[serde(rename = "@LocX")]
pub loc_x: String,
#[serde(rename = "@LocY")]
pub loc_y: String,
#[serde(rename = "@Width")]
pub width: String,
#[serde(rename = "@Height")]
pub height: String,
}

#[derive(Debug, Deserialize, Serialize)]
pub struct GrillHeight {
#[serde(rename = "@Value")]
Expand All @@ -487,6 +505,8 @@ pub struct DirectB2SData {
pub dmd_type: DmdTypeTag,
#[serde(rename = "DMDDefaultLocation")]
pub dmd_default_location: DMDDefaultLocation,
#[serde(rename = "VRDMDLocation", skip_serializing_if = "Option::is_none")]
pub vr_dmd_location: Option<VRDMDLocation>,
#[serde(rename = "GrillHeight")]
pub grill_height: GrillHeight,
#[serde(rename = "ProjectGUID")]
Expand Down
2 changes: 1 addition & 1 deletion tests/directb2s_read_write_compare_all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ fn write_node<W: Write>(
a.name(),
&value.len(),
calculate_hash(&value),
&value[0..100]
value.chars().take(100).collect::<String>()
)
} else {
format!("{}={}", a.name(), a.value())
Expand Down

0 comments on commit d2f3e3c

Please sign in to comment.