Class: XBee::Frames::ExplicitAddressingCommand

Inherits:
AddressedFrame show all
Defined in:
lib/xbee/frames/explicit_addressing_command.rb

Overview

This frame is similar to Transmit Request (0x10), but it also requires you to specify the application- layer addressing fields: endpoints, cluster ID, and profile ID.

This frame causes the device to send payload data as an RF packet to a specific destination, using specific source and destination endpoints, cluster ID, and profile ID.

  • For broadcast transmissions, set the 64-bit destination address to 0x000000000000FFFF . Address the coordinator by either setting the 64-bit address to all 0x00s and the 16-bit address to 0xFFFE, or setting the 64-bit address to the coordinator’s 64-bit address and the 16-bit address to 0x0000.

  • For all other transmissions, setting the 16-bit address to the correct 16-bit address helps improve performance when transmitting to multiple destinations. If you do not know a 16-bit address, set this field to 0xFFFE (unknown). If successful, the Transmit Status frame (0x8B) indicates the discovered 16-bit address.

You can set the broadcast radius from 0 up to NH to 0xFF. If set to 0, the value of NH specifies the broadcast radius (recommended). This parameter is only used for broadcast transmissions.

You can read the maximum number of payload bytes with the NP command.

Constant Summary collapse

OPTIONS =
{
	0x01 => :disable_retries,
	0x08 => :multicast_addressing,
	0x20 => :enable_aps_encryption,
	0x40 => :extended_transmission_timeout,
}.freeze

Instance Attribute Summary collapse

Attributes inherited from AddressedFrame

#address16, #address64

Attributes inherited from IdentifiedFrame

#id

Attributes inherited from Frame

#packet

Instance Method Summary collapse

Methods inherited from Frame

api_id, from_packet, #to_packet

Constructor Details

#initialize(packet: nil) ⇒ ExplicitAddressingCommand

Returns a new instance of ExplicitAddressingCommand.



47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/xbee/frames/explicit_addressing_command.rb', line 47

def initialize(packet: nil)
	super

	if @parse_bytes
		@source_endpoint = @parse_bytes.shift
		@destination_endpoint = @parse_bytes.shift
		@cluster_id = @parse_bytes.shift 2
		@profile_id = @parse_bytes.shift 2
		@broadcast_radius = @parse_bytes.shift
		@transmission_options = @parse_bytes.shift
		@data = @parse_bytes
		@parse_bytes = []
	end
end

Instance Attribute Details

#broadcast_radiusObject

Returns the value of attribute broadcast_radius.



33
34
35
# File 'lib/xbee/frames/explicit_addressing_command.rb', line 33

def broadcast_radius
  @broadcast_radius
end

#cluster_idObject

2 bytes



31
32
33
# File 'lib/xbee/frames/explicit_addressing_command.rb', line 31

def cluster_id
  @cluster_id
end

#dataObject

Returns the value of attribute data.



35
36
37
# File 'lib/xbee/frames/explicit_addressing_command.rb', line 35

def data
  @data
end

#destination_endpointObject

Returns the value of attribute destination_endpoint.



30
31
32
# File 'lib/xbee/frames/explicit_addressing_command.rb', line 30

def destination_endpoint
  @destination_endpoint
end

#profile_idObject

2 bytes



32
33
34
# File 'lib/xbee/frames/explicit_addressing_command.rb', line 32

def profile_id
  @profile_id
end

#source_endpointObject

Returns the value of attribute source_endpoint.



29
30
31
# File 'lib/xbee/frames/explicit_addressing_command.rb', line 29

def source_endpoint
  @source_endpoint
end

#transmission_optionsObject

Returns the value of attribute transmission_options.



34
35
36
# File 'lib/xbee/frames/explicit_addressing_command.rb', line 34

def transmission_options
  @transmission_options
end

Instance Method Details

#bytesObject



63
64
65
# File 'lib/xbee/frames/explicit_addressing_command.rb', line 63

def bytes
	super + [options || 0x00] + (data || [])
end