From 1edb05cd5e44a968210cd51f2eb86bfe3ff8c62a Mon Sep 17 00:00:00 2001 From: "Jan \"Yenya\" Kasprzak" Date: Wed, 11 Jan 2012 11:53:01 +0100 Subject: [PATCH] SCX::Parser: fix strange packets dump --- SCX/Parser.pm | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/SCX/Parser.pm b/SCX/Parser.pm index 080e8f2..6f0b61b 100644 --- a/SCX/Parser.pm +++ b/SCX/Parser.pm @@ -124,7 +124,7 @@ sub parse_packet { sub bus_free_time_packet { my ($self, @bytes) = @_; - $self->strange_packet('bus free time', @bytes) + $self->strange_packet('bus_free_time', @bytes) if $bytes[2] != 0xF0 || $bytes[3] != 0xF0 || $bytes[4] != 0xF0 @@ -136,7 +136,7 @@ sub bus_free_time_packet { sub car_programming_packet { my ($self, @bytes) = @_; - $self->strange_packet('car programming', @bytes) + $self->strange_packet('car_programming', @bytes) if ($bytes[0] & 0xF8) != 0 || ($bytes[0] & 0x07) > 5 || $bytes[1] != 0xFE || $bytes[2] != 0xFF @@ -176,7 +176,7 @@ sub standings_packet { sub car_lap_time_packet { my ($self, @bytes) = @_; - $self->strange_packet('car lap time', @bytes) + $self->strange_packet('car_lap_time', @bytes) if $bytes[0] > 5 || $bytes[1] & 0x01 || $bytes[2] & 0x01 @@ -198,7 +198,7 @@ sub car_lap_time_packet { sub race_setup_packet { my ($self, @bytes) = @_; - $self->strange_packet('race setup') + $self->strange_packet('race_setup', @bytes) if ($bytes[0] != 0x00 && $bytes[0] != 0xFF) || $bytes[1] & 0xF0 || $bytes[2] & 0xF0 @@ -218,7 +218,7 @@ sub race_setup_packet { sub fuel_level_packet { my ($self, @bytes) = @_; - $self->strange_packet('fuel level') + $self->strange_packet('fuel_level', @bytes) if ($bytes[0] >> 4) > 8 || ($bytes[0] & 0x0F) > 8 || ($bytes[1] >> 4) > 8 @@ -239,7 +239,7 @@ sub fuel_level_packet { sub brake_set_packet { my ($self, @bytes) = @_; - $self->strange_packet('brake set') + $self->strange_packet('brake_set', @bytes) if ($bytes[0] > 5) || ($bytes[1] != 0x00 && $bytes[1] != 0x02 && $bytes[1] != 0x04) || $bytes[2] != 0x83 @@ -256,7 +256,7 @@ sub brake_set_packet { sub qualification_packet { my ($self, @bytes) = @_; - $self->strange_packet('qualification') + $self->strange_packet('qualification', @bytes) if $bytes[0] & 0xF0 || $bytes[1] & 0xF0 || $bytes[2] & 0xF0 @@ -275,7 +275,7 @@ sub qualification_packet { sub end_of_race_packet { my ($self, @bytes) = @_; - $self->strange_packet('end of race') + $self->strange_packet('end_of_race', @bytes) if $bytes[0] != 0xFF || $bytes[1] != 0xFF || $bytes[2] != 0xFF @@ -289,7 +289,7 @@ sub end_of_race_packet { sub race_start_packet { my ($self, @bytes) = @_; - $self->strange_packet('race start') + $self->strange_packet('race_start', @bytes) if $bytes[0] != 0x00 || $bytes[1] != 0xAA || $bytes[2] != 0xAA @@ -303,7 +303,7 @@ sub race_start_packet { sub display_change_packet { my ($self, @bytes) = @_; - $self->strange_packet('display change') + $self->strange_packet('display_change', @bytes) if $bytes[0] & 0xFE || $bytes[1] != 0xFF || $bytes[2] != 0xFF @@ -366,7 +366,7 @@ sub finish_line_packet { && $byte != 0xFE } - $self->strange_packet('finish line') + $self->strange_packet('finish_line', @bytes) if $fail; my $regular = 1; @@ -394,7 +394,7 @@ sub controller_status_packet { || ($byte & 0x0F) > 12 } - $self->strange_packet('controller status') + $self->strange_packet('controller_status', @bytes) if $fail; my @ctrl_data; -- 2.43.5