/*******************************************************************/
static int sendResponse (Parcel &p, RIL_SOCKET_ID socket_id);
-static void dispatchVoid (Parcel& p, RequestInfo *pRI);
-static void dispatchString (Parcel& p, RequestInfo *pRI);
-static void dispatchStrings (Parcel& p, RequestInfo *pRI);
-static void dispatchInts (Parcel& p, RequestInfo *pRI);
-static void dispatchDial (Parcel& p, RequestInfo *pRI);
-static void dispatchSIM_IO (Parcel& p, RequestInfo *pRI);
-static void dispatchSIM_APDU (Parcel& p, RequestInfo *pRI);
-static void dispatchCallForward(Parcel& p, RequestInfo *pRI);
-static void dispatchRaw(Parcel& p, RequestInfo *pRI);
-static void dispatchSmsWrite (Parcel &p, RequestInfo *pRI);
-static void dispatchDataCall (Parcel& p, RequestInfo *pRI);
-static void dispatchSetInitialAttachApn (Parcel& p, RequestInfo *pRI);
-static void dispatchCdmaSms(Parcel &p, RequestInfo *pRI);
-static void dispatchImsSms(Parcel &p, RequestInfo *pRI);
-static void dispatchImsCdmaSms(Parcel &p, RequestInfo *pRI, uint8_t retry, int32_t messageRef);
-static void dispatchImsGsmSms(Parcel &p, RequestInfo *pRI, uint8_t retry, int32_t messageRef);
-static void dispatchCdmaSmsAck(Parcel &p, RequestInfo *pRI);
-static void dispatchGsmBrSmsCnf(Parcel &p, RequestInfo *pRI);
-static void dispatchCdmaBrSmsCnf(Parcel &p, RequestInfo *pRI);
-static void dispatchRilCdmaSmsWriteArgs(Parcel &p, RequestInfo *pRI);
-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 void dispatchRadioCapability(Parcel &p, RequestInfo *pRI);
-static void dispatchCarrierRestrictions(Parcel &p, RequestInfo *pRI);
-static int responseInts(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen);
-static int responseFailCause(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen);
-static int responseStrings(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen);
-static int responseString(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen);
-static int responseVoid(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen);
-static int responseCallList(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen);
-static int responseSMS(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen);
-static int responseRaw(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen);
-static int responseSsn(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen);
-static int responseCdmaSms(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen);
-static int responseCdmaInformationRecords(Parcel &p, int slotId, int requestNumber,
- int responseType, int token, RIL_Errno e,void *response, size_t responselen);
-static int responseRilSignalStrength(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e,void *response, size_t responselen);
-static int responseCallRing(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen);
-static int responseCdmaSignalInfoRecord(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e,void *response, size_t responselen);
-static int responseCdmaCallWaiting(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e,void *response, size_t responselen);
-static int responseSimRefresh(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen);
-static int responseCellInfoList(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e, void *response, size_t responselen);
-static int responseHardwareConfig(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e, void *response, size_t responselen);
-static int responseDcRtInfo(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen);
-static int responseRadioCapability(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e, void *response, size_t responselen);
-static int responseSSData(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen);
-static int responseLceData(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen);
-static int responsePcoData(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen);
-
static void grabPartialWakeLock();
void releaseWakeLock();
static void wakeTimeoutCallback(void *);
ret = pthread_mutex_unlock(pendingRequestsMutexHook);
assert (ret == 0);
- pRI->pCI->dispatchFunction(p, pRI);
-
return 0;
}
pRI->token, requestToString(pRI->pCI->requestNumber));
}
-/** Callee expects NULL */
-static void
-dispatchVoid (Parcel& p, RequestInfo *pRI) {
- clearPrintBuf;
- printRequest(pRI->token, pRI->pCI->requestNumber);
- CALL_ONREQUEST(pRI->pCI->requestNumber, NULL, 0, pRI, pRI->socket_id);
-}
-
-/** Callee expects const char * */
-static void
-dispatchString (Parcel& p, RequestInfo *pRI) {
- status_t status;
- size_t datalen;
- size_t stringlen;
- char *string8 = NULL;
-
- string8 = strdupReadString(p);
-
- startRequest;
- appendPrintBuf("%s%s", printBuf, string8);
- closeRequest;
- printRequest(pRI->token, pRI->pCI->requestNumber);
-
- CALL_ONREQUEST(pRI->pCI->requestNumber, string8,
- sizeof(char *), pRI, pRI->socket_id);
-
-#ifdef MEMSET_FREED
- memsetString(string8);
-#endif
-
- free(string8);
- return;
-invalid:
- invalidCommandBlock(pRI);
- return;
-}
-
-/** Callee expects const char ** */
-static void
-dispatchStrings (Parcel &p, RequestInfo *pRI) {
- int32_t countStrings;
- status_t status;
- size_t datalen;
- char **pStrings;
-
- status = p.readInt32 (&countStrings);
-
- if (status != NO_ERROR) {
- goto invalid;
- }
-
- startRequest;
- if (countStrings == 0) {
- // just some non-null pointer
- pStrings = (char **)calloc(1, sizeof(char *));
- if (pStrings == NULL) {
- RLOGE("Memory allocation failed for request %s",
- requestToString(pRI->pCI->requestNumber));
- closeRequest;
- return;
- }
+static int
+blockingWrite(int fd, const void *buffer, size_t len) {
+ size_t writeOffset = 0;
+ const uint8_t *toWrite;
- datalen = 0;
- } else if (countStrings < 0) {
- pStrings = NULL;
- datalen = 0;
- } else {
- datalen = sizeof(char *) * countStrings;
+ toWrite = (const uint8_t *)buffer;
- pStrings = (char **)calloc(countStrings, sizeof(char *));
- if (pStrings == NULL) {
- RLOGE("Memory allocation failed for request %s",
- requestToString(pRI->pCI->requestNumber));
- closeRequest;
- return;
- }
+ while (writeOffset < len) {
+ ssize_t written;
+ do {
+ written = write (fd, toWrite + writeOffset,
+ len - writeOffset);
+ } while (written < 0 && ((errno == EINTR) || (errno == EAGAIN)));
- for (int i = 0 ; i < countStrings ; i++) {
- pStrings[i] = strdupReadString(p);
- appendPrintBuf("%s%s,", printBuf, pStrings[i]);
+ if (written >= 0) {
+ writeOffset += written;
+ } else { // written < 0
+ RLOGE ("RIL Response: unexpected error on write errno:%d", errno);
+ close(fd);
+ return -1;
}
}
- removeLastChar;
- closeRequest;
- printRequest(pRI->token, pRI->pCI->requestNumber);
-
- CALL_ONREQUEST(pRI->pCI->requestNumber, pStrings, datalen, pRI, pRI->socket_id);
-
- if (pStrings != NULL) {
- for (int i = 0 ; i < countStrings ; i++) {
-#ifdef MEMSET_FREED
- memsetString (pStrings[i]);
-#endif
- free(pStrings[i]);
- }
-
-#ifdef MEMSET_FREED
- memset(pStrings, 0, datalen);
+#if VDBG
+ RLOGE("RIL Response bytes written:%d", writeOffset);
#endif
- free(pStrings);
- }
-
- return;
-invalid:
- invalidCommandBlock(pRI);
- return;
+ return 0;
}
-/** Callee expects const int * */
-static void
-dispatchInts (Parcel &p, RequestInfo *pRI) {
- int32_t count;
- status_t status;
- size_t datalen;
- int *pInts;
+static int
+sendResponseRaw (const void *data, size_t dataSize, RIL_SOCKET_ID socket_id) {
+ int fd = s_ril_param_socket.fdCommand;
+ int ret;
+ uint32_t header;
+ pthread_mutex_t * writeMutexHook = &s_writeMutex;
- status = p.readInt32 (&count);
+#if VDBG
+ RLOGE("Send Response to %s", rilSocketIdToString(socket_id));
+#endif
- if (status != NO_ERROR || count <= 0) {
- goto invalid;
+#if (SIM_COUNT >= 2)
+ if (socket_id == RIL_SOCKET_2) {
+ fd = s_ril_param_socket2.fdCommand;
+ writeMutexHook = &s_writeMutex_socket2;
}
-
- datalen = sizeof(int) * count;
- pInts = (int *)calloc(count, sizeof(int));
- if (pInts == NULL) {
- RLOGE("Memory allocation failed for request %s", requestToString(pRI->pCI->requestNumber));
- return;
+#if (SIM_COUNT >= 3)
+ else if (socket_id == RIL_SOCKET_3) {
+ fd = s_ril_param_socket3.fdCommand;
+ writeMutexHook = &s_writeMutex_socket3;
}
-
- startRequest;
- for (int i = 0 ; i < count ; i++) {
- int32_t t;
-
- status = p.readInt32(&t);
- pInts[i] = (int)t;
- appendPrintBuf("%s%d,", printBuf, t);
-
- if (status != NO_ERROR) {
- free(pInts);
- goto invalid;
- }
- }
- removeLastChar;
- closeRequest;
- printRequest(pRI->token, pRI->pCI->requestNumber);
-
- CALL_ONREQUEST(pRI->pCI->requestNumber, const_cast<int *>(pInts),
- datalen, pRI, pRI->socket_id);
-
-#ifdef MEMSET_FREED
- memset(pInts, 0, datalen);
#endif
- free(pInts);
- return;
-invalid:
- invalidCommandBlock(pRI);
- return;
-}
-
-
-/**
- * Callee expects const RIL_SMS_WriteArgs *
- * Payload is:
- * int32_t status
- * String pdu
- */
-static void
-dispatchSmsWrite (Parcel &p, RequestInfo *pRI) {
- RIL_SMS_WriteArgs args;
- int32_t t;
- status_t status;
-
- RLOGD("dispatchSmsWrite");
- memset (&args, 0, sizeof(args));
-
- status = p.readInt32(&t);
- args.status = (int)t;
-
- args.pdu = strdupReadString(p);
-
- if (status != NO_ERROR || args.pdu == NULL) {
- goto invalid;
+#if (SIM_COUNT >= 4)
+ else if (socket_id == RIL_SOCKET_4) {
+ fd = s_ril_param_socket4.fdCommand;
+ writeMutexHook = &s_writeMutex_socket4;
}
-
- args.smsc = strdupReadString(p);
-
- startRequest;
- appendPrintBuf("%s%d,%s,smsc=%s", printBuf, args.status,
- (char*)args.pdu, (char*)args.smsc);
- closeRequest;
- printRequest(pRI->token, pRI->pCI->requestNumber);
-
- CALL_ONREQUEST(pRI->pCI->requestNumber, &args, sizeof(args), pRI, pRI->socket_id);
-
-#ifdef MEMSET_FREED
- memsetString (args.pdu);
#endif
-
- free (args.pdu);
-
-#ifdef MEMSET_FREED
- memset(&args, 0, sizeof(args));
#endif
-
- return;
-invalid:
- invalidCommandBlock(pRI);
- return;
-}
-
-/**
- * Callee expects const RIL_Dial *
- * Payload is:
- * String address
- * int32_t clir
- */
-static void
-dispatchDial (Parcel &p, RequestInfo *pRI) {
- RIL_Dial dial;
- RIL_UUS_Info uusInfo;
- int32_t sizeOfDial;
- int32_t t;
- int32_t uusPresent;
- status_t status;
-
- RLOGD("dispatchDial");
- memset (&dial, 0, sizeof(dial));
-
- dial.address = strdupReadString(p);
-
- status = p.readInt32(&t);
- dial.clir = (int)t;
-
- if (status != NO_ERROR || dial.address == NULL) {
- goto invalid;
+ if (fd < 0) {
+ return -1;
}
- if (s_callbacks.version < 3) { // Remove when partners upgrade to version 3
- uusPresent = 0;
- sizeOfDial = sizeof(dial) - sizeof(RIL_UUS_Info *);
- } else {
- status = p.readInt32(&uusPresent);
-
- if (status != NO_ERROR) {
- goto invalid;
- }
-
- if (uusPresent == 0) {
- dial.uusInfo = NULL;
- } else {
- int32_t len;
-
- memset(&uusInfo, 0, sizeof(RIL_UUS_Info));
-
- status = p.readInt32(&t);
- uusInfo.uusType = (RIL_UUS_Type) t;
-
- status = p.readInt32(&t);
- uusInfo.uusDcs = (RIL_UUS_DCS) t;
-
- status = p.readInt32(&len);
- if (status != NO_ERROR) {
- goto invalid;
- }
-
- // The java code writes -1 for null arrays
- if (((int) len) == -1) {
- uusInfo.uusData = NULL;
- len = 0;
- } else {
- uusInfo.uusData = (char*) p.readInplace(len);
- // check if the length is invalid
- if (uusInfo.uusData == NULL) {
- goto invalid;
- }
- }
-
- uusInfo.uusLength = len;
- dial.uusInfo = &uusInfo;
- }
- sizeOfDial = sizeof(dial);
- }
+ if (dataSize > MAX_COMMAND_BYTES) {
+ RLOGE("RIL: packet larger than %u (%u)",
+ MAX_COMMAND_BYTES, (unsigned int )dataSize);
- startRequest;
- appendPrintBuf("%snum=%s,clir=%d", printBuf, dial.address, dial.clir);
- if (uusPresent) {
- appendPrintBuf("%s,uusType=%d,uusDcs=%d,uusLen=%d", printBuf,
- dial.uusInfo->uusType, dial.uusInfo->uusDcs,
- dial.uusInfo->uusLength);
+ return -1;
}
- closeRequest;
- printRequest(pRI->token, pRI->pCI->requestNumber);
-
- CALL_ONREQUEST(pRI->pCI->requestNumber, &dial, sizeOfDial, pRI, pRI->socket_id);
-
-#ifdef MEMSET_FREED
- memsetString (dial.address);
-#endif
-
- free (dial.address);
-
-#ifdef MEMSET_FREED
- memset(&uusInfo, 0, sizeof(RIL_UUS_Info));
- memset(&dial, 0, sizeof(dial));
-#endif
-
- return;
-invalid:
- invalidCommandBlock(pRI);
- return;
-}
-
-/**
- * Callee expects const RIL_SIM_IO *
- * Payload is:
- * int32_t command
- * int32_t fileid
- * String path
- * int32_t p1, p2, p3
- * String data
- * String pin2
- * String aidPtr
- */
-static void
-dispatchSIM_IO (Parcel &p, RequestInfo *pRI) {
- union RIL_SIM_IO {
- RIL_SIM_IO_v6 v6;
- RIL_SIM_IO_v5 v5;
- } simIO;
-
- int32_t t;
- int size;
- status_t status;
-#if VDBG
- RLOGD("dispatchSIM_IO");
-#endif
- memset (&simIO, 0, sizeof(simIO));
-
- // note we only check status at the end
-
- status = p.readInt32(&t);
- simIO.v6.command = (int)t;
-
- status = p.readInt32(&t);
- simIO.v6.fileid = (int)t;
-
- simIO.v6.path = strdupReadString(p);
-
- status = p.readInt32(&t);
- simIO.v6.p1 = (int)t;
-
- status = p.readInt32(&t);
- simIO.v6.p2 = (int)t;
-
- status = p.readInt32(&t);
- simIO.v6.p3 = (int)t;
+ pthread_mutex_lock(writeMutexHook);
- simIO.v6.data = strdupReadString(p);
- simIO.v6.pin2 = strdupReadString(p);
- simIO.v6.aidPtr = strdupReadString(p);
+ header = htonl(dataSize);
- startRequest;
- appendPrintBuf("%scmd=0x%X,efid=0x%X,path=%s,%d,%d,%d,%s,pin2=%s,aid=%s", printBuf,
- simIO.v6.command, simIO.v6.fileid, (char*)simIO.v6.path,
- simIO.v6.p1, simIO.v6.p2, simIO.v6.p3,
- (char*)simIO.v6.data, (char*)simIO.v6.pin2, simIO.v6.aidPtr);
- closeRequest;
- printRequest(pRI->token, pRI->pCI->requestNumber);
+ ret = blockingWrite(fd, (void *)&header, sizeof(header));
- if (status != NO_ERROR) {
- goto invalid;
+ if (ret < 0) {
+ pthread_mutex_unlock(writeMutexHook);
+ return ret;
}
- size = (s_callbacks.version < 6) ? sizeof(simIO.v5) : sizeof(simIO.v6);
- CALL_ONREQUEST(pRI->pCI->requestNumber, &simIO, size, pRI, pRI->socket_id);
-
-#ifdef MEMSET_FREED
- memsetString (simIO.v6.path);
- memsetString (simIO.v6.data);
- memsetString (simIO.v6.pin2);
- memsetString (simIO.v6.aidPtr);
-#endif
-
- free (simIO.v6.path);
- free (simIO.v6.data);
- free (simIO.v6.pin2);
- free (simIO.v6.aidPtr);
-
-#ifdef MEMSET_FREED
- memset(&simIO, 0, sizeof(simIO));
-#endif
-
- return;
-invalid:
- invalidCommandBlock(pRI);
- return;
-}
-
-/**
- * Callee expects const RIL_SIM_APDU *
- * Payload is:
- * int32_t sessionid
- * int32_t cla
- * int32_t instruction
- * int32_t p1, p2, p3
- * String data
- */
-static void
-dispatchSIM_APDU (Parcel &p, RequestInfo *pRI) {
- int32_t t;
- status_t status;
- RIL_SIM_APDU apdu;
-
-#if VDBG
- RLOGD("dispatchSIM_APDU");
-#endif
- memset (&apdu, 0, sizeof(RIL_SIM_APDU));
-
- // Note we only check status at the end. Any single failure leads to
- // subsequent reads filing.
- status = p.readInt32(&t);
- apdu.sessionid = (int)t;
-
- status = p.readInt32(&t);
- apdu.cla = (int)t;
-
- status = p.readInt32(&t);
- apdu.instruction = (int)t;
-
- status = p.readInt32(&t);
- apdu.p1 = (int)t;
-
- status = p.readInt32(&t);
- apdu.p2 = (int)t;
-
- status = p.readInt32(&t);
- apdu.p3 = (int)t;
-
- apdu.data = strdupReadString(p);
-
- startRequest;
- appendPrintBuf("%ssessionid=%d,cla=%d,ins=%d,p1=%d,p2=%d,p3=%d,data=%s",
- printBuf, apdu.sessionid, apdu.cla, apdu.instruction, apdu.p1, apdu.p2,
- apdu.p3, (char*)apdu.data);
- closeRequest;
- printRequest(pRI->token, pRI->pCI->requestNumber);
+ ret = blockingWrite(fd, data, dataSize);
- if (status != NO_ERROR) {
- goto invalid;
+ if (ret < 0) {
+ pthread_mutex_unlock(writeMutexHook);
+ return ret;
}
- CALL_ONREQUEST(pRI->pCI->requestNumber, &apdu, sizeof(RIL_SIM_APDU), pRI, pRI->socket_id);
-
-#ifdef MEMSET_FREED
- memsetString(apdu.data);
-#endif
- free(apdu.data);
-
-#ifdef MEMSET_FREED
- memset(&apdu, 0, sizeof(RIL_SIM_APDU));
-#endif
+ pthread_mutex_unlock(writeMutexHook);
- return;
-invalid:
- invalidCommandBlock(pRI);
- return;
+ return 0;
}
+static int
+sendResponse (Parcel &p, RIL_SOCKET_ID socket_id) {
+ printResponse;
+ return sendResponseRaw(p.data(), p.dataSize(), socket_id);
+}
-/**
- * Callee expects const RIL_CallForwardInfo *
- * Payload is:
- * int32_t status/action
- * int32_t reason
- * int32_t serviceCode
- * int32_t toa
- * String number (0 length -> null)
- * int32_t timeSeconds
- */
-static void
-dispatchCallForward(Parcel &p, RequestInfo *pRI) {
- RIL_CallForwardInfo cff;
- int32_t t;
- status_t status;
-
- RLOGD("dispatchCallForward");
- memset (&cff, 0, sizeof(cff));
-
- // note we only check status at the end
-
- status = p.readInt32(&t);
- cff.status = (int)t;
-
- status = p.readInt32(&t);
- cff.reason = (int)t;
-
- status = p.readInt32(&t);
- cff.serviceClass = (int)t;
-
- status = p.readInt32(&t);
- cff.toa = (int)t;
-
- cff.number = strdupReadString(p);
-
- status = p.readInt32(&t);
- cff.timeSeconds = (int)t;
-
- if (status != NO_ERROR) {
- goto invalid;
- }
-
- // special case: number 0-length fields is null
-
- if (cff.number != NULL && strlen (cff.number) == 0) {
- cff.number = NULL;
- }
-
- startRequest;
- appendPrintBuf("%sstat=%d,reason=%d,serv=%d,toa=%d,%s,tout=%d", printBuf,
- cff.status, cff.reason, cff.serviceClass, cff.toa,
- (char*)cff.number, cff.timeSeconds);
- closeRequest;
- printRequest(pRI->token, pRI->pCI->requestNumber);
-
- CALL_ONREQUEST(pRI->pCI->requestNumber, &cff, sizeof(cff), pRI, pRI->socket_id);
-
-#ifdef MEMSET_FREED
- memsetString(cff.number);
-#endif
-
- free (cff.number);
-
-#ifdef MEMSET_FREED
- memset(&cff, 0, sizeof(cff));
-#endif
-
- return;
-invalid:
- invalidCommandBlock(pRI);
- return;
-}
-
-
-static void
-dispatchRaw(Parcel &p, RequestInfo *pRI) {
- int32_t len;
- status_t status;
- const void *data;
-
- status = p.readInt32(&len);
-
- if (status != NO_ERROR) {
- goto invalid;
- }
-
- // The java code writes -1 for null arrays
- if (((int)len) == -1) {
- data = NULL;
- len = 0;
- }
-
- data = p.readInplace(len);
-
- startRequest;
- appendPrintBuf("%sraw_size=%d", printBuf, len);
- closeRequest;
- printRequest(pRI->token, pRI->pCI->requestNumber);
-
- CALL_ONREQUEST(pRI->pCI->requestNumber, const_cast<void *>(data), len, pRI, pRI->socket_id);
-
- return;
-invalid:
- invalidCommandBlock(pRI);
- return;
-}
-
-static status_t
-constructCdmaSms(Parcel &p, RequestInfo *pRI, RIL_CDMA_SMS_Message& rcsm) {
- int32_t t;
- uint8_t ut;
- status_t status;
- int32_t digitCount;
- int digitLimit;
-
- memset(&rcsm, 0, sizeof(rcsm));
-
- status = p.readInt32(&t);
- rcsm.uTeleserviceID = (int) t;
-
- status = p.read(&ut,sizeof(ut));
- rcsm.bIsServicePresent = (uint8_t) ut;
-
- status = p.readInt32(&t);
- rcsm.uServicecategory = (int) t;
-
- status = p.readInt32(&t);
- rcsm.sAddress.digit_mode = (RIL_CDMA_SMS_DigitMode) t;
-
- status = p.readInt32(&t);
- rcsm.sAddress.number_mode = (RIL_CDMA_SMS_NumberMode) t;
-
- status = p.readInt32(&t);
- rcsm.sAddress.number_type = (RIL_CDMA_SMS_NumberType) t;
-
- status = p.readInt32(&t);
- rcsm.sAddress.number_plan = (RIL_CDMA_SMS_NumberPlan) t;
-
- status = p.read(&ut,sizeof(ut));
- rcsm.sAddress.number_of_digits= (uint8_t) ut;
-
- digitLimit= MIN((rcsm.sAddress.number_of_digits), RIL_CDMA_SMS_ADDRESS_MAX);
- for(digitCount =0 ; digitCount < digitLimit; digitCount ++) {
- status = p.read(&ut,sizeof(ut));
- rcsm.sAddress.digits[digitCount] = (uint8_t) ut;
- }
-
- status = p.readInt32(&t);
- rcsm.sSubAddress.subaddressType = (RIL_CDMA_SMS_SubaddressType) t;
-
- status = p.read(&ut,sizeof(ut));
- rcsm.sSubAddress.odd = (uint8_t) ut;
-
- status = p.read(&ut,sizeof(ut));
- rcsm.sSubAddress.number_of_digits = (uint8_t) ut;
-
- digitLimit= MIN((rcsm.sSubAddress.number_of_digits), RIL_CDMA_SMS_SUBADDRESS_MAX);
- for(digitCount =0 ; digitCount < digitLimit; digitCount ++) {
- status = p.read(&ut,sizeof(ut));
- rcsm.sSubAddress.digits[digitCount] = (uint8_t) ut;
- }
-
- status = p.readInt32(&t);
- rcsm.uBearerDataLen = (int) t;
-
- digitLimit= MIN((rcsm.uBearerDataLen), RIL_CDMA_SMS_BEARER_DATA_MAX);
- for(digitCount =0 ; digitCount < digitLimit; digitCount ++) {
- status = p.read(&ut, sizeof(ut));
- rcsm.aBearerData[digitCount] = (uint8_t) ut;
- }
-
- if (status != NO_ERROR) {
- return status;
- }
-
- startRequest;
- appendPrintBuf("%suTeleserviceID=%d, bIsServicePresent=%d, uServicecategory=%d, \
- sAddress.digit_mode=%d, sAddress.Number_mode=%d, sAddress.number_type=%d, ",
- printBuf, rcsm.uTeleserviceID,rcsm.bIsServicePresent,rcsm.uServicecategory,
- rcsm.sAddress.digit_mode, rcsm.sAddress.number_mode,rcsm.sAddress.number_type);
- closeRequest;
-
- printRequest(pRI->token, pRI->pCI->requestNumber);
-
- return status;
-}
-
-static void
-dispatchCdmaSms(Parcel &p, RequestInfo *pRI) {
- RIL_CDMA_SMS_Message rcsm;
-
- RLOGD("dispatchCdmaSms");
- if (NO_ERROR != constructCdmaSms(p, pRI, rcsm)) {
- goto invalid;
- }
-
- CALL_ONREQUEST(pRI->pCI->requestNumber, &rcsm, sizeof(rcsm),pRI, pRI->socket_id);
-
-#ifdef MEMSET_FREED
- memset(&rcsm, 0, sizeof(rcsm));
-#endif
-
- return;
-
-invalid:
- invalidCommandBlock(pRI);
- return;
-}
-
-static void
-dispatchImsCdmaSms(Parcel &p, RequestInfo *pRI, uint8_t retry, int32_t messageRef) {
- RIL_IMS_SMS_Message rism;
- RIL_CDMA_SMS_Message rcsm;
-
- RLOGD("dispatchImsCdmaSms: retry=%d, messageRef=%d", retry, messageRef);
-
- if (NO_ERROR != constructCdmaSms(p, pRI, rcsm)) {
- goto invalid;
- }
- memset(&rism, 0, sizeof(rism));
- rism.tech = RADIO_TECH_3GPP2;
- rism.retry = retry;
- rism.messageRef = messageRef;
- rism.message.cdmaMessage = &rcsm;
-
- CALL_ONREQUEST(pRI->pCI->requestNumber, &rism,
- sizeof(RIL_RadioTechnologyFamily)+sizeof(uint8_t)+sizeof(int32_t)
- +sizeof(rcsm),pRI, pRI->socket_id);
-
-#ifdef MEMSET_FREED
- memset(&rcsm, 0, sizeof(rcsm));
- memset(&rism, 0, sizeof(rism));
-#endif
-
- return;
-
-invalid:
- invalidCommandBlock(pRI);
- return;
-}
-
-static void
-dispatchImsGsmSms(Parcel &p, RequestInfo *pRI, uint8_t retry, int32_t messageRef) {
- RIL_IMS_SMS_Message rism;
- int32_t countStrings;
- status_t status;
- size_t datalen;
- char **pStrings;
- RLOGD("dispatchImsGsmSms: retry=%d, messageRef=%d", retry, messageRef);
-
- status = p.readInt32 (&countStrings);
-
- if (status != NO_ERROR) {
- goto invalid;
- }
-
- memset(&rism, 0, sizeof(rism));
- rism.tech = RADIO_TECH_3GPP;
- rism.retry = retry;
- rism.messageRef = messageRef;
-
- startRequest;
- appendPrintBuf("%stech=%d, retry=%d, messageRef=%d, ", printBuf,
- (int)rism.tech, (int)rism.retry, rism.messageRef);
- if (countStrings == 0) {
- // just some non-null pointer
- pStrings = (char **)calloc(1, sizeof(char *));
- if (pStrings == NULL) {
- RLOGE("Memory allocation failed for request %s",
- requestToString(pRI->pCI->requestNumber));
- closeRequest;
- return;
- }
-
- datalen = 0;
- } else if (countStrings < 0) {
- pStrings = NULL;
- datalen = 0;
- } else {
- if ((size_t)countStrings > (INT_MAX/sizeof(char *))) {
- RLOGE("Invalid value of countStrings: \n");
- closeRequest;
- return;
- }
- datalen = sizeof(char *) * countStrings;
-
- pStrings = (char **)calloc(countStrings, sizeof(char *));
- if (pStrings == NULL) {
- RLOGE("Memory allocation failed for request %s",
- requestToString(pRI->pCI->requestNumber));
- closeRequest;
- return;
- }
-
- for (int i = 0 ; i < countStrings ; i++) {
- pStrings[i] = strdupReadString(p);
- appendPrintBuf("%s%s,", printBuf, pStrings[i]);
- }
- }
- removeLastChar;
- closeRequest;
- printRequest(pRI->token, pRI->pCI->requestNumber);
-
- rism.message.gsmMessage = pStrings;
- CALL_ONREQUEST(pRI->pCI->requestNumber, &rism,
- sizeof(RIL_RadioTechnologyFamily)+sizeof(uint8_t)+sizeof(int32_t)
- +datalen, pRI, pRI->socket_id);
-
- if (pStrings != NULL) {
- for (int i = 0 ; i < countStrings ; i++) {
-#ifdef MEMSET_FREED
- memsetString (pStrings[i]);
-#endif
- free(pStrings[i]);
- }
-
-#ifdef MEMSET_FREED
- memset(pStrings, 0, datalen);
-#endif
- free(pStrings);
- }
-
-#ifdef MEMSET_FREED
- memset(&rism, 0, sizeof(rism));
-#endif
- return;
-invalid:
- ALOGE("dispatchImsGsmSms invalid block");
- invalidCommandBlock(pRI);
- return;
-}
-
-static void
-dispatchImsSms(Parcel &p, RequestInfo *pRI) {
- int32_t t;
- status_t status = p.readInt32(&t);
- RIL_RadioTechnologyFamily format;
- uint8_t retry;
- int32_t messageRef;
-
- RLOGD("dispatchImsSms");
- if (status != NO_ERROR) {
- goto invalid;
- }
- format = (RIL_RadioTechnologyFamily) t;
-
- // read retry field
- status = p.read(&retry,sizeof(retry));
- if (status != NO_ERROR) {
- goto invalid;
- }
- // read messageRef field
- status = p.read(&messageRef,sizeof(messageRef));
- if (status != NO_ERROR) {
- goto invalid;
- }
-
- if (RADIO_TECH_3GPP == format) {
- dispatchImsGsmSms(p, pRI, retry, messageRef);
- } else if (RADIO_TECH_3GPP2 == format) {
- dispatchImsCdmaSms(p, pRI, retry, messageRef);
- } else {
- ALOGE("requestImsSendSMS invalid format value =%d", format);
- }
-
- return;
-
-invalid:
- invalidCommandBlock(pRI);
- return;
-}
-
-static void
-dispatchCdmaSmsAck(Parcel &p, RequestInfo *pRI) {
- RIL_CDMA_SMS_Ack rcsa;
- int32_t t;
- status_t status;
- int32_t digitCount;
-
- RLOGD("dispatchCdmaSmsAck");
- memset(&rcsa, 0, sizeof(rcsa));
-
- status = p.readInt32(&t);
- rcsa.uErrorClass = (RIL_CDMA_SMS_ErrorClass) t;
-
- status = p.readInt32(&t);
- rcsa.uSMSCauseCode = (int) t;
-
- if (status != NO_ERROR) {
- goto invalid;
- }
-
- startRequest;
- appendPrintBuf("%suErrorClass=%d, uTLStatus=%d, ",
- printBuf, rcsa.uErrorClass, rcsa.uSMSCauseCode);
- closeRequest;
-
- printRequest(pRI->token, pRI->pCI->requestNumber);
-
- CALL_ONREQUEST(pRI->pCI->requestNumber, &rcsa, sizeof(rcsa),pRI, pRI->socket_id);
-
-#ifdef MEMSET_FREED
- memset(&rcsa, 0, sizeof(rcsa));
-#endif
-
- return;
-
-invalid:
- invalidCommandBlock(pRI);
- return;
-}
-
-static void
-dispatchGsmBrSmsCnf(Parcel &p, RequestInfo *pRI) {
- int32_t t;
- status_t status;
- int32_t num;
-
- status = p.readInt32(&num);
- if (status != NO_ERROR) {
- goto invalid;
- }
-
- {
- RIL_GSM_BroadcastSmsConfigInfo gsmBci[num];
- RIL_GSM_BroadcastSmsConfigInfo *gsmBciPtrs[num];
-
- startRequest;
- for (int i = 0 ; i < num ; i++ ) {
- gsmBciPtrs[i] = &gsmBci[i];
-
- status = p.readInt32(&t);
- gsmBci[i].fromServiceId = (int) t;
-
- status = p.readInt32(&t);
- gsmBci[i].toServiceId = (int) t;
-
- status = p.readInt32(&t);
- gsmBci[i].fromCodeScheme = (int) t;
-
- status = p.readInt32(&t);
- gsmBci[i].toCodeScheme = (int) t;
-
- status = p.readInt32(&t);
- gsmBci[i].selected = (uint8_t) t;
-
- appendPrintBuf("%s [%d: fromServiceId=%d, toServiceId =%d, \
- fromCodeScheme=%d, toCodeScheme=%d, selected =%d]", printBuf, i,
- gsmBci[i].fromServiceId, gsmBci[i].toServiceId,
- gsmBci[i].fromCodeScheme, gsmBci[i].toCodeScheme,
- gsmBci[i].selected);
- }
- closeRequest;
-
- if (status != NO_ERROR) {
- goto invalid;
- }
-
- CALL_ONREQUEST(pRI->pCI->requestNumber,
- gsmBciPtrs,
- num * sizeof(RIL_GSM_BroadcastSmsConfigInfo *),
- pRI, pRI->socket_id);
-
-#ifdef MEMSET_FREED
- memset(gsmBci, 0, num * sizeof(RIL_GSM_BroadcastSmsConfigInfo));
- memset(gsmBciPtrs, 0, num * sizeof(RIL_GSM_BroadcastSmsConfigInfo *));
-#endif
- }
-
- return;
-
-invalid:
- invalidCommandBlock(pRI);
- return;
-}
-
-static void
-dispatchCdmaBrSmsCnf(Parcel &p, RequestInfo *pRI) {
- int32_t t;
- status_t status;
- int32_t num;
-
- status = p.readInt32(&num);
- if (status != NO_ERROR) {
- goto invalid;
- }
-
- {
- RIL_CDMA_BroadcastSmsConfigInfo cdmaBci[num];
- RIL_CDMA_BroadcastSmsConfigInfo *cdmaBciPtrs[num];
-
- startRequest;
- for (int i = 0 ; i < num ; i++ ) {
- cdmaBciPtrs[i] = &cdmaBci[i];
-
- status = p.readInt32(&t);
- cdmaBci[i].service_category = (int) t;
-
- status = p.readInt32(&t);
- cdmaBci[i].language = (int) t;
-
- status = p.readInt32(&t);
- cdmaBci[i].selected = (uint8_t) t;
-
- appendPrintBuf("%s [%d: service_category=%d, language =%d, \
- entries.bSelected =%d]", printBuf, i, cdmaBci[i].service_category,
- cdmaBci[i].language, cdmaBci[i].selected);
- }
- closeRequest;
-
- if (status != NO_ERROR) {
- goto invalid;
- }
-
- CALL_ONREQUEST(pRI->pCI->requestNumber,
- cdmaBciPtrs,
- num * sizeof(RIL_CDMA_BroadcastSmsConfigInfo *),
- pRI, pRI->socket_id);
-
-#ifdef MEMSET_FREED
- memset(cdmaBci, 0, num * sizeof(RIL_CDMA_BroadcastSmsConfigInfo));
- memset(cdmaBciPtrs, 0, num * sizeof(RIL_CDMA_BroadcastSmsConfigInfo *));
-#endif
- }
-
- return;
-
-invalid:
- invalidCommandBlock(pRI);
- return;
-}
-
-static void dispatchRilCdmaSmsWriteArgs(Parcel &p, RequestInfo *pRI) {
- RIL_CDMA_SMS_WriteArgs rcsw;
- int32_t t;
- uint32_t ut;
- uint8_t uct;
- status_t status;
- int32_t digitCount;
- int32_t digitLimit;
-
- memset(&rcsw, 0, sizeof(rcsw));
-
- status = p.readInt32(&t);
- rcsw.status = t;
-
- status = p.readInt32(&t);
- rcsw.message.uTeleserviceID = (int) t;
-
- status = p.read(&uct,sizeof(uct));
- rcsw.message.bIsServicePresent = (uint8_t) uct;
-
- status = p.readInt32(&t);
- rcsw.message.uServicecategory = (int) t;
-
- status = p.readInt32(&t);
- rcsw.message.sAddress.digit_mode = (RIL_CDMA_SMS_DigitMode) t;
-
- status = p.readInt32(&t);
- rcsw.message.sAddress.number_mode = (RIL_CDMA_SMS_NumberMode) t;
-
- status = p.readInt32(&t);
- rcsw.message.sAddress.number_type = (RIL_CDMA_SMS_NumberType) t;
-
- status = p.readInt32(&t);
- rcsw.message.sAddress.number_plan = (RIL_CDMA_SMS_NumberPlan) t;
-
- status = p.read(&uct,sizeof(uct));
- rcsw.message.sAddress.number_of_digits = (uint8_t) uct;
-
- digitLimit = MIN((rcsw.message.sAddress.number_of_digits), RIL_CDMA_SMS_ADDRESS_MAX);
-
- for(digitCount = 0 ; digitCount < digitLimit; digitCount ++) {
- status = p.read(&uct,sizeof(uct));
- rcsw.message.sAddress.digits[digitCount] = (uint8_t) uct;
- }
-
- status = p.readInt32(&t);
- rcsw.message.sSubAddress.subaddressType = (RIL_CDMA_SMS_SubaddressType) t;
-
- status = p.read(&uct,sizeof(uct));
- rcsw.message.sSubAddress.odd = (uint8_t) uct;
-
- status = p.read(&uct,sizeof(uct));
- rcsw.message.sSubAddress.number_of_digits = (uint8_t) uct;
-
- digitLimit = MIN((rcsw.message.sSubAddress.number_of_digits), RIL_CDMA_SMS_SUBADDRESS_MAX);
-
- for(digitCount = 0 ; digitCount < digitLimit; digitCount ++) {
- status = p.read(&uct,sizeof(uct));
- rcsw.message.sSubAddress.digits[digitCount] = (uint8_t) uct;
- }
-
- status = p.readInt32(&t);
- rcsw.message.uBearerDataLen = (int) t;
-
- digitLimit = MIN((rcsw.message.uBearerDataLen), RIL_CDMA_SMS_BEARER_DATA_MAX);
-
- for(digitCount = 0 ; digitCount < digitLimit; digitCount ++) {
- status = p.read(&uct, sizeof(uct));
- rcsw.message.aBearerData[digitCount] = (uint8_t) uct;
- }
-
- if (status != NO_ERROR) {
- goto invalid;
- }
-
- startRequest;
- appendPrintBuf("%sstatus=%d, message.uTeleserviceID=%d, message.bIsServicePresent=%d, \
- message.uServicecategory=%d, message.sAddress.digit_mode=%d, \
- message.sAddress.number_mode=%d, \
- message.sAddress.number_type=%d, ",
- printBuf, rcsw.status, rcsw.message.uTeleserviceID, rcsw.message.bIsServicePresent,
- rcsw.message.uServicecategory, rcsw.message.sAddress.digit_mode,
- rcsw.message.sAddress.number_mode,
- rcsw.message.sAddress.number_type);
- closeRequest;
-
- printRequest(pRI->token, pRI->pCI->requestNumber);
-
- CALL_ONREQUEST(pRI->pCI->requestNumber, &rcsw, sizeof(rcsw),pRI, pRI->socket_id);
-
-#ifdef MEMSET_FREED
- memset(&rcsw, 0, sizeof(rcsw));
-#endif
-
- return;
-
-invalid:
- invalidCommandBlock(pRI);
- return;
-
-}
-
-// For backwards compatibility in RIL_REQUEST_SETUP_DATA_CALL.
-// Version 4 of the RIL interface adds a new PDP type parameter to support
-// IPv6 and dual-stack PDP contexts. When dealing with a previous version of
-// RIL, remove the parameter from the request.
-static void dispatchDataCall(Parcel& p, RequestInfo *pRI) {
- // In RIL v3, REQUEST_SETUP_DATA_CALL takes 6 parameters.
- const int numParamsRilV3 = 6;
-
- // The first bytes of the RIL parcel contain the request number and the
- // serial number - see processCommandBuffer(). Copy them over too.
- int pos = p.dataPosition();
-
- int numParams = p.readInt32();
- if (s_callbacks.version < 4 && numParams > numParamsRilV3) {
- Parcel p2;
- p2.appendFrom(&p, 0, pos);
- p2.writeInt32(numParamsRilV3);
- for(int i = 0; i < numParamsRilV3; i++) {
- p2.writeString16(p.readString16());
- }
- p2.setDataPosition(pos);
- dispatchStrings(p2, pRI);
- } else {
- p.setDataPosition(pos);
- dispatchStrings(p, pRI);
- }
-}
-
-static void dispatchSetInitialAttachApn(Parcel &p, RequestInfo *pRI)
-{
- RIL_InitialAttachApn pf;
- int32_t t;
- status_t status;
-
- memset(&pf, 0, sizeof(pf));
-
- pf.apn = strdupReadString(p);
- pf.protocol = strdupReadString(p);
-
- status = p.readInt32(&t);
- pf.authtype = (int) t;
-
- pf.username = strdupReadString(p);
- pf.password = strdupReadString(p);
-
- startRequest;
- appendPrintBuf("%sapn=%s, protocol=%s, authtype=%d, username=%s, password=%s",
- printBuf, pf.apn, pf.protocol, pf.authtype, pf.username, pf.password);
- 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.apn);
- memsetString(pf.protocol);
- memsetString(pf.username);
- memsetString(pf.password);
-#endif
-
- free(pf.apn);
- free(pf.protocol);
- free(pf.username);
- free(pf.password);
-
-#ifdef MEMSET_FREED
- memset(&pf, 0, sizeof(pf));
-#endif
-
- return;
-invalid:
- invalidCommandBlock(pRI);
- return;
-}
-
-static void dispatchNVReadItem(Parcel &p, RequestInfo *pRI) {
- RIL_NV_ReadItem nvri;
- int32_t t;
- status_t status;
-
- memset(&nvri, 0, sizeof(nvri));
-
- status = p.readInt32(&t);
- nvri.itemID = (RIL_NV_Item) t;
-
- if (status != NO_ERROR) {
- goto invalid;
- }
-
- startRequest;
- appendPrintBuf("%snvri.itemID=%d, ", printBuf, nvri.itemID);
- closeRequest;
-
- printRequest(pRI->token, pRI->pCI->requestNumber);
-
- CALL_ONREQUEST(pRI->pCI->requestNumber, &nvri, sizeof(nvri), pRI, pRI->socket_id);
-
-#ifdef MEMSET_FREED
- memset(&nvri, 0, sizeof(nvri));
-#endif
-
- return;
-
-invalid:
- invalidCommandBlock(pRI);
- return;
-}
-
-static void dispatchNVWriteItem(Parcel &p, RequestInfo *pRI) {
- RIL_NV_WriteItem nvwi;
- int32_t t;
- status_t status;
-
- memset(&nvwi, 0, sizeof(nvwi));
-
- status = p.readInt32(&t);
- nvwi.itemID = (RIL_NV_Item) t;
-
- nvwi.value = strdupReadString(p);
-
- if (status != NO_ERROR || nvwi.value == NULL) {
- goto invalid;
- }
-
- startRequest;
- appendPrintBuf("%snvwi.itemID=%d, value=%s, ", printBuf, nvwi.itemID,
- nvwi.value);
- closeRequest;
-
- printRequest(pRI->token, pRI->pCI->requestNumber);
-
- CALL_ONREQUEST(pRI->pCI->requestNumber, &nvwi, sizeof(nvwi), pRI, pRI->socket_id);
-
-#ifdef MEMSET_FREED
- memsetString(nvwi.value);
-#endif
-
- free(nvwi.value);
-
-#ifdef MEMSET_FREED
- memset(&nvwi, 0, sizeof(nvwi));
-#endif
-
- return;
-
-invalid:
- invalidCommandBlock(pRI);
- return;
-}
-
-
-static void dispatchUiccSubscripton(Parcel &p, RequestInfo *pRI) {
- RIL_SelectUiccSub uicc_sub;
- status_t status;
- int32_t t;
- memset(&uicc_sub, 0, sizeof(uicc_sub));
-
- status = p.readInt32(&t);
- if (status != NO_ERROR) {
- goto invalid;
- }
- uicc_sub.slot = (int) t;
-
- status = p.readInt32(&t);
- if (status != NO_ERROR) {
- goto invalid;
- }
- uicc_sub.app_index = (int) t;
-
- status = p.readInt32(&t);
- if (status != NO_ERROR) {
- goto invalid;
- }
- uicc_sub.sub_type = (RIL_SubscriptionType) t;
-
- status = p.readInt32(&t);
- if (status != NO_ERROR) {
- goto invalid;
- }
- uicc_sub.act_status = (RIL_UiccSubActStatus) t;
-
- startRequest;
- appendPrintBuf("slot=%d, app_index=%d, act_status = %d", uicc_sub.slot, uicc_sub.app_index,
- uicc_sub.act_status);
- RLOGD("dispatchUiccSubscription, slot=%d, app_index=%d, act_status = %d", uicc_sub.slot,
- uicc_sub.app_index, uicc_sub.act_status);
- closeRequest;
- printRequest(pRI->token, pRI->pCI->requestNumber);
-
- CALL_ONREQUEST(pRI->pCI->requestNumber, &uicc_sub, sizeof(uicc_sub), pRI, pRI->socket_id);
-
-#ifdef MEMSET_FREED
- memset(&uicc_sub, 0, sizeof(uicc_sub));
-#endif
- return;
-
-invalid:
- invalidCommandBlock(pRI);
- 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 || num < 0) {
- goto invalid;
- }
-
- {
- RIL_DataProfileInfo *dataProfiles =
- (RIL_DataProfileInfo *)calloc(num, sizeof(RIL_DataProfileInfo));
- if (dataProfiles == NULL) {
- RLOGE("Memory allocation failed for request %s",
- requestToString(pRI->pCI->requestNumber));
- return;
- }
- RIL_DataProfileInfo **dataProfilePtrs =
- (RIL_DataProfileInfo **)calloc(num, sizeof(RIL_DataProfileInfo *));
- if (dataProfilePtrs == NULL) {
- RLOGE("Memory allocation failed for request %s",
- requestToString(pRI->pCI->requestNumber));
- free(dataProfiles);
- return;
- }
-
- 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) {
- free(dataProfiles);
- free(dataProfilePtrs);
- 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
- free(dataProfiles);
- free(dataProfilePtrs);
- }
-
- return;
-
-invalid:
- invalidCommandBlock(pRI);
- return;
-}
-
-static void dispatchRadioCapability(Parcel &p, RequestInfo *pRI){
- RIL_RadioCapability rc;
- int32_t t;
- status_t status;
-
- memset (&rc, 0, sizeof(RIL_RadioCapability));
-
- status = p.readInt32(&t);
- rc.version = (int)t;
- if (status != NO_ERROR) {
- goto invalid;
- }
-
- status = p.readInt32(&t);
- rc.session= (int)t;
- if (status != NO_ERROR) {
- goto invalid;
- }
-
- status = p.readInt32(&t);
- rc.phase= (int)t;
- if (status != NO_ERROR) {
- goto invalid;
- }
-
- status = p.readInt32(&t);
- rc.rat = (int)t;
- if (status != NO_ERROR) {
- goto invalid;
- }
-
- status = readStringFromParcelInplace(p, rc.logicalModemUuid, sizeof(rc.logicalModemUuid));
- if (status != NO_ERROR) {
- goto invalid;
- }
-
- status = p.readInt32(&t);
- rc.status = (int)t;
-
- if (status != NO_ERROR) {
- goto invalid;
- }
-
- startRequest;
- appendPrintBuf("%s [version:%d, session:%d, phase:%d, rat:%d, \
- logicalModemUuid:%s, status:%d", printBuf, rc.version, rc.session,
- rc.phase, rc.rat, rc.logicalModemUuid, rc.session);
-
- closeRequest;
- printRequest(pRI->token, pRI->pCI->requestNumber);
-
- CALL_ONREQUEST(pRI->pCI->requestNumber,
- &rc,
- sizeof(RIL_RadioCapability),
- pRI, pRI->socket_id);
- return;
-invalid:
- invalidCommandBlock(pRI);
- return;
-}
-
-/**
- * Callee expects const RIL_CarrierRestrictions *
- */
-static void dispatchCarrierRestrictions(Parcel &p, RequestInfo *pRI) {
- RIL_CarrierRestrictions cr;
- RIL_Carrier * allowed_carriers = NULL;
- RIL_Carrier * excluded_carriers = NULL;
- int32_t t;
- status_t status;
-
- memset(&cr, 0, sizeof(RIL_CarrierRestrictions));
-
- if (s_callbacks.version < 14) {
- RLOGE("Unsuppoted RIL version %d, min version expected %d",
- s_callbacks.version, 14);
- RIL_onRequestComplete(pRI, RIL_E_REQUEST_NOT_SUPPORTED, NULL, 0);
- return;
- }
-
- status = p.readInt32(&t);
- if (status != NO_ERROR) {
- goto invalid;
- }
- allowed_carriers = (RIL_Carrier *)calloc(t, sizeof(RIL_Carrier));
- if (allowed_carriers == NULL) {
- RLOGE("Memory allocation failed for request %s", requestToString(pRI->pCI->requestNumber));
- goto exit;
- }
- cr.len_allowed_carriers = t;
- cr.allowed_carriers = allowed_carriers;
-
- status = p.readInt32(&t);
- if (status != NO_ERROR) {
- goto invalid;
- }
- excluded_carriers = (RIL_Carrier *)calloc(t, sizeof(RIL_Carrier));
- if (excluded_carriers == NULL) {
- RLOGE("Memory allocation failed for request %s", requestToString(pRI->pCI->requestNumber));
- goto exit;
- }
- cr.len_excluded_carriers = t;
- cr.excluded_carriers = excluded_carriers;
-
- startRequest;
- appendPrintBuf("%s len_allowed_carriers:%d, len_excluded_carriers:%d,",
- printBuf, cr.len_allowed_carriers, cr.len_excluded_carriers);
-
- appendPrintBuf("%s allowed_carriers:", printBuf);
- for (int32_t i = 0; i < cr.len_allowed_carriers; i++) {
- RIL_Carrier *p_cr = allowed_carriers + i;
- p_cr->mcc = strdupReadString(p);
- p_cr->mnc = strdupReadString(p);
- status = p.readInt32(&t);
- p_cr->match_type = static_cast<RIL_CarrierMatchType>(t);
- if (status != NO_ERROR) {
- goto invalid;
- }
- p_cr->match_data = strdupReadString(p);
- appendPrintBuf("%s [%d mcc:%s, mnc:%s, match_type:%d, match_data:%s],",
- printBuf, i, p_cr->mcc, p_cr->mnc, p_cr->match_type, p_cr->match_data);
- }
-
- for (int32_t i = 0; i < cr.len_excluded_carriers; i++) {
- RIL_Carrier *p_cr = excluded_carriers + i;
- p_cr->mcc = strdupReadString(p);
- p_cr->mnc = strdupReadString(p);
- status = p.readInt32(&t);
- p_cr->match_type = static_cast<RIL_CarrierMatchType>(t);
- if (status != NO_ERROR) {
- goto invalid;
- }
- p_cr->match_data = strdupReadString(p);
- appendPrintBuf("%s [%d mcc:%s, mnc:%s, match_type:%d, match_data:%s],",
- printBuf, i, p_cr->mcc, p_cr->mnc, p_cr->match_type, p_cr->match_data);
- }
-
- closeRequest;
- printRequest(pRI->token, pRI->pCI->requestNumber);
-
- CALL_ONREQUEST(pRI->pCI->requestNumber,
- &cr,
- sizeof(RIL_CarrierRestrictions),
- pRI, pRI->socket_id);
-
- goto exit;
-
-invalid:
- invalidCommandBlock(pRI);
- RIL_onRequestComplete(pRI, RIL_E_INVALID_ARGUMENTS, NULL, 0);
-exit:
- if (allowed_carriers != NULL) {
- free(allowed_carriers);
- }
- if (excluded_carriers != NULL) {
- free(excluded_carriers);
- }
- return;
-}
-
-static int
-blockingWrite(int fd, const void *buffer, size_t len) {
- size_t writeOffset = 0;
- const uint8_t *toWrite;
-
- toWrite = (const uint8_t *)buffer;
-
- while (writeOffset < len) {
- ssize_t written;
- do {
- written = write (fd, toWrite + writeOffset,
- len - writeOffset);
- } while (written < 0 && ((errno == EINTR) || (errno == EAGAIN)));
-
- if (written >= 0) {
- writeOffset += written;
- } else { // written < 0
- RLOGE ("RIL Response: unexpected error on write errno:%d", errno);
- close(fd);
- return -1;
- }
- }
-#if VDBG
- RLOGE("RIL Response bytes written:%d", writeOffset);
-#endif
- return 0;
-}
-
-static int
-sendResponseRaw (const void *data, size_t dataSize, RIL_SOCKET_ID socket_id) {
- int fd = s_ril_param_socket.fdCommand;
- int ret;
- uint32_t header;
- pthread_mutex_t * writeMutexHook = &s_writeMutex;
-
-#if VDBG
- RLOGE("Send Response to %s", rilSocketIdToString(socket_id));
-#endif
-
-#if (SIM_COUNT >= 2)
- if (socket_id == RIL_SOCKET_2) {
- fd = s_ril_param_socket2.fdCommand;
- writeMutexHook = &s_writeMutex_socket2;
- }
-#if (SIM_COUNT >= 3)
- else if (socket_id == RIL_SOCKET_3) {
- fd = s_ril_param_socket3.fdCommand;
- writeMutexHook = &s_writeMutex_socket3;
- }
-#endif
-#if (SIM_COUNT >= 4)
- else if (socket_id == RIL_SOCKET_4) {
- fd = s_ril_param_socket4.fdCommand;
- writeMutexHook = &s_writeMutex_socket4;
- }
-#endif
-#endif
- if (fd < 0) {
- return -1;
- }
-
- if (dataSize > MAX_COMMAND_BYTES) {
- RLOGE("RIL: packet larger than %u (%u)",
- MAX_COMMAND_BYTES, (unsigned int )dataSize);
-
- return -1;
- }
-
- pthread_mutex_lock(writeMutexHook);
-
- header = htonl(dataSize);
-
- ret = blockingWrite(fd, (void *)&header, sizeof(header));
-
- if (ret < 0) {
- pthread_mutex_unlock(writeMutexHook);
- return ret;
- }
-
- ret = blockingWrite(fd, data, dataSize);
-
- if (ret < 0) {
- pthread_mutex_unlock(writeMutexHook);
- return ret;
- }
-
- pthread_mutex_unlock(writeMutexHook);
-
- return 0;
-}
-
-static int
-sendResponse (Parcel &p, RIL_SOCKET_ID socket_id) {
- printResponse;
- return sendResponseRaw(p.data(), p.dataSize(), socket_id);
-}
-
-/** response is an int* pointing to an array of ints */
-
-static int
-responseInts(Parcel &p, int slotId, int requestNumber, int responseType, int token, RIL_Errno e,
- void *response, size_t responselen) {
- int numInts;
-
- if (response == NULL && responselen != 0) {
- RLOGE("invalid response: NULL");
- return RIL_ERRNO_INVALID_RESPONSE;
- }
- if (responselen % sizeof(int) != 0) {
- RLOGE("responseInts: invalid response length %d expected multiple of %d\n",
- (int)responselen, (int)sizeof(int));
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- int *p_int = (int *) response;
-
- numInts = responselen / sizeof(int);
- p.writeInt32 (numInts);
-
- /* each int*/
- startResponse;
- for (int i = 0 ; i < numInts ; i++) {
- appendPrintBuf("%s%d,", printBuf, p_int[i]);
- p.writeInt32(p_int[i]);
- }
- removeLastChar;
- closeResponse;
-
- return 0;
-}
-
-// Response is an int or RIL_LastCallFailCauseInfo.
-// Currently, only Shamu plans to use RIL_LastCallFailCauseInfo.
-// TODO(yjl): Let all implementations use RIL_LastCallFailCauseInfo.
-static int responseFailCause(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen) {
- if (response == NULL && responselen != 0) {
- RLOGE("invalid response: NULL");
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- if (responselen == sizeof(int)) {
- startResponse;
- int *p_int = (int *) response;
- appendPrintBuf("%s%d,", printBuf, p_int[0]);
- p.writeInt32(p_int[0]);
- removeLastChar;
- closeResponse;
- } else if (responselen == sizeof(RIL_LastCallFailCauseInfo)) {
- startResponse;
- RIL_LastCallFailCauseInfo *p_fail_cause_info = (RIL_LastCallFailCauseInfo *) response;
- appendPrintBuf("%s[cause_code=%d,vendor_cause=%s]", printBuf, p_fail_cause_info->cause_code,
- p_fail_cause_info->vendor_cause);
- p.writeInt32(p_fail_cause_info->cause_code);
- writeStringToParcel(p, p_fail_cause_info->vendor_cause);
- removeLastChar;
- closeResponse;
- } else {
- RLOGE("responseFailCause: invalid response length %d expected an int or "
- "RIL_LastCallFailCauseInfo", (int)responselen);
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- return 0;
-}
-
-/** response is a char **, pointing to an array of char *'s
- The parcel will begin with the version */
-static int responseStringsWithVersion(int version, Parcel &p, int slotId, int requestNumber,
- int responseType, int token, RIL_Errno e, void *response, size_t responselen) {
- p.writeInt32(version);
- return responseStrings(p, slotId, requestNumber, responseType, token, e, response, responselen);
-}
-
-/** response is a char **, pointing to an array of char *'s */
-static int responseStrings(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen) {
- int numStrings;
-
- if (response == NULL && responselen != 0) {
- RLOGE("invalid response: NULL");
- return RIL_ERRNO_INVALID_RESPONSE;
- }
- if (responselen % sizeof(char *) != 0) {
- RLOGE("responseStrings: invalid response length %d expected multiple of %d\n",
- (int)responselen, (int)sizeof(char *));
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- if (response == NULL) {
- p.writeInt32 (0);
- } else {
- char **p_cur = (char **) response;
-
- numStrings = responselen / sizeof(char *);
- p.writeInt32 (numStrings);
-
- /* each string*/
- startResponse;
- for (int i = 0 ; i < numStrings ; i++) {
- appendPrintBuf("%s%s,", printBuf, (char*)p_cur[i]);
- writeStringToParcel (p, p_cur[i]);
- }
- removeLastChar;
- closeResponse;
- }
- return 0;
-}
-
-
-/**
- * NULL strings are accepted
- * FIXME currently ignores responselen
- */
-static int responseString(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen) {
- /* one string only */
- startResponse;
- appendPrintBuf("%s%s", printBuf, (char*)response);
- closeResponse;
-
- writeStringToParcel(p, (const char *)response);
-
- return 0;
-}
-
-static int responseVoid(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen) {
- startResponse;
- removeLastChar;
- return 0;
-}
-
-static int responseRaw(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen) {
- if (response == NULL && responselen != 0) {
- RLOGE("invalid response: NULL with responselen != 0");
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- // The java code reads -1 size as null byte array
- if (response == NULL) {
- p.writeInt32(-1);
- } else {
- p.writeInt32(responselen);
- p.write(response, responselen);
- }
-
- return 0;
-}
-
-static int responseSsn(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen) {
- if (response == NULL) {
- RLOGE("invalid response: NULL");
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- if (responselen != sizeof(RIL_SuppSvcNotification)) {
- RLOGE("invalid response length was %d expected %d",
- (int)responselen, (int)sizeof (RIL_SuppSvcNotification));
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- RIL_SuppSvcNotification *p_cur = (RIL_SuppSvcNotification *) response;
- p.writeInt32(p_cur->notificationType);
- p.writeInt32(p_cur->code);
- p.writeInt32(p_cur->index);
- p.writeInt32(p_cur->type);
- writeStringToParcel(p, p_cur->number);
-
- startResponse;
- appendPrintBuf("%s%s,code=%d,id=%d,type=%d,%s", printBuf,
- (p_cur->notificationType==0)?"mo":"mt",
- p_cur->code, p_cur->index, p_cur->type,
- (char*)p_cur->number);
- closeResponse;
-
- return 0;
-}
-
-/**
- * Marshall the signalInfoRecord into the parcel if it exists.
- */
-static void marshallSignalInfoRecord(Parcel &p, RIL_CDMA_SignalInfoRecord &p_signalInfoRecord) {
- p.writeInt32(p_signalInfoRecord.isPresent);
- p.writeInt32(p_signalInfoRecord.signalType);
- p.writeInt32(p_signalInfoRecord.alertPitch);
- p.writeInt32(p_signalInfoRecord.signal);
-}
-
-static int responseCdmaInformationRecords(Parcel &p, int slotId, int requestNumber,
- int responseType, int token, RIL_Errno e, void *response, size_t responselen) {
- int num;
- char* string8 = NULL;
- int buffer_lenght;
- RIL_CDMA_InformationRecord *infoRec;
-
- if (response == NULL && responselen != 0) {
- RLOGE("invalid response: NULL");
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- if (responselen != sizeof (RIL_CDMA_InformationRecords)) {
- RLOGE("responseCdmaInformationRecords: invalid response length %d expected multiple of \
- %d\n", (int)responselen, (int)sizeof (RIL_CDMA_InformationRecords *));
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- RIL_CDMA_InformationRecords *p_cur =
- (RIL_CDMA_InformationRecords *) response;
- num = MIN(p_cur->numberOfInfoRecs, RIL_CDMA_MAX_NUMBER_OF_INFO_RECS);
-
- startResponse;
- p.writeInt32(num);
-
- for (int i = 0 ; i < num ; i++) {
- infoRec = &p_cur->infoRec[i];
- p.writeInt32(infoRec->name);
- switch (infoRec->name) {
- case RIL_CDMA_DISPLAY_INFO_REC:
- case RIL_CDMA_EXTENDED_DISPLAY_INFO_REC:
- if (infoRec->rec.display.alpha_len >
- CDMA_ALPHA_INFO_BUFFER_LENGTH) {
- RLOGE("invalid display info response length %d \
- expected not more than %d\n",
- (int)infoRec->rec.display.alpha_len,
- CDMA_ALPHA_INFO_BUFFER_LENGTH);
- return RIL_ERRNO_INVALID_RESPONSE;
- }
- string8 = (char*) calloc(infoRec->rec.display.alpha_len + 1, sizeof(char));
- if (string8 == NULL) {
- RLOGE("Memory allocation failed for responseCdmaInformationRecords");
- closeRequest;
- return RIL_ERRNO_NO_MEMORY;
- }
- for (int i = 0 ; i < infoRec->rec.display.alpha_len ; i++) {
- string8[i] = infoRec->rec.display.alpha_buf[i];
- }
- string8[(int)infoRec->rec.display.alpha_len] = '\0';
- writeStringToParcel(p, (const char*)string8);
- free(string8);
- string8 = NULL;
- break;
- case RIL_CDMA_CALLED_PARTY_NUMBER_INFO_REC:
- case RIL_CDMA_CALLING_PARTY_NUMBER_INFO_REC:
- case RIL_CDMA_CONNECTED_NUMBER_INFO_REC:
- if (infoRec->rec.number.len > CDMA_NUMBER_INFO_BUFFER_LENGTH) {
- RLOGE("invalid display info response length %d \
- expected not more than %d\n",
- (int)infoRec->rec.number.len,
- CDMA_NUMBER_INFO_BUFFER_LENGTH);
- return RIL_ERRNO_INVALID_RESPONSE;
- }
- string8 = (char*) calloc(infoRec->rec.number.len + 1, sizeof(char));
- if (string8 == NULL) {
- RLOGE("Memory allocation failed for responseCdmaInformationRecords");
- closeRequest;
- return RIL_ERRNO_NO_MEMORY;
- }
- for (int i = 0 ; i < infoRec->rec.number.len; i++) {
- string8[i] = infoRec->rec.number.buf[i];
- }
- string8[(int)infoRec->rec.number.len] = '\0';
- writeStringToParcel(p, (const char*)string8);
- free(string8);
- string8 = NULL;
- p.writeInt32(infoRec->rec.number.number_type);
- p.writeInt32(infoRec->rec.number.number_plan);
- p.writeInt32(infoRec->rec.number.pi);
- p.writeInt32(infoRec->rec.number.si);
- break;
- case RIL_CDMA_SIGNAL_INFO_REC:
- p.writeInt32(infoRec->rec.signal.isPresent);
- p.writeInt32(infoRec->rec.signal.signalType);
- p.writeInt32(infoRec->rec.signal.alertPitch);
- p.writeInt32(infoRec->rec.signal.signal);
-
- appendPrintBuf("%sisPresent=%X, signalType=%X, \
- alertPitch=%X, signal=%X, ",
- printBuf, (int)infoRec->rec.signal.isPresent,
- (int)infoRec->rec.signal.signalType,
- (int)infoRec->rec.signal.alertPitch,
- (int)infoRec->rec.signal.signal);
- removeLastChar;
- break;
- case RIL_CDMA_REDIRECTING_NUMBER_INFO_REC:
- if (infoRec->rec.redir.redirectingNumber.len >
- CDMA_NUMBER_INFO_BUFFER_LENGTH) {
- RLOGE("invalid display info response length %d \
- expected not more than %d\n",
- (int)infoRec->rec.redir.redirectingNumber.len,
- CDMA_NUMBER_INFO_BUFFER_LENGTH);
- return RIL_ERRNO_INVALID_RESPONSE;
- }
- string8 = (char*) calloc(infoRec->rec.redir.redirectingNumber.len + 1,
- sizeof(char));
- if (string8 == NULL) {
- RLOGE("Memory allocation failed for responseCdmaInformationRecords");
- closeRequest;
- return RIL_ERRNO_NO_MEMORY;
- }
- for (int i = 0;
- i < infoRec->rec.redir.redirectingNumber.len;
- i++) {
- string8[i] = infoRec->rec.redir.redirectingNumber.buf[i];
- }
- string8[(int)infoRec->rec.redir.redirectingNumber.len] = '\0';
- writeStringToParcel(p, (const char*)string8);
- free(string8);
- string8 = NULL;
- p.writeInt32(infoRec->rec.redir.redirectingNumber.number_type);
- p.writeInt32(infoRec->rec.redir.redirectingNumber.number_plan);
- p.writeInt32(infoRec->rec.redir.redirectingNumber.pi);
- p.writeInt32(infoRec->rec.redir.redirectingNumber.si);
- p.writeInt32(infoRec->rec.redir.redirectingReason);
- break;
- case RIL_CDMA_LINE_CONTROL_INFO_REC:
- p.writeInt32(infoRec->rec.lineCtrl.lineCtrlPolarityIncluded);
- p.writeInt32(infoRec->rec.lineCtrl.lineCtrlToggle);
- p.writeInt32(infoRec->rec.lineCtrl.lineCtrlReverse);
- p.writeInt32(infoRec->rec.lineCtrl.lineCtrlPowerDenial);
-
- appendPrintBuf("%slineCtrlPolarityIncluded=%d, \
- lineCtrlToggle=%d, lineCtrlReverse=%d, \
- lineCtrlPowerDenial=%d, ", printBuf,
- (int)infoRec->rec.lineCtrl.lineCtrlPolarityIncluded,
- (int)infoRec->rec.lineCtrl.lineCtrlToggle,
- (int)infoRec->rec.lineCtrl.lineCtrlReverse,
- (int)infoRec->rec.lineCtrl.lineCtrlPowerDenial);
- removeLastChar;
- break;
- case RIL_CDMA_T53_CLIR_INFO_REC:
- p.writeInt32((int)(infoRec->rec.clir.cause));
-
- appendPrintBuf("%scause%d", printBuf, infoRec->rec.clir.cause);
- removeLastChar;
- break;
- case RIL_CDMA_T53_AUDIO_CONTROL_INFO_REC:
- p.writeInt32(infoRec->rec.audioCtrl.upLink);
- p.writeInt32(infoRec->rec.audioCtrl.downLink);
-
- appendPrintBuf("%supLink=%d, downLink=%d, ", printBuf,
- infoRec->rec.audioCtrl.upLink,
- infoRec->rec.audioCtrl.downLink);
- removeLastChar;
- break;
- case RIL_CDMA_T53_RELEASE_INFO_REC:
- // TODO(Moto): See David Krause, he has the answer:)
- RLOGE("RIL_CDMA_T53_RELEASE_INFO_REC: return INVALID_RESPONSE");
- return RIL_ERRNO_INVALID_RESPONSE;
- default:
- RLOGE("Incorrect name value");
- return RIL_ERRNO_INVALID_RESPONSE;
- }
- }
- closeResponse;
-
- return 0;
-}
-
-static void responseRilSignalStrengthV5(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e, RIL_SignalStrength_v10 *p_cur) {
- p.writeInt32(p_cur->GW_SignalStrength.signalStrength);
- p.writeInt32(p_cur->GW_SignalStrength.bitErrorRate);
- p.writeInt32(p_cur->CDMA_SignalStrength.dbm);
- p.writeInt32(p_cur->CDMA_SignalStrength.ecio);
- p.writeInt32(p_cur->EVDO_SignalStrength.dbm);
- p.writeInt32(p_cur->EVDO_SignalStrength.ecio);
- p.writeInt32(p_cur->EVDO_SignalStrength.signalNoiseRatio);
-}
-
-static void responseRilSignalStrengthV6Extra(Parcel &p, int slotId, int requestNumber,
- int responseType, int token, RIL_Errno e, RIL_SignalStrength_v10 *p_cur) {
- /*
- * Fixup LTE for backwards compatibility
- */
- // signalStrength: -1 -> 99
- if (p_cur->LTE_SignalStrength.signalStrength == -1) {
- p_cur->LTE_SignalStrength.signalStrength = 99;
- }
- // rsrp: -1 -> INT_MAX all other negative value to positive.
- // So remap here
- if (p_cur->LTE_SignalStrength.rsrp == -1) {
- p_cur->LTE_SignalStrength.rsrp = INT_MAX;
- } else if (p_cur->LTE_SignalStrength.rsrp < -1) {
- p_cur->LTE_SignalStrength.rsrp = -p_cur->LTE_SignalStrength.rsrp;
- }
- // rsrq: -1 -> INT_MAX
- if (p_cur->LTE_SignalStrength.rsrq == -1) {
- p_cur->LTE_SignalStrength.rsrq = INT_MAX;
- }
- // Not remapping rssnr is already using INT_MAX
-
- // cqi: -1 -> INT_MAX
- if (p_cur->LTE_SignalStrength.cqi == -1) {
- p_cur->LTE_SignalStrength.cqi = INT_MAX;
- }
-
- p.writeInt32(p_cur->LTE_SignalStrength.signalStrength);
- p.writeInt32(p_cur->LTE_SignalStrength.rsrp);
- p.writeInt32(p_cur->LTE_SignalStrength.rsrq);
- p.writeInt32(p_cur->LTE_SignalStrength.rssnr);
- p.writeInt32(p_cur->LTE_SignalStrength.cqi);
-}
-
-static void responseRilSignalStrengthV10(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e, RIL_SignalStrength_v10 *p_cur) {
- responseRilSignalStrengthV5(p, slotId, requestNumber, responseType, token, e, p_cur);
- responseRilSignalStrengthV6Extra(p, slotId, requestNumber, responseType, token, e, p_cur);
- p.writeInt32(p_cur->TD_SCDMA_SignalStrength.rscp);
-}
-
-static int responseRilSignalStrength(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e, void *response, size_t responselen) {
- if (response == NULL && responselen != 0) {
- RLOGE("invalid response: NULL");
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- RIL_SignalStrength_v10 *p_cur;
- if (s_callbacks.version <= LAST_IMPRECISE_RIL_VERSION) {
- if (responselen >= sizeof (RIL_SignalStrength_v5)) {
- p_cur = ((RIL_SignalStrength_v10 *) response);
-
- responseRilSignalStrengthV5(p, slotId, requestNumber, responseType, token, e, p_cur);
-
- if (responselen >= sizeof (RIL_SignalStrength_v6)) {
- responseRilSignalStrengthV6Extra(p, slotId, requestNumber, responseType, token, e,
- p_cur);
- if (responselen >= sizeof (RIL_SignalStrength_v10)) {
- p.writeInt32(p_cur->TD_SCDMA_SignalStrength.rscp);
- } else {
- p.writeInt32(INT_MAX);
- }
- } else {
- p.writeInt32(99);
- p.writeInt32(INT_MAX);
- p.writeInt32(INT_MAX);
- p.writeInt32(INT_MAX);
- p.writeInt32(INT_MAX);
- p.writeInt32(INT_MAX);
- }
- } else {
- RLOGE("invalid response length");
- return RIL_ERRNO_INVALID_RESPONSE;
- }
- } else { // RIL version >= 13
- if (responselen % sizeof(RIL_SignalStrength_v10) != 0) {
- RLOGE("Data structure expected is RIL_SignalStrength_v10");
- if (!isDebuggable()) {
- return RIL_ERRNO_INVALID_RESPONSE;
- } else {
- assert(0);
- }
- }
- p_cur = ((RIL_SignalStrength_v10 *) response);
- responseRilSignalStrengthV10(p, slotId, requestNumber, responseType, token, e, p_cur);
- }
- startResponse;
- appendPrintBuf("%s[signalStrength=%d,bitErrorRate=%d,\
- CDMA_SS.dbm=%d,CDMA_SSecio=%d,\
- EVDO_SS.dbm=%d,EVDO_SS.ecio=%d,\
- EVDO_SS.signalNoiseRatio=%d,\
- LTE_SS.signalStrength=%d,LTE_SS.rsrp=%d,LTE_SS.rsrq=%d,\
- LTE_SS.rssnr=%d,LTE_SS.cqi=%d,TDSCDMA_SS.rscp=%d]",
- printBuf,
- p_cur->GW_SignalStrength.signalStrength,
- p_cur->GW_SignalStrength.bitErrorRate,
- p_cur->CDMA_SignalStrength.dbm,
- p_cur->CDMA_SignalStrength.ecio,
- p_cur->EVDO_SignalStrength.dbm,
- p_cur->EVDO_SignalStrength.ecio,
- p_cur->EVDO_SignalStrength.signalNoiseRatio,
- p_cur->LTE_SignalStrength.signalStrength,
- p_cur->LTE_SignalStrength.rsrp,
- p_cur->LTE_SignalStrength.rsrq,
- p_cur->LTE_SignalStrength.rssnr,
- p_cur->LTE_SignalStrength.cqi,
- p_cur->TD_SCDMA_SignalStrength.rscp);
- closeResponse;
- return 0;
-}
-
-static int responseCallRing(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen) {
- if ((response == NULL) || (responselen == 0)) {
- return responseVoid(p, slotId, requestNumber, responseType, token, e, response,
- responselen);
- } else {
- return responseCdmaSignalInfoRecord(p, slotId, requestNumber, responseType, token, e,
- response, responselen);
- }
-}
-
-static int responseCdmaSignalInfoRecord(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e, void *response, size_t responselen) {
- if (response == NULL || responselen == 0) {
- RLOGE("invalid response: NULL");
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- if (responselen != sizeof (RIL_CDMA_SignalInfoRecord)) {
- RLOGE("invalid response length %d expected sizeof (RIL_CDMA_SignalInfoRecord) of %d\n",
- (int)responselen, (int)sizeof (RIL_CDMA_SignalInfoRecord));
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- startResponse;
-
- RIL_CDMA_SignalInfoRecord *p_cur = ((RIL_CDMA_SignalInfoRecord *) response);
- marshallSignalInfoRecord(p, *p_cur);
-
- appendPrintBuf("%s[isPresent=%d,signalType=%d,alertPitch=%d\
- signal=%d]",
- printBuf,
- p_cur->isPresent,
- p_cur->signalType,
- p_cur->alertPitch,
- p_cur->signal);
-
- closeResponse;
- return 0;
-}
-
-static int responseCdmaCallWaiting(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e, void *response, size_t responselen) {
- if (response == NULL && responselen != 0) {
- RLOGE("invalid response: NULL");
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- if (responselen < sizeof(RIL_CDMA_CallWaiting_v6)) {
- RLOGW("Upgrade to ril version %d\n", RIL_VERSION);
- }
-
- RIL_CDMA_CallWaiting_v6 *p_cur = ((RIL_CDMA_CallWaiting_v6 *) response);
-
- writeStringToParcel(p, p_cur->number);
- p.writeInt32(p_cur->numberPresentation);
- writeStringToParcel(p, p_cur->name);
- marshallSignalInfoRecord(p, p_cur->signalInfoRecord);
-
- if (s_callbacks.version <= LAST_IMPRECISE_RIL_VERSION) {
- if (responselen >= sizeof(RIL_CDMA_CallWaiting_v6)) {
- p.writeInt32(p_cur->number_type);
- p.writeInt32(p_cur->number_plan);
- } else {
- p.writeInt32(0);
- p.writeInt32(0);
- }
- } else { // RIL version >= 13
- if (responselen % sizeof(RIL_CDMA_CallWaiting_v6) != 0) {
- RLOGE("Data structure expected is RIL_CDMA_CallWaiting_v6");
- if (!isDebuggable()) {
- return RIL_ERRNO_INVALID_RESPONSE;
- } else {
- assert(0);
- }
- }
- p.writeInt32(p_cur->number_type);
- p.writeInt32(p_cur->number_plan);
- }
-
- startResponse;
- appendPrintBuf("%snumber=%s,numberPresentation=%d, name=%s,\
- signalInfoRecord[isPresent=%d,signalType=%d,alertPitch=%d\
- signal=%d,number_type=%d,number_plan=%d]",
- printBuf,
- p_cur->number,
- p_cur->numberPresentation,
- p_cur->name,
- p_cur->signalInfoRecord.isPresent,
- p_cur->signalInfoRecord.signalType,
- p_cur->signalInfoRecord.alertPitch,
- p_cur->signalInfoRecord.signal,
- p_cur->number_type,
- p_cur->number_plan);
- closeResponse;
-
- return 0;
-}
-
-static void responseSimRefreshV7(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e, void *response) {
- RIL_SimRefreshResponse_v7 *p_cur = ((RIL_SimRefreshResponse_v7 *) response);
- p.writeInt32(p_cur->result);
- p.writeInt32(p_cur->ef_id);
- writeStringToParcel(p, p_cur->aid);
-
- appendPrintBuf("%sresult=%d, ef_id=%d, aid=%s",
- printBuf,
- p_cur->result,
- p_cur->ef_id,
- p_cur->aid);
-
-}
-
-static int responseSimRefresh(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen) {
- if (response == NULL && responselen != 0) {
- RLOGE("responseSimRefresh: invalid response: NULL");
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- startResponse;
- if (s_callbacks.version <= LAST_IMPRECISE_RIL_VERSION) {
- if (s_callbacks.version >= 7) {
- responseSimRefreshV7(p, slotId, requestNumber, responseType, token, e, response);
- } else {
- int *p_cur = ((int *) response);
- p.writeInt32(p_cur[0]);
- p.writeInt32(p_cur[1]);
- writeStringToParcel(p, NULL);
-
- appendPrintBuf("%sresult=%d, ef_id=%d",
- printBuf,
- p_cur[0],
- p_cur[1]);
- }
- } else { // RIL version >= 13
- if (responselen % sizeof(RIL_SimRefreshResponse_v7) != 0) {
- RLOGE("Data structure expected is RIL_SimRefreshResponse_v7");
- if (!isDebuggable()) {
- return RIL_ERRNO_INVALID_RESPONSE;
- } else {
- assert(0);
- }
- }
- responseSimRefreshV7(p, slotId, requestNumber, responseType, token, e, response);
-
- }
- closeResponse;
-
- return 0;
-}
-
-static int responseCellInfoListV6(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e, void *response, size_t responselen) {
- if (response == NULL && responselen != 0) {
- RLOGE("invalid response: NULL");
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- if (responselen % sizeof(RIL_CellInfo) != 0) {
- RLOGE("responseCellInfoList: invalid response length %d expected multiple of %d",
- (int)responselen, (int)sizeof(RIL_CellInfo));
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- int num = responselen / sizeof(RIL_CellInfo);
- p.writeInt32(num);
-
- RIL_CellInfo *p_cur = (RIL_CellInfo *) response;
- startResponse;
- int i;
- for (i = 0; i < num; i++) {
- p.writeInt32((int)p_cur->cellInfoType);
- p.writeInt32(p_cur->registered);
- p.writeInt32(p_cur->timeStampType);
- p.writeInt64(p_cur->timeStamp);
- switch(p_cur->cellInfoType) {
- case RIL_CELL_INFO_TYPE_GSM: {
- p.writeInt32(p_cur->CellInfo.gsm.cellIdentityGsm.mcc);
- p.writeInt32(p_cur->CellInfo.gsm.cellIdentityGsm.mnc);
- p.writeInt32(p_cur->CellInfo.gsm.cellIdentityGsm.lac);
- p.writeInt32(p_cur->CellInfo.gsm.cellIdentityGsm.cid);
- p.writeInt32(p_cur->CellInfo.gsm.signalStrengthGsm.signalStrength);
- p.writeInt32(p_cur->CellInfo.gsm.signalStrengthGsm.bitErrorRate);
- break;
- }
- case RIL_CELL_INFO_TYPE_WCDMA: {
- p.writeInt32(p_cur->CellInfo.wcdma.cellIdentityWcdma.mcc);
- p.writeInt32(p_cur->CellInfo.wcdma.cellIdentityWcdma.mnc);
- p.writeInt32(p_cur->CellInfo.wcdma.cellIdentityWcdma.lac);
- p.writeInt32(p_cur->CellInfo.wcdma.cellIdentityWcdma.cid);
- p.writeInt32(p_cur->CellInfo.wcdma.cellIdentityWcdma.psc);
- p.writeInt32(p_cur->CellInfo.wcdma.signalStrengthWcdma.signalStrength);
- p.writeInt32(p_cur->CellInfo.wcdma.signalStrengthWcdma.bitErrorRate);
- break;
- }
- case RIL_CELL_INFO_TYPE_CDMA: {
- p.writeInt32(p_cur->CellInfo.cdma.cellIdentityCdma.networkId);
- p.writeInt32(p_cur->CellInfo.cdma.cellIdentityCdma.systemId);
- p.writeInt32(p_cur->CellInfo.cdma.cellIdentityCdma.basestationId);
- p.writeInt32(p_cur->CellInfo.cdma.cellIdentityCdma.longitude);
- p.writeInt32(p_cur->CellInfo.cdma.cellIdentityCdma.latitude);
-
- p.writeInt32(p_cur->CellInfo.cdma.signalStrengthCdma.dbm);
- p.writeInt32(p_cur->CellInfo.cdma.signalStrengthCdma.ecio);
- p.writeInt32(p_cur->CellInfo.cdma.signalStrengthEvdo.dbm);
- p.writeInt32(p_cur->CellInfo.cdma.signalStrengthEvdo.ecio);
- p.writeInt32(p_cur->CellInfo.cdma.signalStrengthEvdo.signalNoiseRatio);
- break;
- }
- case RIL_CELL_INFO_TYPE_LTE: {
- p.writeInt32(p_cur->CellInfo.lte.cellIdentityLte.mcc);
- p.writeInt32(p_cur->CellInfo.lte.cellIdentityLte.mnc);
- p.writeInt32(p_cur->CellInfo.lte.cellIdentityLte.ci);
- p.writeInt32(p_cur->CellInfo.lte.cellIdentityLte.pci);
- p.writeInt32(p_cur->CellInfo.lte.cellIdentityLte.tac);
-
- p.writeInt32(p_cur->CellInfo.lte.signalStrengthLte.signalStrength);
- p.writeInt32(p_cur->CellInfo.lte.signalStrengthLte.rsrp);
- p.writeInt32(p_cur->CellInfo.lte.signalStrengthLte.rsrq);
- p.writeInt32(p_cur->CellInfo.lte.signalStrengthLte.rssnr);
- p.writeInt32(p_cur->CellInfo.lte.signalStrengthLte.cqi);
- p.writeInt32(p_cur->CellInfo.lte.signalStrengthLte.timingAdvance);
- break;
- }
- case RIL_CELL_INFO_TYPE_TD_SCDMA: {
- p.writeInt32(p_cur->CellInfo.tdscdma.cellIdentityTdscdma.mcc);
- p.writeInt32(p_cur->CellInfo.tdscdma.cellIdentityTdscdma.mnc);
- p.writeInt32(p_cur->CellInfo.tdscdma.cellIdentityTdscdma.lac);
- p.writeInt32(p_cur->CellInfo.tdscdma.cellIdentityTdscdma.cid);
- p.writeInt32(p_cur->CellInfo.tdscdma.cellIdentityTdscdma.cpid);
- p.writeInt32(p_cur->CellInfo.tdscdma.signalStrengthTdscdma.rscp);
- break;
- }
- default: {
- break;
- }
- }
- p_cur += 1;
- }
- removeLastChar;
- closeResponse;
-
- return 0;
-}
-
-static int responseCellInfoListV12(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e, void *response, size_t responselen) {
- if (response == NULL && responselen != 0) {
- RLOGE("invalid response: NULL");
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- if (responselen % sizeof(RIL_CellInfo_v12) != 0) {
- RLOGE("responseCellInfoList: invalid response length %d expected multiple of %d",
- (int)responselen, (int)sizeof(RIL_CellInfo_v12));
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- int num = responselen / sizeof(RIL_CellInfo_v12);
- p.writeInt32(num);
-
- RIL_CellInfo_v12 *p_cur = (RIL_CellInfo_v12 *) response;
- startResponse;
- int i;
- for (i = 0; i < num; i++) {
- p.writeInt32((int)p_cur->cellInfoType);
- p.writeInt32(p_cur->registered);
- p.writeInt32(p_cur->timeStampType);
- p.writeInt64(p_cur->timeStamp);
- switch(p_cur->cellInfoType) {
- case RIL_CELL_INFO_TYPE_GSM: {
- p.writeInt32(p_cur->CellInfo.gsm.cellIdentityGsm.mcc);
- p.writeInt32(p_cur->CellInfo.gsm.cellIdentityGsm.mnc);
- p.writeInt32(p_cur->CellInfo.gsm.cellIdentityGsm.lac);
- p.writeInt32(p_cur->CellInfo.gsm.cellIdentityGsm.cid);
- p.writeInt32(p_cur->CellInfo.gsm.cellIdentityGsm.arfcn);
- p.writeInt32(p_cur->CellInfo.gsm.cellIdentityGsm.bsic);
- p.writeInt32(p_cur->CellInfo.gsm.signalStrengthGsm.signalStrength);
- p.writeInt32(p_cur->CellInfo.gsm.signalStrengthGsm.bitErrorRate);
- p.writeInt32(p_cur->CellInfo.gsm.signalStrengthGsm.timingAdvance);
- break;
- }
- case RIL_CELL_INFO_TYPE_WCDMA: {
- p.writeInt32(p_cur->CellInfo.wcdma.cellIdentityWcdma.mcc);
- p.writeInt32(p_cur->CellInfo.wcdma.cellIdentityWcdma.mnc);
- p.writeInt32(p_cur->CellInfo.wcdma.cellIdentityWcdma.lac);
- p.writeInt32(p_cur->CellInfo.wcdma.cellIdentityWcdma.cid);
- p.writeInt32(p_cur->CellInfo.wcdma.cellIdentityWcdma.psc);
- p.writeInt32(p_cur->CellInfo.wcdma.cellIdentityWcdma.uarfcn);
- p.writeInt32(p_cur->CellInfo.wcdma.signalStrengthWcdma.signalStrength);
- p.writeInt32(p_cur->CellInfo.wcdma.signalStrengthWcdma.bitErrorRate);
- break;
- }
- case RIL_CELL_INFO_TYPE_CDMA: {
- p.writeInt32(p_cur->CellInfo.cdma.cellIdentityCdma.networkId);
- p.writeInt32(p_cur->CellInfo.cdma.cellIdentityCdma.systemId);
- p.writeInt32(p_cur->CellInfo.cdma.cellIdentityCdma.basestationId);
- p.writeInt32(p_cur->CellInfo.cdma.cellIdentityCdma.longitude);
- p.writeInt32(p_cur->CellInfo.cdma.cellIdentityCdma.latitude);
-
- p.writeInt32(p_cur->CellInfo.cdma.signalStrengthCdma.dbm);
- p.writeInt32(p_cur->CellInfo.cdma.signalStrengthCdma.ecio);
- p.writeInt32(p_cur->CellInfo.cdma.signalStrengthEvdo.dbm);
- p.writeInt32(p_cur->CellInfo.cdma.signalStrengthEvdo.ecio);
- p.writeInt32(p_cur->CellInfo.cdma.signalStrengthEvdo.signalNoiseRatio);
- break;
- }
- case RIL_CELL_INFO_TYPE_LTE: {
- p.writeInt32(p_cur->CellInfo.lte.cellIdentityLte.mcc);
- p.writeInt32(p_cur->CellInfo.lte.cellIdentityLte.mnc);
- p.writeInt32(p_cur->CellInfo.lte.cellIdentityLte.ci);
- p.writeInt32(p_cur->CellInfo.lte.cellIdentityLte.pci);
- p.writeInt32(p_cur->CellInfo.lte.cellIdentityLte.tac);
- p.writeInt32(p_cur->CellInfo.lte.cellIdentityLte.earfcn);
-
- p.writeInt32(p_cur->CellInfo.lte.signalStrengthLte.signalStrength);
- p.writeInt32(p_cur->CellInfo.lte.signalStrengthLte.rsrp);
- p.writeInt32(p_cur->CellInfo.lte.signalStrengthLte.rsrq);
- p.writeInt32(p_cur->CellInfo.lte.signalStrengthLte.rssnr);
- p.writeInt32(p_cur->CellInfo.lte.signalStrengthLte.cqi);
- p.writeInt32(p_cur->CellInfo.lte.signalStrengthLte.timingAdvance);
- break;
- }
- case RIL_CELL_INFO_TYPE_TD_SCDMA: {
- p.writeInt32(p_cur->CellInfo.tdscdma.cellIdentityTdscdma.mcc);
- p.writeInt32(p_cur->CellInfo.tdscdma.cellIdentityTdscdma.mnc);
- p.writeInt32(p_cur->CellInfo.tdscdma.cellIdentityTdscdma.lac);
- p.writeInt32(p_cur->CellInfo.tdscdma.cellIdentityTdscdma.cid);
- p.writeInt32(p_cur->CellInfo.tdscdma.cellIdentityTdscdma.cpid);
- p.writeInt32(p_cur->CellInfo.tdscdma.signalStrengthTdscdma.rscp);
- break;
- }
- default: {
- break;
- }
- }
- p_cur += 1;
- }
- removeLastChar;
- closeResponse;
- return 0;
-}
-
-static int responseCellInfoList(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e, void *response, size_t responselen) {
- if (s_callbacks.version <= LAST_IMPRECISE_RIL_VERSION) {
- if (s_callbacks.version < 12) {
- RLOGD("responseCellInfoList: v6");
- return responseCellInfoListV6(p, slotId, requestNumber, responseType, token, e,
- response, responselen);
- } else {
- RLOGD("responseCellInfoList: v12");
- return responseCellInfoListV12(p, slotId, requestNumber, responseType, token, e,
- response, responselen);
- }
- } else { // RIL version >= 13
- if (responselen % sizeof(RIL_CellInfo_v12) != 0) {
- RLOGE("Data structure expected is RIL_CellInfo_v12");
- if (!isDebuggable()) {
- return RIL_ERRNO_INVALID_RESPONSE;
- } else {
- assert(0);
- }
- }
- return responseCellInfoListV12(p, slotId, requestNumber, responseType, token, e, response,
- responselen);
- }
-
- return 0;
-}
-
-static int responseHardwareConfig(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e, void *response, size_t responselen) {
- if (response == NULL && responselen != 0) {
- RLOGE("invalid response: NULL");
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- if (responselen % sizeof(RIL_HardwareConfig) != 0) {
- RLOGE("responseHardwareConfig: invalid response length %d expected multiple of %d",
- (int)responselen, (int)sizeof(RIL_HardwareConfig));
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- int num = responselen / sizeof(RIL_HardwareConfig);
- int i;
- RIL_HardwareConfig *p_cur = (RIL_HardwareConfig *) response;
-
- p.writeInt32(num);
-
- startResponse;
- for (i = 0; i < num; i++) {
- switch (p_cur[i].type) {
- case RIL_HARDWARE_CONFIG_MODEM: {
- writeStringToParcel(p, p_cur[i].uuid);
- p.writeInt32((int)p_cur[i].state);
- p.writeInt32(p_cur[i].cfg.modem.rat);
- p.writeInt32(p_cur[i].cfg.modem.maxVoice);
- p.writeInt32(p_cur[i].cfg.modem.maxData);
- p.writeInt32(p_cur[i].cfg.modem.maxStandby);
-
- appendPrintBuf("%s modem: uuid=%s,state=%d,rat=%08x,maxV=%d,maxD=%d,maxS=%d", printBuf,
- p_cur[i].uuid, (int)p_cur[i].state, p_cur[i].cfg.modem.rat,
- p_cur[i].cfg.modem.maxVoice, p_cur[i].cfg.modem.maxData,
- p_cur[i].cfg.modem.maxStandby);
- break;
- }
- case RIL_HARDWARE_CONFIG_SIM: {
- writeStringToParcel(p, p_cur[i].uuid);
- p.writeInt32((int)p_cur[i].state);
- writeStringToParcel(p, p_cur[i].cfg.sim.modemUuid);
-
- appendPrintBuf("%s sim: uuid=%s,state=%d,modem-uuid=%s", printBuf,
- p_cur[i].uuid, (int)p_cur[i].state, p_cur[i].cfg.sim.modemUuid);
- break;
- }
- }
- }
- removeLastChar;
- closeResponse;
- return 0;
-}
-
-static int responseRadioCapability(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e, void *response, size_t responselen) {
- if (response == NULL) {
- RLOGE("invalid response: NULL");
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- if (responselen != sizeof (RIL_RadioCapability) ) {
- RLOGE("invalid response length was %d expected %d",
- (int)responselen, (int)sizeof (RIL_SIM_IO_Response));
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- RIL_RadioCapability *p_cur = (RIL_RadioCapability *) response;
- p.writeInt32(p_cur->version);
- p.writeInt32(p_cur->session);
- p.writeInt32(p_cur->phase);
- p.writeInt32(p_cur->rat);
- writeStringToParcel(p, p_cur->logicalModemUuid);
- p.writeInt32(p_cur->status);
-
- startResponse;
- appendPrintBuf("%s[version=%d,session=%d,phase=%d,\
- rat=%s,logicalModemUuid=%s,status=%d]",
- printBuf,
- p_cur->version,
- p_cur->session,
- p_cur->phase,
- p_cur->rat,
- p_cur->logicalModemUuid,
- p_cur->status);
- closeResponse;
- return 0;
-}
-
-static void triggerEvLoop() {
- int ret;
- if (!pthread_equal(pthread_self(), s_tid_dispatch)) {
- /* trigger event loop to wakeup. No reason to do this,
- * if we're in the event loop thread */
- do {
- ret = write (s_fdWakeupWrite, " ", 1);
- } while (ret < 0 && errno == EINTR);
+static void triggerEvLoop() {
+ int ret;
+ if (!pthread_equal(pthread_self(), s_tid_dispatch)) {
+ /* trigger event loop to wakeup. No reason to do this,
+ * if we're in the event loop thread */
+ do {
+ ret = write (s_fdWakeupWrite, " ", 1);
+ } while (ret < 0 && errno == EINTR);
}
}
triggerEvLoop();
}
-static int responseCdmaSms(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen) {
- int num;
- int digitCount;
- int digitLimit;
- uint8_t uct;
- void* dest;
-
- RLOGD("Inside responseCdmaSms");
-
- if (response == NULL && responselen != 0) {
- RLOGE("invalid response: NULL");
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- if (responselen != sizeof(RIL_CDMA_SMS_Message)) {
- RLOGE("invalid response length was %d expected %d",
- (int)responselen, (int)sizeof(RIL_CDMA_SMS_Message));
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- RIL_CDMA_SMS_Message *p_cur = (RIL_CDMA_SMS_Message *) response;
- p.writeInt32(p_cur->uTeleserviceID);
- p.write(&(p_cur->bIsServicePresent),sizeof(uct));
- p.writeInt32(p_cur->uServicecategory);
- p.writeInt32(p_cur->sAddress.digit_mode);
- p.writeInt32(p_cur->sAddress.number_mode);
- p.writeInt32(p_cur->sAddress.number_type);
- p.writeInt32(p_cur->sAddress.number_plan);
- p.write(&(p_cur->sAddress.number_of_digits), sizeof(uct));
- digitLimit= MIN((p_cur->sAddress.number_of_digits), RIL_CDMA_SMS_ADDRESS_MAX);
- for(digitCount =0 ; digitCount < digitLimit; digitCount ++) {
- p.write(&(p_cur->sAddress.digits[digitCount]),sizeof(uct));
- }
-
- p.writeInt32(p_cur->sSubAddress.subaddressType);
- p.write(&(p_cur->sSubAddress.odd),sizeof(uct));
- p.write(&(p_cur->sSubAddress.number_of_digits),sizeof(uct));
- digitLimit= MIN((p_cur->sSubAddress.number_of_digits), RIL_CDMA_SMS_SUBADDRESS_MAX);
- for(digitCount =0 ; digitCount < digitLimit; digitCount ++) {
- p.write(&(p_cur->sSubAddress.digits[digitCount]),sizeof(uct));
- }
-
- digitLimit= MIN((p_cur->uBearerDataLen), RIL_CDMA_SMS_BEARER_DATA_MAX);
- p.writeInt32(p_cur->uBearerDataLen);
- for(digitCount =0 ; digitCount < digitLimit; digitCount ++) {
- p.write(&(p_cur->aBearerData[digitCount]), sizeof(uct));
- }
-
- startResponse;
- appendPrintBuf("%suTeleserviceID=%d, bIsServicePresent=%d, uServicecategory=%d, \
- sAddress.digit_mode=%d, sAddress.number_mode=%d, sAddress.number_type=%d, ",
- printBuf, p_cur->uTeleserviceID,p_cur->bIsServicePresent,p_cur->uServicecategory,
- p_cur->sAddress.digit_mode, p_cur->sAddress.number_mode,p_cur->sAddress.number_type);
- closeResponse;
-
- return 0;
-}
-
-static int responseDcRtInfo(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, 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;
-}
-
-static int responseLceData(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen) {
- if (response == NULL || responselen != sizeof(RIL_LceDataInfo)) {
- if (response == NULL) {
- RLOGE("invalid response: NULL");
- }
- else {
- RLOGE("responseLceData: invalid response length %u expecting len: %u",
- (unsigned)sizeof(RIL_LceDataInfo), (unsigned)responselen);
- }
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- RIL_LceDataInfo *p_cur = (RIL_LceDataInfo *)response;
- p.writeInt32(p_cur->last_hop_capacity_kbps);
-
- /* p_cur->confidence_level and p_cur->lce_suspended take 1 byte each.*/
- p.write((void *)&(p_cur->confidence_level), 1);
- p.write((void *)&(p_cur->lce_suspended), 1);
-
- startResponse;
- appendPrintBuf("LCE info received: capacity %d confidence level %d \
- and suspended %d",
- p_cur->last_hop_capacity_kbps, p_cur->confidence_level,
- p_cur->lce_suspended);
- closeResponse;
-
- return 0;
-}
-
-static int responsePcoData(Parcel &p, int slotId, int requestNumber, int responseType, int token,
- RIL_Errno e, void *response, size_t responselen) {
- if (response == NULL) {
- RLOGE("responsePcoData: invalid NULL response");
- return RIL_ERRNO_INVALID_RESPONSE;
- }
- if (responselen != sizeof(RIL_PCO_Data)) {
- RLOGE("responsePcoData: invalid response length %u, expecting %u",
- (unsigned)responselen, (unsigned)sizeof(RIL_PCO_Data));
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- RIL_PCO_Data *p_cur = (RIL_PCO_Data *)response;
- p.writeInt32(p_cur->cid);
- writeStringToParcel(p, p_cur->bearer_proto);
- p.writeInt32(p_cur->pco_id);
- p.writeInt32(p_cur->contents_length);
- p.write(p_cur->contents, p_cur->contents_length);
-
- startResponse;
- appendPrintBuf("PCO data received: cid %d, id %d, length %d",
- p_cur->cid, p_cur->pco_id, p_cur->contents_length);
- 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
** See the License for the specific language governing permissions and
** limitations under the License.
*/
- {0, NULL, NULL}, //none
- {RIL_REQUEST_GET_SIM_STATUS, dispatchVoid, radio::getIccCardStatusResponse},
- {RIL_REQUEST_ENTER_SIM_PIN, dispatchStrings, radio::supplyIccPinForAppResponse},
- {RIL_REQUEST_ENTER_SIM_PUK, dispatchStrings, radio::supplyIccPukForAppResponse},
- {RIL_REQUEST_ENTER_SIM_PIN2, dispatchStrings, radio::supplyIccPin2ForAppResponse},
- {RIL_REQUEST_ENTER_SIM_PUK2, dispatchStrings, radio::supplyIccPuk2ForAppResponse},
- {RIL_REQUEST_CHANGE_SIM_PIN, dispatchStrings, radio::changeIccPinForAppResponse},
- {RIL_REQUEST_CHANGE_SIM_PIN2, dispatchStrings, radio::changeIccPin2ForAppResponse},
- {RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION, dispatchStrings, radio::supplyNetworkDepersonalizationResponse},
- {RIL_REQUEST_GET_CURRENT_CALLS, dispatchVoid, radio::getCurrentCallsResponse},
- {RIL_REQUEST_DIAL, dispatchDial, radio::dialResponse},
- {RIL_REQUEST_GET_IMSI, dispatchStrings, radio::getIMSIForAppResponse},
- {RIL_REQUEST_HANGUP, dispatchInts, radio::hangupConnectionResponse},
- {RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND, dispatchVoid, radio::hangupWaitingOrBackgroundResponse},
- {RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND, dispatchVoid, radio::hangupForegroundResumeBackgroundResponse},
- {RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE, dispatchVoid, radio::switchWaitingOrHoldingAndActiveResponse},
- {RIL_REQUEST_CONFERENCE, dispatchVoid, radio::conferenceResponse},
- {RIL_REQUEST_UDUB, dispatchVoid, radio::rejectCallResponse},
- {RIL_REQUEST_LAST_CALL_FAIL_CAUSE, dispatchVoid, radio::getLastCallFailCauseResponse},
- {RIL_REQUEST_SIGNAL_STRENGTH, dispatchVoid, radio::getSignalStrengthResponse},
- {RIL_REQUEST_VOICE_REGISTRATION_STATE, dispatchVoid, radio::getVoiceRegistrationStateResponse},
- {RIL_REQUEST_DATA_REGISTRATION_STATE, dispatchVoid, radio::getDataRegistrationStateResponse},
- {RIL_REQUEST_OPERATOR, dispatchVoid, radio::getOperatorResponse},
- {RIL_REQUEST_RADIO_POWER, dispatchInts, radio::setRadioPowerResponse},
- {RIL_REQUEST_DTMF, dispatchString, radio::sendDtmfResponse},
- {RIL_REQUEST_SEND_SMS, dispatchStrings, radio::sendSmsResponse},
- {RIL_REQUEST_SEND_SMS_EXPECT_MORE, dispatchStrings, radio::sendSMSExpectMoreResponse},
- {RIL_REQUEST_SETUP_DATA_CALL, dispatchDataCall, radio::setupDataCallResponse},
- {RIL_REQUEST_SIM_IO, dispatchSIM_IO, radio::iccIOForAppResponse},
- {RIL_REQUEST_SEND_USSD, dispatchString, radio::sendUssdResponse},
- {RIL_REQUEST_CANCEL_USSD, dispatchVoid, radio::cancelPendingUssdResponse},
- {RIL_REQUEST_GET_CLIR, dispatchVoid, radio::getClirResponse},
- {RIL_REQUEST_SET_CLIR, dispatchInts, radio::setClirResponse},
- {RIL_REQUEST_QUERY_CALL_FORWARD_STATUS, dispatchCallForward, radio::getCallForwardStatusResponse},
- {RIL_REQUEST_SET_CALL_FORWARD, dispatchCallForward, radio::setCallForwardResponse},
- {RIL_REQUEST_QUERY_CALL_WAITING, dispatchInts, radio::getCallWaitingResponse},
- {RIL_REQUEST_SET_CALL_WAITING, dispatchInts, radio::setCallWaitingResponse},
- {RIL_REQUEST_SMS_ACKNOWLEDGE, dispatchInts, radio::acknowledgeLastIncomingGsmSmsResponse},
- {RIL_REQUEST_GET_IMEI, dispatchVoid, responseString},
- {RIL_REQUEST_GET_IMEISV, dispatchVoid, responseString},
- {RIL_REQUEST_ANSWER,dispatchVoid, radio::acceptCallResponse},
- {RIL_REQUEST_DEACTIVATE_DATA_CALL, dispatchStrings, radio::deactivateDataCallResponse},
- {RIL_REQUEST_QUERY_FACILITY_LOCK, dispatchStrings, radio::getFacilityLockForAppResponse},
- {RIL_REQUEST_SET_FACILITY_LOCK, dispatchStrings, radio::setFacilityLockForAppResponse},
- {RIL_REQUEST_CHANGE_BARRING_PASSWORD, dispatchStrings, radio::setBarringPasswordResponse},
- {RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE, dispatchVoid, radio::getNetworkSelectionModeResponse},
- {RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC, dispatchVoid, radio::setNetworkSelectionModeAutomaticResponse},
- {RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL, dispatchString, radio::setNetworkSelectionModeManualResponse},
- {RIL_REQUEST_QUERY_AVAILABLE_NETWORKS , dispatchVoid, radio::getAvailableNetworksResponse},
- {RIL_REQUEST_DTMF_START, dispatchString, radio::startDtmfResponse},
- {RIL_REQUEST_DTMF_STOP, dispatchVoid, radio::stopDtmfResponse},
- {RIL_REQUEST_BASEBAND_VERSION, dispatchVoid, radio::getBasebandVersionResponse},
- {RIL_REQUEST_SEPARATE_CONNECTION, dispatchInts, radio::separateConnectionResponse},
- {RIL_REQUEST_SET_MUTE, dispatchInts, radio::setMuteResponse},
- {RIL_REQUEST_GET_MUTE, dispatchVoid, radio::getMuteResponse},
- {RIL_REQUEST_QUERY_CLIP, dispatchVoid, radio::getClipResponse},
- {RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE, dispatchVoid, responseInts},
- {RIL_REQUEST_DATA_CALL_LIST, dispatchVoid, radio::getDataCallListResponse},
- {RIL_REQUEST_RESET_RADIO, dispatchVoid, responseVoid},
- {RIL_REQUEST_OEM_HOOK_RAW, dispatchRaw, radio::sendRequestRawResponse},
- {RIL_REQUEST_OEM_HOOK_STRINGS, dispatchStrings, radio::sendRequestStringsResponse},
- {RIL_REQUEST_SCREEN_STATE, dispatchInts, radio::sendDeviceStateResponse}, // Note the response function is different.
- {RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION, dispatchInts, radio::setSuppServiceNotificationsResponse},
- {RIL_REQUEST_WRITE_SMS_TO_SIM, dispatchSmsWrite, radio::writeSmsToSimResponse},
- {RIL_REQUEST_DELETE_SMS_ON_SIM, dispatchInts, radio::deleteSmsOnSimResponse},
- {RIL_REQUEST_SET_BAND_MODE, dispatchInts, radio::setBandModeResponse},
- {RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE, dispatchVoid, radio::getAvailableBandModesResponse},
- {RIL_REQUEST_STK_GET_PROFILE, dispatchVoid, NULL},
- {RIL_REQUEST_STK_SET_PROFILE, dispatchString, NULL},
- {RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND, dispatchString, radio::sendEnvelopeResponse},
- {RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE, dispatchString, radio::sendTerminalResponseToSimResponse},
- {RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM, dispatchInts, radio::handleStkCallSetupRequestFromSimResponse},
- {RIL_REQUEST_EXPLICIT_CALL_TRANSFER, dispatchVoid, radio::explicitCallTransferResponse},
- {RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE, dispatchInts, radio::setPreferredNetworkTypeResponse},
- {RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE, dispatchVoid, radio::getPreferredNetworkTypeResponse},
- {RIL_REQUEST_GET_NEIGHBORING_CELL_IDS, dispatchVoid, radio::getNeighboringCidsResponse},
- {RIL_REQUEST_SET_LOCATION_UPDATES, dispatchInts, radio::setLocationUpdatesResponse},
- {RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE, dispatchInts, radio::setCdmaSubscriptionSourceResponse},
- {RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE, dispatchInts, radio::setCdmaRoamingPreferenceResponse},
- {RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE, dispatchVoid, radio::getCdmaRoamingPreferenceResponse},
- {RIL_REQUEST_SET_TTY_MODE, dispatchInts, radio::setTTYModeResponse},
- {RIL_REQUEST_QUERY_TTY_MODE, dispatchVoid, radio::getTTYModeResponse},
- {RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE, dispatchInts, radio::setPreferredVoicePrivacyResponse},
- {RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE, dispatchVoid, radio::getPreferredVoicePrivacyResponse},
- {RIL_REQUEST_CDMA_FLASH, dispatchString, radio::sendCDMAFeatureCodeResponse},
- {RIL_REQUEST_CDMA_BURST_DTMF, dispatchStrings, radio::sendBurstDtmfResponse},
- {RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY, dispatchString, NULL},
- {RIL_REQUEST_CDMA_SEND_SMS, dispatchCdmaSms, radio::sendCdmaSmsResponse},
- {RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE, dispatchCdmaSmsAck, radio::acknowledgeLastIncomingCdmaSmsResponse},
- {RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG, dispatchVoid, radio::getGsmBroadcastConfigResponse},
- {RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG, dispatchGsmBrSmsCnf, radio::setGsmBroadcastConfigResponse},
- {RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION, dispatchInts, radio::setGsmBroadcastActivationResponse},
- {RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG, dispatchVoid, radio::getCdmaBroadcastConfigResponse},
- {RIL_REQUEST_CDMA_SET_BROADCAST_SMS_CONFIG, dispatchCdmaBrSmsCnf, radio::setCdmaBroadcastConfigResponse},
- {RIL_REQUEST_CDMA_SMS_BROADCAST_ACTIVATION, dispatchInts, radio::setCdmaBroadcastActivationResponse},
- {RIL_REQUEST_CDMA_SUBSCRIPTION, dispatchVoid, radio::getCDMASubscriptionResponse},
- {RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM, dispatchRilCdmaSmsWriteArgs, radio::writeSmsToRuimResponse},
- {RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM, dispatchInts, radio::deleteSmsOnRuimResponse},
- {RIL_REQUEST_DEVICE_IDENTITY, dispatchVoid, radio::getDeviceIdentityResponse},
- {RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE, dispatchVoid, radio::exitEmergencyCallbackModeResponse},
- {RIL_REQUEST_GET_SMSC_ADDRESS, dispatchVoid, radio::getSmscAddressResponse},
- {RIL_REQUEST_SET_SMSC_ADDRESS, dispatchString, radio::setSmscAddressResponse},
- {RIL_REQUEST_REPORT_SMS_MEMORY_STATUS, dispatchInts, radio::reportSmsMemoryStatusResponse},
- {RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING, dispatchVoid, radio::reportStkServiceIsRunningResponse},
- {RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE, dispatchVoid, radio::getCdmaSubscriptionSourceResponse},
- {RIL_REQUEST_ISIM_AUTHENTICATION, dispatchString, radio::requestIsimAuthenticationResponse},
- {RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU, dispatchStrings, radio::acknowledgeIncomingGsmSmsWithPduResponse},
- {RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS, dispatchString, radio::sendEnvelopeWithStatusResponse},
- {RIL_REQUEST_VOICE_RADIO_TECH, dispatchVoid, radio::getVoiceRadioTechnologyResponse},
- {RIL_REQUEST_GET_CELL_INFO_LIST, dispatchVoid, radio::getCellInfoListResponse},
- {RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE, dispatchInts, radio::setCellInfoListRateResponse},
- {RIL_REQUEST_SET_INITIAL_ATTACH_APN, dispatchSetInitialAttachApn, radio::setInitialAttachApnResponse},
- {RIL_REQUEST_IMS_REGISTRATION_STATE, dispatchVoid, radio::getImsRegistrationStateResponse},
- {RIL_REQUEST_IMS_SEND_SMS, dispatchImsSms, radio::sendImsSmsResponse},
- {RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC, dispatchSIM_APDU, radio::iccTransmitApduBasicChannelResponse},
- {RIL_REQUEST_SIM_OPEN_CHANNEL, dispatchString, radio::iccOpenLogicalChannelResponse},
- {RIL_REQUEST_SIM_CLOSE_CHANNEL, dispatchInts, radio::iccCloseLogicalChannelResponse},
- {RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL, dispatchSIM_APDU, radio::iccTransmitApduLogicalChannelResponse},
- {RIL_REQUEST_NV_READ_ITEM, dispatchNVReadItem, radio::nvReadItemResponse},
- {RIL_REQUEST_NV_WRITE_ITEM, dispatchNVWriteItem, radio::nvWriteItemResponse},
- {RIL_REQUEST_NV_WRITE_CDMA_PRL, dispatchRaw, radio::nvWriteCdmaPrlResponse},
- {RIL_REQUEST_NV_RESET_CONFIG, dispatchInts, radio::nvResetConfigResponse},
- {RIL_REQUEST_SET_UICC_SUBSCRIPTION, dispatchUiccSubscripton, radio::setUiccSubscriptionResponse},
- {RIL_REQUEST_ALLOW_DATA, dispatchInts, radio::setDataAllowedResponse},
- {RIL_REQUEST_GET_HARDWARE_CONFIG, dispatchVoid, radio::getHardwareConfigResponse},
- {RIL_REQUEST_SIM_AUTHENTICATION, dispatchSimAuthentication, radio::requestIccSimAuthenticationResponse},
- {RIL_REQUEST_GET_DC_RT_INFO, dispatchVoid, responseDcRtInfo},
- {RIL_REQUEST_SET_DC_RT_INFO_RATE, dispatchInts, responseVoid},
- {RIL_REQUEST_SET_DATA_PROFILE, dispatchDataProfile, radio::setDataProfileResponse},
- {RIL_REQUEST_SHUTDOWN, dispatchVoid, radio::requestShutdownResponse},
- {RIL_REQUEST_GET_RADIO_CAPABILITY, dispatchVoid, radio::getRadioCapabilityResponse},
- {RIL_REQUEST_SET_RADIO_CAPABILITY, dispatchRadioCapability, radio::setRadioCapabilityResponse},
- {RIL_REQUEST_START_LCE, dispatchInts, radio::startLceServiceResponse},
- {RIL_REQUEST_STOP_LCE, dispatchVoid, radio::stopLceServiceResponse},
- {RIL_REQUEST_PULL_LCEDATA, dispatchVoid, radio::pullLceDataResponse},
- {RIL_REQUEST_GET_ACTIVITY_INFO, dispatchVoid, radio::getModemActivityInfoResponse},
- {RIL_REQUEST_SET_CARRIER_RESTRICTIONS, dispatchCarrierRestrictions, radio::setAllowedCarriersResponse},
- {RIL_REQUEST_GET_CARRIER_RESTRICTIONS, dispatchVoid, radio::getAllowedCarriersResponse},
- {RIL_REQUEST_SEND_DEVICE_STATE, dispatchInts, radio::sendDeviceStateResponse},
- {RIL_REQUEST_SET_UNSOLICITED_RESPONSE_FILTER, dispatchInts, radio::setIndicationFilterResponse},
- {RIL_REQUEST_SET_SIM_CARD_POWER, dispatchInts, radio::setSimCardPowerResponse},
+ {0, NULL}, //none
+ {RIL_REQUEST_GET_SIM_STATUS, radio::getIccCardStatusResponse},
+ {RIL_REQUEST_ENTER_SIM_PIN, radio::supplyIccPinForAppResponse},
+ {RIL_REQUEST_ENTER_SIM_PUK, radio::supplyIccPukForAppResponse},
+ {RIL_REQUEST_ENTER_SIM_PIN2, radio::supplyIccPin2ForAppResponse},
+ {RIL_REQUEST_ENTER_SIM_PUK2, radio::supplyIccPuk2ForAppResponse},
+ {RIL_REQUEST_CHANGE_SIM_PIN, radio::changeIccPinForAppResponse},
+ {RIL_REQUEST_CHANGE_SIM_PIN2, radio::changeIccPin2ForAppResponse},
+ {RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION, radio::supplyNetworkDepersonalizationResponse},
+ {RIL_REQUEST_GET_CURRENT_CALLS, radio::getCurrentCallsResponse},
+ {RIL_REQUEST_DIAL, radio::dialResponse},
+ {RIL_REQUEST_GET_IMSI, radio::getIMSIForAppResponse},
+ {RIL_REQUEST_HANGUP, radio::hangupConnectionResponse},
+ {RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND, radio::hangupWaitingOrBackgroundResponse},
+ {RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND, radio::hangupForegroundResumeBackgroundResponse},
+ {RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE, radio::switchWaitingOrHoldingAndActiveResponse},
+ {RIL_REQUEST_CONFERENCE, radio::conferenceResponse},
+ {RIL_REQUEST_UDUB, radio::rejectCallResponse},
+ {RIL_REQUEST_LAST_CALL_FAIL_CAUSE, radio::getLastCallFailCauseResponse},
+ {RIL_REQUEST_SIGNAL_STRENGTH, radio::getSignalStrengthResponse},
+ {RIL_REQUEST_VOICE_REGISTRATION_STATE, radio::getVoiceRegistrationStateResponse},
+ {RIL_REQUEST_DATA_REGISTRATION_STATE, radio::getDataRegistrationStateResponse},
+ {RIL_REQUEST_OPERATOR, radio::getOperatorResponse},
+ {RIL_REQUEST_RADIO_POWER, radio::setRadioPowerResponse},
+ {RIL_REQUEST_DTMF, radio::sendDtmfResponse},
+ {RIL_REQUEST_SEND_SMS, radio::sendSmsResponse},
+ {RIL_REQUEST_SEND_SMS_EXPECT_MORE, radio::sendSMSExpectMoreResponse},
+ {RIL_REQUEST_SETUP_DATA_CALL, radio::setupDataCallResponse},
+ {RIL_REQUEST_SIM_IO, radio::iccIOForAppResponse},
+ {RIL_REQUEST_SEND_USSD, radio::sendUssdResponse},
+ {RIL_REQUEST_CANCEL_USSD, radio::cancelPendingUssdResponse},
+ {RIL_REQUEST_GET_CLIR, radio::getClirResponse},
+ {RIL_REQUEST_SET_CLIR, radio::setClirResponse},
+ {RIL_REQUEST_QUERY_CALL_FORWARD_STATUS, radio::getCallForwardStatusResponse},
+ {RIL_REQUEST_SET_CALL_FORWARD, radio::setCallForwardResponse},
+ {RIL_REQUEST_QUERY_CALL_WAITING, radio::getCallWaitingResponse},
+ {RIL_REQUEST_SET_CALL_WAITING, radio::setCallWaitingResponse},
+ {RIL_REQUEST_SMS_ACKNOWLEDGE, radio::acknowledgeLastIncomingGsmSmsResponse},
+ {RIL_REQUEST_GET_IMEI, NULL},
+ {RIL_REQUEST_GET_IMEISV, NULL},
+ {RIL_REQUEST_ANSWER, radio::acceptCallResponse},
+ {RIL_REQUEST_DEACTIVATE_DATA_CALL, radio::deactivateDataCallResponse},
+ {RIL_REQUEST_QUERY_FACILITY_LOCK, radio::getFacilityLockForAppResponse},
+ {RIL_REQUEST_SET_FACILITY_LOCK, radio::setFacilityLockForAppResponse},
+ {RIL_REQUEST_CHANGE_BARRING_PASSWORD, radio::setBarringPasswordResponse},
+ {RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE, radio::getNetworkSelectionModeResponse},
+ {RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC, radio::setNetworkSelectionModeAutomaticResponse},
+ {RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL, radio::setNetworkSelectionModeManualResponse},
+ {RIL_REQUEST_QUERY_AVAILABLE_NETWORKS , radio::getAvailableNetworksResponse},
+ {RIL_REQUEST_DTMF_START, radio::startDtmfResponse},
+ {RIL_REQUEST_DTMF_STOP, radio::stopDtmfResponse},
+ {RIL_REQUEST_BASEBAND_VERSION, radio::getBasebandVersionResponse},
+ {RIL_REQUEST_SEPARATE_CONNECTION, radio::separateConnectionResponse},
+ {RIL_REQUEST_SET_MUTE, radio::setMuteResponse},
+ {RIL_REQUEST_GET_MUTE, radio::getMuteResponse},
+ {RIL_REQUEST_QUERY_CLIP, radio::getClipResponse},
+ {RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE, NULL},
+ {RIL_REQUEST_DATA_CALL_LIST, radio::getDataCallListResponse},
+ {RIL_REQUEST_RESET_RADIO, NULL},
+ {RIL_REQUEST_OEM_HOOK_RAW, radio::sendRequestRawResponse},
+ {RIL_REQUEST_OEM_HOOK_STRINGS, radio::sendRequestStringsResponse},
+ {RIL_REQUEST_SCREEN_STATE, radio::sendDeviceStateResponse}, // Note the response function is different.
+ {RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION, radio::setSuppServiceNotificationsResponse},
+ {RIL_REQUEST_WRITE_SMS_TO_SIM, radio::writeSmsToSimResponse},
+ {RIL_REQUEST_DELETE_SMS_ON_SIM, radio::deleteSmsOnSimResponse},
+ {RIL_REQUEST_SET_BAND_MODE, radio::setBandModeResponse},
+ {RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE, radio::getAvailableBandModesResponse},
+ {RIL_REQUEST_STK_GET_PROFILE, NULL},
+ {RIL_REQUEST_STK_SET_PROFILE, NULL},
+ {RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND, radio::sendEnvelopeResponse},
+ {RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE, radio::sendTerminalResponseToSimResponse},
+ {RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM, radio::handleStkCallSetupRequestFromSimResponse},
+ {RIL_REQUEST_EXPLICIT_CALL_TRANSFER, radio::explicitCallTransferResponse},
+ {RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE, radio::setPreferredNetworkTypeResponse},
+ {RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE, radio::getPreferredNetworkTypeResponse},
+ {RIL_REQUEST_GET_NEIGHBORING_CELL_IDS, radio::getNeighboringCidsResponse},
+ {RIL_REQUEST_SET_LOCATION_UPDATES, radio::setLocationUpdatesResponse},
+ {RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE, radio::setCdmaSubscriptionSourceResponse},
+ {RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE, radio::setCdmaRoamingPreferenceResponse},
+ {RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE, radio::getCdmaRoamingPreferenceResponse},
+ {RIL_REQUEST_SET_TTY_MODE, radio::setTTYModeResponse},
+ {RIL_REQUEST_QUERY_TTY_MODE, radio::getTTYModeResponse},
+ {RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE, radio::setPreferredVoicePrivacyResponse},
+ {RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE, radio::getPreferredVoicePrivacyResponse},
+ {RIL_REQUEST_CDMA_FLASH, radio::sendCDMAFeatureCodeResponse},
+ {RIL_REQUEST_CDMA_BURST_DTMF, radio::sendBurstDtmfResponse},
+ {RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY, NULL},
+ {RIL_REQUEST_CDMA_SEND_SMS, radio::sendCdmaSmsResponse},
+ {RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE, radio::acknowledgeLastIncomingCdmaSmsResponse},
+ {RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG, radio::getGsmBroadcastConfigResponse},
+ {RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG, radio::setGsmBroadcastConfigResponse},
+ {RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION, radio::setGsmBroadcastActivationResponse},
+ {RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG, radio::getCdmaBroadcastConfigResponse},
+ {RIL_REQUEST_CDMA_SET_BROADCAST_SMS_CONFIG, radio::setCdmaBroadcastConfigResponse},
+ {RIL_REQUEST_CDMA_SMS_BROADCAST_ACTIVATION, radio::setCdmaBroadcastActivationResponse},
+ {RIL_REQUEST_CDMA_SUBSCRIPTION, radio::getCDMASubscriptionResponse},
+ {RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM, radio::writeSmsToRuimResponse},
+ {RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM, radio::deleteSmsOnRuimResponse},
+ {RIL_REQUEST_DEVICE_IDENTITY, radio::getDeviceIdentityResponse},
+ {RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE, radio::exitEmergencyCallbackModeResponse},
+ {RIL_REQUEST_GET_SMSC_ADDRESS, radio::getSmscAddressResponse},
+ {RIL_REQUEST_SET_SMSC_ADDRESS, radio::setSmscAddressResponse},
+ {RIL_REQUEST_REPORT_SMS_MEMORY_STATUS, radio::reportSmsMemoryStatusResponse},
+ {RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING, radio::reportStkServiceIsRunningResponse},
+ {RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE, radio::getCdmaSubscriptionSourceResponse},
+ {RIL_REQUEST_ISIM_AUTHENTICATION, radio::requestIsimAuthenticationResponse},
+ {RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU, radio::acknowledgeIncomingGsmSmsWithPduResponse},
+ {RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS, radio::sendEnvelopeWithStatusResponse},
+ {RIL_REQUEST_VOICE_RADIO_TECH, radio::getVoiceRadioTechnologyResponse},
+ {RIL_REQUEST_GET_CELL_INFO_LIST, radio::getCellInfoListResponse},
+ {RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE, radio::setCellInfoListRateResponse},
+ {RIL_REQUEST_SET_INITIAL_ATTACH_APN, radio::setInitialAttachApnResponse},
+ {RIL_REQUEST_IMS_REGISTRATION_STATE, radio::getImsRegistrationStateResponse},
+ {RIL_REQUEST_IMS_SEND_SMS, radio::sendImsSmsResponse},
+ {RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC, radio::iccTransmitApduBasicChannelResponse},
+ {RIL_REQUEST_SIM_OPEN_CHANNEL, radio::iccOpenLogicalChannelResponse},
+ {RIL_REQUEST_SIM_CLOSE_CHANNEL, radio::iccCloseLogicalChannelResponse},
+ {RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL, radio::iccTransmitApduLogicalChannelResponse},
+ {RIL_REQUEST_NV_READ_ITEM, radio::nvReadItemResponse},
+ {RIL_REQUEST_NV_WRITE_ITEM, radio::nvWriteItemResponse},
+ {RIL_REQUEST_NV_WRITE_CDMA_PRL, radio::nvWriteCdmaPrlResponse},
+ {RIL_REQUEST_NV_RESET_CONFIG, radio::nvResetConfigResponse},
+ {RIL_REQUEST_SET_UICC_SUBSCRIPTION, radio::setUiccSubscriptionResponse},
+ {RIL_REQUEST_ALLOW_DATA, radio::setDataAllowedResponse},
+ {RIL_REQUEST_GET_HARDWARE_CONFIG, radio::getHardwareConfigResponse},
+ {RIL_REQUEST_SIM_AUTHENTICATION, radio::requestIccSimAuthenticationResponse},
+ {RIL_REQUEST_GET_DC_RT_INFO, NULL},
+ {RIL_REQUEST_SET_DC_RT_INFO_RATE, NULL},
+ {RIL_REQUEST_SET_DATA_PROFILE, radio::setDataProfileResponse},
+ {RIL_REQUEST_SHUTDOWN, radio::requestShutdownResponse},
+ {RIL_REQUEST_GET_RADIO_CAPABILITY, radio::getRadioCapabilityResponse},
+ {RIL_REQUEST_SET_RADIO_CAPABILITY, radio::setRadioCapabilityResponse},
+ {RIL_REQUEST_START_LCE, radio::startLceServiceResponse},
+ {RIL_REQUEST_STOP_LCE, radio::stopLceServiceResponse},
+ {RIL_REQUEST_PULL_LCEDATA, radio::pullLceDataResponse},
+ {RIL_REQUEST_GET_ACTIVITY_INFO, radio::getModemActivityInfoResponse},
+ {RIL_REQUEST_SET_CARRIER_RESTRICTIONS, radio::setAllowedCarriersResponse},
+ {RIL_REQUEST_GET_CARRIER_RESTRICTIONS, radio::getAllowedCarriersResponse},
+ {RIL_REQUEST_SEND_DEVICE_STATE, radio::sendDeviceStateResponse},
+ {RIL_REQUEST_SET_UNSOLICITED_RESPONSE_FILTER, radio::setIndicationFilterResponse},
+ {RIL_REQUEST_SET_SIM_CARD_POWER, radio::setSimCardPowerResponse},