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¶ Bytearray. Bytearray containing the data of the message.
-
property
remote_device¶ RemoteXBeeDevice. The device that has sent the message.
-
property
is_broadcast¶ Boolean.
Trueto indicate that the message is broadcast,Falseotherwise.
-
property
timestamp¶ Integer. Instant of time when the message was received.
-
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¶ Integer. The source endpoint of the message
-
property
dest_endpoint¶ Integer. The destination endpoint of the message
-
property
cluster_id¶ Integer. The Cluster ID of the message.
-
property
profile_id¶ Integer. The profile ID of the message.
-
property
data¶ Returns 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
Trueif the message is broadcast,Falseotherwise.- 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_addrisNone.ValueError – if
protocolisNone.ValueError – if
dataisNone.ValueError – if
source_portis less than 0 or greater than 65535.ValueError – if
dest_portis less than 0 or greater than 65535.
-
property
ip_addr¶ ipaddress.IPv4Address. The IPv4 address this message is associated to.
-
property
source_port¶ Integer. The source port of the transmission.
-
property
dest_port¶ Integer. The destination port of the transmission.
-
property
protocol¶ IPProtocol. The protocol used in the transmission.
-
property
data¶ Bytearray. Bytearray containing the data of the message.
-
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_numberisNone.ValueError – if
dataisNone.ValueError – if
phone_numberis not a valid phone number.
-
property
phone_number¶ String. The phone number that sent the message.
-
property
data¶ String. The data of the message.
-
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_interfaceisNone.
See also
-
property
local_interface¶ XBeeLocalInterface. Source interface that sent the message.
-
property
data¶ Bytearray. The data of the message.