digi.xbee.sender module¶
-
class
digi.xbee.sender.PacketSender(xbee)[source]¶ Bases:
objectClass to send XBee packets.
Class constructor. Instantiates a new
PacketSenderobject with the provided parameters.- Parameters
xbee (
XBeeDevice) – The XBee.
-
send_packet(packet)[source]¶ Sends a packet to the XBee. The packet to send is escaped depending on the current operating mode.
- Parameters
packet (
XBeePacket) – The packet to send.- Raises
InvalidOperatingModeException – If the XBee device’s operating mode is not API or ESCAPED API. This method only checks the cached value of the operating mode.
XBeeException – if the XBee device’s communication interface is closed.
See also
-
class
digi.xbee.sender.SyncRequestSender(xbee, packet_to_send, timeout)[source]¶ Bases:
objectClass to synchronously send XBee packets. This means after sending the packet it waits for its response, if the package includes a frame ID, otherwise it does not wait.
Class constructor. Instantiates a new
SyncRequestSenderobject with the provided parameters.- Parameters
xbee (
XBeeDevice) – The local XBee to send the packet.packet_to_send (
XBeePacket) – The packet to transmit.timeout (Integer) – Number of seconds to wait. -1 to wait indefinitely.
-
send()[source]¶ Sends the packet and waits for its corresponding response.
- Returns
Received response packet.
- Return type
- Raises
InvalidOperatingModeException – If the XBee device’s operating mode is not API or ESCAPED API. This method only checks the cached value of the operating mode.
TimeoutException – If the response is not received in the configured timeout.
XBeeException – If the XBee device’s communication interface is closed.
See also
-
property
xbee¶ Returns the local XBee to send the packet.
- Returns
Local XBee device.
- Return type
-
property
packet¶ Returns the packet to send.
- Returns
Packet to send.
- Return type
-
property
timeout¶ Returns the maximum number of seconds to wait for a response.
- Returns
Timeout to wait for a response.
- Return type
Integer