int ConsoleClass::peek() { doBuffer(); if (inBuffered == 0) return -1; // no chars available else return inBuffer[inReadPos]; }
int YunClient::peek() { doBuffer(); if (buffered == 0) return -1; // no chars available else return buffer[readPos]; }
int YunClient::read() { doBuffer(); if (buffered == 0) return -1; // no chars available else { buffered--; return buffer[readPos++]; } }
int ConsoleClass::read() { doBuffer(); if (inBuffered == 0) return -1; // no chars available else { inBuffered--; return inBuffer[inReadPos++]; } }
int BridgeUDP::peek() { if (!opened) return -1; doBuffer(); if (buffered == 0) return -1; // no chars available return buffer[readPos]; }
int BridgeUDP::read() { if (!opened) return -1; doBuffer(); if (buffered == 0) { return -1; // no chars available } buffered--; avail--; return buffer[readPos++]; }
int YunClient::read(uint8_t *buff, size_t size) { int readed = 0; do { if (buffered == 0) { doBuffer(); if (buffered == 0) return readed; } buff[readed++] = buffer[readPos++]; buffered--; } while (readed < size); return readed; }
int File::read(void *buff, uint16_t nbyte) { uint16_t n = 0; uint8_t *p = reinterpret_cast<uint8_t *>(buff); while (n < nbyte) { if (buffered == 0) { doBuffer(); if (buffered == 0) break; } *p++ = buffer[readPos++]; buffered--; n++; } return n; }
int BridgeUDP::read(unsigned char* buff, size_t size) { if (!opened) return -1; size_t readed = 0; do { if (buffered == 0) { doBuffer(); if (buffered == 0) return readed; } buff[readed++] = buffer[readPos++]; buffered--; avail--; } while (readed < size); return readed; }
int YunClient::available() { // Look if there is new data available doBuffer(); return buffered; }
int ConsoleClass::available() { // Look if there is new data available doBuffer(); return inBuffered; }
/********************************************************************************* *Function : int TcpClient::available(void) *Description : Returns the number of bytes available for reading (that is, the amount of data that has been written to the client by the server it is connected to). *Input : none *Output : none *Return : The number of bytes available. *author : robot *date : 2015-02-01 *Others : **********************************************************************************/ int TcpClient::available(void) { // Look if there is new data available doBuffer(); return buffered; }
int Process::available() { // Look if there is new data available doBuffer(); return buffered; }