Class: XBee::Frame::ATCommandResponse
- Inherits:
-
ReceivedFrame
- Object
- Base
- ReceivedFrame
- XBee::Frame::ATCommandResponse
- Defined in:
- lib/apimode/frame/at_command_response.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#at_command ⇒ Object
Returns the value of attribute at_command.
-
#frame_id ⇒ Object
Returns the value of attribute frame_id.
-
#retrieved_value ⇒ Object
Returns the value of attribute retrieved_value.
-
#status ⇒ Object
Returns the value of attribute status.
Attributes inherited from Base
Instance Method Summary collapse
- #cmd_data=(data_string) ⇒ Object
- #command_statuses ⇒ Object
-
#initialize(data = nil) ⇒ ATCommandResponse
constructor
A new instance of ATCommandResponse.
Methods inherited from Base
Constructor Details
#initialize(data = nil) ⇒ ATCommandResponse
Returns a new instance of ATCommandResponse.
6 7 8 |
# File 'lib/apimode/frame/at_command_response.rb', line 6 def initialize(data = nil) super(data) && (yield self if block_given?) end |
Instance Attribute Details
#at_command ⇒ Object
Returns the value of attribute at_command.
4 5 6 |
# File 'lib/apimode/frame/at_command_response.rb', line 4 def at_command @at_command end |
#frame_id ⇒ Object
Returns the value of attribute frame_id.
4 5 6 |
# File 'lib/apimode/frame/at_command_response.rb', line 4 def frame_id @frame_id end |
#retrieved_value ⇒ Object
Returns the value of attribute retrieved_value.
4 5 6 |
# File 'lib/apimode/frame/at_command_response.rb', line 4 def retrieved_value @retrieved_value end |
#status ⇒ Object
Returns the value of attribute status.
4 5 6 |
# File 'lib/apimode/frame/at_command_response.rb', line 4 def status @status end |
Instance Method Details
#cmd_data=(data_string) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/apimode/frame/at_command_response.rb', line 14 def cmd_data=(data_string) self.frame_id, self.at_command, status_byte, self.retrieved_value = data_string.unpack("Ca2Ca*") self.status = case status_byte when 0..3 command_statuses[status_byte] else raise "AT Command Response frame appears to include an invalid status: 0x%x" % status_byte end #actually assign and move along @cmd_data = data_string #### DEBUG #### if $DEBUG then print "Retrieved Value: #{self.retrieved_value.unpack('C*').join(', ')} | " print "Retrieved Value: #{self.retrieved_value.unpack('a*')} | " end #### DEBUG #### end |
#command_statuses ⇒ Object
10 11 12 |
# File 'lib/apimode/frame/at_command_response.rb', line 10 def command_statuses [:OK, :ERROR, :Invalid_Command, :Invalid_Parameter] end |