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
addressisNone.ValueError – if
addressisNoneor 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
addresshas less than 1 character.ValueError – if
addresscontains 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
lsbis less than 0 or greater than 255.ValueError – if
hsbis 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) – String: String containing the address. Must be made by hex. digits without blanks. Minimum 1 character, maximum 4 (16-bit). Bytearray: Address as byte array. Must be 1-2 digits.
- Returns
Truefor a valid 16-bit address,Falseotherwise.- 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¶ Bytearray. Bytearray representation of this XBee16BitAddress.
-
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.
- Raise:
ValueError: if
addressisNoneor 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 or Bytearray) – The XBee 64-bit address as a string or bytearray.
- Returns
Truefor a valid 64-bit address,Falseotherwise.- Return type
Boolean
-
property
address¶ Bytearray. Bytearray representation of this XBee64BitAddress.
-
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
addressisNone.ValueError – if length of
addressgreater 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
addressisNone.ValueError – if
addressdoes 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
Truefor a valid IMEI,Falseotherwise.- Return type
Boolean
-
property
address¶ String. String representation of this XBeeIMEIAddress.