OSDN Git Service

Enable new libhtc_ril which supporting new CDMA ril interface.
authorjohnwang <johnwang@google.com>
Fri, 22 May 2009 22:50:34 +0000 (15:50 -0700)
committerjohnwang <johnwang@google.com>
Tue, 26 May 2009 21:18:57 +0000 (14:18 -0700)
1) Enable new libhtc_ril and support new RIL_Call structure 2) Remove "#define NEWRIL".

include/telephony/ril.h
libril/ril.cpp
reference-ril/reference-ril.c

index 329767c..42d2e61 100644 (file)
@@ -98,23 +98,6 @@ typedef struct {
   char signal;       /* as defined 3.7.5.5-3, 3.7.5.5-4 or 3.7.5.5-5 */
 } RIL_CDMA_SignalInfoRecord;
 
-// NEWRIL:TODO Remove #define NEWRIL and RIL_CallOld when we have the new ril
-#define NEWRIL 0
-#if !NEWRIL
-typedef struct {
-    RIL_CallState   state;
-    int             index;      /* Connection Index for use with, eg, AT+CHLD */
-    int             toa;        /* type of address, eg 145 = intl */
-    char            isMpty;     /* nonzero if is mpty call */
-    char            isMT;       /* nonzero if call is mobile terminated */
-    char            als;        /* ALS line indicator if available
-                                   (0 = line 1) */
-    char            isVoice;    /* nonzero if this is is a voice call */
-    char *          number;     /* Remote party number */
-    char            numberPresentation; /* 0=Allowed, 1=Restricted, 2=Not Specified/Unknown 3=Payphone */
-} RIL_CallOld;
-#endif
-
 typedef struct {
     RIL_CallState   state;
     int             index;      /* Connection Index for use with, eg, AT+CHLD */
index d06f0f3..519866e 100644 (file)
@@ -1301,9 +1301,6 @@ static int responseCallList(Parcel &p, void *response, size_t responselen) {
     p.writeInt32(num);
 
     for (int i = 0 ; i < num ; i++) {
-    /* NEWRIL:TODO Remove this conditional and the else clause when we have the new ril */
-#if NEWRIL
-        LOGD("Compilied for NEWRIL"); // NEWRIL:TODO remove when we have the new ril
         RIL_Call *p_cur = ((RIL_Call **) response)[i];
         /* each call info */
         p.writeInt32(p_cur->state);
@@ -1336,38 +1333,6 @@ static int responseCallList(Parcel &p, void *response, size_t responselen) {
             p_cur->numberPresentation,
             p_cur->name,
             p_cur->namePresentation);
-#else
-        LOGD("Old RIL");
-        RIL_CallOld *p_cur = ((RIL_CallOld **) response)[i];
-        /* each call info */
-        p.writeInt32(p_cur->state);
-        p.writeInt32(p_cur->index);
-        p.writeInt32(p_cur->toa);
-        p.writeInt32(p_cur->isMpty);
-        p.writeInt32(p_cur->isMT);
-        p.writeInt32(p_cur->als);
-        p.writeInt32(p_cur->isVoice);
-        p.writeInt32(0); // p_cur->isVoicePrivacy);
-        writeStringToParcel (p, p_cur->number);
-        p.writeInt32(p_cur->numberPresentation);
-        writeStringToParcel (p, "a-person");
-        p.writeInt32(2); // p_cur->namePresentation);
-        appendPrintBuf("%s[id=%d,%s,toa=%d,",
-            printBuf,
-            p_cur->index,
-            callStateToString(p_cur->state),
-            p_cur->toa);
-        appendPrintBuf("%s%s,%s,als=%d,%s,%s,",
-            printBuf,
-            (p_cur->isMpty)?"conf":"norm",
-            (p_cur->isMT)?"mt":"mo",
-            p_cur->als,
-            (p_cur->isVoice)?"voc":"nonvoc");
-        appendPrintBuf("%s%s,cli=%d]",
-            printBuf,
-            p_cur->number,
-            p_cur->numberPresentation);
-#endif
     }
     removeLastChar;
     closeResponse;
@@ -1785,6 +1750,12 @@ static int responseRilSignalStrength(Parcel &p, void *response, size_t responsel
         for (int i = 0; i < 5; i++) {
             p.writeInt32(0);
         }
+
+        startResponse;
+        appendPrintBuf("%s[signalStrength=%d,bitErrorRate=%d]",
+                       printBuf,
+                       p_cur->signalStrength, p_cur->bitErrorRate);
+        closeResponse;
     } else if (responselen == sizeof (RIL_SignalStrength)) {
         // New RIL
         RIL_SignalStrength *p_cur = ((RIL_SignalStrength *) response);
@@ -1797,26 +1768,27 @@ static int responseRilSignalStrength(Parcel &p, void *response, size_t responsel
         p.writeInt32(p_cur->EVDO_SignalStrength.dbm);
         p.writeInt32(p_cur->EVDO_SignalStrength.ecio);
         p.writeInt32(p_cur->EVDO_SignalStrength.signalNoiseRatio);
+
+        startResponse;
+        appendPrintBuf("%s[signalStrength=%d,bitErrorRate=%d,
+                       CDMA_SignalStrength.dbm=%d,CDMA_SignalStrength.ecio=%d,
+                       EVDO_SignalStrength.dbm =%d,EVDO_SignalStrength.ecio=%d,
+                       EVDO_SignalStrength.signalNoiseRatio=%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);
+        closeResponse;
     } else {
         LOGE("invalid response length");
         return RIL_ERRNO_INVALID_RESPONSE;
     }
 
-    startResponse;
-    appendPrintBuf("%s[signalStrength=%d,bitErrorRate=%d,\
-            CDMA_SignalStrength.dbm=%d,CDMA_SignalStrength.ecio=%d,\
-            EVDO_SignalStrength.dbm =%d,EVDO_SignalStrength.ecio=%d,\
-            EVDO_SignalStrength.signalNoiseRatio=%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);
 
-    closeResponse;
 
     return 0;
 }
index 348234d..0719efa 100644 (file)
@@ -141,11 +141,7 @@ static int clccStateToRILState(int state, RIL_CallState *p_state)
  * Note: directly modified line and has *p_call point directly into
  * modified line
  */
-#if NEWRIL
 static int callFromCLCCLine(char *line, RIL_Call *p_call)
-#else
-static int callFromCLCCLine(char *line, RIL_CallOld *p_call)
-#endif
 {
         //+CLCC: 1,0,2,0,0,\"+18005551212\",145
         //     index,isMT,state,mode,isMpty(,number,TOA)?
@@ -474,13 +470,8 @@ static void requestGetCurrentCalls(void *data, size_t datalen, RIL_Token t)
     ATLine *p_cur;
     int countCalls;
     int countValidCalls;
-#if NEWRIL
     RIL_Call *p_calls;
     RIL_Call **pp_calls;
-#else
-    RIL_CallOld *p_calls;
-    RIL_CallOld **pp_calls;
-#endif
     int i;
     int needRepoll = 0;
 
@@ -508,15 +499,9 @@ static void requestGetCurrentCalls(void *data, size_t datalen, RIL_Token t)
 
     /* yes, there's an array of pointers and then an array of structures */
 
-#if NEWRIL
     pp_calls = (RIL_Call **)alloca(countCalls * sizeof(RIL_Call *));
     p_calls = (RIL_Call *)alloca(countCalls * sizeof(RIL_Call));
     memset (p_calls, 0, countCalls * sizeof(RIL_Call));
-#else
-    pp_calls = (RIL_CallOld **)alloca(countCalls * sizeof(RIL_CallOld *));
-    p_calls = (RIL_CallOld *)alloca(countCalls * sizeof(RIL_CallOld));
-    memset (p_calls, 0, countCalls * sizeof(RIL_CallOld));
-#endif
 
     /* init the pointer array */
     for(i = 0; i < countCalls ; i++) {
@@ -581,13 +566,8 @@ static void requestGetCurrentCalls(void *data, size_t datalen, RIL_Token t)
     s_repollCallsCount = 0;
 #endif /*WORKAROUND_ERRONEOUS_ANSWER*/
 
-#if NEWRIL
     RIL_onRequestComplete(t, RIL_E_SUCCESS, pp_calls,
             countValidCalls * sizeof (RIL_Call *));
-#else
-    RIL_onRequestComplete(t, RIL_E_SUCCESS, pp_calls,
-            countValidCalls * sizeof (RIL_CallOld *));
-#endif
 
     at_response_free(p_response);