diff options
author | Kevin Tang <zhikait@codeaurora.org> | 2019-03-14 17:37:59 -0700 |
---|---|---|
committer | Kevin Tang <zhikait@codeaurora.org> | 2019-03-14 17:43:05 -0700 |
commit | 5a9cc5ae728f73804dde2d3f855ebb387ee9ec0e (patch) | |
tree | 11b3c328e201d8d1362323e062c9a49a80f1ddda /utils | |
parent | 1b6ad38fb95b904d30ec870efcbc8f46e81b76ba (diff) | |
parent | 6b687ef48e134b153a256cb0c8f05860722de72e (diff) | |
download | gps-5a9cc5ae728f73804dde2d3f855ebb387ee9ec0e.tar.gz |
Merge remote-tracking branch 'quic/location.lnx.4.0' into HEAD
CRs-fixed: 2414738
Change-Id: Ic8d1cd5bb37d1ad26c2749e46be279942e28ac05
Diffstat (limited to 'utils')
-rw-r--r-- | utils/LocIpc.h | 8 | ||||
-rw-r--r-- | utils/LocSharedLock.h | 20 | ||||
-rw-r--r-- | utils/LocThread.cpp | 4 | ||||
-rw-r--r-- | utils/MsgTask.cpp | 2 | ||||
-rw-r--r-- | utils/configure.ac | 18 | ||||
-rw-r--r-- | utils/gps_extended_c.h | 260 | ||||
-rw-r--r-- | utils/linked_list.h | 2 | ||||
-rw-r--r-- | utils/loc_nmea.cpp | 3 | ||||
-rw-r--r-- | utils/log_util.h | 9 | ||||
-rw-r--r-- | utils/msg_q.c | 45 | ||||
-rw-r--r-- | utils/msg_q.h | 23 |
11 files changed, 268 insertions, 126 deletions
diff --git a/utils/LocIpc.h b/utils/LocIpc.h index 87f2ff8..90f9e1b 100644 --- a/utils/LocIpc.h +++ b/utils/LocIpc.h @@ -27,8 +27,8 @@ * */ -#ifndef __LOC_SOCKET__ -#define __LOC_SOCKET__ +#ifndef __LOC_IPC__ +#define __LOC_IPC__ #include <string> #include <memory> @@ -105,7 +105,7 @@ public: // This class hides generated fd and destination address object from user. inline LocIpcSender(const char* destSocket): LocIpcSender(std::make_shared<int>(::socket(AF_UNIX, SOCK_DGRAM, 0)), destSocket) { - if (-1 == *mSocket) { + if (mSocket != nullptr && -1 == *mSocket) { mSocket = nullptr; } } @@ -149,4 +149,4 @@ private: } -#endif //__LOC_SOCKET__ +#endif //__LOC_IPC__ diff --git a/utils/LocSharedLock.h b/utils/LocSharedLock.h index 7fe6237..a7af35e 100644 --- a/utils/LocSharedLock.h +++ b/utils/LocSharedLock.h @@ -30,10 +30,28 @@ #define __LOC_SHARED_LOCK__ #include <stddef.h> +#ifndef FEATURE_EXTERNAL_AP #include <cutils/atomic.h> +#endif /* FEATURE_EXTERNAL_AP */ #include <pthread.h> -// This is a utility created for use cases such that there are more than +#ifdef FEATURE_EXTERNAL_AP +#include <atomic> + +inline int32_t android_atomic_inc(volatile int32_t *addr) +{ + volatile std::atomic_int_least32_t* a = (volatile std::atomic_int_least32_t*)addr; + return std::atomic_fetch_add_explicit(a, 1, std::memory_order_release); +} + +inline int32_t android_atomic_dec(volatile int32_t *addr) +{ + volatile std::atomic_int_least32_t* a = (volatile std::atomic_int_least32_t*)addr; + return std::atomic_fetch_sub_explicit(a, 1, std::memory_order_release); +} + +#endif /* FEATURE_EXTERNAL_AP */ + // This is a utility created for use cases such that there are more than // one client who need to share the same lock, but it is not predictable // which of these clients is to last to go away. This shared lock deletes // itself when the last client calls its drop() method. To add a cient, diff --git a/utils/LocThread.cpp b/utils/LocThread.cpp index c1052cb..568a6bb 100644 --- a/utils/LocThread.cpp +++ b/utils/LocThread.cpp @@ -85,8 +85,8 @@ LocThreadDelegate::LocThreadDelegate(LocThread::tCreate creator, if (mThandle) { // set thread name char lname[16]; - int len = (sizeof(lname)>sizeof(threadName)) ? - (sizeof(threadName) -1):(sizeof(lname) - 1); + int len = (sizeof(lname) > (strlen(threadName) + 1)) ? + (strlen(threadName)):(sizeof(lname) - 1); memcpy(lname, threadName, len); lname[len] = 0; // set the thread name here diff --git a/utils/MsgTask.cpp b/utils/MsgTask.cpp index ad95a83..73a77fd 100644 --- a/utils/MsgTask.cpp +++ b/utils/MsgTask.cpp @@ -83,8 +83,10 @@ void MsgTask::sendMsg(const LocMsg* msg) const { } void MsgTask::prerun() { +#ifndef FEATURE_EXTERNAL_AP // make sure we do not run in background scheduling group set_sched_policy(gettid(), SP_FOREGROUND); +#endif /* FEATURE_EXTERNAL_AP */ } bool MsgTask::run() { diff --git a/utils/configure.ac b/utils/configure.ac index 639f8c4..fd16494 100644 --- a/utils/configure.ac +++ b/utils/configure.ac @@ -28,10 +28,20 @@ AC_PROG_LN_S AC_PROG_MAKE_SET PKG_PROG_PKG_CONFIG -# Checks for libraries. -PKG_CHECK_MODULES([CUTILS], [libcutils]) -AC_SUBST([CUTILS_CFLAGS]) -AC_SUBST([CUTILS_LIBS]) +AC_ARG_WITH([external_ap], + AC_HELP_STRING([--with-external_ap=@<:@dir@:>@], + [Using External Application Processor]), + [], + with_external_ap=no) + +if test "x$with_external_ap" != "xno"; then + CPPFLAGS="${CPPFLAGS} -DFEATURE_EXTERNAL_AP" +else + # Checks for libraries. + PKG_CHECK_MODULES([CUTILS], [libcutils]) + AC_SUBST([CUTILS_CFLAGS]) + AC_SUBST([CUTILS_LIBS]) +fi AC_ARG_WITH([core_includes], AC_HELP_STRING([--with-core-includes=@<:@dir@:>@], diff --git a/utils/gps_extended_c.h b/utils/gps_extended_c.h index 8ddf488..abe4f68 100644 --- a/utils/gps_extended_c.h +++ b/utils/gps_extended_c.h @@ -407,9 +407,18 @@ typedef uint32_t LocPosDataMask; /* Bitmask to specify whether Navigation data has Body pitch Unc*/ #define LOC_NAV_DATA_HAS_PITCH_UNC ((LocPosDataMask)0x0200) +typedef uint32_t GnssAdditionalSystemInfoMask; +/* Bitmask to specify whether Tauc is valid */ +#define GNSS_ADDITIONAL_SYSTEMINFO_HAS_TAUC ((GnssAdditionalSystemInfoMask)0x0001) +/* Bitmask to specify whether leapSec is valid */ +#define GNSS_ADDITIONAL_SYSTEMINFO_HAS_LEAP_SEC ((GnssAdditionalSystemInfoMask)0x0002) + + /** GPS PRN Range */ #define GPS_SV_PRN_MIN 1 #define GPS_SV_PRN_MAX 32 +#define SBAS_SV_PRN_MIN 33 +#define SBAS_SV_PRN_MAX 64 #define GLO_SV_PRN_MIN 65 #define GLO_SV_PRN_MAX 96 #define QZSS_SV_PRN_MIN 193 @@ -838,8 +847,8 @@ enum loc_api_adapter_event_index { LOC_API_ADAPTER_BATCH_FULL, // Batching on full LOC_API_ADAPTER_BATCHED_POSITION_REPORT, // Batching on fix LOC_API_ADAPTER_BATCHED_GENFENCE_BREACH_REPORT, // - LOC_API_ADAPTER_GNSS_MEASUREMENT_REPORT, //GNSS Measurement Report - LOC_API_ADAPTER_GNSS_SV_POLYNOMIAL_REPORT, //GNSS SV Polynomial Report + LOC_API_ADAPTER_GNSS_MEASUREMENT_REPORT, // GNSS Measurement Report + LOC_API_ADAPTER_GNSS_SV_POLYNOMIAL_REPORT, // GNSS SV Polynomial Report LOC_API_ADAPTER_GDT_UPLOAD_BEGIN_REQ, // GDT upload start request LOC_API_ADAPTER_GDT_UPLOAD_END_REQ, // GDT upload end request LOC_API_ADAPTER_GNSS_MEASUREMENT, // GNSS Measurement report @@ -853,6 +862,8 @@ enum loc_api_adapter_event_index { LOC_API_ADAPTER_BS_OBS_DATA_SERVICE_REQ, // BS observation data request LOC_API_ADAPTER_GNSS_SV_EPHEMERIS_REPORT, // GNSS SV Ephemeris Report LOC_API_ADAPTER_LOC_SYSTEM_INFO, // Location system info event + LOC_API_ADAPTER_GNSS_NHZ_MEASUREMENT_REPORT, // GNSS SV nHz measurement report + LOC_API_ADAPTER_EVENT_REPORT_INFO, // Event report info LOC_API_ADAPTER_EVENT_MAX }; @@ -893,6 +904,8 @@ enum loc_api_adapter_event_index { #define LOC_API_ADAPTER_BIT_BS_OBS_DATA_SERVICE_REQ (1ULL<<LOC_API_ADAPTER_BS_OBS_DATA_SERVICE_REQ) #define LOC_API_ADAPTER_BIT_GNSS_SV_EPHEMERIS_REPORT (1ULL<<LOC_API_ADAPTER_GNSS_SV_EPHEMERIS_REPORT) #define LOC_API_ADAPTER_BIT_LOC_SYSTEM_INFO (1ULL<<LOC_API_ADAPTER_LOC_SYSTEM_INFO) +#define LOC_API_ADAPTER_BIT_GNSS_NHZ_MEASUREMENT (1ULL<<LOC_API_ADAPTER_GNSS_NHZ_MEASUREMENT_REPORT) +#define LOC_API_ADAPTER_BIT_EVENT_REPORT_INFO (1ULL<<LOC_API_ADAPTER_EVENT_REPORT_INFO) typedef uint64_t LOC_API_ADAPTER_EVENT_MASK_T; @@ -925,7 +938,8 @@ typedef uint32_t LOC_GPS_LOCK_MASK; #define GNSS_SV_POLY_XYZ_0_TH_ORDER_COEFF_MAX_SIZE 3 #define GNSS_SV_POLY_XYZ_N_TH_ORDER_COEFF_MAX_SIZE 9 #define GNSS_SV_POLY_SV_CLKBIAS_COEFF_MAX_SIZE 4 -#define GNSS_LOC_SV_MEAS_LIST_MAX_SIZE 16 +/** Max number of GNSS SV measurement */ +#define GNSS_LOC_SV_MEAS_LIST_MAX_SIZE 128 enum ulp_gnss_sv_measurement_valid_flags{ @@ -1055,71 +1069,12 @@ typedef struct /**< System-1 to System-2 Time Bias uncertainty \n - Units: msec \n */ -}Gnss_InterSystemBiasStructType; - - -typedef struct -{ - size_t size; - uint16_t systemWeek; - /**< System week number for GPS, BDS and GAL satellite systems. \n - Set to 65535 when invalid or not available. \n - Not valid for GLONASS system. \n - */ - - uint32_t systemMsec; - /**< System time msec. Time of Week for GPS, BDS, GAL and - Time of Day for GLONASS. - - Units: msec \n - */ - float systemClkTimeBias; - /**< System clock time bias \n - - Units: msec \n - System time = systemMsec - systemClkTimeBias \n - */ - float systemClkTimeUncMs; - /**< Single sided maximum time bias uncertainty \n - - Units: msec \n - */ -}Gnss_LocSystemTimeStructType; - -typedef struct { - - size_t size; - uint8_t gloFourYear; - /**< GLONASS four year number from 1996. Refer to GLONASS ICD.\n - Applicable only for GLONASS and shall be ignored for other constellations. \n - If unknown shall be set to 255 - */ - - uint16_t gloDays; - /**< GLONASS day number in four years. Refer to GLONASS ICD. - Applicable only for GLONASS and shall be ignored for other constellations. \n - If unknown shall be set to 65535 - */ - - uint32_t gloMsec; - /**< GLONASS time of day in msec. Refer to GLONASS ICD. - - Units: msec \n - */ - - float gloClkTimeBias; - /**< System clock time bias (sub-millisecond) \n - - Units: msec \n - System time = systemMsec - systemClkTimeBias \n - */ +} Gnss_InterSystemBiasStructType; - float gloClkTimeUncMs; - /**< Single sided maximum time bias uncertainty \n - - Units: msec \n - */ -}Gnss_LocGloTimeStructType; /* Type */ typedef struct { size_t size; - uint32_t refFCount; - /**< Receiver frame counter value at reference tick */ uint8_t systemRtc_valid; /**< Validity indicator for System RTC */ @@ -1129,13 +1084,8 @@ typedef struct { - Units: msec \n */ - uint32_t sourceOfTime; - /**< Source of time information */ - }Gnss_LocGnssTimeExtStructType; - - typedef enum { GNSS_LOC_MEAS_STATUS_NULL = 0x00000000, @@ -1231,6 +1181,9 @@ typedef enum typedef struct { size_t size; + Gnss_LocSvSystemEnumType gnssSystem; + // 0 signal type mask indicates invalid value + GnssSignalTypeMask gnssSignalTypeMask; uint16_t gnssSvId; /**< GNSS SV ID. \begin{itemize1} @@ -1367,70 +1320,75 @@ typedef struct } Gnss_SVMeasurementStructType; -/**< Maximum number of satellites in measurement block for given system. */ -typedef struct -{ - size_t size; - Gnss_LocSvSystemEnumType system; - /**< Specifies the Satellite System Type - */ - bool isSystemTimeValid; - /**< Indicates whether System Time is Valid:\n - - 0x01 (TRUE) -- System Time is valid \n - - 0x00 (FALSE) -- System Time is not valid - */ - Gnss_LocSystemTimeStructType systemTime; - /**< System Time Information \n - */ - bool isGloTime_valid; - Gnss_LocGloTimeStructType gloTime; - - bool isSystemTimeExt_valid; - Gnss_LocGnssTimeExtStructType systemTimeExt; +typedef uint64_t GpsSvMeasHeaderFlags; +#define GNSS_SV_MEAS_HEADER_HAS_LEAP_SECOND 0x00000001 +#define GNSS_SV_MEAS_HEADER_HAS_CLOCK_FREQ 0x00000002 +#define GNSS_SV_MEAS_HEADER_HAS_AP_TIMESTAMP 0x00000004 +#define GNSS_SV_MEAS_HEADER_HAS_GPS_GLO_INTER_SYSTEM_BIAS 0x00000008 +#define GNSS_SV_MEAS_HEADER_HAS_GPS_BDS_INTER_SYSTEM_BIAS 0x00000010 +#define GNSS_SV_MEAS_HEADER_HAS_GPS_GAL_INTER_SYSTEM_BIAS 0x00000020 +#define GNSS_SV_MEAS_HEADER_HAS_BDS_GLO_INTER_SYSTEM_BIAS 0x00000040 +#define GNSS_SV_MEAS_HEADER_HAS_GAL_GLO_INTER_SYSTEM_BIAS 0x00000080 +#define GNSS_SV_MEAS_HEADER_HAS_GAL_BDS_INTER_SYSTEM_BIAS 0x00000100 +#define GNSS_SV_MEAS_HEADER_HAS_GPS_SYSTEM_TIME 0x00000200 +#define GNSS_SV_MEAS_HEADER_HAS_GAL_SYSTEM_TIME 0x00000400 +#define GNSS_SV_MEAS_HEADER_HAS_BDS_SYSTEM_TIME 0x00000800 +#define GNSS_SV_MEAS_HEADER_HAS_QZSS_SYSTEM_TIME 0x00001000 +#define GNSS_SV_MEAS_HEADER_HAS_GLO_SYSTEM_TIME 0x00002000 +#define GNSS_SV_MEAS_HEADER_HAS_GPS_SYSTEM_TIME_EXT 0x00004000 +#define GNSS_SV_MEAS_HEADER_HAS_GAL_SYSTEM_TIME_EXT 0x00008000 +#define GNSS_SV_MEAS_HEADER_HAS_BDS_SYSTEM_TIME_EXT 0x00010000 +#define GNSS_SV_MEAS_HEADER_HAS_QZSS_SYSTEM_TIME_EXT 0x00020000 +#define GNSS_SV_MEAS_HEADER_HAS_GPSL1L5_TIME_BIAS 0x00040000 +#define GNSS_SV_MEAS_HEADER_HAS_GALE1E5A_TIME_BIAS 0x00080000 - uint8_t numSvs; - /* Number of SVs in this report block */ - - Gnss_SVMeasurementStructType svMeasurement[GNSS_LOC_SV_MEAS_LIST_MAX_SIZE]; - /**< Satellite measurement Information \n - */ -} Gnss_ClockMeasurementStructType; typedef struct { size_t size; - uint8_t seqNum; - /**< Current message Number */ - uint8_t maxMessageNum; - /**< Maximum number of message that will be sent for present time epoch. */ + // see defines in GNSS_SV_MEAS_HEADER_HAS_XXX_XXX + uint64_t flags; - bool leapSecValid; Gnss_LeapSecondInfoStructType leapSec; - Gnss_InterSystemBiasStructType gpsGloInterSystemBias; + Gnss_LocRcvrClockFrequencyInfoStructType clockFreq; /* Freq */ - Gnss_InterSystemBiasStructType gpsBdsInterSystemBias; + Gnss_ApTimeStampStructType apBootTimeStamp; + Gnss_InterSystemBiasStructType gpsGloInterSystemBias; + Gnss_InterSystemBiasStructType gpsBdsInterSystemBias; Gnss_InterSystemBiasStructType gpsGalInterSystemBias; - Gnss_InterSystemBiasStructType bdsGloInterSystemBias; - Gnss_InterSystemBiasStructType galGloInterSystemBias; - Gnss_InterSystemBiasStructType galBdsInterSystemBias; + Gnss_InterSystemBiasStructType gpsL1L5TimeBias; + Gnss_InterSystemBiasStructType galE1E5aTimeBias; + + GnssSystemTimeStructType gpsSystemTime; + GnssSystemTimeStructType galSystemTime; + GnssSystemTimeStructType bdsSystemTime; + GnssSystemTimeStructType qzssSystemTime; + GnssGloTimeStructType gloSystemTime; + + /** GPS system RTC time information. */ + Gnss_LocGnssTimeExtStructType gpsSystemTimeExt; + /** GAL system RTC time information. */ + Gnss_LocGnssTimeExtStructType galSystemTimeExt; + /** BDS system RTC time information. */ + Gnss_LocGnssTimeExtStructType bdsSystemTimeExt; + /** QZSS system RTC time information. */ + Gnss_LocGnssTimeExtStructType qzssSystemTimeExt; + +} GnssSvMeasurementHeader; - bool clockFreqValid; - Gnss_LocRcvrClockFrequencyInfoStructType clockFreq; /* Freq */ - bool gnssMeasValid; - Gnss_ClockMeasurementStructType gnssMeas; - Gnss_ApTimeStampStructType timeStamp; - /* Extended Time Information - Cumulative Number of Clock Resets */ - uint8_t numClockResets_valid; /**< Must be set to true if numClockResets is being passed */ - uint32_t numClockResets; - bool gnssSignalTypeMaskValid; - GnssSignalTypeMask gnssSignalTypeMask; +typedef struct { + size_t size; + bool isNhz; + GnssSvMeasurementHeader svMeasSetHeader; + uint32_t svMeasCount; + Gnss_SVMeasurementStructType svMeas[GNSS_LOC_SV_MEAS_LIST_MAX_SIZE]; } GnssSvMeasurementSet; @@ -1916,6 +1874,10 @@ typedef struct { Mandatory field */ Gnss_LocSvSystemEnumType gnssConstellation; + /** GPS System Time of the ephemeris report */ + bool isSystemTimeValid; + GnssSystemTimeStructType systemTime; + union { /** GPS Ephemeris */ GpsEphemerisResponse gpsEphemeris; @@ -1930,6 +1892,73 @@ typedef struct { } ephInfo; } GnssSvEphemerisReport; +typedef struct { + /** GPS System Time of the iono model report */ + bool isSystemTimeValid; + GnssSystemTimeStructType systemTime; + + /** Indicates GNSS Constellation Type */ + Gnss_LocSvSystemEnumType gnssConstellation; + + float alpha0; + /**< Klobuchar Model Parameter Alpha 0. + - Type: float + - Unit: Seconds + */ + + float alpha1; + /**< Klobuchar Model Parameter Alpha 1. + - Type: float + - Unit: Seconds / Semi-Circle + */ + + float alpha2; + /**< Klobuchar Model Parameter Alpha 2. + - Type: float + - Unit: Seconds / Semi-Circle^2 + */ + + float alpha3; + /**< Klobuchar Model Parameter Alpha 3. + - Type: float + - Unit: Seconds / Semi-Circle^3 + */ + + float beta0; + /**< Klobuchar Model Parameter Beta 0. + - Type: float + - Unit: Seconds + */ + + float beta1; + /**< Klobuchar Model Parameter Beta 1. + - Type: float + - Unit: Seconds / Semi-Circle + */ + + float beta2; + /**< Klobuchar Model Parameter Beta 2. + - Type: float + - Unit: Seconds / Semi-Circle^2 + */ + + float beta3; + /**< Klobuchar Model Parameter Beta 3. + - Type: float + - Unit: Seconds / Semi-Circle^3 + */ +} GnssKlobucharIonoModel; + +typedef struct { + /** GPS System Time of the report */ + bool isSystemTimeValid; + GnssSystemTimeStructType systemTime; + + GnssAdditionalSystemInfoMask validityMask; + double tauC; + int8_t leapSec; +} GnssAdditionalSystemInfo; + /* Various Short Range Node Technology type*/ typedef enum { SRN_AP_DATA_TECH_TYPE_NONE, @@ -2053,6 +2082,7 @@ typedef void (*LocAgpsCloseResultCb)(bool isSuccess, AGpsExtType agpsType, void* #define SOCKET_DIR_TO_CLIENT "/dev/socket/loc_client/" #define SOCKET_TO_LOCATION_CLIENT_BASE "/dev/socket/loc_client/toclient" +#define SOCKET_TO_EXTERANL_AP_LOCATION_CLIENT_BASE "/dev/socket/loc_client/extap.toclient" #ifdef __cplusplus } diff --git a/utils/linked_list.h b/utils/linked_list.h index a85f09a..0b33ecb 100644 --- a/utils/linked_list.h +++ b/utils/linked_list.h @@ -50,6 +50,8 @@ typedef enum /**< Failed because an there were not enough resources. */ eLINKED_LIST_INSUFFICIENT_BUFFER = -5, /**< Failed because an the supplied buffer was too small. */ + eLINKED_LIST_EMPTY = -6 + /**< Failed because list is empty. */ }linked_list_err_type; /*=========================================================================== diff --git a/utils/loc_nmea.cpp b/utils/loc_nmea.cpp index e9a8f84..0f7c48f 100644 --- a/utils/loc_nmea.cpp +++ b/utils/loc_nmea.cpp @@ -674,6 +674,9 @@ static void loc_nmea_generate_GSV(const GnssSvNotification &svNotify, case GNSS_SV_TYPE_BEIDOU: signalType = GNSS_SIGNAL_BEIDOU_B1I; break; + case GNSS_SV_TYPE_SBAS: + signalType = GNSS_SIGNAL_SBAS_L1; + break; default: LOC_LOGE("NMEA Error unknow constellation type: %d", svNotify.gnssSvs[svNumber - 1].type); diff --git a/utils/log_util.h b/utils/log_util.h index 4fed90b..ed7e19e 100644 --- a/utils/log_util.h +++ b/utils/log_util.h @@ -47,6 +47,14 @@ #endif /* LOG_TAG */ // LE targets with no logcat support +#ifdef FEATURE_EXTERNAL_AP +#include <syslog.h> +#define ALOGE(...) syslog(LOG_ERR, "LOC_LOGE: " __VA_ARGS__); +#define ALOGW(...) syslog(LOG_WARNING, "LOC_LOGW: " __VA_ARGS__); +#define ALOGI(...) syslog(LOG_NOTICE, "LOC_LOGI: " __VA_ARGS__); +#define ALOGD(...) syslog(LOG_DEBUG, "LOC_LOGD: " __VA_ARGS__); +#define ALOGV(...) syslog(LOG_NOTICE, "LOC_LOGV: " __VA_ARGS__); +#else /* FEATURE_EXTERNAL_AP */ #define TS_PRINTF(format, x...) \ { \ struct timeval tv; \ @@ -64,6 +72,7 @@ #define ALOGI(format, x...) TS_PRINTF("I/%s (%d): " format , LOG_TAG, getpid(), ##x) #define ALOGD(format, x...) TS_PRINTF("D/%s (%d): " format , LOG_TAG, getpid(), ##x) #define ALOGV(format, x...) TS_PRINTF("V/%s (%d): " format , LOG_TAG, getpid(), ##x) +#endif /* FEATURE_EXTERNAL_AP */ #endif /* #if defined (USE_ANDROID_LOGGING) || defined (ANDROID) */ diff --git a/utils/msg_q.c b/utils/msg_q.c index 76c1478..2d49b4a 100644 --- a/utils/msg_q.c +++ b/utils/msg_q.c @@ -267,6 +267,51 @@ msq_q_err_type msg_q_rcv(void* msg_q_data, void** msg_obj) /*=========================================================================== + FUNCTION: msg_q_rmv + + ===========================================================================*/ +msq_q_err_type msg_q_rmv(void* msg_q_data, void** msg_obj) +{ + msq_q_err_type rv; + if (msg_q_data == NULL) { + LOC_LOGE("%s: Invalid msg_q_data parameter!\n", __FUNCTION__); + return eMSG_Q_INVALID_HANDLE; + } + + if (msg_obj == NULL) { + LOC_LOGE("%s: Invalid msg_obj parameter!\n", __FUNCTION__); + return eMSG_Q_INVALID_PARAMETER; + } + + msg_q* p_msg_q = (msg_q*)msg_q_data; + + pthread_mutex_lock(&p_msg_q->list_mutex); + + if (p_msg_q->unblocked) { + LOC_LOGE("%s: Message queue has been unblocked.\n", __FUNCTION__); + pthread_mutex_unlock(&p_msg_q->list_mutex); + return eMSG_Q_UNAVAILABLE_RESOURCE; + } + + if (linked_list_empty(p_msg_q->msg_list)) { + LOC_LOGW("%s: list is empty !!\n", __FUNCTION__); + pthread_mutex_unlock(&p_msg_q->list_mutex); + return eLINKED_LIST_EMPTY; + } + + rv = convert_linked_list_err_type(linked_list_remove(p_msg_q->msg_list, msg_obj)); + + pthread_mutex_unlock(&p_msg_q->list_mutex); + + LOC_LOGV("%s: Removed message %p rv = %d\n", __FUNCTION__, *msg_obj, rv); + + return rv; +} + + + +/*=========================================================================== + FUNCTION: msg_q_flush ===========================================================================*/ diff --git a/utils/msg_q.h b/utils/msg_q.h index 453b8ce..16df494 100644 --- a/utils/msg_q.h +++ b/utils/msg_q.h @@ -158,6 +158,29 @@ SIDE EFFECTS msq_q_err_type msg_q_rcv(void* msg_q_data, void** msg_obj); /*=========================================================================== +FUNCTION msg_q_rmv + +DESCRIPTION + Remove data from the message queue. msg_obj is the oldest message received + and pointer is simply removed from message queue. + + msg_q_data: Message Queue to copy data from into msgp. + msg_obj: Pointer to space to copy msg_q contents to. + +DEPENDENCIES + N/A + +RETURN VALUE + Look at error codes above. + +SIDE EFFECTS + N/A + +===========================================================================*/ +msq_q_err_type msg_q_rmv(void* msg_q_data, void** msg_obj); + + +/*=========================================================================== FUNCTION msg_q_flush DESCRIPTION |