digi.xbee.models.message module¶
-
class
digi.xbee.models.message.
XBeeMessage
(data, remote_device, timestamp, broadcast=False)[source]¶ Bases:
object
This 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.
-
data
¶ Bytearray. Bytearray containing the data of the message.
-
remote_device
¶ RemoteXBeeDevice
. The device that has sent the message.
-
is_broadcast
¶ Boolean.
True
to indicate that the message is broadcast,False
otherwise.
-
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.XBeeMessage
This 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.
-
source_endpoint
¶ Integer. The source endpoint of the message
-
dest_endpoint
¶ Integer. The destination endpoint of the message
-
cluster_id
¶ Integer. The Cluster ID of the message.
-
profile_id
¶ Integer. The profile ID of the message.
-
data
¶ Returns the data of the message.
Returns: the data of the message. Return type: Bytearray
-
is_broadcast
¶ Returns whether the message is broadcast or not.
Returns: True
if the message is broadcast,False
otherwise.Return type: Boolean
-
remote_device
¶ Returns the device which has sent the message.
Returns: the device which has sent the message. Return type: RemoteXBeeDevice
-
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:
object
This 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
isNone
. - ValueError – if
protocol
isNone
. - ValueError – if
data
isNone
. - ValueError – if
source_port
is less than 0 or greater than 65535. - ValueError – if
dest_port
is less than 0 or greater than 65535.
-
ip_addr
¶ ipaddress.IPv4Address
. The IPv4 address this message is associated to.
-
source_port
¶ Integer. The source port of the transmission.
-
dest_port
¶ Integer. The destination port of the transmission.
-
protocol
¶ IPProtocol
. The protocol used in the transmission.
-
data
¶ Bytearray. Bytearray containing the data of the message.
- ip_addr (
-
class
digi.xbee.models.message.
SMSMessage
(phone_number, data)[source]¶ Bases:
object
This 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
SMSMessage
object 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
isNone
. - ValueError – if
data
isNone
. - ValueError – if
phone_number
is not a valid phone number.
-
phone_number
¶ String. The phone number that sent the message.
-
data
¶ String. The data of the message.
-
class
digi.xbee.models.message.
UserDataRelayMessage
(local_interface, data)[source]¶ Bases:
object
This 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
UserDataRelayMessage
object 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
isNone
.See also
-
local_interface
¶ XBeeLocalInterface
. Source interface that sent the message.
-
data
¶ Bytearray. The data of the message.
- local_interface (