class XBee::Frame::ExplicitAddressingCommand

Explicit Addressing ZigBee Command Frame (0x11)

This frame allows ZigBee Application Layer fields to be specified for a data transmission. This frame is similar to Zigbee Transmit Request (0x10) but requires the ZigBee application layer addressing fields to be set.

This frame is also used for triggering Programmable XBee (S2B) module Over-the-Air firmware upgrade process.

Attributes

broadcast_radius[RW]
cluster_id[RW]
destination_address[RW]
destination_endpoint[RW]
destination_network[RW]
payload[RW]
payload_pack_string[RW]
profile_id[RW]
source_endpoint[RW]
transmit_options[RW]

Public Class Methods

new(frame_id = nil, destination_address = 0x000000000000ffff, destination_network = 0x0000fffe, source_endpoint = nil, destination_endpoint = nil, cluster_id = nil, profile_id = nil, broadcast_radius = 0x00, transmit_options = 0x00, payload = nil, payload_pack_string = "a*") click to toggle source
# File lib/apimode/frame/explicit_addressing_command.rb, line 18
def initialize(frame_id = nil, destination_address = 0x000000000000ffff, destination_network = 0x0000fffe, source_endpoint = nil, destination_endpoint = nil, cluster_id = nil, profile_id = nil, broadcast_radius = 0x00, transmit_options = 0x00, payload = nil, payload_pack_string = "a*")
  self.frame_id = frame_id
  self.destination_address = destination_address
  self.destination_network = destination_network
  self.source_endpoint = source_endpoint
  self.destination_endpoint = destination_endpoint
  self.cluster_id = cluster_id
  self.profile_id = profile_id
  self.broadcast_radius = broadcast_radius
  self.transmit_options = transmit_options
  self.payload = payload
  self.payload_pack_string = payload_pack_string
end

Public Instance Methods

api_identifier() click to toggle source
# File lib/apimode/frame/explicit_addressing_command.rb, line 14
def  api_identifier ; 0x11 ; end
cmd_data() click to toggle source
# File lib/apimode/frame/explicit_addressing_command.rb, line 39
def cmd_data
  # We need to pack the 64-bit destination_address in two 32-bit parts.
  dest_high = (self.destination_address >> 32) & 0xFFFFFFFF
  dest_low = self.destination_address & 0xFFFFFFFF
  if payload.nil?
    # By default we send a null-byte payload \0
    [self.frame_id, dest_high, dest_low, self.destination_network, self.source_endpoint, self.destination_endpoint, self.cluster_id, self.profile_id, self.broadcast_radius, self.transmit_options, self.payload].pack("CNNnCCnnCCx")
  else
    [self.frame_id, dest_high, dest_low, self.destination_network, self.source_endpoint, self.destination_endpoint, self.cluster_id, self.profile_id, self.broadcast_radius, self.transmit_options, self.payload].pack("CNNnCCnnCC#{payload_pack_string}")
  end
end
cmd_data=(data_string) click to toggle source
# File lib/apimode/frame/explicit_addressing_command.rb, line 32
def cmd_data=(data_string)
  # We need to read in the 64-bit destination_address in two 32-bit parts.
  dest_high = dest_low = 0
  self.frame_id, dest_high, dest_low, self.destination_network, self.source_endpoint, self.destination_endpoint, self.cluster_id, self.profile_id, self.broadcast_radius, self.transmit_options, self.payload = data_string.unpack("CNNnCCnnCC#{payload_pack_string}")
  self.destination_address = dest_high << 32 | dest_low
end