Class: LiveF1::Packet::Sys::SessionStart

Inherits:
LiveF1::Packet::Sys show all
Includes:
Type::Short
Defined in:
lib/live_f1/packet/sys/session_start.rb

Overview

A SessionStart packet is the first packet emitted for a session.

Instance Attribute Summary

Attributes inherited from LiveF1::Packet

#data, #header, #source

Instance Method Summary collapse

Methods included from Type::Short

#length, #spare_bits

Methods inherited from LiveF1::Packet

from_source, #initialize, #leader, #spare_bits, #spare_data, #to_s

Constructor Details

This class inherits a constructor from LiveF1::Packet

Instance Method Details

#event_typeObject

The type of event this is (practise, qualifying or race) as defined by the constants in Event::Type



15
16
17
# File 'lib/live_f1/packet/sys/session_start.rb', line 15

def event_type
  header.data & 0b0111
end

#inspectObject



19
20
21
# File 'lib/live_f1/packet/sys/session_start.rb', line 19

def inspect
  "Event #{session_number} Start (#{Event::Type.name_for event_type})"
end

#session_numberObject

The formula1.com unique identifier for this session



9
10
11
# File 'lib/live_f1/packet/sys/session_start.rb', line 9

def session_number
  data[1..-1].to_i
end