Xbee S2 saving payload to a buffer when a connection loss occurs

I have an Arduino Uno connected to a Xbee S2 (router in API mode 2) and it is communicating with a coordinator connected to Raspberry Pi (coordinator in API mode 2). I am able to send and receive packets. I'm working on a wireless sensor network where some sensors are connected to arduino uno and transmit the values through the router (xbee). I'm using Andrew Rapp's arduino-xbee library and on the Pi I am using python-xbee library . But now I want my code to handle a situation where when the connection is broken, the sensor values are stored in a buffer and upon re-establishment of the connection, data from the buffer is sent. I want to do this in Arduino. One chunk of my data looks like this:

uint8_t payload[18] = {'T', 'C', 0, 0, 0, 0, 'H','X', 0, 0, 0, 0, 'L', 'X', 0, 0, 0, 0};

The zeros are replaced with sensor values (I've done that already). I just need a way/code to store each chunk of data in a buffer. I'm not sure how to do this. I check the connection loss by checking the acknowledgement packet (Zigbee transmit status frame). With Andrew's libray it is checked as:

if (xbee.readPacket(500))
{
// got a response!
// should be a znet tx status
if (xbee.getResponse().getApiId() == ZB_TX_STATUS_RESPONSE)
{
xbee.getResponse().getZBTxStatusResponse(txStatus);

// get the delivery status, the fifth byte
if (txStatus.getDeliveryStatus() == SUCCESS)
{
// success. time to celebrate
flashLed(statusLed, 5, 50);
}
else
{
// the remote XBee did not receive our packet. is it powered on?
flashLed(errorLed, 3, 500);
}
}

}

else if (xbee.getResponse().isError())
{
//Serial.print("Error reading packet. Error code: ");
//Serial.println(xbee.getResponse().getErrorCode());
}
else
{
// local XBee did not provide a timely TX Status Response -- should not happen
flashLed(errorLed, 1, 50);
}

I just need some help (a short sample code) on how to accomplish storing data in a buffer and then sending it. Thank you :slight_smile:
The complete code file is attached with this post.

ZB_TX.ino (3.11 KB)

I'm not sure how to do this.

Why not? You just need to make a copy of payload. Given an 18 element array, how many copies can you make? How long will it take to make that many copies?

I just need some help (a short sample code) on how to accomplish storing data in a buffer

Here's a hint. payload is a buffer.

Here's another hint: DO NOT CROSS-POST, CROSS-POSTING WASTES TIME.

(was I too subtle?)