Skip to content

Commit 67adb10

Browse files
Add XBeeWithCallbacks::sendAndWait()
This just combines send() and waitForStatus() in one convenient call.
1 parent 979cc4a commit 67adb10

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

XBee.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,18 @@ class XBeeWithCallbacks : public XBee {
887887
*/
888888
void loop();
889889

890+
/**
891+
* Sends a XBeeRequest (TX packet) out the serial port, and wait
892+
* for a status response API frame (up until the given timeout).
893+
* Essentially this just calls send() and waitForStatus().
894+
* See waitForStatus for the meaning of the return value and
895+
* more details.
896+
*/
897+
uint8_t sendAndWait(XBeeRequest &request, uint16_t timeout) {
898+
send(request);
899+
return waitForStatus(request.getFrameId(), timeout);
900+
}
901+
890902
/**
891903
* Wait for a status API response with the given frameId and
892904
* return the status from the packet (for ZB_TX_STATUS_RESPONSE,

0 commit comments

Comments
 (0)