Class: XBee::Frames::DataSampleRXIndicator
- Defined in:
- lib/xbee/frames/data_sample_rx_indicator.rb
Constant Summary collapse
- OPTION_BITS =
{ 0x01 => :acknowledged, 0x02 => :broadcast, }.freeze
Instance Attribute Summary collapse
-
#address16 ⇒ Object
readonly
Returns the value of attribute address16.
-
#address64 ⇒ Object
readonly
Returns the value of attribute address64.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#samples ⇒ Object
readonly
- Array<Data::DataSample>
-
Array of sample objects.
Attributes inherited from Frame
Instance Method Summary collapse
- #bytes ⇒ Object
-
#initialize(packet: nil) ⇒ DataSampleRXIndicator
constructor
A new instance of DataSampleRXIndicator.
Methods inherited from Frame
api_id, from_packet, #to_packet
Constructor Details
#initialize(packet: nil) ⇒ DataSampleRXIndicator
Returns a new instance of DataSampleRXIndicator.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/xbee/frames/data_sample_rx_indicator.rb', line 24 def initialize(packet: nil) @samples = [] super if @parse_bytes @address64 = Address64.new *@parse_bytes.shift(8) @address16 = Address16.new *@parse_bytes.shift(2) = @parse_bytes.shift @number_of_samples = @parse_bytes.shift @number_of_samples.times do @samples << Data::Sample.new(parse_bytes: @parse_bytes) end end end |
Instance Attribute Details
#address16 ⇒ Object (readonly)
Returns the value of attribute address16.
10 11 12 |
# File 'lib/xbee/frames/data_sample_rx_indicator.rb', line 10 def address16 @address16 end |
#address64 ⇒ Object (readonly)
Returns the value of attribute address64.
11 12 13 |
# File 'lib/xbee/frames/data_sample_rx_indicator.rb', line 11 def address64 @address64 end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
12 13 14 |
# File 'lib/xbee/frames/data_sample_rx_indicator.rb', line 12 def end |
#samples ⇒ Object (readonly)
- Array<Data::DataSample>
-
Array of sample objects
15 16 17 |
# File 'lib/xbee/frames/data_sample_rx_indicator.rb', line 15 def samples @samples end |
Instance Method Details
#bytes ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/xbee/frames/data_sample_rx_indicator.rb', line 41 def bytes super + (address64 || Address64::COORDINATOR).to_a + (address16 || Address16::COORDINATOR).to_a + [ || 0x00] + [(samples || []).length] + samples.map(&:to_a).reduce(:+) end |