]> www.fi.muni.cz Git - slotcarman.git/blobdiff - SCX/Reader.pm
First implementation of qualification.
[slotcarman.git] / SCX / Reader.pm
index 5422a4b4c43ea5f201ed65e1a1a1473ddb2499e7..010647648b3d5e7e94383f2be529eb085153ee9c 100644 (file)
@@ -260,7 +260,7 @@ sub race_setup_packet {
                        + ($bytes[3] & 0x0F);
 
        $self->log_cmd('race_setup', $rounds);
-       $self->track->race_setup($rounds);
+       $self->track->race_setup($rounds, $self->{last_read_time});
 
        return $msg;
 }
@@ -306,12 +306,17 @@ sub qualification_packet {
                if $bytes[0] & 0xF0
                || $bytes[1] & 0xF0
                || $bytes[2] & 0xF0
-               || $bytes[3] > 5
+               || $bytes[3] > 6
                || $bytes[4] != 0xFF
                || $bytes[5] != 0xFF;
 
-       $self->log_cmd('qualification_start');
-       $self->track->qualification_start;
+       my $rounds = ($bytes[0] & 0x0F) * 256
+                       + ($bytes[1] & 0x0F) * 16
+                       + ($bytes[2] & 0x0F);
+       my $cars = $bytes[3];
+       $self->log_cmd('qualification_start', $rounds, $cars);
+       $self->track->qualification_setup($rounds, $cars,
+               $self->{last_read_time});
 
        return $msg;
 }
@@ -347,7 +352,7 @@ sub race_start_packet {
                || $bytes[5] != 0xAA;
 
        $self->log_cmd('race_start');
-       $self->track->race_start;
+       $self->track->race_start($self->{last_read_time});
 
        return $msg;
 }