From: The Android Open Source Project Date: Thu, 18 Dec 2008 02:05:51 +0000 (-0800) Subject: Code drop from //branches/cupcake/...@124589 X-Git-Tag: android-x86-2.2~70 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=a8657f8726ba81b72eb532c884545b4ad52ff471;p=android-x86%2Fhardware-ril.git Code drop from //branches/cupcake/...@124589 --- diff --git a/include/telephony/ril.h b/include/telephony/ril.h index c86f487..fa1948f 100644 --- a/include/telephony/ril.h +++ b/include/telephony/ril.h @@ -172,6 +172,16 @@ typedef struct { int timeSeconds; /* for CF no reply only */ }RIL_CallForwardInfo; +typedef struct { + char * cid; /* cell id in 2G, Primary Scrambling Code in 3G + * hexadecimal format. + * Valid values are 0x00000000 - 0xffffffff. + */ + int rssi; /* Received RSSI in 2G, + * Level index of CPICH Received Signal Code Power in 3G + */ +} RIL_NeighboringCell; + /* See RIL_REQUEST_LAST_CALL_FAIL_CAUSE */ typedef enum { CALL_FAIL_NORMAL = 16, @@ -1830,17 +1840,7 @@ typedef enum { * Request neighboring cell id in GSM network * * "data" is NULL - * "response" is a char ** - * ((char *)response)[0] is the number of available cell ids, range from 0 to 6 - * ((char *)response)[1] is CID[0] if available or NULL if not - * ((char *)response)[2] is CID[1] if available or NULL if not - * ((char *)response)[3] is CID[2] if available or NULL if not - * ((char *)response)[4] is CID[3] if available or NULL if not - * ((char *)response)[5] is CID[4] if available or NULL if not - * ((char *)response)[6] is CID[5] if available or NULL if not - * - * CIDs are in hexadecimal format. Valid values are 0x00000000 - 0xffffffff. - * + * "response" must be a " const RIL_NeighboringCell** " * * Valid errors: * SUCCESS diff --git a/libril/ril.cpp b/libril/ril.cpp index f9c03b3..7a8c4a9 100644 --- a/libril/ril.cpp +++ b/libril/ril.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -211,6 +212,7 @@ static int responseCallForwards(Parcel &p, void *response, size_t responselen); static int responseContexts(Parcel &p, void *response, size_t responselen); static int responseRaw(Parcel &p, void *response, size_t responselen); static int responseSsn(Parcel &p, void *response, size_t responselen); +static int responseCellList(Parcel &p, void *response, size_t responselen); extern "C" const char * requestToString(int request); extern "C" const char * failCauseToString(RIL_Errno); @@ -1182,6 +1184,42 @@ static int responseSsn(Parcel &p, void *response, size_t responselen) return 0; } +static int responseCellList(Parcel &p, void *response, size_t responselen) +{ + int num; + + if (response == NULL && responselen != 0) { + LOGE("invalid response: NULL"); + return RIL_ERRNO_INVALID_RESPONSE; + } + + if (responselen % sizeof (RIL_NeighboringCell *) != 0) { + LOGE("invalid response length %d expected multiple of %d\n", + (int)responselen, (int)sizeof (RIL_NeighboringCell *)); + return RIL_ERRNO_INVALID_RESPONSE; + } + + startResponse; + /* number of cell info's */ + num = responselen / sizeof(RIL_NeighboringCell *); + p.writeInt32(num); + + for (int i = 0 ; i < num ; i++) { + RIL_NeighboringCell *p_cur = ((RIL_NeighboringCell **) response)[i]; + + /* each cell info */ + p.writeInt32(p_cur->rssi); + writeStringToParcel (p, p_cur->cid); + + appendPrintBuf("%s[cid=%s,rssi=%d],", printBuf, + p_cur->cid, p_cur->rssi); + } + 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 @@ -1903,10 +1941,9 @@ void RIL_onUnsolicitedResponse(int unsolResponse, void *data, case RIL_UNSOL_NITZ_TIME_RECEIVED: - // FIXME use monotonic system time instead - time_t timeReceived = time(NULL); + int64_t timeReceived = elapsedRealtime(); // Store the time this was received in case it is delayed - p.writeInt32(timeReceived); + p.writeInt64(timeReceived); break; } diff --git a/libril/ril_commands.h b/libril/ril_commands.h index 85831fa..a097da0 100644 --- a/libril/ril_commands.h +++ b/libril/ril_commands.h @@ -89,5 +89,5 @@ {RIL_REQUEST_EXPLICIT_CALL_TRANSFER, dispatchVoid, responseVoid}, {RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE, dispatchInts, responseVoid}, {RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE, dispatchVoid, responseInts}, - {RIL_REQUEST_GET_NEIGHBORING_CELL_IDS, dispatchVoid, responseStrings}, + {RIL_REQUEST_GET_NEIGHBORING_CELL_IDS, dispatchVoid, responseCellList}, {RIL_REQUEST_SET_LOCATION_UPDATES, dispatchInts, responseVoid} diff --git a/libril/ril_event.cpp b/libril/ril_event.cpp index ed99a12..46e2cc9 100644 --- a/libril/ril_event.cpp +++ b/libril/ril_event.cpp @@ -34,6 +34,7 @@ static pthread_mutex_t listMutex; #define MUTEX_INIT() pthread_mutex_init(&listMutex, NULL) #define MUTEX_DESTROY() pthread_mutex_destroy(&listMutex) +#ifndef timeradd #define timeradd(tvp, uvp, vvp) \ do { \ (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \ @@ -43,6 +44,7 @@ static pthread_mutex_t listMutex; (vvp)->tv_usec -= 1000000; \ } \ } while (0) +#endif #ifndef timercmp #define timercmp(a, b, op) \ diff --git a/reference-ril/Android.mk b/reference-ril/Android.mk index cb01d51..7ec1f97 100644 --- a/reference-ril/Android.mk +++ b/reference-ril/Android.mk @@ -19,15 +19,15 @@ LOCAL_CFLAGS := -D_GNU_SOURCE LOCAL_C_INCLUDES := $(KERNEL_HEADERS) -ifeq ($(TARGET_PRODUCT),sooner) +ifeq ($(TARGET_DEVICE),sooner) LOCAL_CFLAGS += -DOMAP_CSMI_POWER_CONTROL -DUSE_TI_COMMANDS endif -ifeq ($(TARGET_PRODUCT),surf) +ifeq ($(TARGET_DEVICE),surf) LOCAL_CFLAGS += -DPOLL_CALL_STATE -DUSE_QMI endif -ifeq ($(TARGET_PRODUCT),dream) +ifeq ($(TARGET_DEVICE),dream) LOCAL_CFLAGS += -DPOLL_CALL_STATE -DUSE_QMI endif