Class: XBee::Frames::ReceivePacket
- Defined in:
- lib/xbee/frames/receive_packet.rb
Overview
When a device configured with a standard API Rx Indicator (AO = 0) receives an RF data packet, it sends it out the serial interface using this message type.
Constant Summary collapse
- OPTION_BITS =
{ 0x01 => 'Acknowledged', 0x02 => 'Broadcast packet', 0x20 => 'Encrypted with APS encryption', 0x40 => 'End device', }.freeze
Instance Attribute Summary collapse
-
#address16 ⇒ Object
Returns the value of attribute address16.
-
#address64 ⇒ Object
Returns the value of attribute address64.
-
#data ⇒ Object
Returns the value of attribute data.
-
#options ⇒ Object
Returns the value of attribute options.
Attributes inherited from Frame
Instance Method Summary collapse
- #bytes ⇒ Object
-
#initialize(packet: nil) ⇒ ReceivePacket
constructor
A new instance of ReceivePacket.
Methods inherited from Frame
api_id, from_packet, #to_packet
Constructor Details
#initialize(packet: nil) ⇒ ReceivePacket
Returns a new instance of ReceivePacket.
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/xbee/frames/receive_packet.rb', line 26 def initialize(packet: nil) super if @parse_bytes @address64 = Address64.new *@parse_bytes.shift(8) @address16 = Address16.new *@parse_bytes.shift(2) @options = @parse_bytes.shift @data = @parse_bytes @parse_bytes = [] end end |
Instance Attribute Details
#address16 ⇒ Object
Returns the value of attribute address16.
21 22 23 |
# File 'lib/xbee/frames/receive_packet.rb', line 21 def address16 @address16 end |
#address64 ⇒ Object
Returns the value of attribute address64.
20 21 22 |
# File 'lib/xbee/frames/receive_packet.rb', line 20 def address64 @address64 end |
#data ⇒ Object
Returns the value of attribute data.
23 24 25 |
# File 'lib/xbee/frames/receive_packet.rb', line 23 def data @data end |
#options ⇒ Object
Returns the value of attribute options.
22 23 24 |
# File 'lib/xbee/frames/receive_packet.rb', line 22 def @options end |
Instance Method Details
#bytes ⇒ Object
39 40 41 |
# File 'lib/xbee/frames/receive_packet.rb', line 39 def bytes super + (address64 || Address64.from_array([0] * 8)).to_a + (address16 || Address16.new(0, 0)).to_a + [ || 0x00] + (data || []) end |