Sodaq_AT_Device.cpp
size_t Sodaq_AT_Device::readBytes(uint8_t* buffer, size_t length, uint32_t timeout)
{
    size_t count = 0;

    while (count < length) {
        int c = timedRead(timeout);

        if (c < 0) {
            break;
        }

        *buffer++ = static_cast<uint8_t>(c);
        count++;
    }

    // TODO distinguise timeout from empty string?
    // TODO return error for overflow?
    return count;
}
// Fills the given "buffer" with up to "length" characters read from the modem stream.
// It stops when a character read times out or "length" characters have been read.
// Returns the number of characters written to the buffer.
Fills the given "buffer" with up to "length" characters read from the modem stream.
It stops when a character read times out or "length" characters have been read.
Returns the number of characters written to the buffer.
Fills the given " buffer " with up to " length " characters read from the modem stream . It stops when a character read times out or " length " characters have been read . Returns the number of characters written to the buffer .
size_t Sodaq_AT_Device::readBytes(uint8_t* buffer, size_t length, uint32_t timeout)
{
    size_t count = 0;
    while (count < length) {
        int c = timedRead(timeout);
        if (c < 0) {
            break;
        }
        *buffer++ = static_cast<uint8_t>(c);
        count++;
    }
    return count;
}
size_t Sodaq_AT_Device :: readBytes ( uint8_t * buffer , size_t length , uint32_t timeout ) { size_t count = 0 ; while ( count < length ) { int c = timedRead ( timeout ) ; if ( c < 0 ) { break ; } * buffer ++ = static_cast < uint8_t > ( c ) ; count ++ ; } return count ; }
Fills the given "buffer" with up to "length" characters read from the modem stream.
Fills the given " buffer " with up to " length " characters read from the modem stream .
// TODO distinguise timeout from empty string? // TODO return error for overflow?