summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libril/ril_service.cpp68
1 files changed, 54 insertions, 14 deletions
diff --git a/libril/ril_service.cpp b/libril/ril_service.cpp
index 5dc918c..a5fa8b9 100644
--- a/libril/ril_service.cpp
+++ b/libril/ril_service.cpp
@@ -3391,6 +3391,20 @@ int convertResponseStringEntryToInt(char **response, int index, int numStrings)
return -1;
}
+int convertResponseHexStringEntryToInt(char **response, int index, int numStrings) {
+ const int hexBase = 16;
+ if ((response != NULL) && (numStrings > index) && (response[index] != NULL)) {
+ return strtol(response[index], NULL, hexBase);
+ }
+
+ return -1;
+}
+
+/* Fill Cell Identity info from Voice Registration State Response.
+ * This fucntion is applicable only for RIL Version < 15.
+ * Response is a "char **".
+ * First and Second entries are in hex string format
+ * and rest are integers represented in ascii format. */
void fillCellIdentityFromVoiceRegStateResponseString(CellIdentity &cellIdentity,
int numStrings, char** response) {
@@ -3401,28 +3415,37 @@ void fillCellIdentityFromVoiceRegStateResponseString(CellIdentity &cellIdentity,
switch(rilCellIdentity.cellInfoType) {
case RIL_CELL_INFO_TYPE_GSM: {
+ /* valid LAC are hexstrings in the range 0x0000 - 0xffff */
rilCellIdentity.cellIdentityGsm.lac =
- convertResponseStringEntryToInt(response, 1, numStrings);
+ convertResponseHexStringEntryToInt(response, 1, numStrings);
+
+ /* valid CID are hexstrings in the range 0x00000000 - 0xffffffff */
rilCellIdentity.cellIdentityGsm.cid =
- convertResponseStringEntryToInt(response, 2, numStrings);
+ convertResponseHexStringEntryToInt(response, 2, numStrings);
break;
}
case RIL_CELL_INFO_TYPE_WCDMA: {
+ /* valid LAC are hexstrings in the range 0x0000 - 0xffff */
rilCellIdentity.cellIdentityWcdma.lac =
- convertResponseStringEntryToInt(response, 1, numStrings);
+ convertResponseHexStringEntryToInt(response, 1, numStrings);
+
+ /* valid CID are hexstrings in the range 0x00000000 - 0xffffffff */
rilCellIdentity.cellIdentityWcdma.cid =
- convertResponseStringEntryToInt(response, 2, numStrings);
+ convertResponseHexStringEntryToInt(response, 2, numStrings);
rilCellIdentity.cellIdentityWcdma.psc =
convertResponseStringEntryToInt(response, 14, numStrings);
break;
}
case RIL_CELL_INFO_TYPE_TD_SCDMA:{
+ /* valid LAC are hexstrings in the range 0x0000 - 0xffff */
rilCellIdentity.cellIdentityTdscdma.lac =
- convertResponseStringEntryToInt(response, 1, numStrings);
+ convertResponseHexStringEntryToInt(response, 1, numStrings);
+
+ /* valid CID are hexstrings in the range 0x00000000 - 0xffffffff */
rilCellIdentity.cellIdentityTdscdma.cid =
- convertResponseStringEntryToInt(response, 2, numStrings);
+ convertResponseHexStringEntryToInt(response, 2, numStrings);
break;
}
@@ -3441,10 +3464,13 @@ void fillCellIdentityFromVoiceRegStateResponseString(CellIdentity &cellIdentity,
}
case RIL_CELL_INFO_TYPE_LTE:{
+ /* valid TAC are hexstrings in the range 0x0000 - 0xffff */
rilCellIdentity.cellIdentityLte.tac =
- convertResponseStringEntryToInt(response, 1, numStrings);
+ convertResponseHexStringEntryToInt(response, 1, numStrings);
+
+ /* valid CID are hexstrings in the range 0x00000000 - 0xffffffff */
rilCellIdentity.cellIdentityLte.ci =
- convertResponseStringEntryToInt(response, 2, numStrings);
+ convertResponseHexStringEntryToInt(response, 2, numStrings);
break;
}
@@ -3456,6 +3482,11 @@ void fillCellIdentityFromVoiceRegStateResponseString(CellIdentity &cellIdentity,
fillCellIdentityResponse(cellIdentity, rilCellIdentity);
}
+/* Fill Cell Identity info from Data Registration State Response.
+ * This fucntion is applicable only for RIL Version < 15.
+ * Response is a "char **".
+ * First and Second entries are in hex string format
+ * and rest are integers represented in ascii format. */
void fillCellIdentityFromDataRegStateResponseString(CellIdentity &cellIdentity,
int numStrings, char** response) {
@@ -3465,24 +3496,33 @@ void fillCellIdentityFromDataRegStateResponseString(CellIdentity &cellIdentity,
rilCellIdentity.cellInfoType = getCellInfoTypeRadioTechnology(response[3]);
switch(rilCellIdentity.cellInfoType) {
case RIL_CELL_INFO_TYPE_GSM: {
+ /* valid LAC are hexstrings in the range 0x0000 - 0xffff */
rilCellIdentity.cellIdentityGsm.lac =
- convertResponseStringEntryToInt(response, 1, numStrings);
+ convertResponseHexStringEntryToInt(response, 1, numStrings);
+
+ /* valid CID are hexstrings in the range 0x00000000 - 0xffffffff */
rilCellIdentity.cellIdentityGsm.cid =
- convertResponseStringEntryToInt(response, 2, numStrings);
+ convertResponseHexStringEntryToInt(response, 2, numStrings);
break;
}
case RIL_CELL_INFO_TYPE_WCDMA: {
+ /* valid LAC are hexstrings in the range 0x0000 - 0xffff */
rilCellIdentity.cellIdentityWcdma.lac =
- convertResponseStringEntryToInt(response, 1, numStrings);
+ convertResponseHexStringEntryToInt(response, 1, numStrings);
+
+ /* valid CID are hexstrings in the range 0x00000000 - 0xffffffff */
rilCellIdentity.cellIdentityWcdma.cid =
- convertResponseStringEntryToInt(response, 2, numStrings);
+ convertResponseHexStringEntryToInt(response, 2, numStrings);
break;
}
case RIL_CELL_INFO_TYPE_TD_SCDMA:{
+ /* valid LAC are hexstrings in the range 0x0000 - 0xffff */
rilCellIdentity.cellIdentityTdscdma.lac =
- convertResponseStringEntryToInt(response, 1, numStrings);
+ convertResponseHexStringEntryToInt(response, 1, numStrings);
+
+ /* valid CID are hexstrings in the range 0x00000000 - 0xffffffff */
rilCellIdentity.cellIdentityTdscdma.cid =
- convertResponseStringEntryToInt(response, 2, numStrings);
+ convertResponseHexStringEntryToInt(response, 2, numStrings);
break;
}
case RIL_CELL_INFO_TYPE_LTE: {