digi.xbee.comm_interface module¶
-
class
digi.xbee.comm_interface.XBeeCommunicationInterface[source]¶ Bases:
objectThis class represents the way the communication with the local XBee is established.
-
abstract
open()[source]¶ Establishes the underlying hardware communication interface.
Subclasses may throw specific exceptions to signal implementation specific errors.
-
abstract
close()[source]¶ Terminates the underlying hardware communication interface.
Subclasses may throw specific exceptions to signal implementation specific hardware errors.
-
abstract property
is_interface_open¶ Returns whether the underlying hardware communication interface is active or not.
- Returns
Boolean.
Trueif the interface is active,Falseotherwise.
-
abstract
wait_for_frame(operating_mode)[source]¶ Reads the next API frame packet.
- This method blocks until:
A complete frame is read, in which case returns it.
The configured timeout goes by, in which case returns None.
Another thread calls quit_reading, in which case returns None.
This method is not thread-safe, so no more than one thread should invoke it at the same time.
Subclasses may throw specific exceptions to signal implementation specific hardware errors.
- Parameters
operating_mode (
OperatingMode) – the operating mode of the XBee connected to this hardware interface. Note: if this parameter does not match the connected XBee configuration, the behavior is undefined.- Returns
the read packet as bytearray if a packet is read,
Noneotherwise.- Return type
Bytearray
-
abstract
quit_reading()[source]¶ Makes the thread (if any) blocking on wait_for_frame return.
If a thread was blocked on wait_for_frame, this method blocks (for a maximum of ‘timeout’ seconds) until the blocked thread is resumed.
-
abstract
write_frame(frame)[source]¶ Writes an XBee frame to the underlying hardware interface.
Subclasses may throw specific exceptions to signal implementation specific hardware errors.
- Parameters
frame (
Bytearray) – The XBee API frame packet to write. If the bytearray does not correctly represent an XBee frame, the behaviour is undefined.
-
abstract property
timeout¶ Returns the read timeout.
- Returns
read timeout in seconds.
- Return type
Integer
-
abstract