libxbee3 icon indicating copy to clipboard operation
libxbee3 copied to clipboard

xbeeZB source route packet is corrupt

Open mechazine opened this issue 8 years ago • 0 comments

The current xbee_sZB_createSourceRoute_tx_func in master overwrites the last byte of the last 16-bit address in the source route list as well as the last byte of the 16-bit destination address.

The offset 11 should be 12 as far as I can tell, and I am not sure why the last byte was overwritten by 0. The spec doesn't seem to indicate that.

This is the diff of my change.

diff --git a/modes/xbeeZB/route.c b/modes/xbeeZB/route.c
index cede0a9..1c94638 100644
--- a/modes/xbeeZB/route.c
+++ b/modes/xbeeZB/route.c
@@ -51,8 +51,8 @@ xbee_err xbee_sZB_createSourceRoute_tx_func(struct xbee *xbee, struct xbee_con *
        iBuf->data[0] = identifier;
        iBuf->data[1] = 0; /* the datasheet specifies that the frameID is always zero */
        memcpy(&(iBuf->data[2]), buf, len);
-       iBuf->data[11] = 0; /* the datasheet specifies that this is zero */
-       iBuf->data[bufLen - 1] = '\0';
+       iBuf->data[12] = 0; /* the datasheet specifies that this is zero */
+       //iBuf->data[bufLen - 1] = '\0';
 
        *oBuf = iBuf;
 

mechazine avatar Dec 28 '17 03:12 mechazine