Dear Creotom,
The prototype of the sendACK function is below:
virtual void sendACK(const void* buffer = "", uint8_t bufferSize=0);
The parameters are optional and empty by default. So when you call
radio.sendACK() it simply sends back to the last sender, an empty message with the header ACK bit=1, so that original sender knows their sent message was received OK.
To send back a payload along with your ACK, simply do this:
radio.sendACK("myString", myStringLength) //for a simple string
radio.sendACK(buffer, bufferLength) //for any byte buffer
If you have a struct, then use it like this:
radio.sendACK((const void*)(&theData), sizeof(theData))
Note that for sending important data, it would be recommended to first send your empty ACK, then use
sendWithRetry(...) to ensure it gets transmitted using retries.
The ACKs are special 1 time empty messages (no retries to ACKs) that should be kept as short as possible (ie not loaded with a lot of data), to help ensure they get transmitted as quickly as possible and don't spend a "lot of time" in the air (even a few ms extra can make a difference).
On the other end, provided the ACK message is received OK, you will can now check if you have a message using the usual ACKReceived() method:
if (radio.ACKReceived(toNodeId) && radio.DATALEN > 0) ...
where toNodeId is the node Id of the node that the original message was sent to, and from which the ACK was requested.
This call includes a check to receiveDone() so no need to call that again.
So you'd first call your send(toNodeId, buffer, length, 1), then check ACKReceived for up to 30-40 ms (should be sufficient). When the ACK is received, and it contains a payload then proceed to reading the payload as usual, using the radio.DATALEN and radio.DATA[ i ] buffer.
I hope this helps.