Class: RubyHid::Device::Event

Inherits:
Struct
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#codeObject

Returns the value of attribute code

Returns:

  • (Object)

    the current value of code



55
56
57
# File 'lib/ruby_hid/device.rb', line 55

def code
  @code
end

#tv_secObject

Returns the value of attribute tv_sec

Returns:

  • (Object)

    the current value of tv_sec



55
56
57
# File 'lib/ruby_hid/device.rb', line 55

def tv_sec
  @tv_sec
end

#tv_usecObject

Returns the value of attribute tv_usec

Returns:

  • (Object)

    the current value of tv_usec



55
56
57
# File 'lib/ruby_hid/device.rb', line 55

def tv_usec
  @tv_usec
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



55
56
57
# File 'lib/ruby_hid/device.rb', line 55

def type
  @type
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



55
56
57
# File 'lib/ruby_hid/device.rb', line 55

def value
  @value
end

Instance Method Details

#timeObject



60
61
62
# File 'lib/ruby_hid/device.rb', line 60

def time;
  Time.at(tv_sec)
end

#to_sObject



64
65
66
67
68
69
# File 'lib/ruby_hid/device.rb', line 64

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