Class: Event
- Inherits:
-
Object
- Object
- Event
- Defined in:
- lib/trixter/event.rb
Instance Attribute Summary collapse
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
- #crankPosition ⇒ Object
- #flywheelRotationTime ⇒ Object
-
#initialize(bytes) ⇒ Event
constructor
A new instance of Event.
- #leftBrakePressure ⇒ Object
- #leftControlDown ⇒ Object
- #leftControlLeft ⇒ Object
- #leftControlRight ⇒ Object
- #leftControlUp ⇒ Object
- #leftGearDown ⇒ Object
- #leftGearUp ⇒ Object
- #rightBrakePressure ⇒ Object
- #rightControlLeft ⇒ Object
- #rightControlRight ⇒ Object
- #rightControlUp ⇒ Object
- #rightGearDown ⇒ Object
- #rightGearUp ⇒ Object
- #seated ⇒ Object
Constructor Details
#initialize(bytes) ⇒ Event
Returns a new instance of Event.
6 7 8 9 |
# File 'lib/trixter/event.rb', line 6 def initialize(bytes) @bytes = bytes @time = Time.now.to_f end |
Instance Attribute Details
#time ⇒ Object (readonly)
Returns the value of attribute time.
4 5 6 |
# File 'lib/trixter/event.rb', line 4 def time @time end |
Instance Method Details
#crankPosition ⇒ Object
11 12 13 |
# File 'lib/trixter/event.rb', line 11 def crankPosition return @bytes[6..7] end |
#flywheelRotationTime ⇒ Object
71 72 73 |
# File 'lib/trixter/event.rb', line 71 def flywheelRotationTime return @bytes[24..27] end |
#leftBrakePressure ⇒ Object
19 20 21 |
# File 'lib/trixter/event.rb', line 19 def leftBrakePressure return @bytes[10..11] end |
#leftControlDown ⇒ Object
39 40 41 |
# File 'lib/trixter/event.rb', line 39 def leftControlDown return @bytes[17] == 'b' end |
#leftControlLeft ⇒ Object
31 32 33 |
# File 'lib/trixter/event.rb', line 31 def leftControlLeft return @bytes[16] == 'e' end |
#leftControlRight ⇒ Object
35 36 37 |
# File 'lib/trixter/event.rb', line 35 def leftControlRight return @bytes[16] == 'b' end |
#leftControlUp ⇒ Object
43 44 45 |
# File 'lib/trixter/event.rb', line 43 def leftControlUp return @bytes[17] == 'e' end |
#leftGearDown ⇒ Object
27 28 29 |
# File 'lib/trixter/event.rb', line 27 def leftGearDown return @bytes[18] == '7' end |
#leftGearUp ⇒ Object
23 24 25 |
# File 'lib/trixter/event.rb', line 23 def leftGearUp return @bytes[16] == '7' end |
#rightBrakePressure ⇒ Object
15 16 17 |
# File 'lib/trixter/event.rb', line 15 def rightBrakePressure return @bytes[8..9] end |
#rightControlLeft ⇒ Object
47 48 49 |
# File 'lib/trixter/event.rb', line 47 def rightControlLeft return @bytes[17] == 'd' end |
#rightControlRight ⇒ Object
51 52 53 |
# File 'lib/trixter/event.rb', line 51 def rightControlRight return @bytes[17] == '7' end |
#rightControlUp ⇒ Object
55 56 57 |
# File 'lib/trixter/event.rb', line 55 def rightControlUp return @bytes[16] == 'd' end |
#rightGearDown ⇒ Object
63 64 65 |
# File 'lib/trixter/event.rb', line 63 def rightGearDown return @bytes[18] == 'b' end |
#rightGearUp ⇒ Object
59 60 61 |
# File 'lib/trixter/event.rb', line 59 def rightGearUp return @bytes[18] == 'd' end |
#seated ⇒ Object
67 68 69 |
# File 'lib/trixter/event.rb', line 67 def seated return @bytes[19] == '7' end |