Class: LIRC::Messages::ButtonPress
- Inherits:
-
Struct
- Object
- Struct
- LIRC::Messages::ButtonPress
- Defined in:
- lib/lirc/messages.rb
Overview
code is the hex code sent by the remote button is the name of the button (if found in lircd.conf) remote is the name of the remote (if found)
Instance Attribute Summary collapse
-
#button ⇒ Object
Returns the value of attribute button.
-
#code ⇒ Object
Returns the value of attribute code.
-
#remote ⇒ Object
Returns the value of attribute remote.
-
#repeat_count ⇒ Object
Returns the value of attribute repeat_count.
Class Method Summary collapse
Instance Attribute Details
#button ⇒ Object
Returns the value of attribute button
27 28 29 |
# File 'lib/lirc/messages.rb', line 27 def @button end |
#code ⇒ Object
Returns the value of attribute code
27 28 29 |
# File 'lib/lirc/messages.rb', line 27 def code @code end |
#remote ⇒ Object
Returns the value of attribute remote
27 28 29 |
# File 'lib/lirc/messages.rb', line 27 def remote @remote end |
#repeat_count ⇒ Object
Returns the value of attribute repeat_count
27 28 29 |
# File 'lib/lirc/messages.rb', line 27 def repeat_count @repeat_count end |
Class Method Details
.parse(line) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/lirc/messages.rb', line 28 def self.parse(line) bits = line.split(" ") if bits[0] =~ /[^0-9a-fA-F]/ || bits[1] =~ /[^0-9]/ raise ParseError, "invalid button press message '#{line}'" end # convert hex chars to an integer bits[0] = bits[0].to_i(16) bits[1] = bits[1].to_i new(*bits) end |