Hi,
I've realized that after sending multiple commands at once, the AF_DATA_REQUEST_SRSP responds with a 0x11 status; that looking at the zstack.h file it means that the buffer is full.
In my source code (below the code snippet) what I do is:
- I send the first command.
- Get the status.
- if it's equal to 0x11 it means that the buffer is full, so I just wait for 2 seconds and resend the command.
- And restart from the beginning
But It seems like 2 seconds are not enough for the buffer to empty.
I can't afford to wait for the Data Confirm from the ZED, or any sort of ACK.
public synchronized boolean setSetPoint(int nwkAddr, float temperature)
{
int valoreFormatoZStack = (int)(temperature * 100);
int[] pacchetto = DoPacket.AF_DATA_REQUEST_WRITE_ATTRIBUTE( nwkAddr,
DoPacket.HVAC,
DoPacket.OCCUPIED_HEATING_SETPOINT,
valoreFormatoZStack);
if(!this.writeArray(pacchetto)){
return false;
}
boolean status = waitForCommandResponse();
if(this.lastResponseMessage == 0x11)
{
try
{
Thread.sleep(2000);
}
catch(InterruptedException thError)
{
return false;
}
//Recursive call.
this.setSetPoint(nwkAddr, temperature);
}
return status;
}