XBee API mode library
Diff: Receive.cpp
- Revision:
- 3:8453df14bd30
- Parent:
- 0:0232a97b3883
- Child:
- 4:c05dc188f177
--- a/Receive.cpp Thu Sep 20 02:44:49 2012 +0000 +++ b/Receive.cpp Thu Sep 20 10:50:00 2012 +0000 @@ -56,15 +56,15 @@ /* * function seekFor() - * - * searches buf[] in range between the index out and in for a specified frametype packet. + * searches buf[] in range between the index out and in for a frame of specified type and id. * if the frame is found before timeout, returns the index of the packet, otherwise -1. * */ -int XBee::seekFor(FrameType type, float timeout) { +int XBee::seekFor(FrameType type, char id, float timeout) { int index = out; while (true) { if (index != in) { - if (getFrameType(buf[INDEX(index + 2)]) == type) + if (getFrameType(buf[INDEX(index + 2)]) == type && (id == 0 || buf[INDEX(index + 3)] == id)) return index; int size = SIZE(buf, index); index = INDEX(index + 2 + size);