static void dispatchNVReadItem(Parcel &p, RequestInfo *pRI);
static void dispatchNVWriteItem(Parcel &p, RequestInfo *pRI);
static void dispatchUiccSubscripton(Parcel &p, RequestInfo *pRI);
+static void dispatchSimAuthentication(Parcel &p, RequestInfo *pRI);
+static void dispatchDataProfile(Parcel &p, RequestInfo *pRI);
static int responseInts(Parcel &p, void *response, size_t responselen);
static int responseStrings(Parcel &p, void *response, size_t responselen);
static int responseString(Parcel &p, void *response, size_t responselen);
static int responseSimRefresh(Parcel &p, void *response, size_t responselen);
static int responseCellInfoList(Parcel &p, void *response, size_t responselen);
static int responseHardwareConfig(Parcel &p, void *response, size_t responselen);
+static int responseDcRtInfo(Parcel &p, void *response, size_t responselen);
static int decodeVoiceRadioTechnology (RIL_RadioState radioState);
static int decodeCdmaSubscriptionSource (RIL_RadioState radioState);
return;
}
+static void dispatchSimAuthentication(Parcel &p, RequestInfo *pRI)
+{
+ RIL_SimAuthentication pf;
+ int32_t t;
+ status_t status;
+
+ memset(&pf, 0, sizeof(pf));
+
+ status = p.readInt32(&t);
+ pf.authContext = (int) t;
+ pf.authData = strdupReadString(p);
+ pf.aid = strdupReadString(p);
+
+ startRequest;
+ appendPrintBuf("authContext=%s, authData=%s, aid=%s", pf.authContext, pf.authData, pf.aid);
+ closeRequest;
+ printRequest(pRI->token, pRI->pCI->requestNumber);
+
+ if (status != NO_ERROR) {
+ goto invalid;
+ }
+ CALL_ONREQUEST(pRI->pCI->requestNumber, &pf, sizeof(pf), pRI, pRI->socket_id);
+
+#ifdef MEMSET_FREED
+ memsetString(pf.authData);
+ memsetString(pf.aid);
+#endif
+
+ free(pf.authData);
+ free(pf.aid);
+
+#ifdef MEMSET_FREED
+ memset(&pf, 0, sizeof(pf));
+#endif
+
+ return;
+invalid:
+ invalidCommandBlock(pRI);
+ return;
+}
+
+static void dispatchDataProfile(Parcel &p, RequestInfo *pRI) {
+ int32_t t;
+ status_t status;
+ int32_t num;
+
+ status = p.readInt32(&num);
+ if (status != NO_ERROR) {
+ goto invalid;
+ }
+
+ {
+ RIL_DataProfileInfo dataProfiles[num];
+ RIL_DataProfileInfo *dataProfilePtrs[num];
+
+ startRequest;
+ for (int i = 0 ; i < num ; i++ ) {
+ dataProfilePtrs[i] = &dataProfiles[i];
+
+ status = p.readInt32(&t);
+ dataProfiles[i].profileId = (int) t;
+
+ dataProfiles[i].apn = strdupReadString(p);
+ dataProfiles[i].protocol = strdupReadString(p);
+ status = p.readInt32(&t);
+ dataProfiles[i].authType = (int) t;
+
+ dataProfiles[i].user = strdupReadString(p);
+ dataProfiles[i].password = strdupReadString(p);
+
+ status = p.readInt32(&t);
+ dataProfiles[i].type = (int) t;
+
+ status = p.readInt32(&t);
+ dataProfiles[i].maxConnsTime = (int) t;
+ status = p.readInt32(&t);
+ dataProfiles[i].maxConns = (int) t;
+ status = p.readInt32(&t);
+ dataProfiles[i].waitTime = (int) t;
+
+ status = p.readInt32(&t);
+ dataProfiles[i].enabled = (int) t;
+
+ appendPrintBuf("%s [%d: profileId=%d, apn =%s, protocol =%s, authType =%d, \
+ user =%s, password =%s, type =%d, maxConnsTime =%d, maxConns =%d, \
+ waitTime =%d, enabled =%d]", printBuf, i, dataProfiles[i].profileId,
+ dataProfiles[i].apn, dataProfiles[i].protocol, dataProfiles[i].authType,
+ dataProfiles[i].user, dataProfiles[i].password, dataProfiles[i].type,
+ dataProfiles[i].maxConnsTime, dataProfiles[i].maxConns,
+ dataProfiles[i].waitTime, dataProfiles[i].enabled);
+ }
+ closeRequest;
+ printRequest(pRI->token, pRI->pCI->requestNumber);
+
+ if (status != NO_ERROR) {
+ goto invalid;
+ }
+ CALL_ONREQUEST(pRI->pCI->requestNumber,
+ dataProfilePtrs,
+ num * sizeof(RIL_DataProfileInfo *),
+ pRI, pRI->socket_id);
+
+#ifdef MEMSET_FREED
+ memset(dataProfiles, 0, num * sizeof(RIL_DataProfileInfo));
+ memset(dataProfilePtrs, 0, num * sizeof(RIL_DataProfileInfo *));
+#endif
+ }
+
+ return;
+
+invalid:
+ invalidCommandBlock(pRI);
+ return;
+}
+
static int
blockingWrite(int fd, const void *buffer, size_t len) {
size_t writeOffset = 0;
return RIL_ERRNO_INVALID_RESPONSE;
}
if (responselen % sizeof(int) != 0) {
- RLOGE("invalid response length %d expected multiple of %d\n",
+ RLOGE("responseInts: invalid response length %d expected multiple of %d\n",
(int)responselen, (int)sizeof(int));
return RIL_ERRNO_INVALID_RESPONSE;
}
return RIL_ERRNO_INVALID_RESPONSE;
}
if (responselen % sizeof(char *) != 0) {
- RLOGE("invalid response length %d expected multiple of %d\n",
+ RLOGE("responseStrings: invalid response length %d expected multiple of %d\n",
(int)responselen, (int)sizeof(char *));
return RIL_ERRNO_INVALID_RESPONSE;
}
}
if (responselen % sizeof (RIL_Call *) != 0) {
- RLOGE("invalid response length %d expected multiple of %d\n",
+ RLOGE("responseCallList: invalid response length %d expected multiple of %d\n",
(int)responselen, (int)sizeof (RIL_Call *));
return RIL_ERRNO_INVALID_RESPONSE;
}
}
if (responselen % sizeof(RIL_Data_Call_Response_v4) != 0) {
- RLOGE("invalid response length %d expected multiple of %d",
+ RLOGE("responseDataCallListV4: invalid response length %d expected multiple of %d",
(int)responselen, (int)sizeof(RIL_Data_Call_Response_v4));
return RIL_ERRNO_INVALID_RESPONSE;
}
+ // Write version
+ p.writeInt32(4);
+
int num = responselen / sizeof(RIL_Data_Call_Response_v4);
p.writeInt32(num);
static int responseDataCallListV6(Parcel &p, void *response, size_t responselen)
{
- if (response == NULL && responselen != 0) {
+ if (response == NULL && responselen != 0) {
RLOGE("invalid response: NULL");
return RIL_ERRNO_INVALID_RESPONSE;
}
if (responselen % sizeof(RIL_Data_Call_Response_v6) != 0) {
- RLOGE("invalid response length %d expected multiple of %d",
+ RLOGE("responseDataCallListV6: invalid response length %d expected multiple of %d",
(int)responselen, (int)sizeof(RIL_Data_Call_Response_v6));
return RIL_ERRNO_INVALID_RESPONSE;
}
+ // Write version
+ p.writeInt32(6);
+
int num = responselen / sizeof(RIL_Data_Call_Response_v6);
p.writeInt32(num);
static int responseDataCallList(Parcel &p, void *response, size_t responselen)
{
- // Write version
- p.writeInt32(s_callbacks.version);
-
if (s_callbacks.version < 5) {
+ RLOGD("responseDataCallList: v4");
return responseDataCallListV4(p, response, responselen);
} else {
if (response == NULL && responselen != 0) {
// Support v6 or v9 with new rils
if (responselen % sizeof(RIL_Data_Call_Response_v6) == 0) {
+ RLOGD("responseDataCallList: v6");
return responseDataCallListV6(p, response, responselen);
}
if (responselen % sizeof(RIL_Data_Call_Response_v9) != 0) {
- RLOGE("invalid response length %d expected multiple of %d",
+ RLOGE("responseDataCallList: invalid response length %d expected multiple of %d",
(int)responselen, (int)sizeof(RIL_Data_Call_Response_v9));
return RIL_ERRNO_INVALID_RESPONSE;
}
+ // Write version
+ p.writeInt32(10);
+
int num = responselen / sizeof(RIL_Data_Call_Response_v9);
p.writeInt32(num);
}
if (responselen % sizeof(RIL_CallForwardInfo *) != 0) {
- RLOGE("invalid response length %d expected multiple of %d",
+ RLOGE("responseCallForwards: invalid response length %d expected multiple of %d",
(int)responselen, (int)sizeof(RIL_CallForwardInfo *));
return RIL_ERRNO_INVALID_RESPONSE;
}
}
if (responselen % sizeof (RIL_NeighboringCell *) != 0) {
- RLOGE("invalid response length %d expected multiple of %d\n",
+ RLOGE("responseCellList: invalid response length %d expected multiple of %d\n",
(int)responselen, (int)sizeof (RIL_NeighboringCell *));
return RIL_ERRNO_INVALID_RESPONSE;
}
}
if (responselen != sizeof (RIL_CDMA_InformationRecords)) {
- RLOGE("invalid response length %d expected multiple of %d\n",
+ RLOGE("responseCdmaInformationRecords: invalid response length %d expected multiple of %d\n",
(int)responselen, (int)sizeof (RIL_CDMA_InformationRecords *));
return RIL_ERRNO_INVALID_RESPONSE;
}
}
if (responselen % sizeof(RIL_CellInfo) != 0) {
- RLOGE("invalid response length %d expected multiple of %d",
+ RLOGE("responseCellInfoList: invalid response length %d expected multiple of %d",
(int)responselen, (int)sizeof(RIL_CellInfo));
return RIL_ERRNO_INVALID_RESPONSE;
}
}
if (responselen % sizeof(RIL_HardwareConfig) != 0) {
- RLOGE("invalid response length %d expected multiple of %d",
+ RLOGE("responseHardwareConfig: invalid response length %d expected multiple of %d",
(int)responselen, (int)sizeof(RIL_HardwareConfig));
return RIL_ERRNO_INVALID_RESPONSE;
}
return 0;
}
+static int responseDcRtInfo(Parcel &p, void *response, size_t responselen)
+{
+ int num = responselen / sizeof(RIL_DcRtInfo);
+ if ((responselen % sizeof(RIL_DcRtInfo) != 0) || (num != 1)) {
+ RLOGE("responseDcRtInfo: invalid response length %d expected multiple of %d",
+ (int)responselen, (int)sizeof(RIL_DcRtInfo));
+ return RIL_ERRNO_INVALID_RESPONSE;
+ }
+
+ startResponse;
+ RIL_DcRtInfo *pDcRtInfo = (RIL_DcRtInfo *)response;
+ p.writeInt64(pDcRtInfo->time);
+ p.writeInt32(pDcRtInfo->powerState);
+ appendPrintBuf("%s[time=%d,powerState=%d]", printBuf,
+ pDcRtInfo->time,
+ pDcRtInfo->powerState);
+ closeResponse;
+
+ return 0;
+}
+
/**
* A write on the wakeup fd is done just to pop us out of select()
* We empty the buffer here and then ril_event will reset the timers on the
pRI = (RequestInfo *)t;
+ if (!checkAndDequeueRequestInfo(pRI)) {
+ RLOGE ("RIL_onRequestComplete: invalid RIL_Token");
+ return;
+ }
+
socket_id = pRI->socket_id;
#if (SIM_COUNT >= 2)
if (socket_id == RIL_SOCKET_2) {
#endif
RLOGD("RequestComplete, %s", rilSocketIdToString(socket_id));
- if (!checkAndDequeueRequestInfo(pRI)) {
- RLOGE ("RIL_onRequestComplete: invalid RIL_Token");
- return;
- }
-
if (pRI->local > 0) {
// Locally issued command...void only!
// response does not go back up the command socket
case RIL_REQUEST_ALLOW_DATA: return "ALLOW_DATA";
case RIL_REQUEST_GET_HARDWARE_CONFIG: return "GET_HARDWARE_CONFIG";
case RIL_REQUEST_SIM_AUTHENTICATION: return "SIM_AUTHENTICATION";
+ case RIL_REQUEST_GET_DC_RT_INFO: return "GET_DC_RT_INFO";
+ case RIL_REQUEST_SET_DC_RT_INFO_RATE: return "SET_DC_RT_INFO_RATE";
+ case RIL_REQUEST_SET_DATA_PROFILE: return "SET_DATA_PROFILE";
case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED: return "UNSOL_RESPONSE_RADIO_STATE_CHANGED";
case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED: return "UNSOL_RESPONSE_CALL_STATE_CHANGED";
case RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED: return "UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED";
case RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED: return "UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED";
case RIL_UNSOL_SRVCC_STATE_NOTIFY: return "UNSOL_SRVCC_STATE_NOTIFY";
case RIL_UNSOL_HARDWARE_CONFIG_CHANGED: return "HARDWARE_CONFIG_CHANGED";
+ case RIL_UNSOL_DC_RT_INFO_CHANGED: return "UNSOL_DC_RT_INFO_CHANGED";
default: return "<unknown request>";
}
}