sanders: gps: update to LA.UM.7.6.r1-02000-89xx.0 tag

This commit is contained in:
therootlord
2018-09-12 13:45:48 -03:00
parent 8a6b5c05e7
commit 0a41b9dc1a
150 changed files with 4794 additions and 4130 deletions

View File

@@ -6,8 +6,7 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := liblocation_api
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_TAGS := optional
LOCAL_SHARED_LIBRARIES := \

View File

@@ -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>

View File

@@ -308,8 +308,9 @@ typedef enum {
} GnssSuplMode;
typedef enum {
BATCHING_MODE_ROUTINE = 0,
BATCHING_MODE_TRIP
BATCHING_MODE_ROUTINE = 0, // positions are reported when batched positions memory is full
BATCHING_MODE_TRIP, // positions are reported when a certain distance is covered
BATCHING_MODE_NO_AUTO_REPORT // no report of positions automatically, instead queried on demand
} BatchingMode;
typedef enum {

View File

@@ -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;
@@ -393,14 +392,20 @@ uint32_t LocationAPIClientBase::locAPIStartSession(uint32_t id, uint32_t session
trackingSession = mLocationAPI->startTracking(locationOptions);
LOC_LOGI("%s:%d] start new session: %d", __FUNCTION__, __LINE__, trackingSession);
mRequestQueues[REQUEST_SESSION].push(new StartTrackingRequest(*this));
} else if ((sessionMode == SESSION_MODE_ON_FULL) ||
(sessionMode == SESSION_MODE_ON_TRIP_COMPLETED)) {
} else {
// Fill in the batch mode
BatchingOptions batchOptions = {};
batchOptions.size = sizeof(BatchingOptions);
batchOptions.batchingMode = BATCHING_MODE_ROUTINE;
if (sessionMode == SESSION_MODE_ON_TRIP_COMPLETED) {
switch (sessionMode) {
case SESSION_MODE_ON_FULL:
batchOptions.batchingMode = BATCHING_MODE_ROUTINE;
break;
case SESSION_MODE_ON_TRIP_COMPLETED:
batchOptions.batchingMode = BATCHING_MODE_TRIP;
break;
default:
batchOptions.batchingMode = BATCHING_MODE_NO_AUTO_REPORT;
break;
}
batchingSession = mLocationAPI->startBatching(locationOptions, batchOptions);
@@ -409,8 +414,7 @@ uint32_t LocationAPIClientBase::locAPIStartSession(uint32_t id, uint32_t session
mRequestQueues[REQUEST_SESSION].push(new StartBatchingRequest(*this));
}
uint32_t session = ((sessionMode == SESSION_MODE_ON_FULL ||
(sessionMode == SESSION_MODE_ON_TRIP_COMPLETED)) ?
uint32_t session = ((sessionMode != SESSION_MODE_ON_FIX) ?
batchingSession : trackingSession);
SessionEntity entity;
@@ -445,12 +449,9 @@ uint32_t LocationAPIClientBase::locAPIStopSession(uint32_t id)
if (sMode == SESSION_MODE_ON_FIX) {
mRequestQueues[REQUEST_SESSION].push(new StopTrackingRequest(*this));
mLocationAPI->stopTracking(trackingSession);
} else if ((sMode == SESSION_MODE_ON_FULL) ||
(sMode == SESSION_MODE_ON_TRIP_COMPLETED)) {
} else {
mRequestQueues[REQUEST_SESSION].push(new StopBatchingRequest(*this));
mLocationAPI->stopBatching(batchingSession);
} else {
LOC_LOGE("%s:%d] unknown mode %d.", __FUNCTION__, __LINE__, sMode);
}
retVal = LOCATION_ERROR_SUCCESS;
@@ -484,8 +485,7 @@ uint32_t LocationAPIClientBase::locAPIUpdateSessionOptions(uint32_t id, uint32_t
mRequestQueues[REQUEST_SESSION].push(new UpdateTrackingOptionsRequest(*this));
if (sMode == SESSION_MODE_ON_FIX) {
mLocationAPI->updateTrackingOptions(trackingSession, options);
} else if ((sMode == SESSION_MODE_ON_FULL) ||
(sMode == SESSION_MODE_ON_TRIP_COMPLETED)) {
} else {
// stop batching
// batchingSession will be removed from mSessionBiDict soon,
// so we don't need to add a new request to mRequestQueues[REQUEST_SESSION].
@@ -497,19 +497,23 @@ uint32_t LocationAPIClientBase::locAPIUpdateSessionOptions(uint32_t id, uint32_t
trackingSession = mLocationAPI->startTracking(options);
LOC_LOGI("%s:%d] start new session: %d",
__FUNCTION__, __LINE__, trackingSession);
} else {
LOC_LOGE("%s:%d] unknown mode %d", __FUNCTION__, __LINE__, sMode);
}
} else if ((sessionMode == SESSION_MODE_ON_FULL) ||
(sessionMode == SESSION_MODE_ON_TRIP_COMPLETED)) {
} else {
// we only add an UpdateBatchingOptionsRequest to mRequestQueues[REQUEST_SESSION],
// even if this update request will stop tracking and then start batching.
mRequestQueues[REQUEST_SESSION].push(new UpdateBatchingOptionsRequest(*this));
BatchingOptions batchOptions = {};
batchOptions.size = sizeof(BatchingOptions);
batchOptions.batchingMode = BATCHING_MODE_ROUTINE;
if (sessionMode == SESSION_MODE_ON_TRIP_COMPLETED) {
batchOptions.batchingMode = BATCHING_MODE_TRIP;
switch (sessionMode) {
case SESSION_MODE_ON_FULL:
batchOptions.batchingMode = BATCHING_MODE_ROUTINE;
break;
case SESSION_MODE_ON_TRIP_COMPLETED:
batchOptions.batchingMode = BATCHING_MODE_TRIP;
break;
default:
batchOptions.batchingMode = BATCHING_MODE_NO_AUTO_REPORT;
break;
}
if (sMode == SESSION_MODE_ON_FIX) {
@@ -524,19 +528,13 @@ uint32_t LocationAPIClientBase::locAPIUpdateSessionOptions(uint32_t id, uint32_t
LOC_LOGI("%s:%d] start new session: %d",
__FUNCTION__, __LINE__, batchingSession);
mRequestQueues[REQUEST_SESSION].setSession(batchingSession);
} else if ((sMode == SESSION_MODE_ON_FULL) ||
(sMode == SESSION_MODE_ON_TRIP_COMPLETED)) {
mLocationAPI->updateBatchingOptions(batchingSession, options, batchOptions);
} else {
LOC_LOGE("%s:%d] unknown mode %d", __FUNCTION__, __LINE__, sMode);
mLocationAPI->updateBatchingOptions(batchingSession, options, batchOptions);
}
} else {
LOC_LOGE("%s:%d] unknown mode %d.", __FUNCTION__, __LINE__, sessionMode);
}
uint32_t session = ((sessionMode == SESSION_MODE_ON_FULL) ||
(sessionMode == SESSION_MODE_ON_TRIP_COMPLETED) ?
uint32_t session = ((sessionMode != SESSION_MODE_ON_FIX) ?
batchingSession : trackingSession);
entity.trackingSession = trackingSession;
@@ -556,22 +554,31 @@ uint32_t LocationAPIClientBase::locAPIUpdateSessionOptions(uint32_t id, uint32_t
return retVal;
}
void LocationAPIClientBase::locAPIGetBatchedLocations(uint32_t id, size_t count)
uint32_t LocationAPIClientBase::locAPIGetBatchedLocations(uint32_t id, size_t count)
{
uint32_t retVal = LOCATION_ERROR_GENERAL_FAILURE;
pthread_mutex_lock(&mMutex);
if (mLocationAPI) {
uint32_t session = 0;
session = mRequestQueues[REQUEST_SESSION].getSession();
if (session > 0) {
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);
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 {
LOC_LOGE("%s:%d] invalid session: %d.", __FUNCTION__, __LINE__, session);
retVal = LOCATION_ERROR_ID_UNKNOWN;
LOC_LOGE("%s:%d] invalid session: %d.", __FUNCTION__, __LINE__, id);
}
}
pthread_mutex_unlock(&mMutex);
return retVal;
}
uint32_t LocationAPIClientBase::locAPIAddGeofences(
@@ -612,16 +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;
for (size_t i = 0; i < count; i++) {
sessions[j] = mGeofenceBiDict.getSession(ids[i]);
if (sessions[j] > 0) {
GeofenceBreachTypeMask type = mGeofenceBiDict.getExtBySession(sessions[j]);
mGeofenceBiDict.rmBySession(sessions[j]);
removedGeofenceBiDict->set(ids[i], sessions[j], type);
j++;
}
}
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__,
@@ -743,38 +758,8 @@ void LocationAPIClientBase::locAPIResumeGeofences(
void LocationAPIClientBase::locAPIRemoveAllGeofences()
{
pthread_mutex_lock(&mMutex);
if (mLocationAPI) {
std::vector<uint32_t> sessionsVec = mGeofenceBiDict.getAllSessions();
size_t count = sessionsVec.size();
uint32_t* sessions = (uint32_t*)malloc(sizeof(uint32_t) * count);
if (sessions == NULL) {
LOC_LOGE("%s:%d] Failed to allocate %zu bytes !",
__FUNCTION__, __LINE__, sizeof(uint32_t) * count);
pthread_mutex_unlock(&mMutex);
return;
}
if (mRequestQueues[REQUEST_GEOFENCE].getSession() == GEOFENCE_SESSION_ID) {
size_t j = 0;
for (size_t i = 0; i < count; i++) {
sessions[j] = sessionsVec[i];
if (sessions[j] > 0) {
j++;
}
}
if (j > 0) {
mRequestQueues[REQUEST_GEOFENCE].push(new RemoveGeofencesRequest(*this));
mLocationAPI->removeGeofences(j, sessions);
}
} else {
LOC_LOGE("%s:%d] invalid session: %d.", __FUNCTION__, __LINE__,
mRequestQueues[REQUEST_GEOFENCE].getSession());
}
free(sessions);
}
pthread_mutex_unlock(&mMutex);
std::vector<uint32_t> sessionsVec = mGeofenceBiDict.getAllSessions();
locAPIRemoveGeofences(sessionsVec.size(), &sessionsVec[0]);
}
void LocationAPIClientBase::locAPIGnssNiResponse(uint32_t id, GnssNiResponse response)

View File

@@ -36,6 +36,8 @@
#include <map>
#include "LocationAPI.h"
#include <loc_pla.h>
#include <log_util.h>
enum SESSION_MODE {
SESSION_MODE_NONE = 0,
@@ -195,7 +197,7 @@ public:
uint32_t locAPIStopSession(uint32_t id);
uint32_t locAPIUpdateSessionOptions(uint32_t id, uint32_t sessionMode,
LocationOptions& options);
void locAPIGetBatchedLocations(uint32_t id, size_t count);
uint32_t locAPIGetBatchedLocations(uint32_t id, size_t count);
uint32_t locAPIAddGeofences(size_t count, uint32_t* ids,
GeofenceOption* options, GeofenceInfo* data);
@@ -381,7 +383,10 @@ private:
class StartTrackingRequest : public LocationAPIRequest {
public:
StartTrackingRequest(LocationAPIClientBase& API) : mAPI(API) {}
inline void onResponse(LocationError error, uint32_t /*id*/) {
inline void onResponse(LocationError error, uint32_t id) {
if (error != LOCATION_ERROR_SUCCESS) {
mAPI.removeSession(id);
}
mAPI.onStartTrackingCb(error);
}
LocationAPIClientBase& mAPI;
@@ -411,7 +416,10 @@ private:
class StartBatchingRequest : public LocationAPIRequest {
public:
StartBatchingRequest(LocationAPIClientBase& API) : mAPI(API) {}
inline void onResponse(LocationError error, uint32_t /*id*/) {
inline void onResponse(LocationError error, uint32_t id) {
if (error != LOCATION_ERROR_SUCCESS) {
mAPI.removeSession(id);
}
mAPI.onStartBatchingCb(error);
}
LocationAPIClientBase& mAPI;
@@ -463,17 +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) {
uint32_t *ids = (uint32_t*)malloc(sizeof(uint32_t) * count);
for (size_t i = 0; i < count; i++) {
ids[i] = mAPI.mGeofenceBiDict.getId(sessions[i]);
mAPI.mGeofenceBiDict.rmBySession(sessions[i]);
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__);
}
mAPI.onRemoveGeofencesCb(count, errors, ids);
free(ids);
}
LocationAPIClientBase& mAPI;
BiDict<GeofenceBreachTypeMask>* mRemovedGeofenceBiDict;
};
class ModifyGeofencesRequest : public LocationAPIRequest {

View File

@@ -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)

82
gps/location/configure.ac Normal file
View File

@@ -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

View File

@@ -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

View File

@@ -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 {