summaryrefslogtreecommitdiff
path: root/gps/location
diff options
context:
space:
mode:
authorIsaac Chen <isaacchen@isaacchen.cn>2018-12-31 10:55:08 +0100
committerTingyiChen <tingyi364@gmail.com>2019-08-13 11:54:40 +0200
commite5c53750f06e9d9739b45ec108260ead7ff80941 (patch)
treefe1d84884caefc481e994ae9c59c84b11fddd408 /gps/location
parent3ac2a0309619515c9ac27a5b6ec7c212b86dc355 (diff)
wayne-common: Synchorize gps to P
* QC Tag: LA.UM.7.2.r1-04900-sdm660.0 Signed-off-by: Isaac Chen <isaacchen@isaacchen.cn> Change-Id: I34383e8fbf394b774f83f8d662873e8786ff1bbf
Diffstat (limited to 'gps/location')
-rw-r--r--gps/location/Android.mk1
-rw-r--r--gps/location/LocationAPI.cpp3
-rw-r--r--gps/location/LocationAPIClientBase.cpp39
-rw-r--r--gps/location/LocationAPIClientBase.h19
-rw-r--r--gps/location/Makefile.am22
-rw-r--r--gps/location/configure.ac82
-rw-r--r--gps/location/location-api.pc.in10
-rw-r--r--gps/location/location_interface.h5
8 files changed, 146 insertions, 35 deletions
diff --git a/gps/location/Android.mk b/gps/location/Android.mk
index 2792b12..bbd6fbd 100644
--- a/gps/location/Android.mk
+++ b/gps/location/Android.mk
@@ -7,7 +7,6 @@ include $(CLEAR_VARS)
LOCAL_MODULE := liblocation_api
LOCAL_VENDOR_MODULE := true
-LOCAL_MODULE_OWNER := qti
LOCAL_MODULE_TAGS := optional
LOCAL_SHARED_LIBRARIES := \
diff --git a/gps/location/LocationAPI.cpp b/gps/location/LocationAPI.cpp
index 21d2de0..0111a9c 100644
--- a/gps/location/LocationAPI.cpp
+++ b/gps/location/LocationAPI.cpp
@@ -29,7 +29,8 @@
#include <location_interface.h>
#include <dlfcn.h>
-#include <platform_lib_log_util.h>
+#include <loc_pla.h>
+#include <log_util.h>
#include <pthread.h>
#include <map>
diff --git a/gps/location/LocationAPIClientBase.cpp b/gps/location/LocationAPIClientBase.cpp
index 50b4b83..626968c 100644
--- a/gps/location/LocationAPIClientBase.cpp
+++ b/gps/location/LocationAPIClientBase.cpp
@@ -29,12 +29,12 @@
#define LOG_NDDEBUG 0
#define LOG_TAG "LocSvc_APIClientBase"
-#include <platform_lib_log_util.h>
+#include <loc_pla.h>
+#include <log_util.h>
#include <inttypes.h>
#include <loc_cfg.h>
#include "LocationAPIClientBase.h"
-#define FLP_CONF_FILE "/etc/flp.conf"
#define GEOFENCE_SESSION_ID 0xFFFFFFFF
#define CONFIG_SESSION_ID 0xFFFFFFFF
@@ -153,7 +153,6 @@ uint32_t LocationAPIControlClient::locAPIGnssUpdateConfig(GnssConfig config)
memcpy(&mConfig, &config, sizeof(GnssConfig));
- uint32_t session = 0;
uint32_t* idArray = mLocationControlAPI->gnssUpdateConfig(config);
LOC_LOGV("%s:%d] gnssUpdateConfig return array: %p", __FUNCTION__, __LINE__, idArray);
if (idArray != nullptr) {
@@ -365,7 +364,7 @@ int32_t LocationAPIClientBase::locAPIGetBatchSize()
{
{"BATCH_SIZE", &mBatchSize, nullptr, 'n'},
};
- UTIL_READ_CONF(FLP_CONF_FILE, flp_conf_param_table);
+ UTIL_READ_CONF(LOC_PATH_FLP_CONF, flp_conf_param_table);
if (mBatchSize < 0) {
// set mBatchSize to 0 if we got an illegal value from config file
mBatchSize = 0;
@@ -562,10 +561,16 @@ uint32_t LocationAPIClientBase::locAPIGetBatchedLocations(uint32_t id, size_t co
if (mLocationAPI) {
if (mSessionBiDict.hasId(id)) {
SessionEntity entity = mSessionBiDict.getExtById(id);
- uint32_t batchingSession = entity.batchingSession;
- mRequestQueues[REQUEST_SESSION].push(new GetBatchedLocationsRequest(*this));
- mLocationAPI->getBatchedLocations(batchingSession, count);
- retVal = LOCATION_ERROR_SUCCESS;
+ if (entity.sessionMode != SESSION_MODE_ON_FIX) {
+ uint32_t batchingSession = entity.batchingSession;
+ mRequestQueues[REQUEST_SESSION].push(new GetBatchedLocationsRequest(*this));
+ mLocationAPI->getBatchedLocations(batchingSession, count);
+ retVal = LOCATION_ERROR_SUCCESS;
+ } else {
+ LOC_LOGE("%s:%d] Unsupported for session id: %d, mode is SESSION_MODE_ON_FIX",
+ __FUNCTION__, __LINE__, id);
+ retVal = LOCATION_ERROR_NOT_SUPPORTED;
+ }
} else {
retVal = LOCATION_ERROR_ID_UNKNOWN;
LOC_LOGE("%s:%d] invalid session: %d.", __FUNCTION__, __LINE__, id);
@@ -614,26 +619,24 @@ void LocationAPIClientBase::locAPIRemoveGeofences(size_t count, uint32_t* ids)
}
if (mRequestQueues[REQUEST_GEOFENCE].getSession() == GEOFENCE_SESSION_ID) {
+ BiDict<GeofenceBreachTypeMask>* removedGeofenceBiDict =
+ new BiDict<GeofenceBreachTypeMask>();
size_t j = 0;
- uint32_t id_cb;
- LocationError err;
for (size_t i = 0; i < count; i++) {
sessions[j] = mGeofenceBiDict.getSession(ids[i]);
- id_cb = ids[i];
if (sessions[j] > 0) {
+ GeofenceBreachTypeMask type = mGeofenceBiDict.getExtBySession(sessions[j]);
mGeofenceBiDict.rmBySession(sessions[j]);
- err = LOCATION_ERROR_SUCCESS;
- onRemoveGeofencesCb(1, &err, &id_cb);
+ removedGeofenceBiDict->set(ids[i], sessions[j], type);
j++;
- } else {
- err = LOCATION_ERROR_ID_UNKNOWN;
- onRemoveGeofencesCb(1, &err, &id_cb);
}
}
-
if (j > 0) {
- mRequestQueues[REQUEST_GEOFENCE].push(new RemoveGeofencesRequest(*this));
+ mRequestQueues[REQUEST_GEOFENCE].push(new RemoveGeofencesRequest(*this,
+ removedGeofenceBiDict));
mLocationAPI->removeGeofences(j, sessions);
+ } else {
+ delete(removedGeofenceBiDict);
}
} else {
LOC_LOGE("%s:%d] invalid session: %d.", __FUNCTION__, __LINE__,
diff --git a/gps/location/LocationAPIClientBase.h b/gps/location/LocationAPIClientBase.h
index c6ea05c..4bd1466 100644
--- a/gps/location/LocationAPIClientBase.h
+++ b/gps/location/LocationAPIClientBase.h
@@ -36,6 +36,8 @@
#include <map>
#include "LocationAPI.h"
+#include <loc_pla.h>
+#include <log_util.h>
enum SESSION_MODE {
SESSION_MODE_NONE = 0,
@@ -469,11 +471,24 @@ private:
class RemoveGeofencesRequest : public LocationAPIRequest {
public:
- RemoveGeofencesRequest(LocationAPIClientBase& API) : mAPI(API) {}
+ RemoveGeofencesRequest(LocationAPIClientBase& API,
+ BiDict<GeofenceBreachTypeMask>* removedGeofenceBiDict) :
+ mAPI(API), mRemovedGeofenceBiDict(removedGeofenceBiDict) {}
inline void onCollectiveResponse(size_t count, LocationError* errors, uint32_t* sessions) {
- // No need to handle collectiveResponse, cbs already notified
+ if (nullptr != mRemovedGeofenceBiDict) {
+ uint32_t *ids = (uint32_t*)malloc(sizeof(uint32_t) * count);
+ for (size_t i = 0; i < count; i++) {
+ ids[i] = mRemovedGeofenceBiDict->getId(sessions[i]);
+ }
+ mAPI.onRemoveGeofencesCb(count, errors, ids);
+ free(ids);
+ delete(mRemovedGeofenceBiDict);
+ } else {
+ LOC_LOGE("%s:%d] Unable to access removed geofences data.", __FUNCTION__, __LINE__);
+ }
}
LocationAPIClientBase& mAPI;
+ BiDict<GeofenceBreachTypeMask>* mRemovedGeofenceBiDict;
};
class ModifyGeofencesRequest : public LocationAPIRequest {
diff --git a/gps/location/Makefile.am b/gps/location/Makefile.am
index d1d0131..3688cc8 100644
--- a/gps/location/Makefile.am
+++ b/gps/location/Makefile.am
@@ -1,9 +1,10 @@
+ACLOCAL_AMFLAGS = -I m4
+
AM_CFLAGS = \
- $(LOCPLA_CFLAGS) \
- $(GPSUTILS_CFLAGS) \
- $(LOCHAL_CFLAGS) \
-I./ \
-I../utils \
+ $(LOCPLA_CFLAGS) \
+ $(GPSUTILS_CFLAGS) \
-std=c++11
liblocation_api_la_SOURCES = \
@@ -12,15 +13,15 @@ liblocation_api_la_SOURCES = \
if USE_GLIB
liblocation_api_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
-liblocation_api_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+liblocation_api_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
liblocation_api_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
else
liblocation_api_la_CFLAGS = $(AM_CFLAGS)
-liblocation_api_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+liblocation_api_la_LDFLAGS = -Wl,-z,defs -lpthread -shared -version-info 1:0:0
liblocation_api_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
endif
-liblocation_api_la_LIBADD = -lstdc++ $(LOCPLA_LIBS) $(GPSUTILS_LIBS) $(LOCHAL_LIBS)
+liblocation_api_la_LIBADD = -lstdc++ -ldl $(GPSUTILS_LIBS)
library_include_HEADERS = \
LocationAPI.h \
@@ -31,10 +32,7 @@ library_include_HEADERS = \
lib_LTLIBRARIES = liblocation_api.la
library_includedir = $(pkgincludedir)
-#pkgconfigdir = $(libdir)/pkgconfig
-#pkgconfig_DATA = location-api.pc
-#EXTRA_DIST = $(pkgconfig_DATA)
-
-
-
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = location-api.pc
+EXTRA_DIST = $(pkgconfig_DATA)
diff --git a/gps/location/configure.ac b/gps/location/configure.ac
new file mode 100644
index 0000000..6391d65
--- /dev/null
+++ b/gps/location/configure.ac
@@ -0,0 +1,82 @@
+# configure.ac -- Autoconf script for gps location-api-iface
+#
+# Process this file with autoconf to produce a configure script
+
+# Requires autoconf tool later than 2.61
+AC_PREREQ(2.61)
+# Initialize the gps location-api-iface package version 1.0.0
+AC_INIT([location-api-iface],1.0.0)
+# Does not strictly follow GNU Coding standards
+AM_INIT_AUTOMAKE([foreign])
+# Disables auto rebuilding of configure, Makefile.ins
+AM_MAINTAINER_MODE
+# Verifies the --srcdir is correct by checking for the path
+AC_CONFIG_SRCDIR([location-api.pc.in])
+# defines some macros variable to be included by source
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_MACRO_DIR([m4])
+
+# Checks for programs.
+AC_PROG_LIBTOOL
+AC_PROG_CXX
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_AWK
+AC_PROG_CPP
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+PKG_PROG_PKG_CONFIG
+
+# Checks for libraries.
+PKG_CHECK_MODULES([GPSUTILS], [gps-utils])
+AC_SUBST([GPSUTILS_CFLAGS])
+AC_SUBST([GPSUTILS_LIBS])
+
+AC_ARG_WITH([core_includes],
+ AC_HELP_STRING([--with-core-includes=@<:@dir@:>@],
+ [Specify the location of the core headers]),
+ [core_incdir=$withval],
+ with_core_includes=no)
+
+if test "x$with_core_includes" != "xno"; then
+ CPPFLAGS="${CPPFLAGS} -I${core_incdir}"
+fi
+
+AC_ARG_WITH([locpla_includes],
+ AC_HELP_STRING([--with-locpla-includes=@<:@dir@:>@],
+ [Specify the path to locpla-includes in loc-pla_git.bb]),
+ [locpla_incdir=$withval],
+ with_locpla_includes=no)
+
+if test "x${with_locpla_includes}" != "xno"; then
+ AC_SUBST(LOCPLA_CFLAGS, "-I${locpla_incdir}")
+fi
+
+AC_SUBST([CPPFLAGS])
+
+AC_ARG_WITH([glib],
+ AC_HELP_STRING([--with-glib],
+ [enable glib, building HLOS systems which use glib]))
+
+if (test "x${with_glib}" = "xyes"); then
+ AC_DEFINE(ENABLE_USEGLIB, 1, [Define if HLOS systems uses glib])
+ PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes,
+ AC_MSG_ERROR(GThread >= 2.16 is required))
+ PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, dummy=yes,
+ AC_MSG_ERROR(GLib >= 2.16 is required))
+ GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS"
+ GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
+
+ AC_SUBST(GLIB_CFLAGS)
+ AC_SUBST(GLIB_LIBS)
+fi
+
+AM_CONDITIONAL(USE_GLIB, test "x${with_glib}" = "xyes")
+
+AC_CONFIG_FILES([ \
+ Makefile \
+ location-api.pc \
+ ])
+
+AC_OUTPUT
diff --git a/gps/location/location-api.pc.in b/gps/location/location-api.pc.in
new file mode 100644
index 0000000..c7b146a
--- /dev/null
+++ b/gps/location/location-api.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: location-api
+Description: Location API
+Version: @VERSION
+Libs: -L${libdir} -llocation_api
+Cflags: -I${includedir}/location-api
diff --git a/gps/location/location_interface.h b/gps/location/location_interface.h
index 33ec29e..9229052 100644
--- a/gps/location/location_interface.h
+++ b/gps/location/location_interface.h
@@ -48,6 +48,7 @@ struct GnssInterface {
void (*disable)(uint32_t id);
uint32_t* (*gnssUpdateConfig)(GnssConfig config);
uint32_t (*gnssDeleteAidingData)(GnssAidingData& data);
+ void (*gnssUpdateXtraThrottle)(const bool enabled);
void (*injectLocation)(double latitude, double longitude, float accuracy);
void (*injectTime)(int64_t time, int64_t timeReference, int32_t uncertainty);
void (*agpsInit)(const AgpsCbInfo& cbInfo);
@@ -55,7 +56,9 @@ struct GnssInterface {
void (*agpsDataConnClosed)(AGpsExtType agpsType);
void (*agpsDataConnFailed)(AGpsExtType agpsType);
void (*getDebugReport)(GnssDebugReport& report);
- void (*updateConnectionStatus)(bool connected, uint8_t type);
+ void (*updateConnectionStatus)(bool connected, int8_t type);
+ void (*odcpiInit)(const OdcpiRequestCallback& callback);
+ void (*odcpiInject)(const Location& location);
};
struct FlpInterface {