Class: Event

Inherits:
Object
  • Object
show all
Defined in:
lib/trixter/event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#timeObject (readonly)

Returns the value of attribute time.



4
5
6
# File 'lib/trixter/event.rb', line 4

def time
  @time
end

Instance Method Details

#crankPositionObject



11
12
13
# File 'lib/trixter/event.rb', line 11

def crankPosition
  return @bytes[6..7]
end

#flywheelRotationTimeObject



71
72
73
# File 'lib/trixter/event.rb', line 71

def flywheelRotationTime
  return @bytes[24..27]
end

#leftBrakePressureObject



19
20
21
# File 'lib/trixter/event.rb', line 19

def leftBrakePressure
  return @bytes[10..11]
end

#leftControlDownObject



39
40
41
# File 'lib/trixter/event.rb', line 39

def leftControlDown
  return @bytes[17] == 'b'
end

#leftControlLeftObject



31
32
33
# File 'lib/trixter/event.rb', line 31

def leftControlLeft
  return @bytes[16] == 'e'
end

#leftControlRightObject



35
36
37
# File 'lib/trixter/event.rb', line 35

def leftControlRight
  return @bytes[16] == 'b'
end

#leftControlUpObject



43
44
45
# File 'lib/trixter/event.rb', line 43

def leftControlUp
  return @bytes[17] == 'e'
end

#leftGearDownObject



27
28
29
# File 'lib/trixter/event.rb', line 27

def leftGearDown
  return @bytes[18] == '7'
end

#leftGearUpObject



23
24
25
# File 'lib/trixter/event.rb', line 23

def leftGearUp
  return @bytes[16] == '7'
end

#rightBrakePressureObject



15
16
17
# File 'lib/trixter/event.rb', line 15

def rightBrakePressure
  return @bytes[8..9]
end

#rightControlLeftObject



47
48
49
# File 'lib/trixter/event.rb', line 47

def rightControlLeft
  return @bytes[17] == 'd'
end

#rightControlRightObject



51
52
53
# File 'lib/trixter/event.rb', line 51

def rightControlRight
  return @bytes[17] == '7'
end

#rightControlUpObject



55
56
57
# File 'lib/trixter/event.rb', line 55

def rightControlUp
  return @bytes[16] == 'd'
end

#rightGearDownObject



63
64
65
# File 'lib/trixter/event.rb', line 63

def rightGearDown
  return @bytes[18] == 'b'
end

#rightGearUpObject



59
60
61
# File 'lib/trixter/event.rb', line 59

def rightGearUp
  return @bytes[18] == 'd'
end

#seatedObject



67
68
69
# File 'lib/trixter/event.rb', line 67

def seated
  return @bytes[19] == '7'
end