diff options
author | Naveen Kalla <nkalla@codeaurora.org> | 2011-11-15 12:48:22 -0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2014-11-27 00:39:32 -0800 |
commit | e3ed9eda849439314342fc3ac3206f112470d90b (patch) | |
tree | a6dce315a773362e879159729448f250731fe9c7 | |
parent | 0b7a93c2533ee172cb94a59bc04122d30ec85838 (diff) | |
download | android_hardware_ril-e3ed9eda849439314342fc3ac3206f112470d90b.tar.gz android_hardware_ril-e3ed9eda849439314342fc3ac3206f112470d90b.tar.bz2 android_hardware_ril-e3ed9eda849439314342fc3ac3206f112470d90b.zip |
Support reading data profiles from OMH cards
Conflicts:
include/telephony/ril.h
libril/ril_commands.h
Change-Id: I371a15428cd296cd02a2f82d5904dea483058c26
-rw-r--r-- | include/telephony/ril.h | 28 | ||||
-rwxr-xr-x | libril/ril.cpp | 38 | ||||
-rw-r--r-- | libril/ril_commands.h | 1 | ||||
-rw-r--r-- | reference-ril/reference-ril.c | 50 |
4 files changed, 114 insertions, 3 deletions
diff --git a/include/telephony/ril.h b/include/telephony/ril.h index 2a1ac5f..ec91233 100644 --- a/include/telephony/ril.h +++ b/include/telephony/ril.h @@ -1292,6 +1292,12 @@ typedef struct { int enabled; } RIL_DataProfileInfo; +/* 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 * @@ -4216,6 +4222,28 @@ typedef struct { */ #define RIL_REQUEST_SHUTDOWN 129 +/** + * 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 130 /***********************************************************************/ diff --git a/libril/ril.cpp b/libril/ril.cpp index 217cb6a..902db33 100755 --- a/libril/ril.cpp +++ b/libril/ril.cpp @@ -304,6 +304,7 @@ static int responseCellInfoList(Parcel &p, void *response, size_t responselen); static int responseHardwareConfig(Parcel &p, void *response, size_t responselen); static int responseSSData(Parcel &p, void *response, size_t responselen); static int responseDcRtInfo(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); @@ -3429,6 +3430,42 @@ static int responseDcRtInfo(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 @@ -4770,6 +4807,7 @@ requestToString(int request) { case RIL_REQUEST_GET_DC_RT_INFO: return "GET_DC_RT_INFO"; case RIL_REQUEST_SET_DC_RT_INFO_RATE: return "SET_DC_RT_INFO_RATE"; case RIL_REQUEST_SET_DATA_PROFILE: return "SET_DATA_PROFILE"; + case RIL_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 54b2579..e22f34a 100644 --- a/libril/ril_commands.h +++ b/libril/ril_commands.h @@ -144,3 +144,4 @@ {RIL_REQUEST_SET_DC_RT_INFO_RATE, dispatchInts, responseVoid}, {RIL_REQUEST_SET_DATA_PROFILE, dispatchDataProfile, responseVoid}, {RIL_REQUEST_SHUTDOWN, dispatchVoid, responseVoid}, + {RIL_REQUEST_GET_DATA_CALL_PROFILE, dispatchInts, responseGetDataCallProfile}, diff --git a/reference-ril/reference-ril.c b/reference-ril/reference-ril.c index a3f24c7..9bc176a 100644 --- a/reference-ril/reference-ril.c +++ b/reference-ril/reference-ril.c @@ -1759,7 +1759,47 @@ error: } -static void requestSMSAcknowledge(void *data, size_t datalen __unused, RIL_Token t) +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 = sizeof(RIL_DataCallProfileInfo); + + response = (char*)alloca(mallocSize + sizeof(int)); + respPtr = response; + memcpy(respPtr, &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); + + return; +} + +static void requestSMSAcknowledge(void *data, size_t datalen, RIL_Token t) { int ackSuccess; int err; @@ -2001,7 +2041,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; @@ -2012,7 +2052,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; @@ -2162,6 +2203,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; |