src/atchannel.c
/**
 * Sends string s to the radio with a \r appended.
 * Returns AT_ERROR_* on error, AT_SUCCESS on success
 *
 * This function exists because as of writing, android libc does not
 * have buffered stdio.
 */
Sends string s to the radio with a \r appended.
Returns AT_ERROR_* on error, AT_SUCCESS on success

This function exists because as of writing, android libc does not
have buffered stdio.
Sends string s to the radio with a \ r appended . Returns AT_ERROR_ * on error AT_SUCCESS on success This function exists because as of writing android libc does not have buffered stdio .
static ATReturn writeline(ATChannel* atch, const char *s)
{
    size_t cur = 0;
    size_t len = strlen(s);
    ssize_t written;
    if (atch->fd < 0 || atch->impl->readerClosed) {
        return AT_ERROR_CHANNEL_CLOSED;
    }
    RLOGD(atch, "AT> %s", s);
    AT_DUMP( atch, ">> ", s, strlen(s) );
    while (cur < len) {
        do {
            written = write(atch->fd, s + cur, len - cur);
        } while (written < 0 && errno == EINTR);
        if (written < 0) {
            return AT_ERROR_GENERIC;
        }
        cur += (size_t)written;
    }
    do {
        written = write(atch->fd, "\r" , 1);
    } while ((written < 0 && errno == EINTR) || (written == 0));
    if (written < 0) {
        return AT_ERROR_GENERIC;
    }
    return AT_SUCCESS;
}
static ATReturn writeline ( ATChannel * atch , const char * s ) { size_t cur = 0 ; size_t len = strlen ( s ) ; ssize_t written ; if ( atch -> fd < 0 || atch -> impl -> readerClosed ) { return AT_ERROR_CHANNEL_CLOSED ; } RLOGD ( atch , " " , s ) ; AT_DUMP ( atch , " " , s , strlen ( s ) ) ; while ( cur < len ) { do { written = write ( atch -> fd , s + cur , len - cur ) ; } while ( written < 0 && errno == EINTR ) ; if ( written < 0 ) { return AT_ERROR_GENERIC ; } cur += ( size_t ) written ; } do { written = write ( atch -> fd , " \r " , 1 ) ; } while ( ( written < 0 && errno == EINTR ) || ( written == 0 ) ) ; if ( written < 0 ) { return AT_ERROR_GENERIC ; } return AT_SUCCESS ; }
Sends string s to the radio with a \r appended.
Sends string s to the radio with a \ r appended .
/* the main string */ /* the \r  */