static void *readerLoop(void *arg) { RILChannelCtx *p_channel = (RILChannelCtx *)arg; const char *readerName = p_channel->myName; RLOGI("%s is up", readerName); for (;; ) { const char *line; line = readline(p_channel); RLOGD("%s:%s", readerName, line); if (line == NULL) break; if (isSMSUnsolicited(line)) { char *line1; const char *line2; RLOGD("SMS Urc Received!"); // The scope of string returned by 'readline()' is valid only // till next call to 'readline()' hence making a copy of line // before calling readline again. line1 = strdup(line); line2 = readline(p_channel); if (line2 == NULL) { RLOGE("NULL line found in %s", readerName); break; } if (p_channel->unsolHandler != NULL) { RLOGD("%s: line1:%s,line2:%s", readerName, line1, line2); p_channel->unsolHandler(line1, line2, p_channel); } free(line1); } else { pthread_mutex_lock(&p_channel->commandmutex); RLOGD("%s Enter processLine", readerName); processLine(line, p_channel); pthread_mutex_unlock(&p_channel->commandmutex); } } RLOGE("%s Closed", readerName); onReaderClosed(p_channel); return NULL; }
static void *readerLoop(void *arg) { for (;;) { const char * line; line = readline(); if (line == NULL) { LOGD("LINE NULL READERLOOP"); break; } if(isSMSUnsolicited(line)) { char *line1; const char *line2; // The scope of string returned by 'readline()' is valid only // till next call to 'readline()' hence making a copy of line // before calling readline again. line1 = strdup(line); line2 = readline(); if (line2 == NULL) { break; } if (s_unsolHandler != NULL) { s_unsolHandler (line1, line2); } free(line1); } else { processLine(line); } #ifdef HAVE_ANDROID_OS if (s_ackPowerIoctl > 0) { /* acknowledge that bytes have been read and processed */ ioctl(s_fd, OMAP_CSMI_TTY_ACK, &s_readCount); s_readCount = 0; } #endif /*HAVE_ANDROID_OS*/ } onReaderClosed(); return NULL; }
static void *readerLoop(void *arg) { struct atcontext *ac = NULL; ALOGI("Entering readerloop!"); setAtContext((struct atcontext *) arg); ac = getAtContext(); for (;;) { const char * line; line = readline(); if (line == NULL) break; if(isSMSUnsolicited(line)) { char *line1; const char *line2; /* The scope of string returned by 'readline()' is valid only until next call to 'readline()' hence making a copy of line before calling readline again. */ line1 = strdup(line); line2 = readline(); if (line2 == NULL) { free(line1); break; } if (ac->unsolHandler != NULL) ac->unsolHandler(line1, line2); free(line1); } else processLine(line); } onReaderClosed(); ALOGI("Exiting readerloop!"); return NULL; }
static void *readerLoop(void *arg) { for (;;) { const char * line; line = readline(); if (line == NULL) { break; } if(isSMSUnsolicited(line)) { char *line1; const char *line2; // The scope of string returned by 'readline()' is valid only // till next call to 'readline()' hence making a copy of line // before calling readline again. line1 = strdup(line); line2 = readline(); if (line2 == NULL) { break; } if (s_unsolHandler != NULL) { s_unsolHandler (line1, line2); } free(line1); } else { processLine(line); } } onReaderClosed(); return NULL; }