Class: RubyBuzz::Device::Event

Inherits:
Struct
  • Object
show all
Defined in:
lib/ruby_buzz/device.rb,
lib/ruby_buzz/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



26
27
28
# File 'lib/ruby_buzz/device.rb', line 26

def code
  @code
end

#tv_secObject

Returns the value of attribute tv_sec

Returns:

  • (Object)

    the current value of tv_sec



26
27
28
# File 'lib/ruby_buzz/device.rb', line 26

def tv_sec
  @tv_sec
end

#tv_usecObject

Returns the value of attribute tv_usec

Returns:

  • (Object)

    the current value of tv_usec



26
27
28
# File 'lib/ruby_buzz/device.rb', line 26

def tv_usec
  @tv_usec
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



26
27
28
# File 'lib/ruby_buzz/device.rb', line 26

def type
  @type
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



26
27
28
# File 'lib/ruby_buzz/device.rb', line 26

def value
  @value
end

Instance Method Details

#timeObject



31
32
33
# File 'lib/ruby_buzz/device.rb', line 31

def time;
  Time.at(tv_sec)
end

#to_sObject



35
36
37
38
39
40
# File 'lib/ruby_buzz/device.rb', line 35

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