Class: RubyHid::Device::Event
- Inherits:
-
Struct
- Object
- Struct
- RubyHid::Device::Event
- Defined in:
- lib/ruby_hid/device.rb,
lib/ruby_hid/device.rb
Overview
open Event class and add some convenience methods
Holds the un-packed data parsed from the raw input from the buzz controller.
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#tv_sec ⇒ Object
Returns the value of attribute tv_sec.
-
#tv_usec ⇒ Object
Returns the value of attribute tv_usec.
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code
60 61 62 |
# File 'lib/ruby_hid/device.rb', line 60 def code @code end |
#tv_sec ⇒ Object
Returns the value of attribute tv_sec
60 61 62 |
# File 'lib/ruby_hid/device.rb', line 60 def tv_sec @tv_sec end |
#tv_usec ⇒ Object
Returns the value of attribute tv_usec
60 61 62 |
# File 'lib/ruby_hid/device.rb', line 60 def tv_usec @tv_usec end |
#type ⇒ Object
Returns the value of attribute type
60 61 62 |
# File 'lib/ruby_hid/device.rb', line 60 def type @type end |
#value ⇒ Object
Returns the value of attribute value
60 61 62 |
# File 'lib/ruby_hid/device.rb', line 60 def value @value end |
Instance Method Details
#time ⇒ Object
65 66 67 |
# File 'lib/ruby_hid/device.rb', line 65 def time; Time.at(tv_sec) end |
#to_s ⇒ Object
69 70 71 72 73 74 |
# File 'lib/ruby_hid/device.rb', line 69 def to_s type_s = type.to_s code_s = code.to_s value_s = value.to_s "#{time.iso8601} type: #{type_s} code: #{code_s} value: #{value_s}" end |