1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Fix bug on client.available() to retrun the number of bytes available

This commit is contained in:
Mimmo La Fauci 2013-03-10 22:37:54 +01:00
parent 863b47ad5e
commit 8862a7d54e
2 changed files with 7 additions and 12 deletions

View File

@ -122,7 +122,7 @@ uint8_t ServerDrv::getClientState(uint8_t sock)
return _data;
}
uint8_t ServerDrv::availData(uint8_t sock)
uint16_t ServerDrv::availData(uint8_t sock)
{
WAIT_FOR_SLAVE_SELECT();
// Send Command
@ -133,19 +133,14 @@ uint8_t ServerDrv::availData(uint8_t sock)
SpiDrv::waitForSlaveReady();
// Wait for reply
uint8_t _data = 0;
uint8_t _dataLen = 0;
if (!SpiDrv::waitResponseCmd(AVAIL_DATA_TCP_CMD, PARAM_NUMS_1, &_data, &_dataLen))
{
WARN("error waitResponse");
}
uint16_t len = 0;
SpiDrv::waitResponseCmd(AVAIL_DATA_TCP_CMD, PARAM_NUMS_1, (uint8_t*)&len, &_dataLen);
SpiDrv::spiSlaveDeselect();
if (_dataLen!=0)
{
return (_data == 1);
}
return false;
return len;
}
bool ServerDrv::getData(uint8_t sock, uint8_t *data, uint8_t peek)

View File

@ -31,7 +31,7 @@ public:
static bool sendUdpData(uint8_t sock);
static uint8_t availData(uint8_t sock);
static uint16_t availData(uint8_t sock);
static uint8_t checkDataSent(uint8_t sock);
};