digi.xbee.reader module¶
-
class
digi.xbee.reader.XBeeEvent(iterable=(), /)[source]¶ Bases:
listThis 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(object, /)¶ Append object to the end of the list.
-
clear()¶ Remove all items from list.
-
copy()¶ Return a shallow copy of the list.
-
count(value, /)¶ Return number of occurrences of value.
-
extend(iterable, /)¶ Extend list by appending elements from the iterable.
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert(index, object, /)¶ Insert object before index.
-
pop(index=-1, /)¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove(value, /)¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse()¶ Reverse IN PLACE.
-
sort(*, key=None, reverse=False)¶ Stable sort IN PLACE.
-
-
class
digi.xbee.reader.PacketReceived(iterable=(), /)[source]¶ Bases:
digi.xbee.reader.XBeeEventThis 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.
See also
-
append(object, /)¶ Append object to the end of the list.
-
clear()¶ Remove all items from list.
-
copy()¶ Return a shallow copy of the list.
-
count(value, /)¶ Return number of occurrences of value.
-
extend(iterable, /)¶ Extend list by appending elements from the iterable.
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert(index, object, /)¶ Insert object before index.
-
pop(index=-1, /)¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove(value, /)¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse()¶ Reverse IN PLACE.
-
sort(*, key=None, reverse=False)¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.PacketReceivedFrom(iterable=(), /)[source]¶ Bases:
digi.xbee.reader.XBeeEventThis 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.
See also
-
append(object, /)¶ Append object to the end of the list.
-
clear()¶ Remove all items from list.
-
copy()¶ Return a shallow copy of the list.
-
count(value, /)¶ Return number of occurrences of value.
-
extend(iterable, /)¶ Extend list by appending elements from the iterable.
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert(index, object, /)¶ Insert object before index.
-
pop(index=-1, /)¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove(value, /)¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse()¶ Reverse IN PLACE.
-
sort(*, key=None, reverse=False)¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.DataReceived(iterable=(), /)[source]¶ Bases:
digi.xbee.reader.XBeeEventThis 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.
See also
-
append(object, /)¶ Append object to the end of the list.
-
clear()¶ Remove all items from list.
-
copy()¶ Return a shallow copy of the list.
-
count(value, /)¶ Return number of occurrences of value.
-
extend(iterable, /)¶ Extend list by appending elements from the iterable.
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert(index, object, /)¶ Insert object before index.
-
pop(index=-1, /)¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove(value, /)¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse()¶ Reverse IN PLACE.
-
sort(*, key=None, reverse=False)¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.ModemStatusReceived(iterable=(), /)[source]¶ Bases:
digi.xbee.reader.XBeeEventThis 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.
See also
-
append(object, /)¶ Append object to the end of the list.
-
clear()¶ Remove all items from list.
-
copy()¶ Return a shallow copy of the list.
-
count(value, /)¶ Return number of occurrences of value.
-
extend(iterable, /)¶ Extend list by appending elements from the iterable.
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert(index, object, /)¶ Insert object before index.
-
pop(index=-1, /)¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove(value, /)¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse()¶ Reverse IN PLACE.
-
sort(*, key=None, reverse=False)¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.IOSampleReceived(iterable=(), /)[source]¶ Bases:
digi.xbee.reader.XBeeEventThis 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.
See also
-
append(object, /)¶ Append object to the end of the list.
-
clear()¶ Remove all items from list.
-
copy()¶ Return a shallow copy of the list.
-
count(value, /)¶ Return number of occurrences of value.
-
extend(iterable, /)¶ Extend list by appending elements from the iterable.
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert(index, object, /)¶ Insert object before index.
-
pop(index=-1, /)¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove(value, /)¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse()¶ Reverse IN PLACE.
-
sort(*, key=None, reverse=False)¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.NetworkModified(iterable=(), /)[source]¶ Bases:
digi.xbee.reader.XBeeEventThis 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.XBeeDeviceordigi.xbee.devices.RemoteXBeeDevice): Node added, updated or removed from the network.
See also
-
append(object, /)¶ Append object to the end of the list.
-
clear()¶ Remove all items from list.
-
copy()¶ Return a shallow copy of the list.
-
count(value, /)¶ Return number of occurrences of value.
-
extend(iterable, /)¶ Extend list by appending elements from the iterable.
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert(index, object, /)¶ Insert object before index.
-
pop(index=-1, /)¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove(value, /)¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse()¶ Reverse IN PLACE.
-
sort(*, key=None, reverse=False)¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.DeviceDiscovered(iterable=(), /)[source]¶ Bases:
digi.xbee.reader.XBeeEventThis 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.
See also
-
append(object, /)¶ Append object to the end of the list.
-
clear()¶ Remove all items from list.
-
copy()¶ Return a shallow copy of the list.
-
count(value, /)¶ Return number of occurrences of value.
-
extend(iterable, /)¶ Extend list by appending elements from the iterable.
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert(index, object, /)¶ Insert object before index.
-
pop(index=-1, /)¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove(value, /)¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse()¶ Reverse IN PLACE.
-
sort(*, key=None, reverse=False)¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.DiscoveryProcessFinished(iterable=(), /)[source]¶ Bases:
digi.xbee.reader.XBeeEventThis 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.
See also
-
append(object, /)¶ Append object to the end of the list.
-
clear()¶ Remove all items from list.
-
copy()¶ Return a shallow copy of the list.
-
count(value, /)¶ Return number of occurrences of value.
-
extend(iterable, /)¶ Extend list by appending elements from the iterable.
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert(index, object, /)¶ Insert object before index.
-
pop(index=-1, /)¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove(value, /)¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse()¶ Reverse IN PLACE.
-
sort(*, key=None, reverse=False)¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.ExplicitDataReceived(iterable=(), /)[source]¶ Bases:
digi.xbee.reader.XBeeEventThis 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.
See also
-
append(object, /)¶ Append object to the end of the list.
-
clear()¶ Remove all items from list.
-
copy()¶ Return a shallow copy of the list.
-
count(value, /)¶ Return number of occurrences of value.
-
extend(iterable, /)¶ Extend list by appending elements from the iterable.
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert(index, object, /)¶ Insert object before index.
-
pop(index=-1, /)¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove(value, /)¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse()¶ Reverse IN PLACE.
-
sort(*, key=None, reverse=False)¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.IPDataReceived(iterable=(), /)[source]¶ Bases:
digi.xbee.reader.XBeeEventThis 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.
-
append(object, /)¶ Append object to the end of the list.
-
clear()¶ Remove all items from list.
-
copy()¶ Return a shallow copy of the list.
-
count(value, /)¶ Return number of occurrences of value.
-
extend(iterable, /)¶ Extend list by appending elements from the iterable.
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert(index, object, /)¶ Insert object before index.
-
pop(index=-1, /)¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove(value, /)¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse()¶ Reverse IN PLACE.
-
sort(*, key=None, reverse=False)¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.SMSReceived(iterable=(), /)[source]¶ Bases:
digi.xbee.reader.XBeeEventThis 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.
See also
-
append(object, /)¶ Append object to the end of the list.
-
clear()¶ Remove all items from list.
-
copy()¶ Return a shallow copy of the list.
-
count(value, /)¶ Return number of occurrences of value.
-
extend(iterable, /)¶ Extend list by appending elements from the iterable.
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert(index, object, /)¶ Insert object before index.
-
pop(index=-1, /)¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove(value, /)¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse()¶ Reverse IN PLACE.
-
sort(*, key=None, reverse=False)¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.RelayDataReceived(iterable=(), /)[source]¶ Bases:
digi.xbee.reader.XBeeEventThis 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.
See also
-
append(object, /)¶ Append object to the end of the list.
-
clear()¶ Remove all items from list.
-
copy()¶ Return a shallow copy of the list.
-
count(value, /)¶ Return number of occurrences of value.
-
extend(iterable, /)¶ Extend list by appending elements from the iterable.
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert(index, object, /)¶ Insert object before index.
-
pop(index=-1, /)¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove(value, /)¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse()¶ Reverse IN PLACE.
-
sort(*, key=None, reverse=False)¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.BluetoothDataReceived(iterable=(), /)[source]¶ Bases:
digi.xbee.reader.XBeeEventThis 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(object, /)¶ Append object to the end of the list.
-
clear()¶ Remove all items from list.
-
copy()¶ Return a shallow copy of the list.
-
count(value, /)¶ Return number of occurrences of value.
-
extend(iterable, /)¶ Extend list by appending elements from the iterable.
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert(index, object, /)¶ Insert object before index.
-
pop(index=-1, /)¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove(value, /)¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse()¶ Reverse IN PLACE.
-
sort(*, key=None, reverse=False)¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.MicroPythonDataReceived(iterable=(), /)[source]¶ Bases:
digi.xbee.reader.XBeeEventThis 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(object, /)¶ Append object to the end of the list.
-
clear()¶ Remove all items from list.
-
copy()¶ Return a shallow copy of the list.
-
count(value, /)¶ Return number of occurrences of value.
-
extend(iterable, /)¶ Extend list by appending elements from the iterable.
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert(index, object, /)¶ Insert object before index.
-
pop(index=-1, /)¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove(value, /)¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse()¶ Reverse IN PLACE.
-
sort(*, key=None, reverse=False)¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.SocketStateReceived(iterable=(), /)[source]¶ Bases:
digi.xbee.reader.XBeeEventThis 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(object, /)¶ Append object to the end of the list.
-
clear()¶ Remove all items from list.
-
copy()¶ Return a shallow copy of the list.
-
count(value, /)¶ Return number of occurrences of value.
-
extend(iterable, /)¶ Extend list by appending elements from the iterable.
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert(index, object, /)¶ Insert object before index.
-
pop(index=-1, /)¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove(value, /)¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse()¶ Reverse IN PLACE.
-
sort(*, key=None, reverse=False)¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.SocketDataReceived(iterable=(), /)[source]¶ Bases:
digi.xbee.reader.XBeeEventThis 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(object, /)¶ Append object to the end of the list.
-
clear()¶ Remove all items from list.
-
copy()¶ Return a shallow copy of the list.
-
count(value, /)¶ Return number of occurrences of value.
-
extend(iterable, /)¶ Extend list by appending elements from the iterable.
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert(index, object, /)¶ Insert object before index.
-
pop(index=-1, /)¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove(value, /)¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse()¶ Reverse IN PLACE.
-
sort(*, key=None, reverse=False)¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.SocketDataReceivedFrom(iterable=(), /)[source]¶ Bases:
digi.xbee.reader.XBeeEventThis 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(object, /)¶ Append object to the end of the list.
-
clear()¶ Remove all items from list.
-
copy()¶ Return a shallow copy of the list.
-
count(value, /)¶ Return number of occurrences of value.
-
extend(iterable, /)¶ Extend list by appending elements from the iterable.
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert(index, object, /)¶ Insert object before index.
-
pop(index=-1, /)¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove(value, /)¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse()¶ Reverse IN PLACE.
-
sort(*, key=None, reverse=False)¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.RouteRecordIndicatorReceived(iterable=(), /)[source]¶ Bases:
digi.xbee.reader.XBeeEventThis 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(object, /)¶ Append object to the end of the list.
-
clear()¶ Remove all items from list.
-
copy()¶ Return a shallow copy of the list.
-
count(value, /)¶ Return number of occurrences of value.
-
extend(iterable, /)¶ Extend list by appending elements from the iterable.
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert(index, object, /)¶ Insert object before index.
-
pop(index=-1, /)¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove(value, /)¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse()¶ Reverse IN PLACE.
-
sort(*, key=None, reverse=False)¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.RouteInformationReceived(iterable=(), /)[source]¶ Bases:
digi.xbee.reader.XBeeEventThis 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(object, /)¶ Append object to the end of the list.
-
clear()¶ Remove all items from list.
-
copy()¶ Return a shallow copy of the list.
-
count(value, /)¶ Return number of occurrences of value.
-
extend(iterable, /)¶ Extend list by appending elements from the iterable.
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert(index, object, /)¶ Insert object before index.
-
pop(index=-1, /)¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove(value, /)¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse()¶ Reverse IN PLACE.
-
sort(*, key=None, reverse=False)¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.RouteReceived(iterable=(), /)[source]¶ Bases:
digi.xbee.reader.XBeeEventThis 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).
See also
-
append(object, /)¶ Append object to the end of the list.
-
clear()¶ Remove all items from list.
-
copy()¶ Return a shallow copy of the list.
-
count(value, /)¶ Return number of occurrences of value.
-
extend(iterable, /)¶ Extend list by appending elements from the iterable.
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert(index, object, /)¶ Insert object before index.
-
pop(index=-1, /)¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove(value, /)¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse()¶ Reverse IN PLACE.
-
sort(*, key=None, reverse=False)¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.InitDiscoveryScan(iterable=(), /)[source]¶ Bases:
digi.xbee.reader.XBeeEventThis 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(object, /)¶ Append object to the end of the list.
-
clear()¶ Remove all items from list.
-
copy()¶ Return a shallow copy of the list.
-
count(value, /)¶ Return number of occurrences of value.
-
extend(iterable, /)¶ Extend list by appending elements from the iterable.
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert(index, object, /)¶ Insert object before index.
-
pop(index=-1, /)¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove(value, /)¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse()¶ Reverse IN PLACE.
-
sort(*, key=None, reverse=False)¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.EndDiscoveryScan(iterable=(), /)[source]¶ Bases:
digi.xbee.reader.XBeeEventThis 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(object, /)¶ Append object to the end of the list.
-
clear()¶ Remove all items from list.
-
copy()¶ Return a shallow copy of the list.
-
count(value, /)¶ Return number of occurrences of value.
-
extend(iterable, /)¶ Extend list by appending elements from the iterable.
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert(index, object, /)¶ Insert object before index.
-
pop(index=-1, /)¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove(value, /)¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse()¶ Reverse IN PLACE.
-
sort(*, key=None, reverse=False)¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.FileSystemFrameReceived(iterable=(), /)[source]¶ Bases:
digi.xbee.reader.XBeeEventThis 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.
See also
-
append(object, /)¶ Append object to the end of the list.
-
clear()¶ Remove all items from list.
-
copy()¶ Return a shallow copy of the list.
-
count(value, /)¶ Return number of occurrences of value.
-
extend(iterable, /)¶ Extend list by appending elements from the iterable.
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert(index, object, /)¶ Insert object before index.
-
pop(index=-1, /)¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove(value, /)¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse()¶ Reverse IN PLACE.
-
sort(*, key=None, reverse=False)¶ Stable sort IN PLACE.
-
class
digi.xbee.reader.PacketListener(comm_iface, xbee_device, queue_max_size=None)[source]¶ Bases:
threading.ThreadThis 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
PacketListenerobject 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.
-
property
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_explicit_queue()[source]¶ Returns the explicit packets queue.
- Returns
Explicit packets queue.
- Return type
-
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
-
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
XBeeAPIPacketThe remote XBee device who has sent the packet as a
RemoteXBeeDevice
-
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
-
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
-
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
IOSampleThe remote XBee device who has sent the packet as a
RemoteXBeeDeviceThe time in which the packet was received as an Integer
-
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
-
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
-
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
-
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
-
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
PacketReceivedevent.- Parameters
callback (Function) – Callback to delete.
- Raises
ValueError – If callback is not in the callback list of
PacketReceivedevent.
-
del_packet_received_from_callback(callback)[source]¶ Deletes a callback for the callback list of
PacketReceivedFromevent.- Parameters
callback (Function) – Callback to delete.
- Raises
ValueError – If callback is not in the callback list of
PacketReceivedFromevent.
-
del_data_received_callback(callback)[source]¶ Deletes a callback for the callback list of
DataReceivedevent.- Parameters
callback (Function) – Callback to delete.
- Raises
ValueError – If callback is not in the callback list of
DataReceivedevent.
-
del_modem_status_received_callback(callback)[source]¶ Deletes a callback for the callback list of
ModemStatusReceivedevent.- Parameters
callback (Function) – Callback to delete.
- Raises
ValueError – If callback is not in the callback list of
ModemStatusReceivedevent.
-
del_io_sample_received_callback(callback)[source]¶ Deletes a callback for the callback list of
IOSampleReceivedevent.- Parameters
callback (Function) – Callback to delete.
- Raises
ValueError – If callback is not in the callback list of
IOSampleReceivedevent.
-
del_explicit_data_received_callback(callback)[source]¶ Deletes a callback for the callback list of
ExplicitDataReceivedevent.- Parameters
callback (Function) – Callback to delete.
- Raises
ValueError – If callback is not in the callback list of
ExplicitDataReceivedevent.
-
del_ip_data_received_callback(callback)[source]¶ Deletes a callback for the callback list of
IPDataReceivedevent.- Parameters
callback (Function) – Callback to delete.
- Raises
ValueError – If callback is not in the callback list of
IPDataReceivedevent.
-
del_sms_received_callback(callback)[source]¶ Deletes a callback for the callback list of
SMSReceivedevent.- Parameters
callback (Function) – Callback to delete.
- Raises
ValueError – If callback is not in the callback list of
SMSReceivedevent.
-
del_user_data_relay_received_callback(callback)[source]¶ Deletes a callback for the callback list of
RelayDataReceivedevent.- Parameters
callback (Function) – Callback to delete.
- Raises
ValueError – If callback is not in the callback list of
RelayDataReceivedevent.
-
del_bluetooth_data_received_callback(callback)[source]¶ Deletes a callback for the callback list of
BluetoothDataReceivedevent.- Parameters
callback (Function) – Callback to delete.
- Raises
ValueError – If callback is not in the callback list of
BluetoothDataReceivedevent.
-
del_micropython_data_received_callback(callback)[source]¶ Deletes a callback for the callback list of
MicroPythonDataReceivedevent.- Parameters
callback (Function) – Callback to delete.
- Raises
ValueError – If callback is not in the callback list of
MicroPythonDataReceivedevent.
-
del_socket_state_received_callback(callback)[source]¶ Deletes a callback for the callback list of
SocketStateReceivedevent.- Parameters
callback (Function) – Callback to delete.
- Raises
ValueError – If callback is not in the callback list of
SocketStateReceivedevent.
-
del_socket_data_received_callback(callback)[source]¶ Deletes a callback for the callback list of
SocketDataReceivedevent.- Parameters
callback (Function) – Callback to delete.
- Raises
ValueError – If callback is not in the callback list of
SocketDataReceivedevent.
-
del_socket_data_received_from_callback(callback)[source]¶ Deletes a callback for the callback list of
SocketDataReceivedFromevent.- Parameters
callback (Function) – Callback to delete.
- Raises
ValueError – If callback is not in the callback list of
SocketDataReceivedFromevent.
-
del_route_record_received_callback(callback)[source]¶ Deletes a callback for the callback list of
RouteRecordIndicatorReceivedevent.- Parameters
callback (Function) – Callback to delete.
- Raises
ValueError – If callback is not in the callback list of
RouteRecordIndicatorReceivedevent.
-
del_route_info_callback(callback)[source]¶ Deletes a callback for the callback list of
RouteInformationReceivedevent.- Parameters
callback (Function) – Callback to delete.
- Raises
ValueError – If callback is not in the callback list of
RouteInformationReceivedevent.
-
del_fs_frame_received_callback(callback)[source]¶ Deletes a callback for the callback list of
FileSystemFrameReceivedevent.- Parameters
callback (Function) – Callback to delete.
- Raises
ValueError – If callback is not in the callback list of
FileSystemFrameReceivedevent.
-
get_packet_received_callbacks()[source]¶ Returns the list of registered callbacks for received packets.
- Returns
List of
PacketReceivedevents.- Return type
List
-
get_packet_received_from_callbacks()[source]¶ Returns the list of registered callbacks for received packets.
- Returns
List of
PacketReceivedFromevents.- Return type
List
-
get_data_received_callbacks()[source]¶ Returns the list of registered callbacks for received data.
- Returns
List of
DataReceivedevents.- Return type
List
-
get_modem_status_received_callbacks()[source]¶ Returns the list of registered callbacks for received modem status.
- Returns
List of
ModemStatusReceivedevents.- Return type
List
-
get_io_sample_received_callbacks()[source]¶ Returns the list of registered callbacks for received IO samples.
- Returns
List of
IOSampleReceivedevents.- Return type
List
-
get_explicit_data_received_callbacks()[source]¶ Returns the list of registered callbacks for received explicit data.
- Returns
List of
ExplicitDataReceivedevents.- Return type
List
-
get_ip_data_received_callbacks()[source]¶ Returns the list of registered callbacks for received IP data.
- Returns
List of
IPDataReceivedevents.- Return type
List
-
get_sms_received_callbacks()[source]¶ Returns the list of registered callbacks for received SMS.
- Returns
List of
SMSReceivedevents.- Return type
List
-
get_user_data_relay_received_callbacks()[source]¶ Returns the list of registered callbacks for received user data relay.
- Returns
List of
RelayDataReceivedevents.- Return type
List
-
get_bluetooth_data_received_callbacks()[source]¶ Returns the list of registered callbacks for received Bluetooth data.
- Returns
List of
BluetoothDataReceivedevents.- Return type
List
-
get_micropython_data_received_callbacks()[source]¶ Returns the list of registered callbacks for received MicroPython data.
- Returns
List of
MicroPythonDataReceivedevents.- Return type
List
-
get_socket_state_received_callbacks()[source]¶ Returns the list of registered callbacks for received socket state.
- Returns
List of
SocketStateReceivedevents.- Return type
List
-
get_socket_data_received_callbacks()[source]¶ Returns the list of registered callbacks for received socket data.
- Returns
List of
SocketDataReceivedevents.- Return type
List
-
get_socket_data_received_from_callbacks()[source]¶ Returns the list of registered callbacks for received socket data from.
- Returns
List of
SocketDataReceivedFromevents.- Return type
List
-
get_route_record_received_callbacks()[source]¶ Returns the list of registered callbacks for received route records.
- Returns
List of
RouteRecordIndicatorReceivedevents.- Return type
List
-
get_route_info_callbacks()[source]¶ Returns the list of registered callbacks for received route information packets.
- Returns
List of
RouteInformationReceivedevents.- Return type
List
-
get_fs_frame_received_callbacks()[source]¶ Returns the list of registered callbacks for received file system packets.
- Returns
List of
FileSystemFrameReceivedevents.- Return type
List
-
property
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.
-
property
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.QueueThis class represents an XBee queue.
Class constructor. Instantiates a new
XBeeQueuewith 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.
-
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.
-
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.