digi.xbee.models.message module¶
-
class
digi.xbee.models.message.XBeeMessage(data, remote_device, timestamp, broadcast=False)[source]¶ Bases:
objectThis class represents a XBee message, which is formed by a
RemoteXBeeDevice(the sender) and some data (the data sent) as a bytearray.Class constructor.
- Parameters
data (Bytearray) – the data sent.
remote_device (
RemoteXBeeDevice) – the sender.broadcast (Boolean, optional, default=`False`) – flag indicating whether the message is broadcast (True) or not (False). Optional.
timestamp – instant of time when the message was received.
-
property
data¶ Returns a bytearray containing the data of the message.
- Returns
the data of the message.
- Return type
Bytearray
-
property
remote_device¶ Returns the device which has sent the message.
- Returns
the device which has sent the message.
- Return type
-
property
is_broadcast¶ Returns whether the message is broadcast or not.
- Returns
True if the message is broadcast, False otherwise.
- Return type
Boolean
-
property
timestamp¶ Returns the moment when the message was received as a time.time() function returned value.
- Returns
the returned value of using
time.time()function when the message was received.- Return type
Float
-
class
digi.xbee.models.message.ExplicitXBeeMessage(data, remote_device, timestamp, source_endpoint, dest_endpoint, cluster_id, profile_id, broadcast=False)[source]¶ Bases:
digi.xbee.models.message.XBeeMessageThis class represents an Explicit XBee message, which is formed by all parameters of a common XBee message and: Source endpoint, destination endpoint, cluster ID, profile ID.
Class constructor.
- Parameters
data (Bytearray) – the data sent.
remote_device (
RemoteXBeeDevice) – the sender device.timestamp – instant of time when the message was received.
source_endpoint (Integer) – source endpoint of the message. 1 byte.
dest_endpoint (Integer) – destination endpoint of the message. 1 byte.
cluster_id (Integer) – cluster id of the message. 2 bytes.
profile_id (Integer) – profile id of the message. 2 bytes.
broadcast (Boolean, optional, default=`False`) – flag indicating whether the message is broadcast (True) or not (False). Optional.
-
property
source_endpoint¶ Returns the source endpoint of the message.
- Returns
the source endpoint of the message. 1 byte.
- Return type
Integer
-
property
dest_endpoint¶ Returns the destination endpoint of the message.
- Returns
the destination endpoint of the message. 1 byte.
- Return type
Integer
-
property
cluster_id¶ Returns the cluster ID of the message.
- Returns
the cluster ID of the message. 2 bytes.
- Return type
Integer
-
property
profile_id¶ Returns the profile ID of the message.
- Returns
the profile ID of the message. 2 bytes.
- Return type
Integer
-
property
data¶ Returns a bytearray containing the data of the message.
- Returns
the data of the message.
- Return type
Bytearray
-
property
is_broadcast¶ Returns whether the message is broadcast or not.
- Returns
True if the message is broadcast, False otherwise.
- Return type
Boolean
-
property
remote_device¶ Returns the device which has sent the message.
- Returns
the device which has sent the message.
- Return type
-
property
timestamp¶ Returns the moment when the message was received as a time.time() function returned value.
- Returns
the returned value of using
time.time()function when the message was received.- Return type
Float
-
class
digi.xbee.models.message.IPMessage(ip_addr, source_port, dest_port, protocol, data)[source]¶ Bases:
objectThis class represents an IP message containing the IP address the message belongs to, the source and destination ports, the IP protocol, and the content (data) of the message.
Class constructor.
- Parameters
ip_addr (
ipaddress.IPv4Address) – The IP address the message comes from.source_port (Integer) – TCP or UDP source port of the transmission.
dest_port (Integer) – TCP or UDP destination port of the transmission.
protocol (
IPProtocol) – IP protocol used in the transmission.data (Bytearray) – the data sent.
- Raises
ValueError – if ip_addr is None.
ValueError – if protocol is None.
ValueError – if data is None.
ValueError – if source_port is less than 0 or greater than 65535.
ValueError – if dest_port is less than 0 or greater than 65535.
-
property
ip_addr¶ Returns the IPv4 address this message is associated to.
- Returns
The IPv4 address this message is associated to.
- Return type
ipaddress.IPv4Address
-
property
source_port¶ Returns the source port of the transmission.
- Returns
The source port of the transmission.
- Return type
Integer
-
property
dest_port¶ Returns the destination port of the transmission.
- Returns
The destination port of the transmission.
- Return type
Integer
-
property
protocol¶ Returns the protocol used in the transmission.
- Returns
The protocol used in the transmission.
- Return type
-
property
data¶ Returns a bytearray containing the data of the message.
- Returns
the data of the message.
- Return type
Bytearray
-
class
digi.xbee.models.message.SMSMessage(phone_number, data)[source]¶ Bases:
objectThis class represents an SMS message containing the phone number that sent the message and the content (data) of the message.
This class is used within the library to read SMS sent to Cellular devices.
Class constructor. Instantiates a new
SMSMessageobject with the provided parameters.- Parameters
phone_number (String) – The phone number that sent the message.
data (String) – The message text.
- Raises
ValueError – if phone_number is None.
ValueError – if data is None.
ValueError – if phone_number is not a valid phone number.
-
property
phone_number¶ Returns the phone number that sent the message.
- Returns
The phone number that sent the message.
- Return type
String
-
property
data¶ Returns the data of the message.
- Returns
The data of the message.
- Return type
String
-
class
digi.xbee.models.message.UserDataRelayMessage(local_interface, data)[source]¶ Bases:
objectThis class represents a user data relay message containing the source interface and the content (data) of the message.
See also
Class constructor. Instantiates a new
UserDataRelayMessageobject with the provided parameters.- Parameters
local_interface (
XBeeLocalInterface) – The source XBee local interface.data (Bytearray) – Byte array containing the data of the message.
- Raises
ValueError – if relay_interface is None.
See also
-
property
local_interface¶ Returns the source interface that sent the message.
- Returns
The source interface that sent the message.
- Return type
-
property
data¶ Returns the data of the message.
- Returns
The data of the message.
- Return type
Bytearray