xbee ZBRxResponse(rx)

Hi, i have a few questions about the frame of the Rx Rsponse. When i get a packet by xbee.readPacket() i can read the hole frame. when i look at the single bytes of the frame i see my payload starting with byte 18 when i look up the frame maker of Digi the payload starts at byte 16 ? i googled a lot and i get a lot of diffrent informations about the frame arrangement.So for my project i would need a constant to identify the start of the payload for diffrent sensor nodes. i'm using the xbee api libary and when i print rx.getData() i see the hole frame... but i expected to receive only the payload ? i would appreciate if someone would have a tutorial or some information to solve my problem.

Thanks in advance

Are you using XBee ZB modules (fka Series 2) ? If so the ZigBee Receive Packet frame (type 0x90, see the product manual, page 113) has 14 bytes before the payload BUT if some characters are escaped it could be more (you are using AP=2, yes?).

This will return the first byte of the payload:

ZBRxResponse rx;
uint8_t foo = rx.getData(0);

Not sure how you're printing, but I don't think that

Serial.print( rx.getData() );

is a good idea because it will probably just print until it hits a zero byte, which is not necessarily the end of the frame.

These functions may be helpful

uint8_t  getDataLength ()     //Returns the length of the payload.
uint8_t  getDataOffset ()     //Returns the position in the frame data where the data begins.