digi.xbee.models.address module
- class digi.xbee.models.address.XBee16BitAddress(address)[source]
Bases:
objectThis class represent a 16-bit network address.
This address is only applicable for:
802.15.4
Zigbee
ZNet 2.5
XTend (Legacy)
DigiMesh and Point-to-multipoint does not support 16-bit addressing.
Each device has its own 16-bit address which is unique in the network. It is automatically assigned when the radio joins the network for Zigbee and Znet 2.5, and manually configured in 802.15.4 radios.
Attributes:COORDINATOR_ADDRESS (XBee16BitAddress): 16-bit address reserved for the coordinator.BROADCAST_ADDRESS (XBee16BitAddress): 16-bit broadcast address.UNKNOWN_ADDRESS (XBee16BitAddress): 16-bit unknown address.PATTERN (String): Pattern for the 16-bit address string: (0[xX])?[0-9a-fA-F]{1,4}Class constructor. Instantiates a new
XBee16BitAddressobject with the provided parameters.- Parameters:
address (Bytearray) – address as byte array. Must be 1-2 digits.
- Raises:
TypeError – if address is None.
ValueError – if address is None or has less than 1 byte or more than 2.
- PATTERN = '^(0[xX])?[0-9a-fA-F]{1,4}$'
16-bit address string pattern.
- COORDINATOR_ADDRESS = <digi.xbee.models.address.XBee16BitAddress object>
0000).
- Type:
16-bit address reserved for the coordinator (value
- BROADCAST_ADDRESS = <digi.xbee.models.address.XBee16BitAddress object>
FFFF).
- Type:
16-bit broadcast address (value
- UNKNOWN_ADDRESS = <digi.xbee.models.address.XBee16BitAddress object>
FFFE).
- Type:
16-bit unknown address (value
- classmethod from_hex_string(address)[source]
Class constructor. Instantiates a new :.XBee16BitAddress object from the provided hex string.
- Parameters:
address (String) – String containing the address. Must be made by hex. digits without blanks. Minimum 1 character, maximum 4 (16-bit).
- Raises:
ValueError – if address has less than 1 character.
ValueError – if address contains non-hexadecimal characters.
- classmethod from_bytes(hsb, lsb)[source]
Class constructor. Instantiates a new :.XBee16BitAddress object from the provided high significant byte and low significant byte.
- Parameters:
hsb (Integer) – high significant byte of the address.
lsb (Integer) – low significant byte of the address.
- Raises:
ValueError – if lsb is less than 0 or greater than 255.
ValueError – if hsb is less than 0 or greater than 255.
- classmethod is_valid(address)[source]
Checks if the provided hex string is a valid 16-bit address.
- Parameters:
address (String or Bytearray, or
XBee16BitAddress) – String: String with the address only with hex digits without blanks. Minimum 1 character, maximum 4 (16-bit). Bytearray: Address as byte array. Must be 1-2 digits.- Returns:
True for a valid 16-bit address, False otherwise.
- Return type:
Boolean
- classmethod is_known_node_addr(address)[source]
Checks if a provided address is a known value. That is, if it is a valid 16-bit address and it is not the unknown or the broadcast address.
- Parameters:
address (String, Bytearray, or
XBee16BitAddress) – The 16-bit address to check as a string, bytearray orXBee16BitAddress.- Returns:
True for a known node 16-bit address, False otherwise.
- Return type:
Boolean
- get_hsb()[source]
Returns the high part of the bytearray (component 0).
- Returns:
high part of the bytearray.
- Return type:
Integer
- get_lsb()[source]
Returns the low part of the bytearray (component 1).
- Returns:
low part of the bytearray.
- Return type:
Integer
- property address
Returns a bytearray representation of this XBee16BitAddress.
- Returns:
bytearray representation of this XBee16BitAddress.
- Return type:
Bytearray
- class digi.xbee.models.address.XBee64BitAddress(address)[source]
Bases:
objectThis class represents a 64-bit address (also known as MAC address).
The 64-bit address is a unique device address assigned during manufacturing. This address is unique to each physical device.
Class constructor. Instantiates a new
XBee64BitAddressobject with the provided parameters.- Parameters:
address (Bytearray) – the XBee 64-bit address as byte array.
- Raises:
ValueError – if address is None or its length less than 1 or greater than 8.
- PATTERN = '^(0[xX])?[0-9a-fA-F]{1,16}$'
64-bit address string pattern.
- COORDINATOR_ADDRESS = <digi.xbee.models.address.XBee64BitAddress object>
0000000000000000).
- Type:
64-bit address reserved for the coordinator (value
- BROADCAST_ADDRESS = <digi.xbee.models.address.XBee64BitAddress object>
000000000000FFFF).
- Type:
64-bit broadcast address (value
- UNKNOWN_ADDRESS = <digi.xbee.models.address.XBee64BitAddress object>
FFFFFFFFFFFFFFFF).
- Type:
64-bit unknown address (value
- classmethod from_hex_string(address)[source]
Class constructor. Instantiates a new
XBee64BitAddressobject from the provided hex string.- Parameters:
address (String) – The XBee 64-bit address as a string.
- Raises:
ValueError – if the address’ length is less than 1 or does not match with the pattern: (0[xX])?[0-9a-fA-F]{1,16}.
- classmethod from_bytes(*args)[source]
Class constructor. Instantiates a new
XBee64BitAddressobject from the provided bytes.- Parameters:
args (8 Integers) – 8 integers that represent the bytes 1 to 8 of this XBee64BitAddress.
- Raises:
ValueError – if the amount of arguments is not 8 or if any of the arguments is not between 0 and 255.
- classmethod is_valid(address)[source]
Checks if the provided hex string is a valid 64-bit address.
- Parameters:
address (String, Bytearray, or
XBee64BitAddress) – String: String with the address only with hex digits without blanks. Minimum 1 character, maximum 16 (64-bit). Bytearray: Address as byte array. Must be 1-8 digits.
- Returns
Boolean: True for a valid 64-bit address, False otherwise.
- classmethod is_known_node_addr(address)[source]
Checks if a provided address is a known value. That is, if it is a valid 64-bit address and it is not the unknown or the broadcast address.
- Parameters:
address (String, Bytearray, or
XBee64BitAddress) – The 64-bit address to check as a string, bytearray orXBee64BitAddress.- Returns:
True for a known node 64-bit address, False otherwise.
- Return type:
Boolean
- property address
Returns a bytearray representation of this XBee64BitAddress.
- Returns:
bytearray representation of this XBee64BitAddress.
- Return type:
Bytearray
- class digi.xbee.models.address.XBeeIMEIAddress(address)[source]
Bases:
objectThis class represents an IMEI address used by cellular devices.
This address is only applicable for Cellular protocol.
Class constructor. Instantiates a new :.XBeeIMEIAddress object with the provided parameters.
- Parameters:
address (Bytearray) – The XBee IMEI address as byte array.
- Raises:
ValueError – if address is None.
ValueError – if length of address greater than 8.
- PATTERN = '^\\d{0,15}$'
IMEI address string pattern.
- classmethod from_string(address)[source]
Class constructor. Instantiates a new :.XBeeIMEIAddress object from the provided string.
- Parameters:
address (String) – The XBee IMEI address as a string.
- Raises:
ValueError – if address is None.
ValueError – if address does not match the pattern: ^d{0,15}$.
- classmethod is_valid(address)[source]
Checks if the provided hex string is a valid IMEI.
- Parameters:
address (String or Bytearray) – The XBee IMEI address as a string or bytearray.
- Returns:
True for a valid IMEI, False otherwise.
- Return type:
Boolean
- property address
Returns a string representation of this XBeeIMEIAddress.
- Returns:
the IMEI address in string format.
- Return type:
String
- class digi.xbee.models.address.XBeeBLEAddress(address)[source]
Bases:
objectThis class represents a 48-bit address (also known as MAC address).
The 48-bit address is a unique device address assigned during manufacturing. This address is unique to each physical device.
Class constructor. Instantiates a new
XBeeBLEAddressobject with the provided parameters.- Parameters:
address (Bytearray) – the XBee BLE 48-bit address as byte array.
- Raises:
ValueError – if address is None or its length less than 1
or greater than 6. –
- PATTERN = '^(0[xX])?[0-9a-fA-F]{1,12}$'
48-bit address string pattern.
- classmethod from_hex_string(address)[source]
Class constructor. Instantiates a new
XBeeBLEAddressobject from the provided hex string.- Parameters:
address (String) – The XBee BLE 48-bit address as a string.
- Raises:
ValueError – if the address’ length is less than 1 or does not match with the pattern: (0[xX])?[0-9a-fA-F]{1,12}.
- classmethod from_bytes(*args)[source]
Class constructor. Instantiates a new
XBeeBLEAddressobject from the provided bytes.- Parameters:
args (6 Integers) – 6 integers that represent the bytes 1 to 6 of this XBeeBLEAddress.
- Raises:
ValueError – if the amount of arguments is not 6 or if any of the arguments is not between 0 and 255.
- classmethod is_valid(address)[source]
Checks if the provided hex string is a valid BLE 48-bit address.
- Parameters:
address (String, Bytearray, or
XBeeBLEAddress) – String: String with the address only with hex digits without blanks. Minimum 1 character, maximum 12 (48-bit). Bytearray: Address as byte array. Must be 1-6 digits.
- Returns
Boolean: True for a valid BLE 48-bit address, False otherwise.
- property address
Returns a bytearray representation of this XBeeBLEAddress.
- Returns:
bytearray representation of this XBeeBLEAddress.
- Return type:
Bytearray