replace common qcom sources with samsung ones
This commit is contained in:
48
qcom/opensource/location/client_api/Android.bp
Normal file
48
qcom/opensource/location/client_api/Android.bp
Normal file
@@ -0,0 +1,48 @@
|
||||
|
||||
cc_library_shared {
|
||||
|
||||
name: "liblocation_client_api",
|
||||
vendor: true,
|
||||
|
||||
//# Libs
|
||||
shared_libs: [
|
||||
"libgps.utils",
|
||||
"liblocation_api_msg",
|
||||
"libprotobuf-cpp-lite",
|
||||
"liblog",
|
||||
],
|
||||
|
||||
srcs: [
|
||||
"src/LocationClientApi.cpp",
|
||||
"src/LocationClientApiImpl.cpp",
|
||||
"src/LCAReportLoggerUtil.cpp",
|
||||
],
|
||||
|
||||
cflags: [
|
||||
"-fno-short-enums",
|
||||
"-D_ANDROID_",
|
||||
"-Wno-error=non-virtual-dtor",
|
||||
] + GNSS_CFLAGS,
|
||||
|
||||
local_include_dirs: [
|
||||
"inc", "src",
|
||||
],
|
||||
|
||||
//# Includes
|
||||
ldflags: ["-Wl,--export-dynamic"],
|
||||
|
||||
header_libs: [
|
||||
"libutils_headers",
|
||||
"libgps.utils_headers",
|
||||
"libloc_pla_headers",
|
||||
"liblocation_api_headers",
|
||||
"liblocation_api_msg.headers",
|
||||
],
|
||||
}
|
||||
|
||||
cc_library_headers {
|
||||
|
||||
name: "liblocation_client_api.impl_headers",
|
||||
export_include_dirs: ["src"] + ["inc"],
|
||||
vendor: true,
|
||||
}
|
||||
2294
qcom/opensource/location/client_api/LocationClientApiDoxygen.conf
Normal file
2294
qcom/opensource/location/client_api/LocationClientApiDoxygen.conf
Normal file
File diff suppressed because it is too large
Load Diff
59
qcom/opensource/location/client_api/Makefile.am
Normal file
59
qcom/opensource/location/client_api/Makefile.am
Normal file
@@ -0,0 +1,59 @@
|
||||
AM_CFLAGS = \
|
||||
-DDEBUG \
|
||||
-I src/ \
|
||||
-I inc/ \
|
||||
$(GPSUTILS_CFLAGS) \
|
||||
$(LOCAPIMSGPROTO_CFLAGS) \
|
||||
-std=c++14
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
AM_CPPFLAGS = -std=c++14
|
||||
|
||||
requiredlibs = \
|
||||
$(GPSUTILS_LIBS) \
|
||||
$(LOCAPIMSGPROTO_LIBS) \
|
||||
-lprotobuf-lite
|
||||
|
||||
h_sources = \
|
||||
src/LocationClientApiImpl.h \
|
||||
src/LCAReportLoggerUtil.h \
|
||||
inc/LocationClientApi.h
|
||||
|
||||
c_sources = \
|
||||
src/LocationClientApiImpl.cpp \
|
||||
src/LocationClientApi.cpp \
|
||||
src/LCAReportLoggerUtil.cpp
|
||||
|
||||
liblocation_client_api_la_SOURCES = \
|
||||
$(c_sources) $(h_sources)
|
||||
liblocation_client_api_la_h_sources = $(h_sources)
|
||||
|
||||
######################
|
||||
# Build location_client_api
|
||||
######################
|
||||
|
||||
if USE_EXTERNAL_AP
|
||||
AM_CFLAGS += $(LOCSOCKET_CFLAGS) -DFEATURE_EXTERNAL_AP
|
||||
requiredlibs += $(LOCSOCKET_LIBS)
|
||||
endif
|
||||
|
||||
if USE_GLIB
|
||||
liblocation_client_api_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
|
||||
liblocation_client_api_la_LDFLAGS = -lstdc++ -g -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
|
||||
liblocation_client_api_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
|
||||
else
|
||||
liblocation_client_api_la_CFLAGS = $(AM_CFLAGS)
|
||||
liblocation_client_api_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread -shared -version-info 1:0:0
|
||||
liblocation_client_api_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
|
||||
endif
|
||||
|
||||
liblocation_client_api_la_LIBADD = $(requiredlibs) -lstdc++ -ldl
|
||||
|
||||
#Create and Install libraries
|
||||
library_include_HEADERS = $(h_sources)
|
||||
lib_LTLIBRARIES = liblocation_client_api.la
|
||||
|
||||
library_includedir = $(pkgincludedir)
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = location-client-api.pc
|
||||
EXTRA_DIST = $(pkgconfig_DATA)
|
||||
11
qcom/opensource/location/client_api/README
Normal file
11
qcom/opensource/location/client_api/README
Normal file
@@ -0,0 +1,11 @@
|
||||
Location Client Api doc
|
||||
|
||||
1. Steps to generate doxygen Api doc:
|
||||
run
|
||||
mkclientapidoc.sh [output-path]
|
||||
default output-path is docs/
|
||||
default doxgen configuration file is LocationClientApiDoxygen.conf
|
||||
|
||||
2. below file will be generated:
|
||||
html/
|
||||
-HTML output, where the html/index.html is the home page.
|
||||
92
qcom/opensource/location/client_api/configure.ac
Normal file
92
qcom/opensource/location/client_api/configure.ac
Normal file
@@ -0,0 +1,92 @@
|
||||
# configure.ac -- Autoconf script for gps location-client-api
|
||||
#
|
||||
# Process this file with autoconf to produce a configure script
|
||||
|
||||
# Requires autoconf tool later than 2.61
|
||||
AC_PREREQ(2.61)
|
||||
# Initialize the location_client_api package version 1.0.0
|
||||
AC_INIT([location-client-api],1.0.0)
|
||||
# Does not strictly follow GNU Coding standards
|
||||
AM_INIT_AUTOMAKE([foreign subdir-objects])
|
||||
# Disables auto rebuilding of configure, Makefile.ins
|
||||
AM_MAINTAINER_MODE
|
||||
# Verifies the --srcdir is correct by checking for the path
|
||||
AC_CONFIG_SRCDIR([Makefile.am])
|
||||
# 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], [qcom-gps-utils])
|
||||
AC_SUBST([GPSUTILS_CFLAGS])
|
||||
AC_SUBST([GPSUTILS_LIBS])
|
||||
|
||||
PKG_CHECK_MODULES([LOCAPIMSGPROTO], [location-api-msg-proto])
|
||||
AC_SUBST([LOCAPIMSGPROTO_CFLAGS])
|
||||
AC_SUBST([LOCAPIMSGPROTO_LIBS])
|
||||
|
||||
AC_ARG_WITH([external_ap],
|
||||
AC_HELP_STRING([--with-external_ap=@<:@dir@:>@],
|
||||
[Using External Application Processor]),
|
||||
[],
|
||||
with_external_ap=no)
|
||||
|
||||
AM_CONDITIONAL(USE_EXTERNAL_AP, test "x${with_external_ap}" = "xyes")
|
||||
|
||||
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_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_CONFIG_FILES([ \
|
||||
Makefile \
|
||||
location-client-api.pc
|
||||
])
|
||||
|
||||
AC_OUTPUT
|
||||
4161
qcom/opensource/location/client_api/inc/LocationClientApi.h
Normal file
4161
qcom/opensource/location/client_api/inc/LocationClientApi.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: location-client-api
|
||||
Description: location client api library
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -llocation_client_api
|
||||
Cflags: -I${includedir} -I${includedir}/location-client-api
|
||||
86
qcom/opensource/location/client_api/mkclientapidoc.sh
Normal file
86
qcom/opensource/location/client_api/mkclientapidoc.sh
Normal file
@@ -0,0 +1,86 @@
|
||||
#!/bin/bash
|
||||
#==========================================================================
|
||||
#Copyright (c) 2018, The Linux Foundation. All rights reserved.
|
||||
#
|
||||
#Redistribution and use in source and binary forms, with or without
|
||||
#modification, are permitted provided that the following conditions are
|
||||
#met:
|
||||
#* Redistributions of source code must retain the above copyright
|
||||
#notice, this list of conditions and the following disclaimer.
|
||||
#* Redistributions in binary form must reproduce the above
|
||||
#copyright notice, this list of conditions and the following
|
||||
#disclaimer in the documentation and/or other materials provided
|
||||
#with the distribution.
|
||||
#* Neither the name of The Linux Foundation nor the names of its
|
||||
#contributors may be used to endorse or promote products derived
|
||||
#from this software without specific prior written permission.
|
||||
#
|
||||
#THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
#WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
#MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
#ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
#BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
#CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
#SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
#BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
#WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
#OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
#IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
#==========================================================================
|
||||
|
||||
#==========================================================================
|
||||
#
|
||||
# Usage:
|
||||
# mkclientapidoc.sh [output-path]
|
||||
#
|
||||
# Note, this script requires the existence of the doxygen tool -
|
||||
# This script can be called from any directory
|
||||
#==========================================================================
|
||||
|
||||
DIR="$( cd "$( dirname "$0" )" && pwd )"
|
||||
# the default doxygen configuration is LocationClientApiDoxygen.conf
|
||||
CONFIG=$DIR/LocationClientApiDoxygen.conf
|
||||
OUT="docs"
|
||||
|
||||
# Show help message if requested, otherwise create output folder
|
||||
if [ -n "$1" ]
|
||||
then
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--help" ]
|
||||
then
|
||||
echo "$0 [output-path]"
|
||||
echo " e.g. $0"
|
||||
echo " $0 docs"
|
||||
exit
|
||||
else
|
||||
OUT=$1
|
||||
if [ ! -d $OUT ]
|
||||
then
|
||||
mkdir -p $OUT
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
which doxygen
|
||||
if [ "$?" == 0 ]
|
||||
then
|
||||
# Use ? here to seperate patterns as / in path will be regarded as splitter by default
|
||||
sed -i "s?^OUTPUT_DIRECTORY .*?OUTPUT_DIRECTORY = $OUT?" $CONFIG
|
||||
sed -i "s?^INPUT .*?INPUT = $DIR/inc?" $CONFIG
|
||||
doxygen $CONFIG > /dev/null 2>&1
|
||||
else
|
||||
echo "This script requires doxygen tool be to installed. "
|
||||
echo "You can install is with e.g. sudo apt-get install doxygen"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -e $OUT/html/index.html ]
|
||||
then
|
||||
echo "Error building Location Client Api doc files."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "doxygen docs for Location Client Api available at: $OUT/html"
|
||||
183
qcom/opensource/location/client_api/src/LCAReportLoggerUtil.cpp
Normal file
183
qcom/opensource/location/client_api/src/LCAReportLoggerUtil.cpp
Normal file
@@ -0,0 +1,183 @@
|
||||
/* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
Changes from Qualcomm Innovation Center are provided under the following license:
|
||||
|
||||
Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted (subject to the limitations in the
|
||||
disclaimer below) provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
* Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
|
||||
GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
|
||||
HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "LCAReportLoggerUtil.h"
|
||||
#include <loc_cfg.h>
|
||||
#include <log_util.h>
|
||||
|
||||
namespace location_client {
|
||||
|
||||
LCAReportLoggerUtil::LCAReportLoggerUtil():
|
||||
mLogLocation(nullptr),
|
||||
mLogSv(nullptr),
|
||||
mLogNmea(nullptr),
|
||||
mLogMeas(nullptr),
|
||||
mLogDcReport(nullptr),
|
||||
mLogEph(nullptr),
|
||||
mLogGnssData(nullptr){
|
||||
|
||||
int loadDiagIfaceLib = 1;
|
||||
const loc_param_s_type gps_conf_params[] = {
|
||||
{"LOC_DIAGIFACE_ENABLED", &loadDiagIfaceLib, nullptr, 'n'}
|
||||
};
|
||||
UTIL_READ_CONF(LOC_PATH_GPS_CONF, gps_conf_params);
|
||||
|
||||
LOC_LOGi("Loc_DiagIface_enabled: %d", loadDiagIfaceLib);
|
||||
|
||||
if (0 != loadDiagIfaceLib) {
|
||||
const char* libname = "liblocdiagiface.so";
|
||||
void* libHandle = nullptr;
|
||||
mLogLocation = (LogGnssLocation)dlGetSymFromLib(
|
||||
libHandle, libname, "LogGnssLocation");
|
||||
if (nullptr == mLogLocation) {
|
||||
LOC_LOGw("DiagIface mLogLocation is null");
|
||||
}
|
||||
mLogSv = (LogGnssSv)dlGetSymFromLib(
|
||||
libHandle, libname, "LogGnssSv");
|
||||
if (nullptr == mLogSv) {
|
||||
LOC_LOGw("DiagIface mLogSv is null");
|
||||
}
|
||||
mLogNmea = (LogGnssNmea)dlGetSymFromLib(
|
||||
libHandle, libname, "LogGnssNmea");
|
||||
if (nullptr == mLogNmea) {
|
||||
LOC_LOGw("DiagIface mLogNmea is null");
|
||||
}
|
||||
mLogMeas = (LogGnssMeas)dlGetSymFromLib(
|
||||
libHandle, libname, "LogGnssMeas");
|
||||
if (nullptr == mLogMeas) {
|
||||
LOC_LOGw("DiagIface mLogMeas is null");
|
||||
}
|
||||
mLogDcReport = (LogGnssDcReport)dlGetSymFromLib(
|
||||
libHandle, libname, "LogGnssDcReport");
|
||||
if (nullptr == mLogDcReport) {
|
||||
LOC_LOGw("DiagIface mLogDcReport is null");
|
||||
}
|
||||
mLogGeofenceBreach = (LogGeofenceBreach)dlGetSymFromLib(
|
||||
libHandle, libname, "LogGeofenceBreach");
|
||||
if (nullptr == mLogGeofenceBreach) {
|
||||
LOC_LOGw("DiagIface mLogGeofenceBreach is null");
|
||||
}
|
||||
mLogEph = (LogGnssEphemeris)dlGetSymFromLib(
|
||||
libHandle, libname, "LogGnssEphemeris");
|
||||
if (nullptr == mLogEph) {
|
||||
LOC_LOGw("DiagIface mLogEph is null");
|
||||
}
|
||||
mLogGnssData = (LogGnssData)dlGetSymFromLib(
|
||||
libHandle, libname, "LogGnssData");
|
||||
if (nullptr == mLogGnssData) {
|
||||
LOC_LOGw("DiagIface mLogGnssData is null");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LCAReportLoggerUtil::log(const GnssLocation& gnssLocation,
|
||||
const DiagLocationInfoExt& diagInfoExt) {
|
||||
if (mLogLocation != nullptr) {
|
||||
mLogLocation(gnssLocation, diagInfoExt);
|
||||
}
|
||||
}
|
||||
|
||||
void LCAReportLoggerUtil::log(const std::vector<GnssSv>& gnssSvsVector) {
|
||||
if (mLogSv != nullptr) {
|
||||
mLogSv(gnssSvsVector);
|
||||
}
|
||||
}
|
||||
|
||||
void LCAReportLoggerUtil::log(
|
||||
uint64_t timestamp, uint32_t length, const char* nmea, LocOutputEngineType engType) {
|
||||
if (mLogNmea != nullptr) {
|
||||
mLogNmea(timestamp, length, nmea, engType);
|
||||
}
|
||||
}
|
||||
|
||||
void LCAReportLoggerUtil::log(const GnssMeasurements& gnssMeasurements) {
|
||||
if (mLogMeas != nullptr) {
|
||||
mLogMeas(gnssMeasurements);
|
||||
}
|
||||
}
|
||||
|
||||
void LCAReportLoggerUtil::log(const GnssDcReport& gnssDcReport) {
|
||||
if (mLogDcReport != nullptr) {
|
||||
mLogDcReport(gnssDcReport);
|
||||
}
|
||||
}
|
||||
void LCAReportLoggerUtil::log(const GeofenceBreachNotification& breachNotif,
|
||||
const std::vector<Geofence> &geofences) {
|
||||
if (mLogGeofenceBreach != nullptr) {
|
||||
mLogGeofenceBreach(breachNotif, geofences);
|
||||
}
|
||||
}
|
||||
|
||||
void LCAReportLoggerUtil::log(const GnssEphemeris& ephInfo) {
|
||||
if (mLogEph != nullptr) {
|
||||
mLogEph(ephInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void LCAReportLoggerUtil::log(const GnssData& gnssData) {
|
||||
if (mLogGnssData != nullptr) {
|
||||
mLogGnssData(gnssData);
|
||||
}
|
||||
}
|
||||
} // namespace loc_client
|
||||
117
qcom/opensource/location/client_api/src/LCAReportLoggerUtil.h
Normal file
117
qcom/opensource/location/client_api/src/LCAReportLoggerUtil.h
Normal file
@@ -0,0 +1,117 @@
|
||||
/* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
Changes from Qualcomm Innovation Center are provided under the following license:
|
||||
|
||||
Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted (subject to the limitations in the
|
||||
disclaimer below) provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
* Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
|
||||
GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
|
||||
HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LOCATION_CLIENT_API_DIAG_BASE
|
||||
#define LOCATION_CLIENT_API_DIAG_BASE
|
||||
|
||||
#include "LocLoggerBase.h"
|
||||
#include <LocationDataTypes.h>
|
||||
#include "LocationClientApi.h"
|
||||
#include <loc_misc_utils.h>
|
||||
|
||||
using namespace loc_util;
|
||||
|
||||
namespace location_client {
|
||||
|
||||
class LCAReportLoggerUtil {
|
||||
public:
|
||||
typedef void (*LogGnssLocation)(const GnssLocation& gnssLocation,
|
||||
const DiagLocationInfoExt& diagLocationInfoExt);
|
||||
typedef void (*LogGnssSv)(const std::vector<GnssSv>& gnssSvsVector);
|
||||
typedef void (*LogGnssNmea)(uint64_t timestamp, uint32_t length, const char* nmea,
|
||||
LocOutputEngineType engType);
|
||||
typedef void (*LogGnssMeas)(const GnssMeasurements& gnssMeasurements);
|
||||
typedef void (*LogGnssDcReport)(const GnssDcReport& gnssDcReport);
|
||||
typedef void (*LogGeofenceBreach)(const GeofenceBreachNotification& breachNotif,
|
||||
const std::vector<Geofence>& geofences);
|
||||
typedef void (*LogGnssEphemeris)(const GnssEphemeris& ephInfo);
|
||||
typedef void (*LogGnssData)(const GnssData& gnssData);
|
||||
|
||||
LCAReportLoggerUtil();
|
||||
void log(const GnssLocation& gnssLocation,
|
||||
const DiagLocationInfoExt & diagLocationInfoExt);
|
||||
void log(const std::vector<GnssSv>& gnssSvsVector);
|
||||
void log(uint64_t timestamp, uint32_t length, const char* nmea, LocOutputEngineType engType);
|
||||
void log(const GnssMeasurements& gnssMeasurements);
|
||||
void log(const GnssDcReport& gnssDcReport);
|
||||
void log(const GeofenceBreachNotification& breachNotif,
|
||||
const std::vector<Geofence>& geofences);
|
||||
void log(const GnssEphemeris& ephInfo);
|
||||
void log(const GnssData& gnssData);
|
||||
|
||||
private:
|
||||
LogGnssLocation mLogLocation;
|
||||
LogGnssSv mLogSv;
|
||||
LogGnssNmea mLogNmea;
|
||||
LogGnssMeas mLogMeas;
|
||||
LogGnssDcReport mLogDcReport;
|
||||
LogGeofenceBreach mLogGeofenceBreach;
|
||||
LogGnssEphemeris mLogEph;
|
||||
LogGnssData mLogGnssData;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
1950
qcom/opensource/location/client_api/src/LocationClientApi.cpp
Normal file
1950
qcom/opensource/location/client_api/src/LocationClientApi.cpp
Normal file
File diff suppressed because it is too large
Load Diff
3900
qcom/opensource/location/client_api/src/LocationClientApiImpl.cpp
Normal file
3900
qcom/opensource/location/client_api/src/LocationClientApiImpl.cpp
Normal file
File diff suppressed because it is too large
Load Diff
367
qcom/opensource/location/client_api/src/LocationClientApiImpl.h
Normal file
367
qcom/opensource/location/client_api/src/LocationClientApiImpl.h
Normal file
@@ -0,0 +1,367 @@
|
||||
/* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
Changes from Qualcomm Innovation Center are provided under the following license:
|
||||
|
||||
Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted (subject to the limitations in the
|
||||
disclaimer below) provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
* Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
|
||||
GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
|
||||
HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LOCATIONCLIENTAPIIMPL_H
|
||||
#define LOCATIONCLIENTAPIIMPL_H
|
||||
|
||||
#include <mutex>
|
||||
|
||||
#include <loc_pla.h>
|
||||
#include <LocIpc.h>
|
||||
#include <LocationDataTypes.h>
|
||||
#include <ILocationAPI.h>
|
||||
#include <MsgTask.h>
|
||||
#include <LocationApiMsg.h>
|
||||
#include <LocationApiPbMsgConv.h>
|
||||
#include <LCAReportLoggerUtil.h>
|
||||
#include <unordered_set>
|
||||
#include <unordered_map>
|
||||
#include <condition_variable>
|
||||
#include <chrono>
|
||||
|
||||
using namespace loc_util;
|
||||
|
||||
namespace location_client
|
||||
{
|
||||
enum LocationCallbackType {
|
||||
// Tracking callbacks type
|
||||
TRACKING_CBS = 0,
|
||||
// Batching callbacks type
|
||||
BATCHING_CBS = 1,
|
||||
// Geofence callbacks type
|
||||
GEOFENCE_CBS = 2
|
||||
};
|
||||
|
||||
typedef std::function<void(
|
||||
uint32_t response
|
||||
)> PingTestCb;
|
||||
|
||||
|
||||
class GeofenceImpl: public std::enable_shared_from_this<GeofenceImpl> {
|
||||
uint32_t mId;
|
||||
Geofence mGeofence;
|
||||
static uint32_t nextId();
|
||||
static mutex mGfMutex;
|
||||
public:
|
||||
GeofenceImpl(Geofence* geofence) : mId(nextId()), mGeofence(*geofence) {
|
||||
}
|
||||
void bindGeofence(Geofence* geofence) {
|
||||
geofence->mGeofenceImpl = shared_from_this();
|
||||
}
|
||||
inline uint32_t getClientId() { return mId; }
|
||||
};
|
||||
|
||||
// utility for wait / notify
|
||||
class Waitable {
|
||||
std::mutex mMutex;
|
||||
std::condition_variable mCond;
|
||||
public:
|
||||
Waitable() = default;
|
||||
~Waitable() = default;
|
||||
|
||||
void wait(uint32_t ms) {
|
||||
std::unique_lock<std::mutex> lock(mMutex);
|
||||
mCond.wait_for(lock, std::chrono::milliseconds(ms));
|
||||
}
|
||||
|
||||
void notify() {
|
||||
mCond.notify_one();
|
||||
}
|
||||
};
|
||||
|
||||
class IpcListener;
|
||||
|
||||
class LocationClientApiImpl : public ILocationAPI, public Waitable {
|
||||
friend IpcListener;
|
||||
public:
|
||||
LocationClientApiImpl(capabilitiesCallback capabitiescb);
|
||||
virtual void destroy(locationApiDestroyCompleteCallback destroyCompleteCb=nullptr) override;
|
||||
|
||||
// Tracking
|
||||
virtual void updateCallbacks(LocationCallbacks&) override;
|
||||
|
||||
virtual uint32_t startTracking(const TrackingOptions&) override;
|
||||
|
||||
virtual void stopTracking(uint32_t id) override;
|
||||
|
||||
virtual void updateTrackingOptions(uint32_t id, const TrackingOptions&) override;
|
||||
|
||||
//Batching
|
||||
virtual uint32_t startBatching(const BatchingOptions&) override;
|
||||
|
||||
virtual void stopBatching(uint32_t id) override;
|
||||
|
||||
virtual void updateBatchingOptions(uint32_t id, const BatchingOptions&) override;
|
||||
|
||||
virtual void getBatchedLocations(uint32_t id, size_t count) override;
|
||||
|
||||
//Geofence
|
||||
virtual uint32_t* addGeofences(size_t count, GeofenceOption*,
|
||||
GeofenceInfo*) override;
|
||||
|
||||
virtual void removeGeofences(size_t count, uint32_t* ids) override;
|
||||
|
||||
virtual void modifyGeofences(size_t count, uint32_t* ids,
|
||||
GeofenceOption* options) override;
|
||||
|
||||
virtual void pauseGeofences(size_t count, uint32_t* ids) override;
|
||||
|
||||
virtual void resumeGeofences(size_t count, uint32_t* ids) override;
|
||||
|
||||
//GNSS
|
||||
virtual void gnssNiResponse(uint32_t id, GnssNiResponse response) override;
|
||||
|
||||
virtual void getDebugReport(GnssDebugReport& reports) override;
|
||||
|
||||
virtual uint32_t getAntennaInfo(AntennaInfoCallback* cb) override;
|
||||
|
||||
// other interface
|
||||
void startPositionSession(const LocationCallbacks& callbacksOption,
|
||||
const TrackingOptions& trackingOptions);
|
||||
|
||||
void startBatchingSession(const LocationCallbacks& callbacksOption,
|
||||
const BatchingOptions& batchOptions);
|
||||
|
||||
void updateNetworkAvailability(bool available);
|
||||
void getGnssEnergyConsumed(gnssEnergyConsumedCallback gnssEnergyConsumedCb,
|
||||
responseCallback responseCb);
|
||||
void updateLocationSystemInfoListener(
|
||||
locationSystemInfoCallback locationSystemInfoCb,
|
||||
responseCallback responseCb);
|
||||
|
||||
uint32_t startTrackingSync(const TrackingOptions&);
|
||||
uint32_t startBatchingSync(const BatchingOptions&);
|
||||
void updateCallbacksSync(LocationCallbacks& callbacks);
|
||||
|
||||
void addGeofences(const LocationCallbacks& callbacksOption,
|
||||
const std::vector<Geofence>& geofences);
|
||||
inline Geofence getMappedGeofence(uint32_t id) {
|
||||
return mGeofenceMap.at(id);
|
||||
}
|
||||
|
||||
inline uint16_t getYearOfHw() {return mYearOfHw;}
|
||||
|
||||
void getSingleTerrestrialPos(uint32_t timeoutMsec, TerrestrialTechMask techMask,
|
||||
float horQoS, trackingCallback terrestrialPositionCallback,
|
||||
responseCallback responseCallback);
|
||||
void getSinglePos(uint32_t timeoutMsec, float horQoS,
|
||||
trackingCallback positionCb,
|
||||
responseCallback responseCb);
|
||||
|
||||
void pingTest(PingTestCb pingTestCallback);
|
||||
|
||||
static LocationSystemInfo parseLocationSystemInfo(
|
||||
const::LocationSystemInfo &halSystemInfo);
|
||||
static LocationResponse parseLocationError(::LocationError error);
|
||||
static GnssMeasurements parseGnssMeasurements(const ::GnssMeasurementsNotification
|
||||
&halGnssMeasurements);
|
||||
static GnssData parseGnssData(const ::GnssDataNotification &halGnssData);
|
||||
static GnssSv parseGnssSv(const ::GnssSv &halGnssSv);
|
||||
static GnssLocation parseLocationInfo(const ::GnssLocationInfoNotification &halLocationInfo);
|
||||
static GnssSystemTime parseSystemTime(const ::GnssSystemTime &halSystemTime);
|
||||
static GnssGloTimeStructType parseGloTime(const ::GnssGloTimeStructType &halGloTime);
|
||||
static GnssSystemTimeStructType parseGnssTime(const ::GnssSystemTimeStructType &halGnssTime);
|
||||
static LocationReliability parseLocationReliability(
|
||||
const ::LocationReliability &halReliability);
|
||||
static GnssLocationPositionDynamics parseLocationPositionDynamics(
|
||||
const ::GnssLocationPositionDynamics &halPositionDynamics,
|
||||
const ::GnssLocationPositionDynamicsExt &halPositionDynamicsExt);
|
||||
static void parseGnssMeasUsageInfo(const ::GnssLocationInfoNotification &halLocationInfo,
|
||||
std::vector<GnssMeasUsageInfo>& clientMeasUsageInfo);
|
||||
static GnssSignalTypeMask parseGnssSignalType(
|
||||
const ::GnssSignalTypeMask &halGnssSignalTypeMask);
|
||||
static GnssLocationSvUsedInPosition parseLocationSvUsedInPosition(
|
||||
const ::GnssLocationSvUsedInPosition &halSv);
|
||||
static void parseLocation(const ::Location &halLocation, Location& location);
|
||||
static Location parseLocation(const ::Location &halLocation);
|
||||
static uint16_t parseYearOfHw(::LocationCapabilitiesMask mask);
|
||||
static LocationCapabilitiesMask parseCapabilitiesMask(::LocationCapabilitiesMask mask);
|
||||
static GnssMeasurementsDataFlagsMask parseMeasurementsDataMask(
|
||||
::GnssMeasurementsDataFlagsMask in);
|
||||
static GnssEnergyConsumedInfo parseGnssConsumedInfo(::GnssEnergyConsumedInfo);
|
||||
static GnssDcReport parseDcReport(const::GnssDcReportInfo &halDcReport);
|
||||
static GeofenceBreachTypeMask parseGeofenceBreachType(GeofenceBreachType breachType);
|
||||
static GeofenceBreachType parseGeofenceBreachTypeMask(::GeofenceBreachTypeMask breachTypeMask);
|
||||
|
||||
static void parseEphSrcAndAction(const ::GnssEphAction& halEphAction,
|
||||
GnssEphSource& ephSrc, GnssEphAction& ephAction);
|
||||
static GnssEphemeris parseGnssEphemerisInfo(const ::GnssSvEphemerisReport &ephInfo);
|
||||
static void parseCommanGnssEphemeris(const ::GnssEphCommon& halCommanEph,
|
||||
GnssEphCommonInfo& lcaCommanEph);
|
||||
static void parseGloEphemeris( const GlonassEphemerisResponse& halEph,
|
||||
std::vector<GlonassEphemeris>& lcaEphInfo);
|
||||
static void parseGalEphemeris( const GalileoEphemerisResponse& halEph,
|
||||
std::vector<GalileoEphemeris>& lcaEphInfo);
|
||||
static void parseGpsEphemeris(const GpsEphemerisResponse& halEph,
|
||||
std::vector<GpsQzssEphemeris>& lcaEphInfo);
|
||||
static void parseBdsEphemeris(const BdsEphemerisResponse& halEph,
|
||||
std::vector<BdsEphemeris>& lcaEphInfo);
|
||||
static void parseQzssEphemeris(const QzssEphemerisResponse& halEph,
|
||||
std::vector<QzssEphemeris>& lcaEphInfo);
|
||||
static void parseNavicEphemeris(const NavicEphemerisResponse& halEph,
|
||||
std::vector<NavicEphemeris>& lcaEphInfo);
|
||||
|
||||
void logLocation(const Location &location,
|
||||
LocReportTriggerType reportTriggerType);
|
||||
void logLocation(const GnssLocation &gnssLocation,
|
||||
LocReportTriggerType reportTriggerType);
|
||||
void logGeofenceBreach(const GeofenceBreachNotification& breachNotif,
|
||||
const std::vector<Geofence> &geofences);
|
||||
|
||||
LCAReportLoggerUtil & getLogger() {
|
||||
return mLogger;
|
||||
}
|
||||
|
||||
void stopTrackingAndClearSubscriptions(uint32_t id);
|
||||
void clearSubscriptions(LocationCallbackType cbTypeToClear);
|
||||
void stopTrackingSync(bool clearSubscriptions);
|
||||
bool isInTracking() { return mSessionId != LOCATION_CLIENT_SESSION_ID_INVALID; }
|
||||
bool isInBatching() { return mBatchingId != LOCATION_CLIENT_SESSION_ID_INVALID; }
|
||||
|
||||
private:
|
||||
~LocationClientApiImpl();
|
||||
|
||||
inline LocationCapabilitiesMask getCapabilities() {return mCapsMask;}
|
||||
void capabilitesCallback(ELocMsgID msgId, const void* msgData);
|
||||
void updateTrackingOptionsSync(const TrackingOptions& option, bool clearSubscriptions);
|
||||
bool checkGeofenceMap(size_t count, uint32_t* ids);
|
||||
void addGeofenceMap(Geofence& geofence);
|
||||
void eraseGeofenceMap(size_t count, uint32_t* ids);
|
||||
bool isGeofenceMapEmpty();
|
||||
|
||||
// convenient methods
|
||||
inline bool sendMessage(const uint8_t* data, uint32_t length) const {
|
||||
return (mIpcSender != nullptr) && LocIpc::send(*mIpcSender, data, length);
|
||||
}
|
||||
|
||||
void invokePositionSessionResponseCb(LocationError errCode);
|
||||
void diagLogGnssLocation(const GnssLocation &gnssLocation);
|
||||
void processGetDebugRespCb(const LocAPIGetDebugRespMsg* pRespMsg);
|
||||
void processAntennaInfo(const LocAPIAntennaInfoMsg* pAntennaInfoMsg);
|
||||
|
||||
// protobuf conversion util class
|
||||
LocationApiPbMsgConv mPbufMsgConv;
|
||||
|
||||
// internal session parameter
|
||||
static uint32_t mClientIdGenerator;
|
||||
static uint32_t mClientIdIndex;
|
||||
static mutex mMutex;
|
||||
uint32_t mClientId;
|
||||
uint32_t mSessionId;
|
||||
uint32_t mBatchingId;
|
||||
bool mHalRegistered;
|
||||
// For client on different processor, socket name will start with
|
||||
// defined constant of SOCKET_TO_EXTERANL_AP_LOCATION_CLIENT_BASE.
|
||||
// For client on same processor, socket name will start with
|
||||
// SOCKET_LOC_CLIENT_DIR + LOC_CLIENT_NAME_PREFIX.
|
||||
char mSocketName[MAX_SOCKET_PATHNAME_LENGTH];
|
||||
// for client on a different processor, 0 is invalid
|
||||
uint32_t mInstanceId;
|
||||
LocationCallbacksMask mCallbacksMask;
|
||||
LocationOptions mLocationOptions;
|
||||
BatchingOptions mBatchingOptions;
|
||||
LocationCapabilitiesMask mCapsMask;
|
||||
//Year of HW information, 0 is invalid
|
||||
uint16_t mYearOfHw;
|
||||
bool mPositionSessionResponseCbPending;
|
||||
uint64_t mSessionStartBootTimestampNs;
|
||||
GnssDebugReport* mpDebugReport;
|
||||
AntennaInfoCallback* mpAntennaInfoCb;
|
||||
|
||||
// callbacks
|
||||
LocationCallbacks mLocationCbs;
|
||||
|
||||
//TODO:: remove after replacing all calls with ILocationAPI callbacks
|
||||
capabilitiesCallback mCapabilitiesCb;
|
||||
PingTestCb mPingTestCb;
|
||||
|
||||
gnssEnergyConsumedCallback mGnssEnergyConsumedInfoCb;
|
||||
responseCallback mGnssEnergyConsumedResponseCb;
|
||||
|
||||
locationSystemInfoCallback mLocationSysInfoCb;
|
||||
responseCallback mLocationSysInfoResponseCb;
|
||||
|
||||
// Terrestrial fix callback
|
||||
trackingCallback mSingleTerrestrialPosCb;
|
||||
responseCallback mSingleTerrestrialPosRespCb;
|
||||
|
||||
// Single fix callback
|
||||
trackingCallback mSinglePosCb;
|
||||
responseCallback mSinglePosRespCb;
|
||||
|
||||
MsgTask mMsgTask;
|
||||
|
||||
LocIpc mIpc;
|
||||
shared_ptr<LocIpcSender> mIpcSender;
|
||||
|
||||
std::vector<uint32_t> mLastAddedClientIds;
|
||||
// clientId --> Geofence object
|
||||
std::unordered_map<uint32_t, Geofence> mGeofenceMap;
|
||||
|
||||
LCAReportLoggerUtil mLogger;
|
||||
};
|
||||
|
||||
} // namespace location_client
|
||||
|
||||
#endif /* LOCATIONCLIENTAPIIMPL_H */
|
||||
Reference in New Issue
Block a user