class XBee::Frames::XBeeSensorReadIndicator
When the device receives a sensor sample (from a Digi 1-wire sensor adapter), it is sent out the serial port using this message type (when AO=0).
Attributes
address16[RW]
address64[RW]
analog_values[RW]
one_wire_sensors[RW]
options[RW]
temperature[RW]
Public Class Methods
new(packet: nil)
click to toggle source
Calls superclass method
XBee::Frames::Frame::new
# File lib/xbee/frames/xbee_sensor_read_indicator.rb, line 20 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 @one_wire_sensors = @parse_bytes.shift @analog_values = [ Bytes.unsigned_int_from_array(@parse_bytes.shift(2)), Bytes.unsigned_int_from_array(@parse_bytes.shift(2)), Bytes.unsigned_int_from_array(@parse_bytes.shift(2)), Bytes.unsigned_int_from_array(@parse_bytes.shift(2)), ] @temperature = Bytes.unsigned_int_from_array(@parse_bytes.shift(2)) end end
Public Instance Methods
bytes()
click to toggle source
Calls superclass method
XBee::Frames::Frame#bytes
# File lib/xbee/frames/xbee_sensor_read_indicator.rb, line 39 def bytes super + (address64 || Address64::COORDINATOR).to_a + (address16 || Address16::COORDINATOR).to_a + [options || 0x00] + [one_wire_sensors || 0x00] + ((analog_values || [0xffff] * 4).map { |v| Bytes.array_from_unsigned_int(v, 2) }.reduce(:+))+ Bytes.array_from_unsigned_int(temperature || 0x0, 2) end