本文整理汇总了C++中HTTPClient::available方法的典型用法代码示例。如果您正苦于以下问题:C++ HTTPClient::available方法的具体用法?C++ HTTPClient::available怎么用?C++ HTTPClient::available使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTTPClient
的用法示例。
在下文中一共展示了HTTPClient::available方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
int
HTTPClient::clientRead(FILE* stream)
{
if (stream == NULL)
{
return EOF;
}
http_stream_udata* udata = (http_stream_udata*) fdev_get_udata(stream);
HTTPClient* client = udata->client;
if (!client->connected())
{
return EOF;
}
//block until we got a byte
while (client->available() == 0)
{
if (client->connected() == 0)
{
return EOF;
}
};
int result = client->read();
if (result == EOF)
{
return EOF;
}
if (client->debugCommunication)
{
Serial.print((byte) result);
}
//as long as we do not read encoded or it is no % everything is ok
if (udata->encode == 0 || result != '%')
{
return result;
}
else
{
//block until we got the needed bytes
while (client->available() >= 2)
{
if (client->connected() == 0)
{
return EOF;
}
};
char return_value = 0;
for (char i = 0; i < 2; i++)
{
result = client->read();
if (result == EOF)
{
return EOF;
}
else if (result >= 'A' && result <= 'Z')
{
return_value += (1 - i) * 16 * (result - 'A');
}
else if (result >= 'a' && result <= 'z')
{
return_value += (1 - i) * 16 * (result - 'a');
}
else if (result >= '0' && result <= '9')
{
return_value += (1 - i) * 16 * (result - '0');
}
}
return return_value;
}
}