Class: XBee::Frame::ATCommand
- Defined in:
- lib/apimode/frame/at_command.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#at_command ⇒ Object
Returns the value of attribute at_command.
-
#parameter_pack_string ⇒ Object
Returns the value of attribute parameter_pack_string.
-
#parameter_value ⇒ Object
Returns the value of attribute parameter_value.
Attributes inherited from Base
Instance Method Summary collapse
- #api_identifier ⇒ Object
- #cmd_data ⇒ Object
- #cmd_data=(data_string) ⇒ Object
-
#initialize(at_command, frame_id = nil, parameter_value = nil, parameter_pack_string = "a*") {|_self| ... } ⇒ ATCommand
constructor
A new instance of ATCommand.
Methods inherited from Base
Constructor Details
#initialize(at_command, frame_id = nil, parameter_value = nil, parameter_pack_string = "a*") {|_self| ... } ⇒ ATCommand
Returns a new instance of ATCommand.
8 9 10 11 12 13 14 |
# File 'lib/apimode/frame/at_command.rb', line 8 def initialize(at_command, frame_id = nil, parameter_value = nil, parameter_pack_string = "a*") self.frame_id = frame_id self.at_command = at_command # TODO: Check for valid AT command codes here self.parameter_value = parameter_value self.parameter_pack_string = parameter_pack_string yield self if block_given? end |
Instance Attribute Details
#at_command ⇒ Object
Returns the value of attribute at_command.
6 7 8 |
# File 'lib/apimode/frame/at_command.rb', line 6 def at_command @at_command end |
#parameter_pack_string ⇒ Object
Returns the value of attribute parameter_pack_string.
6 7 8 |
# File 'lib/apimode/frame/at_command.rb', line 6 def parameter_pack_string @parameter_pack_string end |
#parameter_value ⇒ Object
Returns the value of attribute parameter_value.
6 7 8 |
# File 'lib/apimode/frame/at_command.rb', line 6 def parameter_value @parameter_value end |
Instance Method Details
#api_identifier ⇒ Object
4 |
# File 'lib/apimode/frame/at_command.rb', line 4 def api_identifier ; 0x08 ; end |
#cmd_data ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/apimode/frame/at_command.rb', line 20 def cmd_data if parameter_value.nil? [frame_id, at_command].pack("ca2") else [frame_id, at_command, parameter_value].pack("ca2#{parameter_pack_string}") end end |
#cmd_data=(data_string) ⇒ Object
16 17 18 |
# File 'lib/apimode/frame/at_command.rb', line 16 def cmd_data=(data_string) self.frame_id, self.at_command, self.parameter_value = data_string.unpack("ca2#{parameter_pack_string}") end |