digi.xbee.reader module¶
-
class
digi.xbee.reader.
XBeeEvent
[source]¶ Bases:
list
This class represents a generic XBee event.
New event callbacks can be added here following this prototype:
def callback_prototype(*args, **kwargs): #do something...
All of them will be executed when the event is fired.
See also
list (Python standard class)-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
-
class
digi.xbee.reader.
PacketReceived
[source]¶ Bases:
digi.xbee.reader.XBeeEvent
This event is fired when an XBee receives any packet, independent of its frame type.
- The callbacks for handle this events will receive the following arguments:
- received_packet (
XBeeAPIPacket
): Received packet.
- received_packet (
See also
-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.
PacketReceivedFrom
[source]¶ Bases:
digi.xbee.reader.XBeeEvent
This event is fired when an XBee receives any packet, independent of its frame type.
- The callbacks for handle this events will receive the following arguments:
- received_packet (
XBeeAPIPacket
): Received packet. - sender (
RemoteXBeeDevice
): Remote XBee who sent the packet.
- received_packet (
See also
-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.
DataReceived
[source]¶ Bases:
digi.xbee.reader.XBeeEvent
This event is fired when an XBee receives data.
- The callbacks for handle this events will receive the following arguments:
- message (
XBeeMessage
): Message containing the data received, the sender and the time.
- message (
See also
-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.
ModemStatusReceived
[source]¶ Bases:
digi.xbee.reader.XBeeEvent
This event is fired when a XBee receives a modem status packet.
- The callbacks for handle this events will receive the following arguments:
- modem_status (
ModemStatus
): Modem status received.
- modem_status (
See also
-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.
IOSampleReceived
[source]¶ Bases:
digi.xbee.reader.XBeeEvent
This event is fired when a XBee receives an IO packet.
This includes:
- IO data sample RX indicator packet.
- RX IO 16 packet.
- RX IO 64 packet.
- The callbacks that handle this event will receive the following arguments:
- io_sample (
IOSample
): Received IO sample. - sender (
RemoteXBeeDevice
): Remote XBee who sent the packet. - time (Integer): the time in which the packet was received.
- io_sample (
See also
-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.
NetworkModified
[source]¶ Bases:
digi.xbee.reader.XBeeEvent
This event is fired when the network is being modified by the addition of a new node, an existing node information is updated, a node removal, or when the network items are cleared.
- The callbacks that handle this event will receive the following arguments:
- event_type (
digi.xbee.devices.NetworkEventType
): Network event type. - reason (
digi.xbee.devices.NetworkEventReason
): Reason of the event. - node (
digi.xbee.devices.XBeeDevice
ordigi.xbee.devices.RemoteXBeeDevice
): Node added, updated or removed from the network.
- event_type (
See also
-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.
DeviceDiscovered
[source]¶ Bases:
digi.xbee.reader.XBeeEvent
This event is fired when an XBee discovers another remote XBee during a discovering operation.
- The callbacks that handle this event will receive the following arguments:
- discovered_device (
RemoteXBeeDevice
): Discovered remote XBee.
- discovered_device (
See also
-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.
DiscoveryProcessFinished
[source]¶ Bases:
digi.xbee.reader.XBeeEvent
This event is fired when the discovery process finishes, either successfully or due to an error.
- The callbacks that handle this event will receive the following arguments:
- status (
NetworkDiscoveryStatus
): Network discovery status. - description (String, optional): Description of the discovery status.
- status (
See also
-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.
ExplicitDataReceived
[source]¶ Bases:
digi.xbee.reader.XBeeEvent
This event is fired when an XBee receives an explicit data packet.
- The callbacks for handle this events will receive the following arguments:
- message (
ExplicitXBeeMessage
): Message containing the received data, the sender, the time, and explicit data message parameters.
- message (
See also
-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.
IPDataReceived
[source]¶ Bases:
digi.xbee.reader.XBeeEvent
This event is fired when an XBee receives IP data.
- The callbacks for handle this events will receive the following arguments:
- message (
IPMessage
): Message containing containing the IP address the message belongs to, source and destination ports, IP protocol, and the content (data) of the message.
- message (
-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.
SMSReceived
[source]¶ Bases:
digi.xbee.reader.XBeeEvent
This event is fired when an XBee receives an SMS.
- The callbacks for handle this events will receive the following arguments:
- message (
SMSMessage
): Message containing the phone number that sent the message and the content (data) of the message.
- message (
See also
-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.
RelayDataReceived
[source]¶ Bases:
digi.xbee.reader.XBeeEvent
This event is fired when an XBee receives a user data relay output packet.
- The callbacks to handle these events will receive the following arguments:
- message (
UserDataRelayMessage
): Message containing the source interface and the content (data) of the message.
- message (
See also
-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.
BluetoothDataReceived
[source]¶ Bases:
digi.xbee.reader.XBeeEvent
This event is fired when an XBee receives data from the Bluetooth interface.
- The callbacks to handle these events will receive the following arguments:
- data (Bytearray): Received Bluetooth data.
See also
-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.
MicroPythonDataReceived
[source]¶ Bases:
digi.xbee.reader.XBeeEvent
This event is fired when an XBee receives data from the MicroPython interface.
- The callbacks to handle these events will receive the following arguments:
- data (Bytearray): Received MicroPython data.
See also
-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.
SocketStateReceived
[source]¶ Bases:
digi.xbee.reader.XBeeEvent
This event is fired when an XBee receives a socket state packet.
- The callbacks to handle these events will receive the following arguments:
- socket_id (Integer): Socket ID for state reported.
- state (
SocketState
): Received state.
See also
-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.
SocketDataReceived
[source]¶ Bases:
digi.xbee.reader.XBeeEvent
This event is fired when an XBee receives a socket receive data packet.
- The callbacks to handle these events will receive the following arguments:
- socket_id (Integer): ID of the socket that received the data.
- payload (Bytearray): Received data.
See also
-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.
SocketDataReceivedFrom
[source]¶ Bases:
digi.xbee.reader.XBeeEvent
This event is fired when an XBee receives a socket receive from data packet.
- The callbacks to handle these events will receive the following arguments:
- socket_id (Integer): ID of the socket that received the data.
- address (Tuple): Pair (host, port) of the source address where
- host is a string representing an IPv4 address like ‘100.50.200.5’, and port is an integer.
- payload (Bytearray): Received data.
See also
-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.
RouteRecordIndicatorReceived
[source]¶ Bases:
digi.xbee.reader.XBeeEvent
This event is fired when a route record packet is received.
- The callbacks to handle these events will receive the following arguments:
- Source (
RemoteXBeeDevice
): Remote node that sent the - route record.
- Source (
- Hops (List): List of intermediate hops 16-bit addresses from closest
- to source (who sent the route record) to closest to destination
(
XBee16BitAddress
).
See also
-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.
RouteInformationReceived
[source]¶ Bases:
digi.xbee.reader.XBeeEvent
This event is fired when a route information packet is received.
- The callbacks to handle these events will receive the following arguments:
- Source event (Integer): Source event (0x11: NACK, 0x12: Trace route)
- Timestamp (Integer): System timer value on the node generating
- this package. The timestamp is in microseconds.
- ACK timeout count (Integer): Number of MAC ACK timeouts that occur.
- TX blocked count (Integer): Number of times the transmissions was
- blocked due to reception in progress.
- Destination address (
XBee64BitAddress
): 64-bit address of - the final destination node.
- Destination address (
- Source address (
XBee64BitAddress
): 64-bit address of - the source node.
- Source address (
- Responder address (
XBee64BitAddress
): 64-bit address of - of the node that generates this packet after it sends (or attempts to send) the packet to the next hop (successor node)
- Responder address (
- Successor address (
XBee64BitAddress
): 64-bit address of - of the next node after the responder in the route towards the destination.
- Successor address (
See also
-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.
RouteReceived
[source]¶ Bases:
digi.xbee.reader.XBeeEvent
This event is fired when a route is received.
- The callbacks to handle these events will receive the following arguments:
- source (
XBeeDevice
): Local node. - destination (
RemoteXBeeDevice
): Remote node. - hops (List): List of intermediate hops from source node to
- closest to destination (
RemoteXBeeDevice
).
- source (
See also
-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.
InitDiscoveryScan
[source]¶ Bases:
digi.xbee.reader.XBeeEvent
This event is fired when a new network discovery scan is about to start.
- The callbacks to handle these events will receive the following arguments:
- Number of scan to start (starting with 1).
- Total number of scans.
See also
-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.
EndDiscoveryScan
[source]¶ Bases:
digi.xbee.reader.XBeeEvent
This event is fired when a network discovery scan has just finished.
- The callbacks to handle these events will receive the following arguments:
- Number of scan that has finished (starting with 1).
- Total number of scans.
See also
-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.
FileSystemFrameReceived
[source]¶ Bases:
digi.xbee.reader.XBeeEvent
This event is fired when a file system packet is received.
- The callbacks to handle these events will receive the following arguments:
- Source (
AbstractXBeeDevice
): Node that sent the file system frame. - Frame id (Integer): Received frame id.
- Command (
FSCmd
): File system command. - Status (:class: .FSCommandStatus): Status code.
- Receive options (Integer): Bitfield indicating receive options.
See
ReceiveOptions
.
- Source (
See also
-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.
NetworkUpdateProgress
[source]¶ Bases:
digi.xbee.reader.XBeeEvent
This event is fired when the progress of a running firmware update changes.
- The callbacks to handle these events will receive the following arguments:
- The XBee being updated.
- The current update task as a String.
- The current update task percentage as an Integer.
See also
-
append
()¶ Append object to the end of the list.
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.
PacketListener
(comm_iface, xbee_device, queue_max_size=None)[source]¶ Bases:
threading.Thread
This class represents a packet listener, which is a thread that’s always listening for incoming packets to the XBee.
When it receives a packet, this class throws an event depending on which packet it is. You can add your own callbacks for this events via certain class methods. This callbacks must have a certain header, see each event documentation.
This class has fields that are events. Its recommended to use only the append() and remove() method on them, or -= and += operators. If you do something more with them, it’s for your own risk.
Here are the parameters which will be received by the event callbacks, depending on which event it is in each case:
The following parameters are passed via **kwargs to event callbacks of:
- PacketReceived:
- 1.1 received_packet (
XBeeAPIPacket
): Received packet.
- DataReceived
- 2.1 message (
XBeeMessage
): Message containing the data - received, the sender and the time.
- 2.1 message (
- ModemStatusReceived
- 3.1 modem_status (
ModemStatus
): Modem status received.
Class constructor. Instantiates a new
PacketListener
object with the provided parameters.Parameters: - comm_iface (
XBeeCommunicationInterface
) – Hardware interface to listen to. - xbee_device (
XBeeDevice
) – XBee that is the listener owner. - queue_max_size (Integer) – Maximum size of the XBee queue.
-
daemon
¶ A boolean value indicating whether this thread is a daemon thread.
This must be set before start() is called, otherwise RuntimeError is raised. Its initial value is inherited from the creating thread; the main thread is not a daemon thread and therefore all threads created in the main thread default to daemon = False.
The entire Python program exits when only daemon threads are left.
-
wait_until_started
(timeout=None)[source]¶ Blocks until the thread has fully started. If already started, returns immediately.
Parameters: timeout (Float) – Timeout for the operation in seconds.
-
run
()[source]¶ This is the method that will be executing for listening packets.
For each packet, it will execute the proper callbacks.
-
is_running
()[source]¶ Returns whether this instance is running or not.
Returns: True if this instance is running, False otherwise. Return type: Boolean
-
get_data_queue
()[source]¶ Returns the data packets queue.
Returns: Data packets queue. Return type: XBeeQueue
-
get_explicit_queue
()[source]¶ Returns the explicit packets queue.
Returns: Explicit packets queue. Return type: XBeeQueue
-
get_ip_queue
()[source]¶ Returns the IP packets queue.
Returns: IP packets queue. Return type: XBeeQueue
-
add_packet_received_callback
(callback)[source]¶ Adds a callback for the event
PacketReceived
.Parameters: callback (Function or List of functions) – Callback. Receives one argument.
- The received packet as a
XBeeAPIPacket
- The received packet as a
-
add_packet_received_from_callback
(callback)[source]¶ Adds a callback for the event
PacketReceivedFrom
.Parameters: callback (Function or List of functions) – Callback. Receives two arguments.
- The received packet as a
XBeeAPIPacket
- The remote XBee device who has sent the packet as a
RemoteXBeeDevice
- The received packet as a
-
add_data_received_callback
(callback)[source]¶ Adds a callback for the event
DataReceived
.Parameters: callback (Function or List of functions) – Callback. Receives one argument.
- The data received as an
XBeeMessage
- The data received as an
-
add_modem_status_received_callback
(callback)[source]¶ Adds a callback for the event
ModemStatusReceived
.Parameters: callback (Function or List of functions) – Callback. Receives one argument.
- The modem status as a
ModemStatus
- The modem status as a
-
add_io_sample_received_callback
(callback)[source]¶ Adds a callback for the event
IOSampleReceived
.Parameters: callback (Function or List of functions) – Callback. Receives three arguments.
- The received IO sample as an
IOSample
- The remote XBee device who has sent the packet as a
RemoteXBeeDevice
- The time in which the packet was received as an Integer
- The received IO sample as an
-
add_explicit_data_received_callback
(callback)[source]¶ Adds a callback for the event
ExplicitDataReceived
.Parameters: callback (Function or List of functions) – Callback. Receives one argument.
- The explicit data received as an
ExplicitXBeeMessage
- The explicit data received as an
-
add_ip_data_received_callback
(callback)[source]¶ Adds a callback for the event
IPDataReceived
.Parameters: callback (Function or List of functions) – Callback. Receives one argument.
- The data received as an
IPMessage
- The data received as an
-
add_sms_received_callback
(callback)[source]¶ Adds a callback for the event
SMSReceived
.Parameters: callback (Function or List of functions) – Callback. Receives one argument.
- The data received as an
SMSMessage
- The data received as an
-
add_user_data_relay_received_callback
(callback)[source]¶ Adds a callback for the event
RelayDataReceived
.Parameters: callback (Function or List of functions) – Callback. Receives one argument.
- The data received as a
UserDataRelayMessage
- The data received as a
-
add_bluetooth_data_received_callback
(callback)[source]¶ Adds a callback for the event
BluetoothDataReceived
.Parameters: callback (Function or List of functions) – Callback. Receives one argument.
- The data received as a Bytearray
-
add_micropython_data_received_callback
(callback)[source]¶ Adds a callback for the event
MicroPythonDataReceived
.Parameters: callback (Function or List of functions) – Callback. Receives one argument.
- The data received as a Bytearray
-
add_socket_state_received_callback
(callback)[source]¶ Adds a callback for the event
SocketStateReceived
.Parameters: callback (Function or List of functions) – Callback. Receives two arguments.
- The socket ID as an Integer.
- The state received as a
SocketState
-
add_socket_data_received_callback
(callback)[source]¶ Adds a callback for the event
SocketDataReceived
.Parameters: callback (Function or List of functions) – Callback. Receives two arguments.
- The socket ID as an Integer.
- The status received as a
SocketStatus
-
add_socket_data_received_from_callback
(callback)[source]¶ Adds a callback for the event
SocketDataReceivedFrom
.Parameters: callback (Function or List of functions) – Callback. Receives three arguments.
- The socket ID as an Integer.
- A pair (host, port) of the source address where host is a string representing an IPv4 address like ‘100.50.200.5’, and port is an integer.
- The status received as a
SocketStatus
-
add_route_record_received_callback
(callback)[source]¶ Adds a callback for the event
RouteRecordIndicatorReceived
.Parameters: callback (Function or List of functions) – Callback. Receives two arguments.
- Source (
RemoteXBeeDevice
): Remote node that sent - the route record.
- Source (
- Hops (List): List of intermediate hops 16-bit addresses from
- closest to source (who sent the route record) to closest to destination.
-
add_route_info_received_callback
(callback)[source]¶ Adds a callback for the event
RouteInformationReceived
.Parameters: callback (Function or List of functions) – Callback. Receives eight arguments.
- Source event (Integer): Source event (0x11: NACK, 0x12: Trace route)
- Timestamp (Integer): System timer value on the node generating this package. The timestamp is in microseconds.
- ACK timeout count (Integer): Number of MAC ACK timeouts that occur.
- TX blocked count (Integer): Number of times the transmissions was blocked due to reception in progress.
- Destination address (
XBee64BitAddress
): 64-bit address of the final destination node. - Source address (
XBee64BitAddress
): 64-bit address of the source node. - Responder address (
XBee64BitAddress
): 64-bit address of the node that generated this packet after it sent (or attempted to send) the packet to the next hop (successor node) - Successor address (
XBee64BitAddress
): 64-bit address of the next node after the responder in the route towards the destination.
-
add_fs_frame_received_callback
(callback)[source]¶ Adds a callback for the event
FileSystemFrameReceived
.Parameters: callback (Function or List of functions) – Callback. Receives four arguments.
- Source (
AbstractXBeeDevice
): Node that sent the - file system frame.
- Source (
- Frame id (Integer): Received frame id.
- Command (
FSCmd
): File system command. - Receive options (Integer): Bitfield indicating receive
options. See
ReceiveOptions
.
-
del_packet_received_callback
(callback)[source]¶ Deletes a callback for the callback list of
PacketReceived
event.Parameters: callback (Function) – Callback to delete. Raises: ValueError
– If callback is not in the callback list ofPacketReceived
event.
-
del_packet_received_from_callback
(callback)[source]¶ Deletes a callback for the callback list of
PacketReceivedFrom
event.Parameters: callback (Function) – Callback to delete. Raises: ValueError
– If callback is not in the callback list ofPacketReceivedFrom
event.
-
del_data_received_callback
(callback)[source]¶ Deletes a callback for the callback list of
DataReceived
event.Parameters: callback (Function) – Callback to delete. Raises: ValueError
– If callback is not in the callback list ofDataReceived
event.
-
del_modem_status_received_callback
(callback)[source]¶ Deletes a callback for the callback list of
ModemStatusReceived
event.Parameters: callback (Function) – Callback to delete. Raises: ValueError
– If callback is not in the callback list ofModemStatusReceived
event.
-
del_io_sample_received_callback
(callback)[source]¶ Deletes a callback for the callback list of
IOSampleReceived
event.Parameters: callback (Function) – Callback to delete. Raises: ValueError
– If callback is not in the callback list ofIOSampleReceived
event.
-
del_explicit_data_received_callback
(callback)[source]¶ Deletes a callback for the callback list of
ExplicitDataReceived
event.Parameters: callback (Function) – Callback to delete. Raises: ValueError
– If callback is not in the callback list ofExplicitDataReceived
event.
-
del_ip_data_received_callback
(callback)[source]¶ Deletes a callback for the callback list of
IPDataReceived
event.Parameters: callback (Function) – Callback to delete. Raises: ValueError
– If callback is not in the callback list ofIPDataReceived
event.
-
del_sms_received_callback
(callback)[source]¶ Deletes a callback for the callback list of
SMSReceived
event.Parameters: callback (Function) – Callback to delete. Raises: ValueError
– If callback is not in the callback list ofSMSReceived
event.
-
del_user_data_relay_received_callback
(callback)[source]¶ Deletes a callback for the callback list of
RelayDataReceived
event.Parameters: callback (Function) – Callback to delete. Raises: ValueError
– If callback is not in the callback list ofRelayDataReceived
event.
-
del_bluetooth_data_received_callback
(callback)[source]¶ Deletes a callback for the callback list of
BluetoothDataReceived
event.Parameters: callback (Function) – Callback to delete. Raises: ValueError
– If callback is not in the callback list ofBluetoothDataReceived
event.
-
del_micropython_data_received_callback
(callback)[source]¶ Deletes a callback for the callback list of
MicroPythonDataReceived
event.Parameters: callback (Function) – Callback to delete. Raises: ValueError
– If callback is not in the callback list ofMicroPythonDataReceived
event.
-
del_socket_state_received_callback
(callback)[source]¶ Deletes a callback for the callback list of
SocketStateReceived
event.Parameters: callback (Function) – Callback to delete. Raises: ValueError
– If callback is not in the callback list ofSocketStateReceived
event.
-
del_socket_data_received_callback
(callback)[source]¶ Deletes a callback for the callback list of
SocketDataReceived
event.Parameters: callback (Function) – Callback to delete. Raises: ValueError
– If callback is not in the callback list ofSocketDataReceived
event.
-
del_socket_data_received_from_callback
(callback)[source]¶ Deletes a callback for the callback list of
SocketDataReceivedFrom
event.Parameters: callback (Function) – Callback to delete. Raises: ValueError
– If callback is not in the callback list ofSocketDataReceivedFrom
event.
-
del_route_record_received_callback
(callback)[source]¶ Deletes a callback for the callback list of
RouteRecordIndicatorReceived
event.Parameters: callback (Function) – Callback to delete. Raises: ValueError
– If callback is not in the callback list ofRouteRecordIndicatorReceived
event.
-
del_route_info_callback
(callback)[source]¶ Deletes a callback for the callback list of
RouteInformationReceived
event.Parameters: callback (Function) – Callback to delete. Raises: ValueError
– If callback is not in the callback list ofRouteInformationReceived
event.
-
del_fs_frame_received_callback
(callback)[source]¶ Deletes a callback for the callback list of
FileSystemFrameReceived
event.Parameters: callback (Function) – Callback to delete. Raises: ValueError
– If callback is not in the callback list ofFileSystemFrameReceived
event.
-
get_packet_received_callbacks
()[source]¶ Returns the list of registered callbacks for received packets.
Returns: List of PacketReceived
events.Return type: List
-
get_packet_received_from_callbacks
()[source]¶ Returns the list of registered callbacks for received packets.
Returns: List of PacketReceivedFrom
events.Return type: List
-
get_data_received_callbacks
()[source]¶ Returns the list of registered callbacks for received data.
Returns: List of DataReceived
events.Return type: List
-
get_modem_status_received_callbacks
()[source]¶ Returns the list of registered callbacks for received modem status.
Returns: List of ModemStatusReceived
events.Return type: List
-
get_io_sample_received_callbacks
()[source]¶ Returns the list of registered callbacks for received IO samples.
Returns: List of IOSampleReceived
events.Return type: List
-
get_explicit_data_received_callbacks
()[source]¶ Returns the list of registered callbacks for received explicit data.
Returns: List of ExplicitDataReceived
events.Return type: List
-
get_ip_data_received_callbacks
()[source]¶ Returns the list of registered callbacks for received IP data.
Returns: List of IPDataReceived
events.Return type: List
-
get_sms_received_callbacks
()[source]¶ Returns the list of registered callbacks for received SMS.
Returns: List of SMSReceived
events.Return type: List
-
get_user_data_relay_received_callbacks
()[source]¶ Returns the list of registered callbacks for received user data relay.
Returns: List of RelayDataReceived
events.Return type: List
-
get_bluetooth_data_received_callbacks
()[source]¶ Returns the list of registered callbacks for received Bluetooth data.
Returns: List of BluetoothDataReceived
events.Return type: List
-
get_micropython_data_received_callbacks
()[source]¶ Returns the list of registered callbacks for received MicroPython data.
Returns: List of MicroPythonDataReceived
events.Return type: List
-
get_socket_state_received_callbacks
()[source]¶ Returns the list of registered callbacks for received socket state.
Returns: List of SocketStateReceived
events.Return type: List
-
get_socket_data_received_callbacks
()[source]¶ Returns the list of registered callbacks for received socket data.
Returns: List of SocketDataReceived
events.Return type: List
-
get_socket_data_received_from_callbacks
()[source]¶ Returns the list of registered callbacks for received socket data from.
Returns: List of SocketDataReceivedFrom
events.Return type: List
-
get_route_record_received_callbacks
()[source]¶ Returns the list of registered callbacks for received route records.
Returns: List of RouteRecordIndicatorReceived
events.Return type: List
-
get_route_info_callbacks
()[source]¶ Returns the list of registered callbacks for received route information packets.
Returns: List of RouteInformationReceived
events.Return type: List
-
get_fs_frame_received_callbacks
()[source]¶ Returns the list of registered callbacks for received file system packets.
Returns: List of FileSystemFrameReceived
events.Return type: List
-
ident
¶ Thread identifier of this thread or None if it has not been started.
This is a nonzero integer. See the get_ident() function. Thread identifiers may be recycled when a thread exits and another thread is created. The identifier is available even after the thread has exited.
-
isAlive
()¶ Return whether the thread is alive.
This method is deprecated, use is_alive() instead.
-
is_alive
()¶ Return whether the thread is alive.
This method returns True just before the run() method starts until just after the run() method terminates. The module function enumerate() returns a list of all alive threads.
-
join
(timeout=None)¶ Wait until the thread terminates.
This blocks the calling thread until the thread whose join() method is called terminates – either normally or through an unhandled exception or until the optional timeout occurs.
When the timeout argument is present and not None, it should be a floating point number specifying a timeout for the operation in seconds (or fractions thereof). As join() always returns None, you must call is_alive() after join() to decide whether a timeout happened – if the thread is still alive, the join() call timed out.
When the timeout argument is not present or None, the operation will block until the thread terminates.
A thread can be join()ed many times.
join() raises a RuntimeError if an attempt is made to join the current thread as that would cause a deadlock. It is also an error to join() a thread before it has been started and attempts to do so raises the same exception.
-
name
¶ A string used for identification purposes only.
It has no semantics. Multiple threads may be given the same name. The initial name is set by the constructor.
-
start
()¶ Start the thread’s activity.
It must be called at most once per thread object. It arranges for the object’s run() method to be invoked in a separate thread of control.
This method will raise a RuntimeError if called more than once on the same thread object.
-
class
digi.xbee.reader.
XBeeQueue
(maxsize=10)[source]¶ Bases:
queue.Queue
This class represents an XBee queue.
Class constructor. Instantiates a new
XBeeQueue
with the provided parameters.Parameters: maxsize (Integer, optional, default=10) – Maximum size of the queue. -
get
(block=True, timeout=None)[source]¶ Returns the first element of the queue if there is some element ready before timeout expires, in case of the timeout is not None.
If timeout is None, this method is non-blocking. In this case, if there is not any element available, it returns None, otherwise it returns an
XBeeAPIPacket
.Parameters: - block (Boolean) – True to block during timeout waiting for a packet, False to not block.
- timeout (Integer, optional) – timeout in seconds.
Returns: - Packet if there is any packet available
before timeout expires. If timeout is None, the returned value may be None.
Return type: Raises: TimeoutException
– If timeout is not None and there is not any packet available before the timeout expires.
-
get_by_remote
(remote, timeout=None)[source]¶ Returns the first element of the queue that had been sent by remote, if there is some in the specified timeout.
If timeout is None, this method is non-blocking. In this case, if there is not any packet sent by remote in the queue, it returns None, otherwise it returns an
XBeeAPIPacket
.Parameters: - remote (
RemoteXBeeDevice
) – Remote XBee to get its first element from queue. - timeout (Integer, optional, default=`None`) – Timeout in seconds.
Returns: - If there is any packet available before
the timeout expires. If timeout is None, the returned value may be None.
Return type: Raises: TimeoutException
– If timeout is not None and there is not any packet available that was sent by remote before the timeout expires.- remote (
-
get_by_ip
(ip_addr, timeout=None)[source]¶ Returns the first IP data packet from the queue whose IP address matches the provided address.
If timeout is None, this method is non-blocking. In this case, if there is not any packet sent by ip_addr in the queue, it returns None, otherwise it returns an
XBeeAPIPacket
.Parameters: - ip_addr (
ipaddress.IPv4Address
) – IP address to look for in the list of packets. - timeout (Integer, optional, default=`None`) – Timeout in seconds.
Returns: - If there is any packet available before the
timeout expires. If timeout is None, the returned value may be None.
Return type: Raises: TimeoutException
– If timeout is not None and there is not any packet available that was sent by ip_addr before the timeout expires.- ip_addr (
-
empty
()¶ Return True if the queue is empty, False otherwise (not reliable!).
This method is likely to be removed at some point. Use qsize() == 0 as a direct substitute, but be aware that either approach risks a race condition where a queue can grow before the result of empty() or qsize() can be used.
To create code that needs to wait for all queued tasks to be completed, the preferred technique is to use the join() method.
-
full
()¶ Return True if the queue is full, False otherwise (not reliable!).
This method is likely to be removed at some point. Use qsize() >= n as a direct substitute, but be aware that either approach risks a race condition where a queue can shrink before the result of full() or qsize() can be used.
-
get_by_id
(frame_id, timeout=None)[source]¶ Returns the first packet from the queue whose frame ID matches the provided one.
If timeout is None, this method is non-blocking. In this case, if there is not any received packet with the provided frame ID in the queue, it returns None, otherwise it returns an
XBeeAPIPacket
.Parameters: - frame_id (Integer) – Frame ID to look for in the list of packets.
- timeout (Integer, optional, default=`None`) – Timeout in seconds.
Returns: - If there is any packet available before
the timeout expires. If timeout is None, the returned value may be None.
Return type: Raises: TimeoutException
– If timeout is not None and there is not any packet available that matches the provided frame ID before the timeout expires.
-
get_nowait
()¶ Remove and return an item from the queue without blocking.
Only get an item if one is immediately available. Otherwise raise the Empty exception.
-
join
()¶ Blocks until all items in the Queue have been gotten and processed.
The count of unfinished tasks goes up whenever an item is added to the queue. The count goes down whenever a consumer thread calls task_done() to indicate the item was retrieved and all work on it is complete.
When the count of unfinished tasks drops to zero, join() unblocks.
-
put
(item, block=True, timeout=None)¶ Put an item into the queue.
If optional args ‘block’ is true and ‘timeout’ is None (the default), block if necessary until a free slot is available. If ‘timeout’ is a non-negative number, it blocks at most ‘timeout’ seconds and raises the Full exception if no free slot was available within that time. Otherwise (‘block’ is false), put an item on the queue if a free slot is immediately available, else raise the Full exception (‘timeout’ is ignored in that case).
-
put_nowait
(item)¶ Put an item into the queue without blocking.
Only enqueue the item if a free slot is immediately available. Otherwise raise the Full exception.
-
qsize
()¶ Return the approximate size of the queue (not reliable!).
-
task_done
()¶ Indicate that a formerly enqueued task is complete.
Used by Queue consumer threads. For each get() used to fetch a task, a subsequent call to task_done() tells the queue that the processing on the task is complete.
If a join() is currently blocking, it will resume when all items have been processed (meaning that a task_done() call was received for every item that had been put() into the queue).
Raises a ValueError if called more times than there were items placed in the queue.
-