summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNaveen Kalla <nkalla@codeaurora.org>2011-11-15 12:48:22 -0800
committerLinux Build Service Account <lnxbuild@localhost>2013-10-31 19:03:16 -0600
commit7bfd4ce31e581497ca4f5b6b411cb92cfcfd1ff8 (patch)
treeaa459bd7f2854d0109ef60dc7ca49b7ad89c2ce9
parentdb06e94925d47a26a9bf7b44d686f072f9e304a5 (diff)
downloadandroid_hardware_ril-7bfd4ce31e581497ca4f5b6b411cb92cfcfd1ff8.tar.gz
android_hardware_ril-7bfd4ce31e581497ca4f5b6b411cb92cfcfd1ff8.tar.bz2
android_hardware_ril-7bfd4ce31e581497ca4f5b6b411cb92cfcfd1ff8.zip
Support reading data profiles from OMH cards
Change-Id: I371a15428cd296cd02a2f82d5904dea483058c26 (cherry picked from commit e2d39f6cf77d29ad57243649dc54d96a60db922c) (cherry picked from commit 54866893124465af843a16148ff53534e725eb54) (cherry picked from commit 494ba62c5119b0002bfedb51d4ed51514c76aa0e)
-rw-r--r--include/telephony/ril.h30
-rw-r--r--libril/ril.cpp38
-rw-r--r--libril/ril_commands.h1
-rw-r--r--reference-ril/reference-ril.c50
4 files changed, 117 insertions, 2 deletions
diff --git a/include/telephony/ril.h b/include/telephony/ril.h
index 803d965..9959f81 100644
--- a/include/telephony/ril.h
+++ b/include/telephony/ril.h
@@ -969,6 +969,12 @@ typedef struct {
RIL_CDMA_InformationRecord infoRec[RIL_CDMA_MAX_NUMBER_OF_INFO_RECS];
} RIL_CDMA_InformationRecords;
+/* Data Call Profile: Simple IP User Profile Parameters*/
+typedef struct {
+ int profileId;
+ int priority; /* priority. [0..255], 0 - highest */
+} RIL_DataCallProfileInfo;
+
/**
* RIL_REQUEST_GET_SIM_STATUS
*
@@ -3565,6 +3571,30 @@ typedef struct {
*/
#define RIL_REQUEST_IMS_SEND_SMS 113
+/**
+ * RIL_REQUEST_GET_DATA_CALL_PROFILE
+ *
+ * Get the Data Call Profile for a particular app type
+ *
+ * "data" is const int*
+ * (const int*)data[0] - App type. Value is specified the RUIM spec C.S0023-D
+ *
+ *
+ * "response" is a const char * containing the count and the array of profiles
+ * ((const int *)response)[0] Number RIL_DataCallProfileInfo structs(count)
+ * ((const char *)response)[1] is the buffer that contains 'count' number of
+ * RIL_DataCallProfileInfo structs.
+ *
+ * Valid errors:
+ * SUCCESS
+ * GENERIC_FAILURE
+ * RIL_E_DATA_CALL_PROFILE_ERROR
+ * RIL_E_DATA_CALL_PROFILE_NOT_AVAILABLE
+ *
+ */
+#define RIL_REQUEST_GET_DATA_CALL_PROFILE 114
+
+
/***********************************************************************/
diff --git a/libril/ril.cpp b/libril/ril.cpp
index 30a35e1..b54d12b 100644
--- a/libril/ril.cpp
+++ b/libril/ril.cpp
@@ -239,6 +239,7 @@ static int responseCdmaSignalInfoRecord(Parcel &p,void *response, size_t respons
static int responseCdmaCallWaiting(Parcel &p,void *response, size_t responselen);
static int responseSimRefresh(Parcel &p, void *response, size_t responselen);
static int responseCellInfoList(Parcel &p, void *response, size_t responselen);
+static int responseGetDataCallProfile(Parcel &p, void *response, size_t responselen);
static int decodeVoiceRadioTechnology (RIL_RadioState radioState);
static int decodeCdmaSubscriptionSource (RIL_RadioState radioState);
@@ -2724,6 +2725,42 @@ static int responseCdmaSms(Parcel &p, void *response, size_t responselen) {
return 0;
}
+/* response is the count and the list of RIL_DataCallProfileInfo */
+static int responseGetDataCallProfile(Parcel &p, void *response, size_t responselen) {
+ int num = 0;
+
+ RLOGD("[OMH>]> %d", responselen);
+
+ if (response == NULL && responselen != 0) {
+ RLOGE("invalid response: NULL");
+ return RIL_ERRNO_INVALID_RESPONSE;
+ }
+
+ RLOGD("[OMH>]> processing response");
+
+ /* number of profile info's */
+ num = *((int *) response);
+ if (num > (responselen / sizeof(RIL_DataCallProfileInfo))) {
+ num = responselen / sizeof(RIL_DataCallProfileInfo);
+ }
+ p.writeInt32(num);
+
+ RIL_DataCallProfileInfo *p_cur = ((RIL_DataCallProfileInfo *) ((int *)response + 1));
+
+ startResponse;
+ for (int i = 0 ; i < num ; i++) {
+ p.writeInt32(p_cur->profileId);
+ p.writeInt32(p_cur->priority);
+ appendPrintBuf("%s[profileId=%d,priority=%d],", printBuf,
+ p_cur->profileId, p_cur->priority);
+ p_cur++;
+ }
+ removeLastChar;
+ 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
@@ -3825,6 +3862,7 @@ requestToString(int request) {
case RIL_REQUEST_SET_INITIAL_ATTACH_APN: return "RIL_REQUEST_SET_INITIAL_ATTACH_APN";
case RIL_REQUEST_IMS_REGISTRATION_STATE: return "IMS_REGISTRATION_STATE";
case RIL_REQUEST_IMS_SEND_SMS: return "IMS_SEND_SMS";
+ case RIL_REQUEST_GET_DATA_CALL_PROFILE: return "GET_DATA_CALL_PROFILE";
case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED: return "UNSOL_RESPONSE_RADIO_STATE_CHANGED";
case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED: return "UNSOL_RESPONSE_CALL_STATE_CHANGED";
case RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED: return "UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED";
diff --git a/libril/ril_commands.h b/libril/ril_commands.h
index 16daa72..1c2451b 100644
--- a/libril/ril_commands.h
+++ b/libril/ril_commands.h
@@ -128,3 +128,4 @@
{RIL_REQUEST_SET_INITIAL_ATTACH_APN, dispatchSetInitialAttachApn, responseVoid},
{RIL_REQUEST_IMS_REGISTRATION_STATE, dispatchVoid, responseInts},
{RIL_REQUEST_IMS_SEND_SMS, dispatchImsSms, responseSMS},
+ {RIL_REQUEST_GET_DATA_CALL_PROFILE, dispatchInts, responseGetDataCallProfile},
diff --git a/reference-ril/reference-ril.c b/reference-ril/reference-ril.c
index 1b7a7bc..78049c6 100644
--- a/reference-ril/reference-ril.c
+++ b/reference-ril/reference-ril.c
@@ -1737,6 +1737,48 @@ error:
}
+static void requestGetDataCallProfile(void *data, size_t datalen, RIL_Token t)
+{
+ //ATResponse *p_response = NULL;
+ char *response = NULL;
+ char *respPtr = NULL;
+ int responseLen = 0;
+ int numProfiles = 1; // hard coded to return only one profile
+ int i = 0;
+
+ // TBD: AT command support
+
+ int mallocSize = 0;
+ mallocSize += (sizeof(RIL_DataCallProfileInfo));
+
+ response = (char*)alloca(mallocSize + sizeof(int));
+ respPtr = response;
+ memcpy(respPtr, (char*)&numProfiles, sizeof(numProfiles));
+ respPtr += sizeof(numProfiles);
+ responseLen += sizeof(numProfiles);
+
+ // Fill up 'numProfiles' dummy 'RIL_DataCallProfileInfo;
+ for (i = 0; i < numProfiles; i++)
+ {
+ RIL_DataCallProfileInfo dummyProfile;
+
+ // Adding arbitrary values for the dummy response
+ dummyProfile.profileId = i+1;
+ dummyProfile.priority = i+10;
+ RLOGI("profileId %d priority %d", dummyProfile.profileId, dummyProfile.priority);
+
+ responseLen += sizeof(RIL_DataCallProfileInfo);
+ memcpy(respPtr, (char*)&dummyProfile, sizeof(RIL_DataCallProfileInfo));
+ respPtr += sizeof(RIL_DataCallProfileInfo);
+ }
+
+ RLOGI("requestGetDataCallProfile():reponseLen:%d, %d profiles", responseLen, i);
+ RIL_onRequestComplete(t, RIL_E_SUCCESS, response, responseLen);
+
+ // at_response_free(p_response);
+ return;
+}
+
static void requestSMSAcknowledge(void *data, size_t datalen, RIL_Token t)
{
int ackSuccess;
@@ -1964,7 +2006,7 @@ onRequest (int request, void *data, size_t datalen, RIL_Token t)
* when RADIO_STATE_UNAVAILABLE.
*/
if (sState == RADIO_STATE_UNAVAILABLE
- && request != RIL_REQUEST_GET_SIM_STATUS
+ && !(request == RIL_REQUEST_GET_SIM_STATUS || request == RIL_REQUEST_GET_DATA_CALL_PROFILE)
) {
RIL_onRequestComplete(t, RIL_E_RADIO_NOT_AVAILABLE, NULL, 0);
return;
@@ -1975,7 +2017,8 @@ onRequest (int request, void *data, size_t datalen, RIL_Token t)
*/
if (sState == RADIO_STATE_OFF
&& !(request == RIL_REQUEST_RADIO_POWER
- || request == RIL_REQUEST_GET_SIM_STATUS)
+ || request == RIL_REQUEST_GET_SIM_STATUS
+ || request == RIL_REQUEST_GET_DATA_CALL_PROFILE)
) {
RIL_onRequestComplete(t, RIL_E_RADIO_NOT_AVAILABLE, NULL, 0);
return;
@@ -2124,6 +2167,9 @@ onRequest (int request, void *data, size_t datalen, RIL_Token t)
case RIL_REQUEST_SETUP_DATA_CALL:
requestSetupDataCall(data, datalen, t);
break;
+ case RIL_REQUEST_GET_DATA_CALL_PROFILE:
+ requestGetDataCallProfile(data, datalen, t);
+ break;
case RIL_REQUEST_SMS_ACKNOWLEDGE:
requestSMSAcknowledge(data, datalen, t);
break;