Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #43 from driftersprt/1067629
Browse files Browse the repository at this point in the history
Bug 1067629 - Introduce a new unsolicited AT response (+CFUN: 1) to indicate radio is enabled. r=echen
  • Loading branch information
rvandermeulen committed Feb 24, 2015
2 parents c397182 + deddf86 commit f810aba
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions reference-ril/reference-ril.c
Expand Up @@ -4415,8 +4415,35 @@ static void onUnsolicited (const char *s, const char *sms_pdu)
}
free(line);
RIL_onUnsolicitedResponse(RIL_UNSOL_CDMA_PRL_CHANGED, &version, sizeof(version));
} else if (strStartsWith(s, "+CFUN: 0")) {
setRadioState(RADIO_STATE_OFF);
} else if (strStartsWith(s, "+CFUN:")) {
int state = -1;
line = p = strdup(s);
if (!line) {
RLOGE("+CFUN: Unable to allocate memory");
return;
}
if (at_tok_start(&p) < 0) {
RLOGE("invalid +CFUN response: %s", s);
free(line);
return;
}
if (at_tok_nextint(&p, &state) < 0) {
RLOGE("invalid +CFUN response: %s", s);
free(line);
return;
}
free(line);
switch (state) {
case 0:
setRadioState(RADIO_STATE_OFF);
break;
case 1:
setRadioState(RADIO_STATE_ON);
break;
default:
RLOGE("invalid +CFUN response: %s", s);
return;
}
} else if (strStartsWith(s, "+CSQ:")) {
RIL_SignalStrength_v6 response;
line = p = strdup(s);
Expand Down

0 comments on commit f810aba

Please sign in to comment.