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



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

def code
  @code
end

#tv_secObject

Returns the value of attribute tv_sec

Returns:

  • (Object)

    the current value of tv_sec



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

def tv_sec
  @tv_sec
end

#tv_usecObject

Returns the value of attribute tv_usec

Returns:

  • (Object)

    the current value of tv_usec



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

def tv_usec
  @tv_usec
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



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

def type
  @type
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



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

def value
  @value
end

Instance Method Details

#timeObject



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

def time;
  Time.at(tv_sec)
end

#to_sObject



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