sm6225-common: location: Remove unused components

loc_api_v02 and synergy_loc_api don't compile without proprietary
headers. The rest are unused so remove all of them.

Change-Id: I385c0bf79b550423464d0f09968f6b7bf7e04ac9
This commit is contained in:
Michael Bestas 2023-05-04 01:51:37 +03:00
parent 10f4d72f92
commit 65e60909dc
No known key found for this signature in database
GPG key ID: CC95044519BE6669
87 changed files with 0 additions and 91170 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,59 +0,0 @@
AM_CFLAGS = \
-DDEBUG \
-I src/ \
-I inc/ \
$(GPSUTILS_CFLAGS) \
$(LOCAPIMSGPROTO_CFLAGS) \
-std=c++11
ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS = -std=c++11
requiredlibs = \
$(GPSUTILS_LIBS) \
$(LOCAPIMSGPROTO_LIBS) \
-lprotobuf
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)

View file

@ -1,11 +0,0 @@
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.

View file

@ -1,72 +0,0 @@
# 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], [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_CONFIG_FILES([ \
Makefile \
location-client-api.pc
])
AC_OUTPUT

File diff suppressed because it is too large Load diff

View file

@ -1,10 +0,0 @@
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

View file

@ -1,86 +0,0 @@
#!/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"

View file

@ -1,74 +0,0 @@
/* Copyright (c) 2020, 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.
*/
#include "LCAReportLoggerUtil.h"
namespace location_client {
LCAReportLoggerUtil::LCAReportLoggerUtil():
mLogLocation(nullptr),
mLogSv(nullptr),
mLogNmea(nullptr),
mLogMeas(nullptr) {
const char* libname = "liblocdiagiface.so";
void* libHandle = nullptr;
mLogLocation = (LogGnssLocation)dlGetSymFromLib(
libHandle, libname, "LogGnssLocation");
mLogSv = (LogGnssSv)dlGetSymFromLib(
libHandle, libname, "LogGnssSv");
mLogNmea = (LogGnssNmea)dlGetSymFromLib(
libHandle, libname, "LogGnssNmea");
mLogMeas = (LogGnssMeas)dlGetSymFromLib(
libHandle, libname, "LogGnssMeas");
}
void LCAReportLoggerUtil::log(const GnssLocation& gnssLocation,
const LocationCapabilitiesMask& capMask) {
if (mLogLocation != nullptr) {
mLogLocation(gnssLocation, capMask);
}
}
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) {
if (mLogNmea != nullptr) {
mLogNmea(timestamp, length, nmea);
}
}
void LCAReportLoggerUtil::log(const GnssMeasurements& gnssMeasurements) {
if (mLogMeas != nullptr) {
mLogMeas(gnssMeasurements);
}
}
}

View file

@ -1,62 +0,0 @@
/* Copyright (c) 2020, 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.
*/
#ifndef LOCATION_CLIENT_API_DIAG_BASE
#define LOCATION_CLIENT_API_DIAG_BASE
#include "LocLoggerBase.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 LocationCapabilitiesMask& capMask);
typedef void (*LogGnssSv)(const std::vector<GnssSv>& gnssSvsVector);
typedef void (*LogGnssNmea)(uint64_t timestamp, uint32_t length, const char* nmea);
typedef void (*LogGnssMeas)(const GnssMeasurements& gnssMeasurements);
LCAReportLoggerUtil();
void log(const GnssLocation& gnssLocation, const LocationCapabilitiesMask& capMask);
void log(const std::vector<GnssSv>& gnssSvsVector);
void log(uint64_t timestamp, uint32_t length, const char* nmea);
void log(const GnssMeasurements& gnssMeasurements);
private:
LogGnssLocation mLogLocation;
LogGnssSv mLogSv;
LogGnssNmea mLogNmea;
LogGnssMeas mLogMeas;
};
}
#endif

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,239 +0,0 @@
/* Copyright (c) 2018-2020, 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.
*/
#ifndef LOCATIONCLIENTAPIIMPL_H
#define LOCATIONCLIENTAPIIMPL_H
#include <mutex>
#include <loc_pla.h>
#include <LocIpc.h>
#include <LocationDataTypes.h>
#include <ILocationAPI.h>
#include <LocationClientApi.h>
#include <MsgTask.h>
#include <LocationApiMsg.h>
#include <LocationApiPbMsgConv.h>
#include <LCAReportLoggerUtil.h>
#ifdef NO_UNORDERED_SET_OR_MAP
#include <set>
#include <map>
#else
#include <unordered_set>
#include <unordered_map>
#endif
using namespace std;
using namespace loc_util;
namespace location_client
{
enum ReportCbEnumType {
REPORT_CB_TYPE_NONE = 0,
/** cb for GNSS info, including location, sv info, nmea and
* etc */
REPORT_CB_GNSS_INFO = 1,
/** cb for GNSS info, including location, sv info, nmea and
* etc and also for location of other engines running in the
* system */
REPORT_CB_ENGINE_INFO = 2,
};
struct ClientCallbacks {
CapabilitiesCb capabilitycb;
ResponseCb responsecb;
CollectiveResponseCb collectivecb;
LocationCb locationcb;
BatchingCb batchingcb;
GeofenceBreachCb gfbreachcb;
GnssReportCbs gnssreportcbs;
EngineReportCbs engreportcbs;
};
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; }
};
class IpcListener;
class LocationClientApiImpl : public ILocationAPI {
friend IpcListener;
public:
LocationClientApiImpl(CapabilitiesCb capabitiescb);
void destroy();
// Tracking
virtual void updateCallbacks(LocationCallbacks&) override;
virtual uint32_t startTracking(TrackingOptions&) override;
virtual void stopTracking(uint32_t id) override;
virtual void updateTrackingOptions(uint32_t id, TrackingOptions&) override;
//Batching
virtual uint32_t startBatching(BatchingOptions&) override;
virtual void stopBatching(uint32_t id) override;
virtual void updateBatchingOptions(uint32_t id, 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;
// other interface
void updateNetworkAvailability(bool available);
void updateCallbackFunctions(const ClientCallbacks&,
ReportCbEnumType reportCbType = REPORT_CB_TYPE_NONE);
void getGnssEnergyConsumed(GnssEnergyConsumedCb gnssEnergyConsumedCallback,
ResponseCb responseCallback);
void updateLocationSystemInfoListener(LocationSystemInfoCb locSystemInfoCallback,
ResponseCb responseCallback);
void diagLogGnssLocation(const GnssLocation &gnssLocation);
inline LocationCapabilitiesMask getCapabilities() {return mCapsMask;}
bool checkGeofenceMap(size_t count, uint32_t* ids);
void addGeofenceMap(uint32_t id, Geofence& geofence);
void eraseGeofenceMap(size_t count, uint32_t* ids);
std::vector<uint32_t> mLastAddedClientIds;
std::unordered_map<uint32_t, Geofence> mGeofenceMap; //clientId --> Geofence object
// convenient methods
inline bool sendMessage(const uint8_t* data, uint32_t length) const {
return (mIpcSender != nullptr) && LocIpc::send(*mIpcSender, data, length);
}
void pingTest(PingTestCb pingTestCallback);
inline uint16_t getYearOfHw() {return mYearOfHw;}
void invokePositionSessionResponseCb(LocationResponse responseCode);
void getSingleTerrestrialPos(uint32_t timeoutMsec, TerrestrialTechMask techMask,
float horQoS, LocationCb terrestrialPositionCallback,
ResponseCb responseCallback);
private:
~LocationClientApiImpl();
void capabilitesCallback(ELocMsgID msgId, const void* msgData);
void updateTrackingOptionsSync(LocationClientApiImpl* pImpl, TrackingOptions& option);
// protobuf conversion util class
LocationApiPbMsgConv mPbufMsgConv;
// internal session parameter
static uint32_t mClientIdGenerator;
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;
// callbacks
CapabilitiesCb mCapabilitiesCb;
ResponseCb mResponseCb;
CollectiveResponseCb mCollectiveResCb;
LocationCb mLocationCb;
BatchingCb mBatchingCb;
GeofenceBreachCb mGfBreachCb;
PingTestCb mPingTestCb;
// location callbacks
GnssLocationCb mGnssLocationCb;
EngineLocationsCb mEngLocationsCb;
// other GNSS related callback
GnssSvCb mGnssSvCb;
GnssNmeaCb mGnssNmeaCb;
GnssDataCb mGnssDataCb;
GnssMeasurementsCb mGnssMeasurementsCb;
GnssEnergyConsumedCb mGnssEnergyConsumedInfoCb;
ResponseCb mGnssEnergyConsumedResponseCb;
LocationSystemInfoCb mLocationSysInfoCb;
ResponseCb mLocationSysInfoResponseCb;
// Terrestrial fix callback
LocationCb mSingleTerrestrialPosCb;
ResponseCb mSingleTerrestrialPosRespCb;
MsgTask mMsgTask;
LocIpc mIpc;
shared_ptr<LocIpcSender> mIpcSender;
LCAReportLoggerUtil mLogger;
};
} // namespace location_client
#endif /* LOCATIONCLIENTAPIIMPL_H */

View file

@ -1,847 +0,0 @@
/* Copyright (c) 2019-2020 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.
*/
#ifndef LOCATION_CLIENT_API_LOG_H
#define LOCATION_CLIENT_API_LOG_H
#include <stdint.h>
#include <time.h>
#include <comdef.h>
#include <log.h>
#include <log_codes.h>
#include "LocationClientApi.h"
#define CLIENT_DIAG_GNSS_SV_MAX (176)
#define CLIENT_DIAG_GNSS_MEASUREMENTS_MAX (128)
#define LOG_CLIENT_LOCATION_DIAG_MSG_VERSION (3)
#define LOG_CLIENT_SV_REPORT_DIAG_MSG_VERSION (2)
#define LOG_CLIENT_NMEA_REPORT_DIAG_MSG_VERSION (1)
#define LOG_CLIENT_MEASUREMENTS_DIAG_MSG_VERSION (1)
#ifndef LOG_GNSS_CLIENT_API_NMEA_REPORT_C
#define LOG_GNSS_CLIENT_API_NMEA_REPORT_C (0x1CB2)
#endif
#ifndef LOG_GNSS_CLIENT_API_MEASUREMENTS_REPORT_C
#define LOG_GNSS_CLIENT_API_MEASUREMENTS_REPORT_C (0x1CB7)
#endif
namespace location_client
{
/** Flags to indicate which values are valid in a Location */
typedef uint16_t clientDiagLocationFlagsMask;
typedef enum {
/** location has valid latitude and longitude */
CLIENT_DIAG_LOCATION_HAS_LAT_LONG_BIT = (1<<0),
/** location has valid altitude */
CLIENT_DIAG_LOCATION_HAS_ALTITUDE_BIT = (1<<1),
/** location has valid speed */
CLIENT_DIAG_LOCATION_HAS_SPEED_BIT = (1<<2),
/** location has valid bearing */
CLIENT_DIAG_LOCATION_HAS_BEARING_BIT = (1<<3),
/** location has valid accuracy */
CLIENT_DIAG_LOCATION_HAS_ACCURACY_BIT = (1<<4),
/** location has valid vertical accuracy */
CLIENT_DIAG_LOCATION_HAS_VERTICAL_ACCURACY_BIT = (1<<5),
/** location has valid speed accuracy */
CLIENT_DIAG_LOCATION_HAS_SPEED_ACCURACY_BIT = (1<<6),
/** location has valid bearing accuracy */
CLIENT_DIAG_LOCATION_HAS_BEARING_ACCURACY_BIT = (1<<7),
/** location has valid valid timestamp */
CLIENT_DIAG_LOCATION_HAS_TIMESTAMP_BIT = (1<<8)
} clientDiagLocationFlagsBits;
typedef uint32_t clientDiagGnssLocationPosDataMask;
typedef enum {
/** Navigation data has Forward Acceleration */
CLIENT_DIAG_LOCATION_NAV_DATA_HAS_LONG_ACCEL_BIT = (1<<0),
/** Navigation data has Sideward Acceleration */
CLIENT_DIAG_LOCATION_NAV_DATA_HAS_LAT_ACCEL_BIT = (1<<1),
/** Navigation data has Vertical Acceleration */
CLIENT_DIAG_LOCATION_NAV_DATA_HAS_VERT_ACCEL_BIT = (1<<2),
/** Navigation data has Heading Rate */
CLIENT_DIAG_LOCATION_NAV_DATA_HAS_YAW_RATE_BIT = (1<<3),
/** Navigation data has Body pitch */
CLIENT_DIAG_LOCATION_NAV_DATA_HAS_PITCH_BIT = (1<<4),
/** Navigation data has Forward Acceleration uncertainty */
CLIENT_DIAG_LOCATION_NAV_DATA_HAS_LONG_ACCEL_UNC_BIT = (1<<5),
/** Navigation data has Sideward Acceleration uncertainty */
CLIENT_DIAG_LOCATION_NAV_DATA_HAS_LAT_ACCEL_UNC_BIT = (1<<6),
/** Navigation data has Vertical Acceleration uncertainty */
CLIENT_DIAG_LOCATION_NAV_DATA_HAS_VERT_ACCEL_UNC_BIT = (1<<7),
/** Navigation data has Heading Rate uncertainty */
CLIENT_DIAG_LOCATION_NAV_DATA_HAS_YAW_RATE_UNC_BIT = (1<<8),
/** Navigation data has Body pitch uncertainty */
CLIENT_DIAG_LOCATION_NAV_DATA_HAS_PITCH_UNC_BIT = (1<<9),
/** Navigation data has pitch rate */
CLIENT_DIAG_LOCATION_NAV_DATA_HAS_PITCH_RATE_BIT = (1<<10),
/** Navigation data has body pitch rate uncertainty */
CLIENT_DIAG_LOCATION_NAV_DATA_HAS_PITCH_RATE_UNC_BIT = (1<<11),
/** Navigation data has body roll */
CLIENT_DIAG_LOCATION_NAV_DATA_HAS_ROLL_BIT = (1<<12),
/** Navigation data has body roll uncertainty */
CLIENT_DIAG_LOCATION_NAV_DATA_HAS_ROLL_UNC_BIT = (1<<13),
/** Navigation data has body rate roll */
CLIENT_DIAG_LOCATION_NAV_DATA_HAS_ROLL_RATE_BIT = (1<<14),
/** Navigation data has body roll rate uncertainty */
CLIENT_DIAG_LOCATION_NAV_DATA_HAS_ROLL_RATE_UNC_BIT = (1<<15),
/** Navigation data has body yaw */
CLIENT_DIAG_LOCATION_NAV_DATA_HAS_YAW_BIT = (1<<16),
/** Navigation data has body roll uncertainty */
CLIENT_DIAG_LOCATION_NAV_DATA_HAS_YAW_UNC_BIT = (1<<17)
} clientDiagGnssLocationPosDataBits;
typedef enum
{
/** GPS satellite. */
CLIENT_DIAG_GNSS_LOC_SV_SYSTEM_GPS = 1,
/** GALILEO satellite. */
CLIENT_DIAG_GNSS_LOC_SV_SYSTEM_GALILEO = 2,
/** SBAS satellite. */
CLIENT_DIAG_GNSS_LOC_SV_SYSTEM_SBAS = 3,
//Leave 4 blank for backward compatibility.
/** GLONASS satellite. */
CLIENT_DIAG_GNSS_LOC_SV_SYSTEM_GLONASS = 5,
/** BDS satellite. */
CLIENT_DIAG_GNSS_LOC_SV_SYSTEM_BDS = 6,
/** QZSS satellite. */
CLIENT_DIAG_GNSS_LOC_SV_SYSTEM_QZSS = 7,
/** NAVIC satellite. */
CLIENT_DIAG_GNSS_LOC_SV_SYSTEM_NAVIC = 8
} clientDiagGnss_LocSvSystemEnumType;
typedef uint32_t clientDiagGnssSystemTimeStructTypeFlags;
typedef enum {
CLIENT_DIAG_GNSS_SYSTEM_TIME_WEEK_VALID = (1 << 0),
CLIENT_DIAG_GNSS_SYSTEM_TIME_WEEK_MS_VALID = (1 << 1),
CLIENT_DIAG_GNSS_SYSTEM_CLK_TIME_BIAS_VALID = (1 << 2),
CLIENT_DIAG_GNSS_SYSTEM_CLK_TIME_BIAS_UNC_VALID = (1 << 3),
CLIENT_DIAG_GNSS_SYSTEM_REF_FCOUNT_VALID = (1 << 4),
CLIENT_DIAG_GNSS_SYSTEM_NUM_CLOCK_RESETS_VALID = (1 << 5)
} clientDiagGnssSystemTimeTypeBits;
typedef uint32_t clientDiagGnssGloTimeStructTypeFlags;
typedef enum {
CLIENT_DIAG_GNSS_CLO_DAYS_VALID = (1 << 0),
CLIENT_DIAG_GNSS_GLOS_MSEC_VALID = (1 << 1),
CLIENT_DIAG_GNSS_GLO_CLK_TIME_BIAS_VALID = (1 << 2),
CLIENT_DIAG_GNSS_GLO_CLK_TIME_BIAS_UNC_VALID = (1 << 3),
CLIENT_DIAG_GNSS_GLO_REF_FCOUNT_VALID = (1 << 4),
CLIENT_DIAG_GNSS_GLO_NUM_CLOCK_RESETS_VALID = (1 << 5),
CLIENT_DIAG_GNSS_GLO_FOUR_YEAR_VALID = (1 << 6)
} clientDiagGnssGloTimeTypeBits;
typedef PACKED struct PACKED_POST {
/** Validity mask for below fields */
clientDiagGnssSystemTimeStructTypeFlags validityMask;
/** Extended week number at reference tick.
Unit: Week.
Set to 65535 if week number is unknown.
For GPS:
Calculated from midnight, Jan. 6, 1980.
OTA decoded 10 bit GPS week is extended to map between:
[NV6264 to (NV6264 + 1023)].
NV6264: Minimum GPS week number configuration.
Default value of NV6264: 1738
For BDS:
Calculated from 00:00:00 on January 1, 2006 of Coordinated Universal Time (UTC).
For GAL:
Calculated from 00:00 UT on Sunday August 22, 1999 (midnight between August 21 and August 22).
*/
uint16_t systemWeek;
/** Time in to the current week at reference tick.
Unit: Millisecond. Range: 0 to 604799999.
Check for systemClkTimeUncMs before use */
uint32_t systemMsec;
/** System clock time bias (sub-millisecond)
Units: Millisecond
Note: System time (TOW Millisecond) = systemMsec - systemClkTimeBias.
Check for systemClkTimeUncMs before use. */
float systemClkTimeBias;
/** Single sided maximum time bias uncertainty
Units: Millisecond */
float systemClkTimeUncMs;
/** FCount (free running HW timer) value. Don't use for relative time purpose
due to possible discontinuities.
Unit: Millisecond */
uint32_t refFCount;
/** Number of clock resets/discontinuities detected,
affecting the local hardware counter value. */
uint32_t numClockResets;
} clientDiagGnssSystemTimeStructType;
typedef PACKED struct PACKED_POST {
/** GLONASS day number in four years. Refer to GLONASS ICD.
Applicable only for GLONASS and shall be ignored for other constellations.
If unknown shall be set to 65535 */
uint16_t gloDays;
/** Validity mask for below fields */
clientDiagGnssGloTimeStructTypeFlags validityMask;
/** GLONASS time of day in Millisecond. Refer to GLONASS ICD.
Units: Millisecond
Check for gloClkTimeUncMs before use */
uint32_t gloMsec;
/** GLONASS clock time bias (sub-millisecond)
Units: Millisecond
Note: GLO time (TOD Millisecond) = gloMsec - gloClkTimeBias.
Check for gloClkTimeUncMs before use. */
float gloClkTimeBias;
/** Single sided maximum time bias uncertainty
Units: Millisecond */
float gloClkTimeUncMs;
/** FCount (free running HW timer) value. Don't use for relative time purpose
due to possible discontinuities.
Unit: Millisecond */
uint32_t refFCount;
/** Number of clock resets/discontinuities detected,
affecting the local hardware counter value. */
uint32_t numClockResets;
/** GLONASS four year number from 1996. Refer to GLONASS ICD.
Applicable only for GLONASS and shall be ignored for other constellations.
If unknown shall be set to 255 */
uint8_t gloFourYear;
} clientDiagGnssGloTimeStructType;
typedef PACKED union PACKED_POST {
clientDiagGnssSystemTimeStructType gpsSystemTime;
clientDiagGnssSystemTimeStructType galSystemTime;
clientDiagGnssSystemTimeStructType bdsSystemTime;
clientDiagGnssSystemTimeStructType qzssSystemTime;
clientDiagGnssGloTimeStructType gloSystemTime;
clientDiagGnssSystemTimeStructType navicSystemTime;
} clientDiagSystemTimeStructUnion;
typedef PACKED struct PACKED_POST {
/** Contains Body frame LocPosDataMask bits. */
clientDiagGnssLocationPosDataMask bodyFrameDataMask;
/** Forward Acceleration in body frame (m/s2)*/
float longAccel;
/** Sideward Acceleration in body frame (m/s2)*/
float latAccel;
/** Vertical Acceleration in body frame (m/s2)*/
float vertAccel;
/** Heading Rate (Radians/second) */
float yawRate;
/** Body pitch (Radians) */
float pitch;
/** Uncertainty of Forward Acceleration in body frame */
float longAccelUnc;
/** Uncertainty of Side-ward Acceleration in body frame */
float latAccelUnc;
/** Uncertainty of Vertical Acceleration in body frame */
float vertAccelUnc;
/** Uncertainty of Heading Rate */
float yawRateUnc;
/** Uncertainty of Body pitch */
float pitchUnc;
/** Body pitch rate (Radians/second) */
float pitchRate;
/** Uncertainty of pitch rate (Radians/second) */
float pitchRateUnc;
/** Roll of body frame. Clockwise positive. (Radian) */
float roll;
/** Uncertainty of Roll, 68% confidence level (radian) */
float rollUnc;
/** Roll rate of body frame. Clockwise positive. (radian/second)
*/
float rollRate;
/** Uncertainty of Roll rate, 68% confidence level (radian/second) */
float rollRateUnc;
/** Yaw of body frame. Clockwise positive (radian) */
float yaw;
/** Uncertainty of Yaw, 68% confidence level (radian) */
float yawUnc;
} clientDiagGnssLocationPositionDynamics;
/** @struct
Time applicability of PVT report
*/
typedef PACKED struct PACKED_POST {
/** Specifies GNSS system time reported. Mandatory field */
clientDiagGnss_LocSvSystemEnumType gnssSystemTimeSrc;
/** Reporting of GPS system time is recommended.
If GPS time is unknown & other satellite system time is known,
it should be reported.
Mandatory field
*/
clientDiagSystemTimeStructUnion u;
} clientDiagGnssSystemTime;
/** GNSS Signal Type and RF Band */
typedef uint32_t clientDiagGnssSignalTypeMask;
typedef enum {
/** GPS L1CA Signal */
CLIENT_DIAG_GNSS_SIGNAL_GPS_L1CA = (1<<0),
/** GPS L1C Signal */
CLIENT_DIAG_GNSS_SIGNAL_GPS_L1C = (1<<1),
/** GPS L2 RF Band */
CLIENT_DIAG_GNSS_SIGNAL_GPS_L2 = (1<<2),
/** GPS L5 RF Band */
CLIENT_DIAG_GNSS_SIGNAL_GPS_L5 = (1<<3),
/** GLONASS G1 (L1OF) RF Band */
CLIENT_DIAG_GNSS_SIGNAL_GLONASS_G1 = (1<<4),
/** GLONASS G2 (L2OF) RF Band */
CLIENT_DIAG_GNSS_SIGNAL_GLONASS_G2 = (1<<5),
/** GALILEO E1 RF Band */
CLIENT_DIAG_GNSS_SIGNAL_GALILEO_E1 = (1<<6),
/** GALILEO E5A RF Band */
CLIENT_DIAG_GNSS_SIGNAL_GALILEO_E5A = (1<<7),
/** GALILEO E5B RF Band */
CLIENT_DIAG_GNSS_SIGNAL_GALILEO_E5B = (1<<8),
/** BEIDOU B1 RF Band */
CLIENT_DIAG_GNSS_SIGNAL_BEIDOU_B1 = (1<<9),
/** BEIDOU B2 RF Band */
CLIENT_DIAG_GNSS_SIGNAL_BEIDOU_B2 = (1<<10),
/** QZSS L1CA RF Band */
CLIENT_DIAG_GNSS_SIGNAL_QZSS_L1CA = (1<<11),
/** QZSS L1S RF Band */
CLIENT_DIAG_GNSS_SIGNAL_QZSS_L1S = (1<<12),
/** QZSS L2 RF Band */
CLIENT_DIAG_GNSS_SIGNAL_QZSS_L2 = (1<<13),
/** QZSS L5 RF Band */
CLIENT_DIAG_GNSS_SIGNAL_QZSS_L5 = (1<<14),
/** SBAS L1 RF Band */
CLIENT_DIAG_GNSS_SIGNAL_SBAS_L1 = (1<<15),
/** BEIDOU B1I RF Band */
CLIENT_DIAG_GNSS_SIGNAL_BEIDOU_B1I = (1<<16),
/** BEIDOU B1C RF Band */
CLIENT_DIAG_GNSS_SIGNAL_BEIDOU_B1C = (1<<17),
/** BEIDOU B2I RF Band */
CLIENT_DIAG_GNSS_SIGNAL_BEIDOU_B2I = (1<<18),
/** BEIDOU B2AI RF Band */
CLIENT_DIAG_GNSS_SIGNAL_BEIDOU_B2AI = (1<<19),
/** NAVIC L5 RF Band */
CLIENT_DIAG_GNSS_SIGNAL_NAVIC_L5 = (1<<20),
/** BEIDOU B2AQ RF Band */
CLIENT_DIAG_GNSS_SIGNAL_BEIDOU_B2AQ = (1<<21)
} clientDiagGnssSignalTypeBits;
typedef PACKED struct PACKED_POST {
/** GnssSignalType mask */
clientDiagGnssSignalTypeMask gnssSignalType;
/** Specifies GNSS Constellation Type */
clientDiagGnss_LocSvSystemEnumType gnssConstellation;
/** GNSS SV ID.
For GPS: 1 to 32
For GLONASS: 65 to 96. When slot-number to SV ID mapping is unknown, set as 255.
For SBAS: 120 to 151
For QZSS-L1CA:193 to 197
For BDS: 201 to 263
For GAL: 301 to 336
For NAVIC: 401 to 414 */
uint16_t gnssSvId;
} clientDiagGnssMeasUsageInfo;
typedef enum {
CLIENT_DIAG_GNSS_SV_TYPE_UNKNOWN = 0,
CLIENT_DIAG_GNSS_SV_TYPE_GPS,
CLIENT_DIAG_GNSS_SV_TYPE_SBAS,
CLIENT_DIAG_GNSS_SV_TYPE_GLONASS,
CLIENT_DIAG_GNSS_SV_TYPE_QZSS,
CLIENT_DIAG_GNSS_SV_TYPE_BEIDOU,
CLIENT_DIAG_GNSS_SV_TYPE_GALILEO,
CLIENT_DIAG_GNSS_SV_TYPE_NAVIC
} clientDiagGnssSvType;
typedef uint16_t clientDiagGnssSvOptionsMask;
typedef enum {
CLIENT_DIAG_GNSS_SV_OPTIONS_HAS_EPHEMER_BIT = (1<<0),
CLIENT_DIAG_GNSS_SV_OPTIONS_HAS_ALMANAC_BIT = (1<<1),
CLIENT_DIAG_GNSS_SV_OPTIONS_USED_IN_FIX_BIT = (1<<2),
CLIENT_DIAG_GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT = (1<<3)
} clientDiagGnssSvOptionsBits;
typedef PACKED struct PACKED_POST {
/** Unique Identifier */
uint16_t svId;
/** type of SV (GPS, SBAS, GLONASS, QZSS, BEIDOU, GALILEO, NAVIC) */
clientDiagGnssSvType type;
/** signal strength */
float cN0Dbhz;
/** elevation of SV (in degrees) */
float elevation;
/** azimuth of SV (in degrees) */
float azimuth;
/** Bitwise OR of GnssSvOptionsBits */
clientDiagGnssSvOptionsMask gnssSvOptionsMask;
/** carrier frequency of the signal tracked */
float carrierFrequencyHz;
/** Specifies GNSS signal type */
clientDiagGnssSignalTypeMask gnssSignalTypeMask;
} clientDiagGnssSv;
typedef uint16_t clientDiagLocationTechnologyMask;
typedef enum {
/** location was calculated using GNSS */
CLIENT_DIAG_LOCATION_TECHNOLOGY_GNSS_BIT = (1<<0),
/** location was calculated using Cell */
CLIENT_DIAG_LOCATION_TECHNOLOGY_CELL_BIT = (1<<1),
/** location was calculated using WiFi */
CLIENT_DIAG_LOCATION_TECHNOLOGY_WIFI_BIT = (1<<2),
/** location was calculated using Sensors */
CLIENT_DIAG_LOCATION_TECHNOLOGY_SENSORS_BIT = (1<<3),
} clientDiagLocationTechnologyBits;
typedef uint16_t clientDiagDrCalibrationStatusMask;
typedef enum {
/** Indicate that roll calibration is needed. Need to take more
* turns on level ground */
CLIENT_DIAG_DR_ROLL_CALIBRATION_NEEDED = (1<<0),
/** Indicate that pitch calibration is needed. Need to take more
* turns on level ground */
CLIENT_DIAG_DR_PITCH_CALIBRATION_NEEDED = (1<<1),
/** Indicate that yaw calibration is needed. Need to accelerate
* in a straight line */
CLIENT_DIAG_DR_YAW_CALIBRATION_NEEDED = (1<<2),
/** Indicate that odo calibration is needed. Need to accelerate
* in a straight line */
CLIENT_DIAG_DR_ODO_CALIBRATION_NEEDED = (1<<3),
/** Indicate that gyro calibration is needed. Need to take more
* turns on level ground */
CLIENT_DIAG_DR_GYRO_CALIBRATION_NEEDED = (1<<4)
} clientDiagDrCalibrationStatusBits;
typedef uint32_t clientDiagGnssLocationInfoFlagMask;
typedef enum {
/** valid altitude mean sea level */
CLIENT_DIAG_GNSS_LOCATION_INFO_ALTITUDE_MEAN_SEA_LEVEL_BIT = (1<<0),
/** valid pdop, hdop, and vdop */
CLIENT_DIAG_GNSS_LOCATION_INFO_DOP_BIT = (1<<1),
/** valid magnetic deviation */
CLIENT_DIAG_GNSS_LOCATION_INFO_MAGNETIC_DEVIATION_BIT = (1<<2),
/** valid horizontal reliability */
CLIENT_DIAG_GNSS_LOCATION_INFO_HOR_RELIABILITY_BIT = (1<<3),
/** valid vertical reliability */
CLIENT_DIAG_GNSS_LOCATION_INFO_VER_RELIABILITY_BIT = (1<<4),
/** valid elipsode semi major */
CLIENT_DIAG_GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MAJOR_BIT = (1<<5),
/** valid elipsode semi minor */
CLIENT_DIAG_GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MINOR_BIT = (1<<6),
/** valid accuracy elipsode azimuth */
CLIENT_DIAG_GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_AZIMUTH_BIT = (1<<7),
/** valid gnss sv used in pos data */
CLIENT_DIAG_GNSS_LOCATION_INFO_GNSS_SV_USED_DATA_BIT = (1<<8),
/** valid navSolutionMask */
CLIENT_DIAG_GNSS_LOCATION_INFO_NAV_SOLUTION_MASK_BIT = (1<<9),
/** valid LocPosTechMask */
CLIENT_DIAG_GNSS_LOCATION_INFO_POS_TECH_MASK_BIT = (1<<10),
/** valid LocSvInfoSource */
CLIENT_DIAG_GNSS_LOCATION_INFO_SV_SOURCE_INFO_BIT = (1<<11),
/** valid position dynamics data */
CLIENT_DIAG_GNSS_LOCATION_INFO_POS_DYNAMICS_DATA_BIT = (1<<12),
/** valid gdop, tdop */
CLIENT_DIAG_GNSS_LOCATION_INFO_EXT_DOP_BIT = (1<<13),
/** valid North standard deviation */
CLIENT_DIAG_GNSS_LOCATION_INFO_NORTH_STD_DEV_BIT = (1<<14),
/** valid East standard deviation */
CLIENT_DIAG_GNSS_LOCATION_INFO_EAST_STD_DEV_BIT = (1<<15),
/** valid North Velocity */
CLIENT_DIAG_GNSS_LOCATION_INFO_NORTH_VEL_BIT = (1<<16),
/** valid East Velocity */
CLIENT_DIAG_GNSS_LOCATION_INFO_EAST_VEL_BIT = (1<<17),
/** valid Up Velocity */
CLIENT_DIAG_GNSS_LOCATION_INFO_UP_VEL_BIT = (1<<18),
/** valid North Velocity Uncertainty */
CLIENT_DIAG_GNSS_LOCATION_INFO_NORTH_VEL_UNC_BIT = (1<<19),
/** valid East Velocity Uncertainty */
CLIENT_DIAG_GNSS_LOCATION_INFO_EAST_VEL_UNC_BIT = (1<<20),
/** valid Up Velocity Uncertainty */
CLIENT_DIAG_GNSS_LOCATION_INFO_UP_VEL_UNC_BIT = (1<<21),
/** valid leap seconds */
CLIENT_DIAG_GNSS_LOCATION_INFO_LEAP_SECONDS_BIT = (1<<22),
/** valid time uncertainty */
CLIENT_DIAG_GNSS_LOCATION_INFO_TIME_UNC_BIT = (1<<23),
/** valid numSvUsedInPosition */
CLIENT_DIAG_GNSS_LOCATION_INFO_NUM_SV_USED_IN_POSITION_BIT = (1<<24),
/** valid calibrationConfidencePercent */
CLIENT_DIAG_GNSS_LOCATION_INFO_CALIBRATION_CONFIDENCE_PERCENT_BIT = (1<<25),
/** valid calibrationStatus */
CLIENT_DIAG_GNSS_LOCATION_INFO_CALIBRATION_STATUS_BIT = (1<<26),
/** valid output engine type */
CLIENT_DIAG_GNSS_LOCATION_INFO_OUTPUT_ENG_TYPE_BIT = (1<<27),
/** valid output engine mask */
CLIENT_DIAG_GNSS_LOCATION_INFO_OUTPUT_ENG_MASK_BIT = (1<<28),
/** valid output conformityIndex */
CLIENT_DIAG_GNSS_LOCATION_INFO_CONFORMITY_INDEX_BIT = (1<<29),
/** valid llaVRPBased. */
CLIENT_DIAG_GNSS_LOCATION_INFO_LLA_VRP_BASED_BIT = (1<<30),
/** valid enuVelocityVRPBased. */
CLIENT_DIAG_GNSS_LOCATION_INFO_ENU_VELOCITY_VRP_BASED_BIT = (1<<31),
} clientDiagGnssLocationInfoFlagBits;
typedef enum {
CLIENT_DIAG_LOCATION_RELIABILITY_NOT_SET = 0,
CLIENT_DIAG_LOCATION_RELIABILITY_VERY_LOW,
CLIENT_DIAG_LOCATION_RELIABILITY_LOW,
CLIENT_DIAG_LOCATION_RELIABILITY_MEDIUM,
CLIENT_DIAG_LOCATION_RELIABILITY_HIGH,
} clientDiagLocationReliability;
typedef PACKED struct PACKED_POST {
uint64_t gpsSvUsedIdsMask;
uint64_t gloSvUsedIdsMask;
uint64_t galSvUsedIdsMask;
uint64_t bdsSvUsedIdsMask;
uint64_t qzssSvUsedIdsMask;
uint64_t navicSvUsedIdsMask;
} clientDiagGnssLocationSvUsedInPosition;
typedef uint32_t clientDiagGnssLocationNavSolutionMask;
typedef enum {
/** SBAS ionospheric correction is used*/
CLIENT_DIAG_LOCATION_SBAS_CORRECTION_IONO_BIT = (1<<0),
/** SBAS fast correction is used*/
CLIENT_DIAG_LOCATION_SBAS_CORRECTION_FAST_BIT = (1<<1),
/** SBAS long-tem correction is used*/
CLIENT_DIAG_LOCATION_SBAS_CORRECTION_LONG_BIT = (1<<2),
/** SBAS integrity information is used*/
CLIENT_DIAG_LOCATION_SBAS_INTEGRITY_BIT = (1<<3),
/** Position Report is DGNSS corrected*/
CLIENT_DIAG_LOCATION_NAV_CORRECTION_DGNSS_BIT = (1<<4),
/** Position Report is RTK corrected*/
CLIENT_DIAG_LOCATION_NAV_CORRECTION_RTK_BIT = (1<<5),
/** Position Report is PPP corrected*/
CLIENT_DIAG_LOCATION_NAV_CORRECTION_PPP_BIT = (1<<6)
} clientDiagGnssLocationNavSolutionBits;
typedef uint32_t clientDiagGnssLocationPosTechMask;
typedef enum {
CLIENT_DIAG_LOCATION_POS_TECH_DEFAULT_BIT = 0,
CLIENT_DIAG_LOCATION_POS_TECH_SATELLITE_BIT = (1<<0),
CLIENT_DIAG_LOCATION_POS_TECH_CELLID_BIT = (1<<1),
CLIENT_DIAG_LOCATION_POS_TECH_WIFI_BIT = (1<<2),
CLIENT_DIAG_LOCATION_POS_TECH_SENSORS_BIT = (1<<3),
CLIENT_DIAG_LOCATION_POS_TECH_REFERENCE_LOCATION_BIT = (1<<4),
CLIENT_DIAG_LOCATION_POS_TECH_INJECTED_COARSE_POSITION_BIT = (1<<5),
CLIENT_DIAG_LOCATION_POS_TECH_AFLT_BIT = (1<<6),
CLIENT_DIAG_LOCATION_POS_TECH_HYBRID_BIT = (1<<7),
CLIENT_DIAG_LOCATION_POS_TECH_PPE_BIT = (1<<8)
} clientDiagGnssLocationPosTechBits;
typedef enum {
/** This is the propagated/aggregated reports from all engines
running on the system (e.g.: DR/SPE/PPE). */
CLIENT_DIAG_LOC_OUTPUT_ENGINE_FUSED = 0,
/** This fix is the unmodified fix from modem GNSS engine */
CLIENT_DIAG_LOC_OUTPUT_ENGINE_SPE = 1,
/** This is the unmodified fix from PPP/RTK correction engine */
CLIENT_DIAG_LOC_OUTPUT_ENGINE_PPE = 2,
CLIENT_DIAG_LOC_OUTPUT_ENGINE_COUNT,
} clientDiagLocOutputEngineType;
typedef uint32_t clientDiagPositioningEngineMask;
typedef enum {
CLIENT_DIAG_STANDARD_POSITIONING_ENGINE = (1 << 0),
CLIENT_DIAG_DEAD_RECKONING_ENGINE = (1 << 1),
CLIENT_DIAG_PRECISE_POSITIONING_ENGINE = (1 << 2)
} clientDiagPositioningEngineBits;
typedef PACKED struct PACKED_POST {
/** Latitude, in unit of degrees, range [-90.0, 90.0]. */
double latitude;
/** Longitude, in unit of degrees, range [-180.0, 180.0]. */
double longitude;
/** Altitude above the WGS 84 reference ellipsoid, in unit
of meters. */
float altitude;
} clientDiagLLAInfo;
typedef PACKED struct PACKED_POST {
/** Used by Logging Module
* Mandatory field */
log_hdr_type logHeader;
/** clientDiag Message Version
* Mandatory field */
uint8 version;
/** bitwise OR of LocationFlagsBits to mark which params are valid */
clientDiagLocationFlagsMask flags;
/** UTC timestamp for location fix, milliseconds since January 1, 1970 */
uint64_t timestamp;
/** in degrees; range [-90.0, 90.0] */
double latitude;
/** in degrees; range [-180.0, 180.0] */
double longitude;
/** in meters above the WGS 84 reference ellipsoid */
double altitude;
/** in meters per second */
float speed;
/** in degrees; range [0, 360) */
float bearing;
/** in meters */
float horizontalAccuracy;
/** in meters */
float verticalAccuracy;
/** in meters/second */
float speedAccuracy;
/** in degrees (0 to 359.999) */
float bearingAccuracy;
clientDiagLocationTechnologyMask techMask;
/** bitwise OR of GnssLocationInfoBits for param validity */
clientDiagGnssLocationInfoFlagMask gnssInfoFlags;
/** altitude wrt mean sea level */
float altitudeMeanSeaLevel;
/** position dilusion of precision */
float pdop;
/** horizontal dilusion of precision */
float hdop;
/** vertical dilusion of precision */
float vdop;
/** geometric dilution of precision */
float gdop;
/** time dilution of precision */
float tdop;
/** magnetic deviation */
float magneticDeviation;
/** horizontal reliability */
clientDiagLocationReliability horReliability;
/** vertical reliability */
clientDiagLocationReliability verReliability;
/** horizontal elliptical accuracy semi-major axis */
float horUncEllipseSemiMajor;
/** horizontal elliptical accuracy semi-minor axis */
float horUncEllipseSemiMinor;
/** horizontal elliptical accuracy azimuth */
float horUncEllipseOrientAzimuth;
/** North standard deviation Unit: Meters */
float northStdDeviation;
/** East standard deviation. Unit: Meters */
float eastStdDeviation;
/** North Velocity.Unit: Meters/sec */
float northVelocity;
/** East Velocity Unit: Meters/sec */
float eastVelocity;
/** Up Velocity Unit: Meters/sec */
float upVelocity;
float northVelocityStdDeviation;
float eastVelocityStdDeviation;
float upVelocityStdDeviation;
/** Gnss sv used in position data */
clientDiagGnssLocationSvUsedInPosition svUsedInPosition;
/** Nav solution mask to indicate sbas corrections */
clientDiagGnssLocationNavSolutionMask navSolutionMask;
/** Position technology used in computing this fix */
clientDiagGnssLocationPosTechMask posTechMask;
/** Body Frame Dynamics: 4wayAcceleration and pitch set with validity */
clientDiagGnssLocationPositionDynamics bodyFrameData;
/** GNSS System Time */
clientDiagGnssSystemTime gnssSystemTime;
/** Number of measurements received for use in fix */
uint8_t numOfMeasReceived;
/** Gnss measurement usage info */
clientDiagGnssMeasUsageInfo measUsageInfo[CLIENT_DIAG_GNSS_SV_MAX];
/** Leap Seconds */
uint8_t leapSeconds;
/** Time uncertainty in milliseconds */
float timeUncMs;
/** number of SV used in position report */
uint16_t numSvUsedInPosition;
/** Sensor calibration confidence percent, valid range [0,
* 100] */
uint8_t calibrationConfidencePercent;
/** Sensor calibration status */
clientDiagDrCalibrationStatusMask calibrationStatus;
/** boot timestamp in nano-second when this diag log packet is
* created and filled with the info at location client api
* layer */
uint64_t bootTimestampNs;
/** location engine type. When the fix. when the type is set to
LOC_ENGINE_SRC_FUSED, the fix is the propagated/aggregated
reports from all engines running on the system (e.g.:
DR/SPE/PPE). To check which location engine contributes to
the fused output, check for locOutputEngMask. */
clientDiagLocOutputEngineType locOutputEngType;
/** when loc output eng type is set to fused, this field
indicates the set of engines contribute to the fix. */
clientDiagPositioningEngineMask locOutputEngMask;
/** When robust location is enabled, this field
* will indicate how well the various input data considered for
* navigation solution conform to expectations.
* Range: [0.0, 1.0], with 0.0 for least conforming and 1.0 for
* most conforming. */
float conformityIndex;
/** VRR-based latitude/longitude/altitude. */
clientDiagLLAInfo llaVRPBased;
/** VRR-based east, north, and up velocity */
float enuVelocityVRPBased[3];
/** qtimer tick count when this diag log packet is
* created and filled with the info at location client api
* layer. This field is always valid. */
uint64_t qtimerTickCnt;
} clientDiagGnssLocationStructType;
typedef uint32_t clientDiagGnssMeasurementsDataFlagsMask;
typedef enum {
CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_SV_ID_BIT = (1 << 0),
CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_SV_TYPE_BIT = (1 << 1),
CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_STATE_BIT = (1 << 2),
CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_RECEIVED_SV_TIME_BIT = (1 << 3),
CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_RECEIVED_SV_TIME_UNCERTAINTY_BIT = (1 << 4),
CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_CARRIER_TO_NOISE_BIT = (1 << 5),
CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_PSEUDORANGE_RATE_BIT = (1 << 6),
CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_PSEUDORANGE_RATE_UNCERTAINTY_BIT = (1 << 7),
CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_ADR_STATE_BIT = (1 << 8),
CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_ADR_BIT = (1 << 9),
CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_ADR_UNCERTAINTY_BIT = (1 << 10),
CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_CARRIER_FREQUENCY_BIT = (1 << 11),
CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_CARRIER_CYCLES_BIT = (1 << 12),
CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_BIT = (1 << 13),
CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_UNCERTAINTY_BIT = (1 << 14),
CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_MULTIPATH_INDICATOR_BIT = (1 << 15),
CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_SIGNAL_TO_NOISE_RATIO_BIT = (1 << 16),
CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT = (1 << 17),
} clientDiagGnssMeasurementsDataFlagsBits;
typedef uint32_t clientDiagGnssMeasurementsStateMask;
typedef enum {
CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_UNKNOWN_BIT = 0,
CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT = (1 << 0),
CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_BIT_SYNC_BIT = (1 << 1),
CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_SUBFRAME_SYNC_BIT = (1 << 2),
CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_TOW_DECODED_BIT = (1 << 3),
CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_MSEC_AMBIGUOUS_BIT = (1 << 4),
CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_SYMBOL_SYNC_BIT = (1 << 5),
CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_GLO_STRING_SYNC_BIT = (1 << 6),
CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_GLO_TOD_DECODED_BIT = (1 << 7),
CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_BDS_D2_BIT_SYNC_BIT = (1 << 8),
CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_BDS_D2_SUBFRAME_SYNC_BIT = (1 << 9),
CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_GAL_E1BC_CODE_LOCK_BIT = (1 << 10),
CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_GAL_E1C_2ND_CODE_LOCK_BIT = (1 << 11),
CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_GAL_E1B_PAGE_SYNC_BIT = (1 << 12),
CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_SBAS_SYNC_BIT = (1 << 13),
} clientDiagGnssMeasurementsStateBits;
typedef uint16_t clientDiagGnssMeasurementsAdrStateMask;
typedef enum {
CLIENT_DIAG_GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_UNKNOWN = 0,
CLIENT_DIAG_GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_VALID_BIT = (1 << 0),
CLIENT_DIAG_GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_RESET_BIT = (1 << 1),
CLIENT_DIAG_GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_CYCLE_SLIP_BIT = (1 << 2),
} clientDiagGnssMeasurementsAdrStateBits;
typedef enum {
CLIENT_DIAG_GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_UNKNOWN = 0,
CLIENT_DIAG_GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_PRESENT,
CLIENT_DIAG_GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_NOT_PRESENT,
} clientDiagGnssMeasurementsMultipathIndicator;
typedef uint32_t clientDiagGnssMeasurementsClockFlagsMask;
typedef enum {
CLIENT_DIAG_GNSS_MEASUREMENTS_CLOCK_FLAGS_LEAP_SECOND_BIT = (1 << 0),
CLIENT_DIAG_GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_BIT = (1 << 1),
CLIENT_DIAG_GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_UNCERTAINTY_BIT = (1 << 2),
CLIENT_DIAG_GNSS_MEASUREMENTS_CLOCK_FLAGS_FULL_BIAS_BIT = (1 << 3),
CLIENT_DIAG_GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_BIT = (1 << 4),
CLIENT_DIAG_GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_UNCERTAINTY_BIT = (1 << 5),
CLIENT_DIAG_GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_BIT = (1 << 6),
CLIENT_DIAG_GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_UNCERTAINTY_BIT = (1 << 7),
CLIENT_DIAG_GNSS_MEASUREMENTS_CLOCK_FLAGS_HW_CLOCK_DISCONTINUITY_COUNT_BIT = (1 << 8),
} clientDiagGnssMeasurementsClockFlagsBits;
typedef PACKED struct PACKED_POST {
clientDiagGnssMeasurementsDataFlagsMask flags; // bitwise OR of GnssMeasurementsDataFlagsBits
int16_t svId;
clientDiagGnssSvType svType;
double timeOffsetNs;
clientDiagGnssMeasurementsStateMask stateMask; // bitwise OR of GnssMeasurementsStateBits
int64_t receivedSvTimeNs;
int64_t receivedSvTimeUncertaintyNs;
double carrierToNoiseDbHz;
double pseudorangeRateMps;
double pseudorangeRateUncertaintyMps;
clientDiagGnssMeasurementsAdrStateMask adrStateMask;
double adrMeters;
double adrUncertaintyMeters;
float carrierFrequencyHz;
int64_t carrierCycles;
double carrierPhase;
double carrierPhaseUncertainty;
clientDiagGnssMeasurementsMultipathIndicator multipathIndicator;
double signalToNoiseRatioDb;
double agcLevelDb;
} clientDiagGnssMeasurementsData;
typedef PACKED struct PACKED_POST {
clientDiagGnssMeasurementsClockFlagsMask flags;// bitwise OR of GnssMeasurementsClockFlagsBits
int16_t leapSecond;
int64_t timeNs;
double timeUncertaintyNs;
int64_t fullBiasNs;
double biasNs;
double biasUncertaintyNs;
double driftNsps;
double driftUncertaintyNsps;
uint32_t hwClockDiscontinuityCount;
} clientDiagGnssMeasurementsClock;
typedef PACKED struct PACKED_POST {
/** Used by Logging Module
* Mandatory field */
log_hdr_type logHeader;
/** clientDiag Message Version
* Mandatory field */
uint8 version;
uint32_t count; // number of items in GnssMeasurementsData array
clientDiagGnssMeasurementsClock clock; // clock
clientDiagGnssMeasurementsData measurements[CLIENT_DIAG_GNSS_MEASUREMENTS_MAX];
} clientDiagGnssMeasurementsStructType;
typedef PACKED struct PACKED_POST {
/** Used by Logging Module
* Mandatory field */
log_hdr_type logHeader;
/** clientDiag Message Version
* Mandatory field */
uint8 version;
/** number of SVs in the GnssSvs array */
uint32_t count;
clientDiagGnssSv gnssSvs[CLIENT_DIAG_GNSS_SV_MAX];
} clientDiagGnssSvStructType;
typedef PACKED struct PACKED_POST {
/** Used by Logging Module
* Mandatory field */
log_hdr_type logHeader;
/** clientDiag Message Version
* Mandatory field */
uint8 version;
/** Timestamp of NMEA generation */
uint64_t timestamp;
/** Length of nmea data */
uint32_t nmeaLength;
/** One or more nmea strings separated by \n charachter */
uint8_t nmea[1];
} clientDiagGnssNmeaStructType;
}
#endif /*LOCATION_CLIENT_API_LOG_H */

View file

@ -1,44 +0,0 @@
AM_CFLAGS = \
-DDEBUG \
-I./ \
$(GPSUTILS_CFLAGS) \
$(LOCUTILS_CFLAGS) \
$(LOCCLIENTAPI_CFLAGS) \
$(LOCINTEGRATIONAPI_CFLAGS) \
-std=c++11
# HALDAEMON is requird only for msg.h
ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS = -std=c++11
requiredlibs = \
$(GPSUTILS_LIBS) \
$(LOCCLIENTAPI_LIBS) \
$(LOCINTEGRATIONAPI_LIBS)
h_sources =
c_sources = \
main.cpp
location_client_api_testapp_SOURCES = \
$(c_sources) $(h_sources)
######################
# Build location_client_api_testapp
######################
if USE_GLIB
location_client_api_testapp_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
location_client_api_testapp_LDFLAGS = -lstdc++ -g -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
location_client_api_testapp_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
else
location_client_api_testapp_CFLAGS = $(AM_CFLAGS)
location_client_api_testapp_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread -shared -version-info 1:0:0
location_client_api_testapp_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
endif
location_client_api_testapp_LDADD = $(requiredlibs) -lstdc++ -lc -ldl
bin_PROGRAMS = location_client_api_testapp

View file

@ -1,88 +0,0 @@
# configure.ac -- Autoconf script for gps location_client_api_testapp
#
# 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_testapp package version 1.0.0
AC_INIT([location_client_api_testapp],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], [gps-utils])
AC_SUBST([GPSUTILS_CFLAGS])
AC_SUBST([GPSUTILS_LIBS])
PKG_CHECK_MODULES([LOCCLIENTAPI], [location-client-api])
AC_SUBST([LOCCLIENTAPI_CFLAGS])
AC_SUBST([LOCCLIENTAPI_LIBS])
PKG_CHECK_MODULES([LOCINTEGRATIONAPI], [location-integration-api])
AC_SUBST([LOCINTEGRATIONAPI_CFLAGS])
AC_SUBST([LOCINTEGRATIONAPI_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"
fi
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_CONFIG_FILES([ \
Makefile \
location_client_api_testapp.pc
])
AC_OUTPUT

View file

@ -1,10 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: location_client_api_testapp
Description: location_client_api_tesetapp
Version: @VERSION@
Libs: -L${libdir} -llocation_client_api
Cflags: -I${includedir}

View file

@ -1,918 +0,0 @@
/* Copyright (c) 2019-2020 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.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <inttypes.h>
#include <string.h>
#include <sstream>
#include <grp.h>
#include <sys/types.h>
#include <sys/prctl.h>
#include <sys/capability.h>
#include <semaphore.h>
#include <loc_pla.h>
#include <loc_cfg.h>
#include <loc_misc_utils.h>
#ifdef NO_UNORDERED_SET_OR_MAP
#include <map>
#else
#include <unordered_map>
#endif
#include <LocationClientApi.h>
#include <LocationIntegrationApi.h>
using namespace location_client;
using namespace location_integration;
static bool outputEnabled = true;
// debug events counter
static uint32_t numLocationCb = 0;
static uint32_t numGnssLocationCb = 0;
static uint32_t numEngLocationCb = 0;
static uint32_t numGnssSvCb = 0;
static uint32_t numGnssNmeaCb = 0;
static uint32_t numDataCb = 0;
static uint32_t numGnssMeasurementsCb = 0;
#define DISABLE_REPORT_OUTPUT "disableReportOutput"
#define ENABLE_REPORT_OUTPUT "enableReportOutput"
#define DISABLE_TUNC "disableTunc"
#define ENABLE_TUNC "enableTunc"
#define DISABLE_PACE "disablePACE"
#define ENABLE_PACE "enablePACE"
#define RESET_SV_CONFIG "resetSVConfig"
#define CONFIG_SV "configSV"
#define CONFIG_SECONDARY_BAND "configSecondaryBand"
#define GET_SECONDARY_BAND_CONFIG "getSecondaryBandConfig"
#define MULTI_CONFIG_SV "multiConfigSV"
#define DELETE_ALL "deleteAll"
#define DELETE_AIDING_DATA "deleteAidingData"
#define CONFIG_LEVER_ARM "configLeverArm"
#define CONFIG_ROBUST_LOCATION "configRobustLocation"
#define GET_ROBUST_LOCATION_CONFIG "getRobustLocationConfig"
#define CONFIG_MIN_GPS_WEEK "configMinGpsWeek"
#define GET_MIN_GPS_WEEK "getMinGpsWeek"
#define CONFIG_DR_ENGINE "configDrEngine"
#define CONFIG_MIN_SV_ELEVATION "configMinSvElevation"
#define GET_MIN_SV_ELEVATION "getMinSvElevation"
#define CONFIG_ENGINE_RUN_STATE "configEngineRunState"
#define SET_USER_CONSENT "setUserConsentForTerrestrialPositioning"
#define GET_SINGLE_GTP_WWAN_FIX "getSingleGtpWwanFix"
// debug utility
static uint64_t getTimestamp() {
struct timespec ts;
clock_gettime(CLOCK_BOOTTIME, &ts);
uint64_t absolute_micro =
((uint64_t)(ts.tv_sec)) * 1000000ULL + ((uint64_t)(ts.tv_nsec)) / 1000ULL;
return absolute_micro;
}
/******************************************************************************
Callback functions
******************************************************************************/
static void onCapabilitiesCb(location_client::LocationCapabilitiesMask mask) {
printf("<<< onCapabilitiesCb mask=0x%" PRIx64 "\n", mask);
printf("<<< onCapabilitiesCb mask string=%s",
LocationClientApi::capabilitiesToString(mask).c_str());
}
static void onResponseCb(location_client::LocationResponse response) {
printf("<<< onResponseCb err=%u\n", response);
}
static void onLocationCb(const location_client::Location& location) {
numLocationCb++;
if (!outputEnabled) {
return;
}
printf("<<< onLocationCb cnt=%u time=%" PRIu64" mask=0x%x lat=%f lon=%f alt=%f\n",
numLocationCb,
location.timestamp,
location.flags,
location.latitude,
location.longitude,
location.altitude);
}
static void onGtpResponseCb(location_client::LocationResponse response) {
printf("<<< onGtpResponseCb err=%u\n", response);
}
static void onGtpLocationCb(const location_client::Location& location) {
numLocationCb++;
if (!outputEnabled) {
return;
}
printf("<<< onGtpLocationCb cnt=%u time=%" PRIu64" mask=0x%x lat=%f lon=%f alt=%f\n",
numLocationCb,
location.timestamp,
location.flags,
location.latitude,
location.longitude,
location.altitude);
}
static void onGnssLocationCb(const location_client::GnssLocation& location) {
numGnssLocationCb++;
if (!outputEnabled) {
return;
}
printf("<<< onGnssLocationCb cnt=%u time=%" PRIu64" mask=0x%x lat=%f lon=%f alt=%f\n",
numGnssLocationCb,
location.timestamp,
location.flags,
location.latitude,
location.longitude,
location.altitude);
}
static void onEngLocationsCb(const std::vector<location_client::GnssLocation>& locations) {
numEngLocationCb++;
if (!outputEnabled) {
return;
}
for (auto gnssLocation : locations) {
printf("<<< onEngLocationsCb: cnt=%u time=%" PRIu64" mask=0x%x lat=%f lon=%f alt=%f\n"
"info mask=0x%" PRIx64 ", nav solution maks = 0x%x, eng type %d, eng mask 0x%x, "
"session status %d",
numEngLocationCb,
gnssLocation.timestamp,
gnssLocation.flags,
gnssLocation.latitude,
gnssLocation.longitude,
gnssLocation.altitude,
gnssLocation.gnssInfoFlags,
gnssLocation.navSolutionMask,
gnssLocation.locOutputEngType,
gnssLocation.locOutputEngMask,
gnssLocation.sessionStatus);
}
}
static void onGnssSvCb(const std::vector<location_client::GnssSv>& gnssSvs) {
numGnssSvCb++;
if (!outputEnabled) {
return;
}
std::stringstream ss;
ss << "<<< onGnssSvCb c=" << numGnssSvCb << " s=" << gnssSvs.size();
for (auto sv : gnssSvs) {
ss << " " << sv.type << ":" << sv.svId << "/" << (uint32_t)sv.cN0Dbhz;
}
printf("%s\n", ss.str().c_str());
}
static void onGnssNmeaCb(uint64_t timestamp, const std::string& nmea) {
numGnssNmeaCb++;
if (!outputEnabled) {
return;
}
printf("<<< onGnssNmeaCb cnt=%u time=%" PRIu64" nmea=%s",
numGnssNmeaCb, timestamp, nmea.c_str());
}
static void onGnssDataCb(const location_client::GnssData& gnssData) {
numDataCb++;
if (!outputEnabled) {
return;
}
printf("<<< gnssDataCb cnt=%u, %s ", numDataCb, gnssData.toString().c_str());
}
static void onGnssMeasurementsCb(const location_client::GnssMeasurements& gnssMeasurements) {
numGnssMeasurementsCb++;
if (!outputEnabled) {
return;
}
printf("<<< onGnssMeasurementsCb cnt=%u, num of meas %d\n", numGnssMeasurementsCb,
gnssMeasurements.measurements.size());
}
static void onConfigResponseCb(location_integration::LocConfigTypeEnum requestType,
location_integration::LocIntegrationResponse response) {
printf("<<< onConfigResponseCb, type %d, err %d\n", requestType, response);
}
static void onGetRobustLocationConfigCb(RobustLocationConfig robustLocationConfig) {
printf("<<< onGetRobustLocationConfigCb, valid flags 0x%x, enabled %d, enabledForE911 %d, "
"version (major %u, minor %u)\n",
robustLocationConfig.validMask, robustLocationConfig.enabled,
robustLocationConfig.enabledForE911, robustLocationConfig.version.major,
robustLocationConfig.version.minor);
}
static void onGetMinGpsWeekCb(uint16_t minGpsWeek) {
printf("<<< onGetMinGpsWeekCb, minGpsWeek %d\n", minGpsWeek);
}
static void onGetMinSvElevationCb(uint8_t minSvElevation) {
printf("<<< onGetMinSvElevationCb, minSvElevationAngleSetting: %d\n", minSvElevation);
}
static void onGetSecondaryBandConfigCb(const ConstellationSet& secondaryBandDisablementSet) {
for (GnssConstellationType disabledSecondaryBand : secondaryBandDisablementSet) {
printf("<<< disabled secondary band for constellation %d\n", disabledSecondaryBand);
}
}
static void printHelp() {
printf("\n************* options *************\n");
printf("e: Concurrent engine report session with 100 ms interval\n");
printf("g: Gnss report session with 100 ms interval\n");
printf("u: Update a session with 2000 ms interval\n");
printf("m: Interleaving fix session with 1000 and 2000 ms interval, change every 3 seconds\n");
printf("s: Stop a session \n");
printf("p: Ping test\n");
printf("q: Quit\n");
printf("r: delete client\n");
printf("%s supress output from various reports: disable output\n", DISABLE_REPORT_OUTPUT);
printf("%s enable output from various reports: disable output\n", ENABLE_REPORT_OUTPUT);
printf("%s tuncThreshold energyBudget: enable tunc\n", ENABLE_TUNC);
printf("%s: disable tunc\n", DISABLE_TUNC);
printf("%s: enable PACE\n", ENABLE_PACE);
printf("%s: disable PACE\n", DISABLE_PACE);
printf("%s: reset sv config to default\n", RESET_SV_CONFIG);
printf("%s: configure sv \n", CONFIG_SV);
printf("%s: configure secondary band\n", CONFIG_SECONDARY_BAND);
printf("%s: get secondary band configure \n", GET_SECONDARY_BAND_CONFIG);
printf("%s: mulitple config SV \n", MULTI_CONFIG_SV);
printf("%s: delete all aiding data\n", DELETE_ALL);
printf("%s: delete ephemeris/calibration data\n", DELETE_AIDING_DATA);
printf("%s: config lever arm\n", CONFIG_LEVER_ARM);
printf("%s: config robust location\n", CONFIG_ROBUST_LOCATION);
printf("%s: get robust location config\n", GET_ROBUST_LOCATION_CONFIG);
printf("%s: set min gps week\n", CONFIG_MIN_GPS_WEEK);
printf("%s: get min gps week\n", GET_MIN_GPS_WEEK);
printf("%s: config DR engine\n", CONFIG_DR_ENGINE);
printf("%s: set min sv elevation angle\n", CONFIG_MIN_SV_ELEVATION);
printf("%s: get min sv elevation angle\n", GET_MIN_SV_ELEVATION);
printf("%s: config engine run state\n", CONFIG_ENGINE_RUN_STATE);
printf("%s: set user consent for terrestrial positioning 0/1\n", SET_USER_CONSENT);
printf("%s: get single shot wwan fix\n", GET_SINGLE_GTP_WWAN_FIX);
}
void setRequiredPermToRunAsLocClient() {
#ifdef USE_GLIB
if (0 == getuid()) {
char groupNames[LOC_MAX_PARAM_NAME] = "diag locclient";
printf("group ids: diag locclient\n");
gid_t groupIds[LOC_PROCESS_MAX_NUM_GROUPS] = {};
char *splitGrpString[LOC_PROCESS_MAX_NUM_GROUPS];
int numGrps = loc_util_split_string(groupNames, splitGrpString,
LOC_PROCESS_MAX_NUM_GROUPS, ' ');
int numGrpIds=0;
for (int i = 0; i < numGrps; i++) {
struct group* grp = getgrnam(splitGrpString[i]);
if (grp) {
groupIds[numGrpIds] = grp->gr_gid;
printf("Group %s = %d\n", splitGrpString[i], groupIds[numGrpIds]);
numGrpIds++;
}
}
if (0 != numGrpIds) {
if (-1 == setgroups(numGrpIds, groupIds)) {
printf("Error: setgroups failed %s", strerror(errno));
}
}
// Set the group id first and then set the effective userid, to locclient.
if (-1 == setgid(GID_LOCCLIENT)) {
printf("Error: setgid failed. %s", strerror(errno));
}
// Set user id to locclient
if (-1 == setuid(UID_LOCCLIENT)) {
printf("Error: setuid failed. %s", strerror(errno));
}
// Set capabilities
struct __user_cap_header_struct cap_hdr = {};
cap_hdr.version = _LINUX_CAPABILITY_VERSION;
cap_hdr.pid = getpid();
if (prctl(PR_SET_KEEPCAPS, 1) < 0) {
printf("Error: prctl failed. %s", strerror(errno));
}
// Set access to CAP_NET_BIND_SERVICE
struct __user_cap_data_struct cap_data = {};
cap_data.permitted = (1 << CAP_NET_BIND_SERVICE);
cap_data.effective = cap_data.permitted;
printf("cap_data.permitted: %d", (int)cap_data.permitted);
if (capset(&cap_hdr, &cap_data)) {
printf("Error: capset failed. %s", strerror(errno));
}
} else {
printf("Test app started as user: %d", getuid());
}
#endif// USE_GLIB
}
void parseSVConfig(char* buf, bool & resetConstellation,
LocConfigBlacklistedSvIdList &svList) {
static char *save = nullptr;
char* token = strtok_r(buf, " ", &save); // skip first one of "configSV"
token = strtok_r(NULL, " ", &save);
if (token == nullptr) {
printf("empty sv blacklist\n");
return;
}
if (strncmp(token, "reset", strlen("reset")) == 0) {
resetConstellation = true;
printf("reset sv constellation\n");
return;
}
while (token != nullptr) {
GnssSvIdInfo svIdInfo = {};
svIdInfo.constellation = (GnssConstellationType) atoi(token);
token = strtok_r(NULL, " ", &save);
if (token == NULL) {
break;
}
svIdInfo.svId = atoi(token);
svList.push_back(svIdInfo);
token = strtok_r(NULL, " ", &save);
}
printf("parse sv config:\n");
for (GnssSvIdInfo it : svList) {
printf("\t\tblacklisted SV: %d, sv id %d\n", (int) it.constellation, it.svId);
}
}
void parseSecondaryBandConfig(char* buf, bool &nullSecondaryBandConfig,
ConstellationSet& secondaryBandDisablementSet) {
static char *save = nullptr;
char* token = strtok_r(buf, " ", &save); // skip first one of "configSeconaryBand"
token = strtok_r(NULL, " ", &save);
if (token == nullptr) {
printf("empty secondary band disablement set\n");
return;
}
if (strncmp(token, "null", strlen("null")) == 0) {
nullSecondaryBandConfig = true;
printf("null secondary band disablement set\n");
return;
}
while (token != nullptr) {
GnssConstellationType secondaryBandDisabled = (GnssConstellationType) atoi(token);
secondaryBandDisablementSet.emplace(secondaryBandDisabled);
token = strtok_r(NULL, " ", &save);
}
printf("\t\tnull SecondaryBandConfig %d\n", nullSecondaryBandConfig);
for (GnssConstellationType disabledSecondaryBand : secondaryBandDisablementSet) {
printf("\t\tdisabled secondary constellation %d\n", disabledSecondaryBand);
}
}
void parseLeverArm (char* buf, LeverArmParamsMap &leverArmMap) {
static char *save = nullptr;
char* token = strtok_r(buf, " ", &save); // skip first one of "configLeverArm"
token = strtok_r(NULL, " ", &save);
while (token != nullptr) {
LeverArmParams leverArm = {};
LeverArmType type = (LeverArmType) 0;
if (strcmp(token, "vrp") == 0) {
type = location_integration::LEVER_ARM_TYPE_GNSS_TO_VRP;
} else if (strcmp(token, "drimu") == 0) {
type = location_integration::LEVER_ARM_TYPE_DR_IMU_TO_GNSS;
} else if (strcmp(token, "veppimu") == 0) {
type = location_integration::LEVER_ARM_TYPE_VEPP_IMU_TO_GNSS;
} else {
break;
}
token = strtok_r(NULL, " ", &save);
if (token == NULL) {
break;
}
leverArm.forwardOffsetMeters = atof(token);
token = strtok_r(NULL, " ", &save);
if (token == NULL) {
break;
}
leverArm.sidewaysOffsetMeters = atof(token);
token = strtok_r(NULL, " ", &save);
if (token == NULL) {
break;
}
leverArm.upOffsetMeters = atof(token);
printf("type %d, %f %f %f\n", type, leverArm.forwardOffsetMeters,
leverArm.sidewaysOffsetMeters, leverArm.upOffsetMeters);
leverArmMap.emplace(type, leverArm);
token = strtok_r(NULL, " ", &save);
}
}
void parseDreConfig (char* buf, DeadReckoningEngineConfig& dreConfig) {
static char *save = nullptr;
char* token = strtok_r(buf, " ", &save); // skip first one of "configDrEngine"
printf("Usage: configDrEngine b2s roll pitch yaw unc speed scaleFactor scaleFactorUnc "
"gyro scaleFactor ScaleFactorUnc\n");
uint32_t validMask = 0;
do {
token = strtok_r(NULL, " ", &save);
if (token == NULL) {
printf("missing key word b2s, speed, or gyro\n");
break;
}
if (strncmp(token, "b2s", strlen("b2s"))==0) {
token = strtok_r(NULL, " ", &save); // skip the token of "b2s"
if (token == NULL) {
printf("missing roll offset\n");
break;
}
dreConfig.bodyToSensorMountParams.rollOffset = atof(token);
token = strtok_r(NULL, " ", &save);
if (token == NULL) {
printf("missing pitch offset\n");
break;
}
dreConfig.bodyToSensorMountParams.pitchOffset = atof(token);
token = strtok_r(NULL, " ", &save);
if (token == NULL) {
printf("missing yaw offset\n");
break;
}
dreConfig.bodyToSensorMountParams.yawOffset = atof(token);
token = strtok_r(NULL, " ", &save);
if (token == NULL) {
printf("missing offset uncertainty\n");
break;
}
dreConfig.bodyToSensorMountParams.offsetUnc = atof(token);
validMask |= BODY_TO_SENSOR_MOUNT_PARAMS_VALID;
} else if (strncmp(token, "speed", strlen("speed"))==0) {
token = strtok_r(NULL, " ", &save);
if (token == NULL) {
printf("missing speed scale factor\n");
break;
}
dreConfig.vehicleSpeedScaleFactor = atof(token);
validMask |= VEHICLE_SPEED_SCALE_FACTOR_VALID;
token = strtok_r(NULL, " ", &save);
if (token == NULL) {
printf("missing speed scale factor uncertainty\n");
break;
}
dreConfig.vehicleSpeedScaleFactorUnc = atof(token);
validMask |= VEHICLE_SPEED_SCALE_FACTOR_UNC_VALID;
} else if (strncmp(token, "gyro", strlen("gyro"))==0) {
token = strtok_r(NULL, " ", &save);
if (token == NULL) {
printf("missing gyro scale factor\n");
break;
}
dreConfig.gyroScaleFactor = atof(token);
validMask |= GYRO_SCALE_FACTOR_VALID;
token = strtok_r(NULL, " ", &save);
if (token == NULL) {
printf("missing gyro scale factor uncertainty\n");
break;
}
dreConfig.gyroScaleFactorUnc = atof(token);
validMask |= GYRO_SCALE_FACTOR_UNC_VALID;
}
} while (1);
dreConfig.validMask = (DeadReckoningEngineConfigValidMask)validMask;
}
/******************************************************************************
Main function
******************************************************************************/
static void checkForAutoStart(int argc, char *argv[]) {
// check for auto-start option
if (argc >= 2) {
if (strncmp (argv[1], "auto", strlen("auto")) == 0) {
printf("usage: location_clientapi_test_app auto");
uint32_t pid = (uint32_t)getpid();
LocationClientApi* pClient = new LocationClientApi(onCapabilitiesCb);
if (nullptr == pClient) {
printf("can not create Location client API");
exit(1);
}
bool cleanup = false;
if (argc >= 3) {
if (strncmp (argv[2], "clean", strlen("clean")) == 0) {
cleanup = true;
}
}
// wait for capability to come
sleep(1);
EngineReportCbs reportcbs;
reportcbs.engLocationsCallback = EngineLocationsCb(onEngLocationsCb);
reportcbs.gnssSvCallback = GnssSvCb(onGnssSvCb);
reportcbs.gnssNmeaCallback = GnssNmeaCb(onGnssNmeaCb);
LocReqEngineTypeMask reqEngMask = (LocReqEngineTypeMask)
(LOC_REQ_ENGINE_FUSED_BIT|LOC_REQ_ENGINE_SPE_BIT|
LOC_REQ_ENGINE_PPE_BIT);
pClient->startPositionSession(100, reqEngMask, reportcbs, onResponseCb);
// wait for fix report to come
sleep(2);
while (numEngLocationCb < 10) {
sleep(3);
printf("pid %u, recevied %d report\n", pid, numEngLocationCb);
}
printf("pid %u, recevied %d report\n", pid, numEngLocationCb);
if (pClient && cleanup) {
printf("calling stopPosition and delete client \n");
pClient->stopPositionSession();
delete pClient;
sleep(1);
}
exit(0);
}
}
}
int main(int argc, char *argv[]) {
setRequiredPermToRunAsLocClient();
checkForAutoStart(argc, argv);
// create Location client API
LocationClientApi* pClient = new LocationClientApi(onCapabilitiesCb);
if (!pClient) {
printf("failed to create client, return");
return -1;;
}
// callbacks
GnssReportCbs reportcbs;
reportcbs.gnssLocationCallback = GnssLocationCb(onGnssLocationCb);
reportcbs.gnssSvCallback = GnssSvCb(onGnssSvCb);
reportcbs.gnssNmeaCallback = GnssNmeaCb(onGnssNmeaCb);
// callbacks
EngineReportCbs enginecbs;
enginecbs.engLocationsCallback = EngineLocationsCb(onEngLocationsCb);
enginecbs.gnssSvCallback = GnssSvCb(onGnssSvCb);
enginecbs.gnssNmeaCallback = GnssNmeaCb(onGnssNmeaCb);
enginecbs.gnssMeasurementsCallback = GnssMeasurementsCb(onGnssMeasurementsCb);
enginecbs.gnssDataCallback = GnssDataCb(onGnssDataCb);
// create location integratin API
LocIntegrationCbs intCbs;
intCbs.configCb = LocConfigCb(onConfigResponseCb);
intCbs.getRobustLocationConfigCb =
LocConfigGetRobustLocationConfigCb(onGetRobustLocationConfigCb);
intCbs.getMinGpsWeekCb = LocConfigGetMinGpsWeekCb(onGetMinGpsWeekCb);
intCbs.getMinSvElevationCb = LocConfigGetMinSvElevationCb(onGetMinSvElevationCb);
intCbs.getConstellationSecondaryBandConfigCb =
LocConfigGetConstellationSecondaryBandConfigCb(onGetSecondaryBandConfigCb);
LocConfigPriorityMap priorityMap;
location_integration::LocationIntegrationApi* pIntClient =
new LocationIntegrationApi(priorityMap, intCbs);
printHelp();
sleep(1); // wait for capability callback if you don't like sleep
// main loop
while (1) {
char buf[300];
memset (buf, 0, sizeof(buf));
fgets(buf, sizeof(buf), stdin);
printf("execute command %s\n", buf);
if (!pIntClient) {
pIntClient =
new LocationIntegrationApi(priorityMap, intCbs);
if (nullptr == pIntClient) {
printf("failed to create integration client\n");
break;
}
sleep(1); // wait for capability callback if you don't like sleep
}
if (strncmp(buf, ENABLE_REPORT_OUTPUT, strlen(ENABLE_REPORT_OUTPUT)) == 0) {
outputEnabled = true;
} else if (strncmp(buf, DISABLE_REPORT_OUTPUT, strlen(DISABLE_REPORT_OUTPUT)) == 0) {
outputEnabled = false;
} else if (strncmp(buf, DISABLE_TUNC, strlen(DISABLE_TUNC)) == 0) {
pIntClient->configConstrainedTimeUncertainty(false);
} else if (strncmp(buf, ENABLE_TUNC, strlen(ENABLE_TUNC)) == 0) {
// get tuncThreshold and energyBudget from the command line
static char *save = nullptr;
float tuncThreshold = 0.0;
int energyBudget = 0;
char* token = strtok_r(buf, " ", &save); // skip first one
token = strtok_r(NULL, " ", &save);
if (token != NULL) {
tuncThreshold = atof(token);
token = strtok_r(NULL, " ", &save);
if (token != NULL) {
energyBudget = atoi(token);
}
}
printf("tuncThreshold %f, energyBudget %d\n", tuncThreshold, energyBudget);
pIntClient->configConstrainedTimeUncertainty(
true, tuncThreshold, energyBudget);
} else if (strncmp(buf, DISABLE_PACE, strlen(DISABLE_TUNC)) == 0) {
pIntClient->configPositionAssistedClockEstimator(false);
} else if (strncmp(buf, ENABLE_PACE, strlen(ENABLE_TUNC)) == 0) {
pIntClient->configPositionAssistedClockEstimator(true);
} else if (strncmp(buf, DELETE_ALL, strlen(DELETE_ALL)) == 0) {
pIntClient->deleteAllAidingData();
} else if (strncmp(buf, DELETE_AIDING_DATA, strlen(DELETE_AIDING_DATA)) == 0) {
uint32_t aidingDataMask = 0;
printf("deleteAidingData 1 (eph) 2 (qdr calibration data) 3 (eph+calibraiton dat)\n");
static char *save = nullptr;
char* token = strtok_r(buf, " ", &save); // skip first one
token = strtok_r(NULL, " ", &save);
if (token != NULL) {
aidingDataMask = atoi(token);
}
pIntClient->deleteAidingData((AidingDataDeletionMask) aidingDataMask);
} else if (strncmp(buf, RESET_SV_CONFIG, strlen(RESET_SV_CONFIG)) == 0) {
pIntClient->configConstellations(nullptr);
} else if (strncmp(buf, CONFIG_SV, strlen(CONFIG_SV)) == 0) {
bool resetConstellation = false;
LocConfigBlacklistedSvIdList svList;
LocConfigBlacklistedSvIdList* svListPtr = &svList;
parseSVConfig(buf, resetConstellation, svList);
if (resetConstellation) {
svListPtr = nullptr;
}
pIntClient->configConstellations(svListPtr);
} else if (strncmp(buf, CONFIG_SECONDARY_BAND, strlen(CONFIG_SECONDARY_BAND)) == 0) {
bool nullSecondaryConfig = false;
ConstellationSet secondaryBandDisablementSet;
ConstellationSet* secondaryBandDisablementSetPtr = &secondaryBandDisablementSet;
parseSecondaryBandConfig(buf, nullSecondaryConfig, secondaryBandDisablementSet);
if (nullSecondaryConfig) {
secondaryBandDisablementSetPtr = nullptr;
printf("setting secondary band config to null\n");
}
pIntClient->configConstellationSecondaryBand(secondaryBandDisablementSetPtr);
} else if (strncmp(buf, GET_SECONDARY_BAND_CONFIG,
strlen(GET_SECONDARY_BAND_CONFIG)) == 0) {
pIntClient->getConstellationSecondaryBandConfig();
} else if (strncmp(buf, MULTI_CONFIG_SV, strlen(MULTI_CONFIG_SV)) == 0) {
// reset
pIntClient->configConstellations(nullptr);
// disable GAL
LocConfigBlacklistedSvIdList galSvList;
GnssSvIdInfo svIdInfo = {};
svIdInfo.constellation = GNSS_CONSTELLATION_TYPE_GALILEO;
svIdInfo.svId = 0;
galSvList.push_back(svIdInfo);
pIntClient->configConstellations(&galSvList);
// disable SBAS
LocConfigBlacklistedSvIdList sbasSvList;
svIdInfo.constellation = GNSS_CONSTELLATION_TYPE_SBAS;
svIdInfo.svId = 0;
sbasSvList.push_back(svIdInfo);
pIntClient->configConstellations(&sbasSvList);
} else if (strncmp(buf, CONFIG_LEVER_ARM, strlen(CONFIG_LEVER_ARM)) == 0) {
LeverArmParamsMap configInfo;
parseLeverArm(buf, configInfo);
pIntClient->configLeverArm(configInfo);
} else if (strncmp(buf, CONFIG_ROBUST_LOCATION, strlen(CONFIG_ROBUST_LOCATION)) == 0) {
// get enable and enableForE911
static char *save = nullptr;
bool enable = false;
bool enableForE911 = false;
// skip first argument of configRobustLocation
char* token = strtok_r(buf, " ", &save);
token = strtok_r(NULL, " ", &save);
if (token != NULL) {
enable = (atoi(token) == 1);
token = strtok_r(NULL, " ", &save);
if (token != NULL) {
enableForE911 = (atoi(token) == 1);
}
}
printf("enable %d, enableForE911 %d\n", enable, enableForE911);
pIntClient->configRobustLocation(enable, enableForE911);
} else if (strncmp(buf, GET_ROBUST_LOCATION_CONFIG,
strlen(GET_ROBUST_LOCATION_CONFIG)) == 0) {
pIntClient->getRobustLocationConfig();
} else if (strncmp(buf, CONFIG_MIN_GPS_WEEK, strlen(CONFIG_MIN_GPS_WEEK)) == 0) {
static char *save = nullptr;
uint16_t gpsWeekNum = 0;
// skip first argument of configMinGpsWeek
char* token = strtok_r(buf, " ", &save);
token = strtok_r(NULL, " ", &save);
if (token != NULL) {
gpsWeekNum = (uint16_t) atoi(token);
}
printf("gps week num %d\n", gpsWeekNum);
pIntClient->configMinGpsWeek(gpsWeekNum);
} else if (strncmp(buf, GET_MIN_GPS_WEEK, strlen(GET_MIN_GPS_WEEK)) == 0) {
pIntClient->getMinGpsWeek();
} else if (strncmp(buf, CONFIG_DR_ENGINE, strlen(CONFIG_DR_ENGINE)) == 0) {
DeadReckoningEngineConfig dreConfig = {};
parseDreConfig(buf, dreConfig);
printf("mask 0x%x, roll %f, speed %f, yaw %f\n", dreConfig.validMask,
dreConfig.bodyToSensorMountParams.rollOffset, dreConfig.vehicleSpeedScaleFactor,
dreConfig.gyroScaleFactor);
pIntClient->configDeadReckoningEngineParams(dreConfig);
} else if (strncmp(buf, CONFIG_MIN_SV_ELEVATION, strlen(CONFIG_MIN_SV_ELEVATION)) == 0) {
static char *save = nullptr;
uint8_t minSvElevation = 0;
// skip first argument of configMinSvElevation
char* token = strtok_r(buf, " ", &save);
token = strtok_r(NULL, " ", &save);
if (token != NULL) {
minSvElevation = (uint16_t) atoi(token);
}
printf("min Sv elevation %d\n", minSvElevation);
pIntClient->configMinSvElevation(minSvElevation);
} else if (strncmp(buf, GET_MIN_SV_ELEVATION, strlen(GET_MIN_SV_ELEVATION)) == 0) {
pIntClient->getMinSvElevation();
} else if (strncmp(buf, CONFIG_ENGINE_RUN_STATE, strlen(CONFIG_ENGINE_RUN_STATE)) == 0) {
printf("%s 3(DRE) 1(pause)/2(resume)", CONFIG_ENGINE_RUN_STATE);
static char *save = nullptr;
LocIntegrationEngineType engType = (LocIntegrationEngineType)0;
LocIntegrationEngineRunState engState = (LocIntegrationEngineRunState) 0;
// skip first argument of configEngineRunState
char* token = strtok_r(buf, " ", &save);
token = strtok_r(NULL, " ", &save);
if (token != NULL) {
engType = (LocIntegrationEngineType) atoi(token);
token = strtok_r(NULL, " ", &save);
if (token != NULL) {
engState = (LocIntegrationEngineRunState) atoi(token);
}
}
printf("eng type %d, eng state %d\n", engType, engState);
bool retVal = pIntClient->configEngineRunState(engType, engState);
printf("configEngineRunState returned %d\n", retVal);
} else if (strncmp(buf, SET_USER_CONSENT, strlen(SET_USER_CONSENT)) == 0) {
static char *save = nullptr;
bool userConsent = false;
char* token = strtok_r(buf, " ", &save);
token = strtok_r(NULL, " ", &save);
if (token != NULL) {
userConsent = (atoi(token) != 0);
}
printf("userConsent %d\n", userConsent);
pIntClient->setUserConsentForTerrestrialPositioning(userConsent);
} else if (strncmp(buf, GET_SINGLE_GTP_WWAN_FIX, strlen(GET_SINGLE_GTP_WWAN_FIX)) == 0) {
static char *save = nullptr;
uint32_t timeoutMsec = 0;
float horQoS = 0.0;
uint32_t techMask = 0x0;
// skip first argument
char* token = strtok_r(buf, " ", &save);
// get timeout
token = strtok_r(NULL, " ", &save);
if (token != NULL) {
timeoutMsec = atoi(token);
}
// get qos
token = strtok_r(NULL, " ", &save);
if (token != NULL) {
horQoS = atof(token);
}
// tech mask
token = strtok_r(NULL, " ", &save);
if (token != NULL) {
techMask = atoi(token);
}
printf("timeout msec %d, horQoS %f, techMask 0x%x\n", timeoutMsec, horQoS, techMask);
if (!pClient) {
pClient = new LocationClientApi(onCapabilitiesCb);
}
pClient->getSingleTerrestrialPosition(timeoutMsec, (TerrestrialTechnologyMask) techMask,
horQoS, onGtpLocationCb, onGtpResponseCb);
} else {
int command = buf[0];
switch(command) {
case 'e':
if (!pClient) {
pClient = new LocationClientApi(onCapabilitiesCb);
}
if (pClient) {
LocReqEngineTypeMask reqEngMask = (LocReqEngineTypeMask)
(LOC_REQ_ENGINE_FUSED_BIT|LOC_REQ_ENGINE_SPE_BIT|
LOC_REQ_ENGINE_PPE_BIT);
pClient->startPositionSession(100, reqEngMask, enginecbs, onResponseCb);
}
break;
case 'g':
if (!pClient) {
pClient = new LocationClientApi(onCapabilitiesCb);
}
if (pClient) {
pClient->startPositionSession(100, reportcbs, onResponseCb);
}
break;
case 'u':
if (!pClient) {
pClient = new LocationClientApi(onCapabilitiesCb);
}
if (pClient) {
pClient->startPositionSession(2000, reportcbs, onResponseCb);
}
break;
case 's':
if (pClient) {
pClient->stopPositionSession();
delete pClient;
pClient = NULL;
}
break;
case 'm':
if (!pClient) {
pClient = new LocationClientApi(onCapabilitiesCb);
}
if (pClient) {
int i = 0;
do {
if (i%2 == 0) {
pClient->startPositionSession(2000, reportcbs, onResponseCb);
} else {
pClient->startPositionSession(1000, reportcbs, onResponseCb);
}
i++;
sleep(3);
} while (1);
}
break;
case 'r':
if (nullptr != pClient) {
delete pClient;
pClient = nullptr;
}
if (nullptr != pIntClient) {
delete pIntClient;
pIntClient = nullptr;
}
break;
case 'q':
goto EXIT;
break;
default:
printf("unknown command %s\n", buf);
break;
}
}
}//while(1)
EXIT:
if (nullptr != pClient) {
delete pClient;
}
if (nullptr != pIntClient) {
delete pIntClient;
}
printf("Done\n");
return 0;
}

File diff suppressed because it is too large Load diff

View file

@ -1,57 +0,0 @@
AM_CFLAGS = \
-DDEBUG \
-I src/ \
-I inc/ \
$(GPSUTILS_CFLAGS) \
$(LOCAPIMSGPROTO_CFLAGS) \
-std=c++11
ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS = -std=c++11
requiredlibs = \
$(GPSUTILS_LIBS) \
$(LOCAPIMSGPROTO_LIBS) \
-lprotobuf
h_sources = \
src/LocationIntegrationApiImpl.h \
inc/LocationIntegrationApi.h
c_sources = \
src/LocationIntegrationApiImpl.cpp \
src/LocationIntegrationApi.cpp
liblocation_integration_api_la_SOURCES = \
$(c_sources) $(h_sources)
liblocation_integration_api_la_h_sources = $(h_sources)
######################
# Build location_integration_api
######################
if USE_EXTERNAL_AP
AM_CFLAGS += $(LOCSOCKET_CFLAGS) -DFEATURE_EXTERNAL_AP
requiredlibs += $(LOCSOCKET_LIBS)
endif
if USE_GLIB
liblocation_integration_api_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
liblocation_integration_api_la_LDFLAGS = -lstdc++ -g -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
liblocation_integration_api_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
else
liblocation_integration_api_la_CFLAGS = $(AM_CFLAGS)
liblocation_integration_api_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread -shared -version-info 1:0:0
liblocation_integration_api_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
endif
liblocation_integration_api_la_LIBADD = $(requiredlibs) -lstdc++ -ldl
#Create and Install libraries
library_include_HEADERS = $(h_sources)
lib_LTLIBRARIES = liblocation_integration_api.la
library_includedir = $(pkgincludedir)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = location-integration-api.pc
EXTRA_DIST = $(pkgconfig_DATA)

View file

@ -1,11 +0,0 @@
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.

View file

@ -1,72 +0,0 @@
# configure.ac -- Autoconf script for gps location-integration-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_integration_api package version 1.0.0
AC_INIT([location-integration-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], [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_CONFIG_FILES([ \
Makefile \
location-integration-api.pc
])
AC_OUTPUT

File diff suppressed because it is too large Load diff

View file

@ -1,38 +0,0 @@
/* Copyright (c) 2019 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.
*/
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: location-integration-api
Description: location integration api library
Version: @VERSION@
Libs: -L${libdir} -llocation_integration_api
Cflags: -I${includedir} -I${includedir}/location-integration-api

View file

@ -1,86 +0,0 @@
#!/bin/bash
#==========================================================================
#Copyright (c) 2018-2019, 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:
# mkintegrationapidoc.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 LocationIntegrationApiDoxygen.conf
CONFIG=$DIR/LocationIntegrationApiDoxygen.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"

View file

@ -1,560 +0,0 @@
/* Copyright (c) 2019-2020 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.
*/
#define LOG_TAG "LocSvc_LocationIntegrationApi"
#include <LocationDataTypes.h>
#include <LocationIntegrationApi.h>
#include <LocationIntegrationApiImpl.h>
#include <log_util.h>
#include <loc_pla.h>
namespace location_integration {
/******************************************************************************
LocationIntegrationApi
******************************************************************************/
LocationIntegrationApi::LocationIntegrationApi(
const LocConfigPriorityMap& priorityMap,
LocIntegrationCbs& integrationCbs) {
mApiImpl = new LocationIntegrationApiImpl(integrationCbs);
}
LocationIntegrationApi::~LocationIntegrationApi() {
LOC_LOGd("calling destructor of LocationIntegrationApi");
if (mApiImpl) {
mApiImpl->destroy();
}
}
bool LocationIntegrationApi::configConstellations(
const LocConfigBlacklistedSvIdList* blacklistedSvIds){
if (nullptr == mApiImpl) {
LOC_LOGe ("NULL mApiImpl");
return false;
}
GnssSvTypeConfig constellationEnablementConfig = {};
GnssSvIdConfig blacklistSvConfig = {};
if (nullptr == blacklistedSvIds) {
// set size field in constellationEnablementConfig to 0 to indicate
// to restore to modem default
constellationEnablementConfig.size = 0;
// all fields in blacklistSvConfig has already been initialized to 0
blacklistSvConfig.size = sizeof(GnssSvIdConfig);
} else {
constellationEnablementConfig.size = sizeof(constellationEnablementConfig);
constellationEnablementConfig.enabledSvTypesMask =
GNSS_SV_TYPES_MASK_GLO_BIT|GNSS_SV_TYPES_MASK_BDS_BIT|
GNSS_SV_TYPES_MASK_QZSS_BIT|GNSS_SV_TYPES_MASK_GAL_BIT;
blacklistSvConfig.size = sizeof(GnssSvIdConfig);
for (GnssSvIdInfo it : *blacklistedSvIds) {
LOC_LOGv("constellation %d, sv id %f", (int) it.constellation, it.svId);
GnssSvTypesMask svTypeMask = (GnssSvTypesMask) 0;
uint64_t* svMaskPtr = NULL;
GnssSvId initialSvId = 0;
uint16_t svIndexOffset = 0;
switch (it.constellation) {
case GNSS_CONSTELLATION_TYPE_GLONASS:
svTypeMask = (GnssSvTypesMask) GNSS_SV_TYPES_MASK_GLO_BIT;
svMaskPtr = &blacklistSvConfig.gloBlacklistSvMask;
initialSvId = GNSS_SV_CONFIG_GLO_INITIAL_SV_ID;
break;
case GNSS_CONSTELLATION_TYPE_QZSS:
svTypeMask = (GnssSvTypesMask) GNSS_SV_TYPES_MASK_QZSS_BIT;
svMaskPtr = &blacklistSvConfig.qzssBlacklistSvMask;
initialSvId = GNSS_SV_CONFIG_QZSS_INITIAL_SV_ID;
break;
case GNSS_CONSTELLATION_TYPE_BEIDOU:
svTypeMask = (GnssSvTypesMask) GNSS_SV_TYPES_MASK_BDS_BIT;
svMaskPtr = &blacklistSvConfig.bdsBlacklistSvMask;
initialSvId = GNSS_SV_CONFIG_BDS_INITIAL_SV_ID;
break;
case GNSS_CONSTELLATION_TYPE_GALILEO:
svTypeMask = (GnssSvTypesMask) GNSS_SV_TYPES_MASK_GAL_BIT;
svMaskPtr = &blacklistSvConfig.galBlacklistSvMask;
initialSvId = GNSS_SV_CONFIG_GAL_INITIAL_SV_ID;
break;
case GNSS_CONSTELLATION_TYPE_SBAS:
// SBAS does not support enable/disable whole constellation
// so do not set up svTypeMask for SBAS
svMaskPtr = &blacklistSvConfig.sbasBlacklistSvMask;
// SBAS currently has two ranges
// range of SV id: 183 to 191
if (GNSS_SV_ID_BLACKLIST_ALL == it.svId) {
LOC_LOGd("blacklist all SBAS SV");
} else if (it.svId >= GNSS_SV_CONFIG_SBAS_INITIAL2_SV_ID) {
initialSvId = GNSS_SV_CONFIG_SBAS_INITIAL2_SV_ID;
svIndexOffset = GNSS_SV_CONFIG_SBAS_INITIAL_SV_LENGTH;
} else if ((it.svId >= GNSS_SV_CONFIG_SBAS_INITIAL_SV_ID) &&
(it.svId < (GNSS_SV_CONFIG_SBAS_INITIAL_SV_ID +
GNSS_SV_CONFIG_SBAS_INITIAL_SV_LENGTH))){
// range of SV id: 120 to 158
initialSvId = GNSS_SV_CONFIG_SBAS_INITIAL_SV_ID;
} else {
LOC_LOGe("invalid SBAS sv id %d", it.svId);
svMaskPtr = nullptr;
}
break;
case GNSS_CONSTELLATION_TYPE_NAVIC:
svTypeMask = (GnssSvTypesMask) GNSS_SV_TYPES_MASK_NAVIC_BIT;
svMaskPtr = &blacklistSvConfig.navicBlacklistSvMask;
initialSvId = GNSS_SV_CONFIG_NAVIC_INITIAL_SV_ID;
break;
default:
LOC_LOGe("blacklistedSv in constellation %d not supported", it.constellation);
break;
}
if (nullptr == svMaskPtr) {
LOC_LOGe("Invalid constellation %d", it.constellation);
} else {
// SV ID 0 = Blacklist All SVs
if (GNSS_SV_ID_BLACKLIST_ALL == it.svId) {
// blacklist all SVs in this constellation
*svMaskPtr = GNSS_SV_CONFIG_ALL_BITS_ENABLED_MASK;
constellationEnablementConfig.enabledSvTypesMask &= ~svTypeMask;
constellationEnablementConfig.blacklistedSvTypesMask |= svTypeMask;
} else if (it.svId < initialSvId || it.svId >= initialSvId + 64) {
LOC_LOGe ("SV TYPE %d, Invalid sv id %d ", it.constellation, it.svId);
} else {
uint32_t shiftCnt = it.svId + svIndexOffset - initialSvId;
*svMaskPtr |= (1ULL << shiftCnt);
}
}
}
}
LOC_LOGd("constellation config size=%d, enabledMask=0x%" PRIx64 ", disabledMask=0x%" PRIx64 ", "
"glo blacklist mask =0x%" PRIx64 ", qzss blacklist mask =0x%" PRIx64 ", "
"bds blacklist mask =0x%" PRIx64 ", gal blacklist mask =0x%" PRIx64 ", "
"sbas blacklist mask =0x%" PRIx64 ", Navic blacklist mask =0x%" PRIx64 ", ",
constellationEnablementConfig.size, constellationEnablementConfig.enabledSvTypesMask,
constellationEnablementConfig.blacklistedSvTypesMask,
blacklistSvConfig.gloBlacklistSvMask, blacklistSvConfig.qzssBlacklistSvMask,
blacklistSvConfig.bdsBlacklistSvMask, blacklistSvConfig.galBlacklistSvMask,
blacklistSvConfig.sbasBlacklistSvMask, blacklistSvConfig.navicBlacklistSvMask);
mApiImpl->configConstellations(constellationEnablementConfig,
blacklistSvConfig);
return true;
}
bool LocationIntegrationApi::configConstellationSecondaryBand(
const ConstellationSet* secondaryBandDisablementSet) {
GnssSvTypeConfig secondaryBandConfig = {};
if (nullptr == mApiImpl) {
LOC_LOGe ("NULL mApiImpl");
return false;
}
if (nullptr != secondaryBandDisablementSet) {
for (GnssConstellationType disabledSecondaryBand : *secondaryBandDisablementSet) {
LOC_LOGd("to disable secondary band for constellation %d", disabledSecondaryBand);
secondaryBandConfig.enabledSvTypesMask =
(GNSS_SV_TYPES_MASK_GLO_BIT | GNSS_SV_TYPES_MASK_QZSS_BIT|
GNSS_SV_TYPES_MASK_BDS_BIT | GNSS_SV_TYPES_MASK_GAL_BIT|
GNSS_SV_TYPES_MASK_NAVIC_BIT | GNSS_SV_TYPES_MASK_GPS_BIT);
switch (disabledSecondaryBand) {
case GNSS_CONSTELLATION_TYPE_GLONASS:
secondaryBandConfig.blacklistedSvTypesMask |= GNSS_SV_TYPES_MASK_GLO_BIT;
break;
case GNSS_CONSTELLATION_TYPE_QZSS:
secondaryBandConfig.blacklistedSvTypesMask |= GNSS_SV_TYPES_MASK_QZSS_BIT;
break;
case GNSS_CONSTELLATION_TYPE_BEIDOU:
secondaryBandConfig.blacklistedSvTypesMask |= GNSS_SV_TYPES_MASK_BDS_BIT;
break;
case GNSS_CONSTELLATION_TYPE_GALILEO:
secondaryBandConfig.blacklistedSvTypesMask |= GNSS_SV_TYPES_MASK_GAL_BIT;
break;
case GNSS_CONSTELLATION_TYPE_NAVIC:
secondaryBandConfig.blacklistedSvTypesMask |= GNSS_SV_TYPES_MASK_NAVIC_BIT;
break;
case GNSS_CONSTELLATION_TYPE_GPS:
secondaryBandConfig.blacklistedSvTypesMask |= GNSS_SV_TYPES_MASK_GPS_BIT;
break;
default:
LOC_LOGd("disabled secondary band for constellation %d not suported",
disabledSecondaryBand);
break;
}
}
}
secondaryBandConfig.size = sizeof (secondaryBandConfig);
secondaryBandConfig.enabledSvTypesMask =
(GNSS_SV_TYPES_MASK_GLO_BIT | GNSS_SV_TYPES_MASK_BDS_BIT |
GNSS_SV_TYPES_MASK_QZSS_BIT | GNSS_SV_TYPES_MASK_GAL_BIT |
GNSS_SV_TYPES_MASK_NAVIC_BIT | GNSS_SV_TYPES_MASK_GPS_BIT);
secondaryBandConfig.enabledSvTypesMask ^= secondaryBandConfig.blacklistedSvTypesMask;
LOC_LOGd("secondary band config size=%d, enableMask=0x%" PRIx64 ", disabledMask=0x%" PRIx64 "",
secondaryBandConfig.size, secondaryBandConfig.enabledSvTypesMask,
secondaryBandConfig.blacklistedSvTypesMask);
mApiImpl->configConstellationSecondaryBand(secondaryBandConfig);
return true;
}
bool LocationIntegrationApi::getConstellationSecondaryBandConfig() {
if (mApiImpl) {
// mApiImpl->getConstellationSecondaryBandConfig returns
// none-zero when there is no callback registered in the contructor
return (mApiImpl->getConstellationSecondaryBandConfig() == 0);
} else {
LOC_LOGe ("NULL mApiImpl");
return false;
}
}
bool LocationIntegrationApi::configConstrainedTimeUncertainty(
bool enable, float tuncThreshold, uint32_t energyBudget) {
if (mApiImpl) {
LOC_LOGd("enable %d, tuncThreshold %f, energyBudget %u",
enable, tuncThreshold, energyBudget);
mApiImpl->configConstrainedTimeUncertainty(
enable, tuncThreshold, energyBudget);
return true;
} else {
LOC_LOGe ("NULL mApiImpl");
return false;
}
}
bool LocationIntegrationApi::configPositionAssistedClockEstimator(bool enable) {
if (mApiImpl) {
LOC_LOGd("enable %d", enable);
mApiImpl->configPositionAssistedClockEstimator(enable);
return true;
} else {
LOC_LOGe ("NULL mApiImpl");
return false;
}
}
bool LocationIntegrationApi::deleteAllAidingData() {
if (mApiImpl) {
GnssAidingData aidingData = {};
aidingData.deleteAll = true;
aidingData.posEngineMask = POSITION_ENGINE_MASK_ALL;
aidingData.sv.svTypeMask = GNSS_AIDING_DATA_SV_TYPE_MASK_ALL;
aidingData.sv.svMask |= GNSS_AIDING_DATA_SV_EPHEMERIS_BIT;
aidingData.dreAidingDataMask |= DR_ENGINE_AIDING_DATA_CALIBRATION_BIT;
mApiImpl->gnssDeleteAidingData(aidingData);
return true;
} else {
LOC_LOGe ("NULL mApiImpl");
return false;
}
}
bool LocationIntegrationApi::deleteAidingData(AidingDataDeletionMask aidingDataMask) {
if (mApiImpl) {
LOC_LOGd("aiding data mask 0x%x", aidingDataMask);
GnssAidingData aidingData = {};
aidingData.deleteAll = false;
if (aidingDataMask & AIDING_DATA_DELETION_EPHEMERIS) {
aidingData.sv.svTypeMask = GNSS_AIDING_DATA_SV_TYPE_MASK_ALL;
aidingData.sv.svMask |= GNSS_AIDING_DATA_SV_EPHEMERIS_BIT;
aidingData.posEngineMask = POSITION_ENGINE_MASK_ALL;
}
if (aidingDataMask & AIDING_DATA_DELETION_DR_SENSOR_CALIBRATION) {
aidingData.dreAidingDataMask |= DR_ENGINE_AIDING_DATA_CALIBRATION_BIT;
aidingData.posEngineMask |= DEAD_RECKONING_ENGINE;
}
mApiImpl->gnssDeleteAidingData(aidingData);
return true;
} else {
LOC_LOGe ("NULL mApiImpl");
return false;
}
}
bool LocationIntegrationApi::configLeverArm(const LeverArmParamsMap& configInfo) {
if (mApiImpl) {
LeverArmConfigInfo halLeverArmConfigInfo = {};
for (auto it = configInfo.begin(); it != configInfo.end(); ++it) {
::LeverArmParams* params = nullptr;
LeverArmTypeMask mask = (LeverArmTypeMask) 0;
switch (it->first){
case LEVER_ARM_TYPE_GNSS_TO_VRP:
mask = LEVER_ARM_TYPE_GNSS_TO_VRP_BIT;
params = &halLeverArmConfigInfo.gnssToVRP;
break;
case LEVER_ARM_TYPE_DR_IMU_TO_GNSS:
mask = LEVER_ARM_TYPE_DR_IMU_TO_GNSS_BIT;
params = &halLeverArmConfigInfo.drImuToGnss;
break;
case LEVER_ARM_TYPE_VEPP_IMU_TO_GNSS:
mask = LEVER_ARM_TYPE_VEPP_IMU_TO_GNSS_BIT;
params = &halLeverArmConfigInfo.veppImuToGnss;
break;
default:
break;
}
if (nullptr != params) {
halLeverArmConfigInfo.leverArmValidMask |= mask;
params->forwardOffsetMeters = it->second.forwardOffsetMeters;
params->sidewaysOffsetMeters = it->second.sidewaysOffsetMeters;
params->upOffsetMeters = it->second.upOffsetMeters;
LOC_LOGd("mask 0x%x, forward %f, sidways %f, up %f",
mask, params->forwardOffsetMeters,
params->sidewaysOffsetMeters, params->upOffsetMeters);
}
}
mApiImpl->configLeverArm(halLeverArmConfigInfo);
return true;
} else {
LOC_LOGe ("NULL mApiImpl");
return false;
}
}
bool LocationIntegrationApi::configRobustLocation(bool enable, bool enableForE911) {
if (mApiImpl) {
LOC_LOGd("enable %d, enableForE911 %d", enable, enableForE911);
mApiImpl->configRobustLocation(enable, enableForE911);
return true;
} else {
LOC_LOGe ("NULL mApiImpl");
return false;
}
}
bool LocationIntegrationApi::getRobustLocationConfig() {
if (mApiImpl) {
// mApiImpl->getRobustLocationConfig returns none-zero when
// there is no callback
return (mApiImpl->getRobustLocationConfig() == 0);
} else {
LOC_LOGe ("NULL mApiImpl");
return false;
}
}
bool LocationIntegrationApi::configMinGpsWeek(uint16_t minGpsWeek) {
if (mApiImpl && minGpsWeek != 0) {
LOC_LOGd("min gps week %u", minGpsWeek);
return (mApiImpl->configMinGpsWeek(minGpsWeek) == 0);
} else {
LOC_LOGe ("NULL mApiImpl");
return false;
}
}
bool LocationIntegrationApi::getMinGpsWeek() {
if (mApiImpl) {
return (mApiImpl->getMinGpsWeek() == 0);
} else {
LOC_LOGe ("NULL mApiImpl or callback");
return false;
}
}
bool LocationIntegrationApi::configBodyToSensorMountParams(
const BodyToSensorMountParams& b2sParams) {
return false;
}
bool LocationIntegrationApi::configDeadReckoningEngineParams(
const DeadReckoningEngineConfig& dreConfig) {
if (mApiImpl) {
LOC_LOGd("mask 0x%x, roll offset %f, pitch offset %f, yaw offset %f, offset unc %f",
dreConfig.validMask,
dreConfig.bodyToSensorMountParams.rollOffset,
dreConfig.bodyToSensorMountParams.pitchOffset,
dreConfig.bodyToSensorMountParams.yawOffset,
dreConfig.bodyToSensorMountParams.offsetUnc,
dreConfig.vehicleSpeedScaleFactor,
dreConfig.vehicleSpeedScaleFactorUnc,
dreConfig.gyroScaleFactor, dreConfig.gyroScaleFactorUnc);
::DeadReckoningEngineConfig halConfig = {};
if (dreConfig.validMask & BODY_TO_SENSOR_MOUNT_PARAMS_VALID) {
if (dreConfig.bodyToSensorMountParams.rollOffset < -180.0 ||
dreConfig.bodyToSensorMountParams.rollOffset > 180.0 ||
dreConfig.bodyToSensorMountParams.pitchOffset < -180.0 ||
dreConfig.bodyToSensorMountParams.pitchOffset > 180.0 ||
dreConfig.bodyToSensorMountParams.yawOffset < -180.0 ||
dreConfig.bodyToSensorMountParams.yawOffset > 180.0 ||
dreConfig.bodyToSensorMountParams.offsetUnc < -180.0 ||
dreConfig.bodyToSensorMountParams.offsetUnc > 180.0 ) {
LOC_LOGe("invalid b2s parameter, range is [-180.0, 180.0]");
return false;
}
halConfig.validMask |= ::BODY_TO_SENSOR_MOUNT_PARAMS_VALID;
halConfig.bodyToSensorMountParams.rollOffset =
dreConfig.bodyToSensorMountParams.rollOffset;
halConfig.bodyToSensorMountParams.pitchOffset =
dreConfig.bodyToSensorMountParams.pitchOffset;
halConfig.bodyToSensorMountParams.yawOffset =
dreConfig.bodyToSensorMountParams.yawOffset;
halConfig.bodyToSensorMountParams.offsetUnc =
dreConfig.bodyToSensorMountParams.offsetUnc;
}
if (dreConfig.validMask & VEHICLE_SPEED_SCALE_FACTOR_VALID) {
if (dreConfig.vehicleSpeedScaleFactor < 0.9 ||
dreConfig.vehicleSpeedScaleFactor > 1.1) {
LOC_LOGe("invalid vehicle speed scale factor, range is [0.9, 1,1]");
return false;
}
halConfig.validMask |= ::VEHICLE_SPEED_SCALE_FACTOR_VALID;
halConfig.vehicleSpeedScaleFactor = dreConfig.vehicleSpeedScaleFactor;
}
if (dreConfig.validMask & VEHICLE_SPEED_SCALE_FACTOR_UNC_VALID) {
if (dreConfig.vehicleSpeedScaleFactorUnc < 0.0 ||
dreConfig.vehicleSpeedScaleFactorUnc > 0.1) {
LOC_LOGe("invalid vehicle speed scale factor uncertainty, range is [0.0, 0.1]");
return false;
}
halConfig.validMask |= ::VEHICLE_SPEED_SCALE_FACTOR_UNC_VALID;
halConfig.vehicleSpeedScaleFactorUnc = dreConfig.vehicleSpeedScaleFactorUnc;
}
if (dreConfig.validMask & GYRO_SCALE_FACTOR_VALID) {
if (dreConfig.gyroScaleFactor < 0.9 ||
dreConfig.gyroScaleFactor > 1.1) {
LOC_LOGe("invalid gyro scale factor, range is [0.9, 1,1]");
return false;
}
halConfig.validMask |= ::GYRO_SCALE_FACTOR_VALID;
halConfig.gyroScaleFactor = dreConfig.gyroScaleFactor;
}
if (dreConfig.validMask & GYRO_SCALE_FACTOR_UNC_VALID) {
if (dreConfig.gyroScaleFactorUnc < 0.0 ||
dreConfig.gyroScaleFactorUnc > 0.1) {
LOC_LOGe("invalid gyro scale factor uncertainty, range is [0.0, 0.1]");
return false;
}
halConfig.validMask |= ::GYRO_SCALE_FACTOR_UNC_VALID;
halConfig.gyroScaleFactorUnc = dreConfig.gyroScaleFactorUnc;
}
LOC_LOGd("mask 0x%" PRIx64 ", roll offset %f, pitch offset %f, "
"yaw offset %f, offset unc %f", halConfig.validMask,
halConfig.bodyToSensorMountParams.rollOffset,
halConfig.bodyToSensorMountParams.pitchOffset,
halConfig.bodyToSensorMountParams.yawOffset,
halConfig.bodyToSensorMountParams.offsetUnc,
halConfig.vehicleSpeedScaleFactor,
halConfig.vehicleSpeedScaleFactorUnc,
halConfig.gyroScaleFactor, halConfig.gyroScaleFactorUnc);
mApiImpl->configDeadReckoningEngineParams(halConfig);
return true;
} else {
LOC_LOGe ("NULL mApiImpl");
return false;
}
}
bool LocationIntegrationApi::configMinSvElevation(uint8_t minSvElevation) {
if (mApiImpl) {
if (minSvElevation <= 90) {
LOC_LOGd("min sv elevation %u", minSvElevation);
GnssConfig gnssConfig = {};
gnssConfig.flags = GNSS_CONFIG_FLAGS_MIN_SV_ELEVATION_BIT;
gnssConfig.minSvElevation = minSvElevation;
mApiImpl->configMinSvElevation(minSvElevation);
return true;
} else {
LOC_LOGe("invalid minSvElevation: %u, valid range is [0, 90]", minSvElevation);
return false;
}
} else {
LOC_LOGe ("NULL mApiImpl");
return false;
}
}
bool LocationIntegrationApi::getMinSvElevation() {
if (mApiImpl) {
return (mApiImpl->getMinSvElevation() == 0);
} else {
LOC_LOGe ("NULL mApiImpl");
return false;
}
}
bool LocationIntegrationApi::configEngineRunState(LocIntegrationEngineType engType,
LocIntegrationEngineRunState engState) {
if (mApiImpl) {
PositioningEngineMask halEngType = (PositioningEngineMask)0;
LocEngineRunState halEngState = (LocEngineRunState)0;
switch (engType) {
case LOC_INT_ENGINE_SPE:
halEngType = STANDARD_POSITIONING_ENGINE;
break;
case LOC_INT_ENGINE_DRE:
halEngType = DEAD_RECKONING_ENGINE;
break;
case LOC_INT_ENGINE_PPE:
halEngType = PRECISE_POSITIONING_ENGINE;
break;
case LOC_INT_ENGINE_VPE:
halEngType = VP_POSITIONING_ENGINE;
break;
default:
LOC_LOGe("unknown engine type of %d", engType);
return false;
}
if (engState == LOC_INT_ENGINE_RUN_STATE_PAUSE) {
halEngState = LOC_ENGINE_RUN_STATE_PAUSE;
} else if (engState == LOC_INT_ENGINE_RUN_STATE_RESUME) {
halEngState = LOC_ENGINE_RUN_STATE_RESUME;
} else {
LOC_LOGe("unknown engine state %d", engState);
return false;
}
return (mApiImpl->configEngineRunState(halEngType, halEngState) == 0);
} else {
LOC_LOGe ("NULL mApiImpl");
return false;
}
}
bool LocationIntegrationApi::setUserConsentForTerrestrialPositioning(bool userConsent) {
if (mApiImpl) {
return (mApiImpl->setUserConsentForTerrestrialPositioning(userConsent) == 0);
} else {
LOC_LOGe ("NULL mApiImpl");
return false;
}
}
} // namespace location_integration

File diff suppressed because it is too large Load diff

View file

@ -1,191 +0,0 @@
/* Copyright (c) 2019-2020 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.
*/
#ifndef LOCATION_INTEGRATION_API_IMPL_H
#define LOCATION_INTEGRATION_API_IMPL_H
#include <mutex>
#include <LocIpc.h>
#include <LocationDataTypes.h>
#include <ILocationAPI.h>
#include <LocationIntegrationApi.h>
#include <MsgTask.h>
#include <LocationApiMsg.h>
#include <LocationApiPbMsgConv.h>
#ifdef NO_UNORDERED_SET_OR_MAP
#include <map>
#else
#include <unordered_map>
#endif
using namespace std;
using namespace loc_util;
using namespace location_integration;
namespace location_integration
{
typedef std::unordered_map<LocConfigTypeEnum, int32_t> LocConfigReqCntMap;
typedef std::unordered_map<PositioningEngineMask, LocEngineRunState> LocConfigEngRunStateMap;
typedef struct {
bool isValid;
bool enable;
float tuncThresholdMs; // need to be specified if enable is true
uint32_t energyBudget; // need to be specified if enable is true
} TuncConfigInfo;
typedef struct {
bool isValid;
bool enable;
} PaceConfigInfo;
typedef struct {
bool isValid;
GnssSvTypeConfig constellationEnablementConfig;
GnssSvIdConfig blacklistSvConfig;
GnssSvTypeConfig secondaryBandConfig;
} SvConfigInfo;
typedef struct {
bool isValid;
bool enable;
bool enableForE911;
} RobustLocationConfigInfo;
typedef struct {
bool isValid;
::DeadReckoningEngineConfig dreConfig;
} DeadReckoningEngineConfigInfo;
typedef struct {
bool isValid;
bool userConsent;
} GtpUserConsentConfigInfo;
class IpcListener;
class LocationIntegrationApiImpl : public ILocationControlAPI {
friend IpcListener;
public:
LocationIntegrationApiImpl(LocIntegrationCbs& integrationCbs);
void destroy();
// convenient methods
inline bool sendMessage(const uint8_t* data, uint32_t length) const {
return (mIpcSender != nullptr) && LocIpc::send(*mIpcSender, data, length);
}
// reset to defaut will apply to enable/disable SV constellation and
// blacklist/unblacklist SVs
virtual uint32_t configConstellations(
const GnssSvTypeConfig& constellationEnablementConfig,
const GnssSvIdConfig& blacklistSvConfig) override;
virtual uint32_t configConstellationSecondaryBand(
const GnssSvTypeConfig& secondaryBandConfig) override;
virtual uint32_t configConstrainedTimeUncertainty(
bool enable, float tuncThreshold, uint32_t energyBudget) override;
virtual uint32_t configPositionAssistedClockEstimator(bool enable) override;
virtual uint32_t configLeverArm(const LeverArmConfigInfo& configInfo) override;
virtual uint32_t configRobustLocation(bool enable, bool enableForE911) override;
virtual uint32_t configDeadReckoningEngineParams(
const ::DeadReckoningEngineConfig& dreConfig) override;
virtual uint32_t* gnssUpdateConfig(const GnssConfig& config) override;
virtual uint32_t gnssDeleteAidingData(GnssAidingData& data) override;
virtual uint32_t configMinGpsWeek(uint16_t minGpsWeek) override;
uint32_t getRobustLocationConfig();
uint32_t getMinGpsWeek();
uint32_t configMinSvElevation(uint8_t minSvElevation);
uint32_t getMinSvElevation();
uint32_t getConstellationSecondaryBandConfig();
uint32_t configEngineRunState(PositioningEngineMask engType, LocEngineRunState engState);
uint32_t setUserConsentForTerrestrialPositioning(bool userConsent);
private:
~LocationIntegrationApiImpl();
bool integrationClientAllowed();
void sendConfigMsgToHalDaemon(LocConfigTypeEnum configType,
uint8_t* pMsg,
size_t msgSize,
bool invokeResponseCb = true);
void sendClientRegMsgToHalDaemon();
void processHalReadyMsg();
void addConfigReq(LocConfigTypeEnum configType);
void flushConfigReqs();
void processConfigRespCb(const LocAPIGenericRespMsg* pRespMsg);
void processGetRobustLocationConfigRespCb(
const LocConfigGetRobustLocationConfigRespMsg* pRespMsg);
void processGetMinGpsWeekRespCb(const LocConfigGetMinGpsWeekRespMsg* pRespMsg);
void processGetMinSvElevationRespCb(const LocConfigGetMinSvElevationRespMsg* pRespMsg);
void processGetConstellationSecondaryBandConfigRespCb(
const LocConfigGetConstellationSecondaryBandConfigRespMsg* pRespMsg);
// protobuf conversion util class
LocationApiPbMsgConv mPbufMsgConv;
// internal session parameter
static mutex mMutex;
static bool mClientRunning; // allow singleton int client
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_INTAPI_NAME_PREFIX.
char mSocketName[MAX_SOCKET_PATHNAME_LENGTH];
// cached configuration to be used when hal daemon crashes
// and restarts
TuncConfigInfo mTuncConfigInfo;
PaceConfigInfo mPaceConfigInfo;
SvConfigInfo mSvConfigInfo;
LeverArmConfigInfo mLeverArmConfigInfo;
RobustLocationConfigInfo mRobustLocationConfigInfo;
DeadReckoningEngineConfigInfo mDreConfigInfo;
LocConfigEngRunStateMap mEngRunStateConfigMap;
GtpUserConsentConfigInfo mGtpUserConsentConfigInfo;
LocConfigReqCntMap mConfigReqCntMap;
LocIntegrationCbs mIntegrationCbs;
LocIpc mIpc;
shared_ptr<LocIpcSender> mIpcSender;
MsgTask mMsgTask;
};
} // namespace location_client
#endif /* LOCATION_INTEGRATION_API_IMPL_H */

View file

@ -1,7 +0,0 @@
cc_library_headers {
name: "izat_remote_api_headers",
vendor: true,
export_include_dirs: ["."],
}

View file

@ -1,77 +0,0 @@
/*=============================================================================
Copyright (c) 2016, 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.
=============================================================================*/
#ifndef __IZATREMOTEAPIS_H__
#define __IZATREMOTEAPIS_H__
#include <izat_remote_api.h>
#include <string>
#include <stdio.h>
namespace qc_loc_fw {
class InPostcard;
}
namespace izat_remote_api {
class IzatNotifierProxy;
struct OutCard;
class IzatNotifier {
protected:
IzatNotifierProxy* const mNotifierProxy;
IzatNotifier(const char* const tag, const OutCard* subCard);
virtual ~IzatNotifier();
public:
virtual void handleMsg(qc_loc_fw::InPostcard * const in_card) = 0;
};
class SstpUpdater : public IzatNotifier {
static const char* const sLatTag;
static const char* const sLonTag;
static const char* const sUncTag;
static const char* const sUncConfTag;
protected:
SstpUpdater();
virtual inline ~SstpUpdater() {}
public:
static const char sName[];
virtual void handleMsg(qc_loc_fw::InPostcard * const in_card) final;
void stop();
virtual void errReport(const char* errStr) = 0;
virtual void siteUpdate(const char* name, double lat, double lon,
float unc, int32_t uncConfidence) = 0;
virtual void mccUpdate(uint32_t mcc, const char* confidence) = 0;
};
} // izat_remote_api
#endif //__IZATREMOTEAPIS_H__

View file

@ -1,116 +0,0 @@
/*=============================================================================
Copyright (c) 2016, 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.
=============================================================================*/
#ifndef __IZAT_REMOTE_APIS_H__
#define __IZAT_REMOTE_APIS_H__
#include <gps_extended_c.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef void (*locationUpdateCb)(UlpLocation *location,
GpsLocationExtended *locExtended,
void* clientData);
typedef void (*svRptUpdateCb)(GnssSvNotification *svNotify,
void* clientData);
typedef void (*nmeaUpdateCb)(UlpNmea *nmea, void* clientData);
typedef struct {
locationUpdateCb locCb;
svRptUpdateCb svReportCb;
nmeaUpdateCb nmeaCb;
}remoteClientInfo;
/* registers a client callback structure for listening to final location updates
pClientInfo - pointer to remoteClientInfo structure
Can not be NULL.
clientData - an opaque data pointer from client. This pointer will be
provided back when the callbacak is called.
This can be used by client to store application context
or statemachine etc.
Can be NULL.
return: an opaque pointer that serves as a request handle. This handle
to be fed to the unregisterLocationUpdater() call.
*/
void* registerLocationUpdater(remoteClientInfo *pClientInfo, void* clientData);
/* unregisters the client callback
locationUpdaterHandle - the opaque pointer from the return of
registerLocationUpdater()
*/
void unregisterLocationUpdater(void* locationUpdaterHandle);
typedef void (*errReportCb)(const char* errStr, void* clientData);
typedef void (*sstpSiteUpdateCb)(const char* name, double lat, double lon,
float unc, int32_t uncConfidence,
void* clientData);
typedef void (*sstpMccUpdateCb)(uint32_t mcc, const char* confidence,
void* clientData);
/* registers a client callback for listening to SSTP updates
siteCb - site info callback function pointer implemented by client
Can not be NULL.
mccCb - MCC info callback function pointer implemented by client
Can not be NULL.
errCb - callback to receive error report in string format, in case
of any error that might happen, and no siteCb or mccCb can
be called.
Can be NULL.
clientData - an opaque data pointer from client. This pointer will be
provided back when the locationCb() callbacak is called.
This can be used by client to store application context
or statemachine etc.
Can be NULL.
return: an opaque pointer that serves as a request handle. This handle
is to be fed to theunregisterLocationUpdater() call.
*/
void* registerSstpUpdater(sstpSiteUpdateCb siteCb, sstpMccUpdateCb mccCb,
errReportCb errCb, void* clientData);
/* unregisters the client callback
sstpUpdaterHandle - the opaque pointer from the return of
registerLocationUpdater()
*/
void unregisterSstpUpdater(void* sstpUpdaterHandle);
/* stop the current burst of SSTP updates (until next triggering event)
sstpUpdaterHandle - the opaque pointer from the return of
registerLocationUpdater()
*/
void stopSstpUpdate(void* sstpUpdaterHandle);
#ifdef __cplusplus
} // extern "C"
#endif
#endif //__IZAT_REMOTE_APIS_H__

View file

@ -1,2 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(call all-subdir-makefiles)

View file

@ -1,7 +0,0 @@
cc_library_headers {
name: "libloc_api_v02_headers",
export_include_dirs: ["."],
vendor: true,
}

View file

@ -1,46 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libloc_api_v02
# activate the following line for debug purposes only, comment out for production
#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
LOCAL_MODULE_TAGS := optional
LOCAL_SHARED_LIBRARIES := \
libutils \
libcutils \
libqmi_cci \
libqmi_common_so \
libloc_core \
libgps.utils \
libdl \
liblog
LOCAL_SRC_FILES = \
LocApiV02.cpp \
loc_api_v02_log.cpp \
loc_api_v02_client.cpp \
loc_api_sync_req.cpp \
location_service_v02.c
LOCAL_CFLAGS += \
-fno-short-enums \
-D_ANDROID_
## Includes
LOCAL_C_INCLUDES := \
$(TARGET_OUT_HEADERS)/qmi-framework/inc
LOCAL_HEADER_LIBRARIES := \
libloc_core_headers \
libgps.utils_headers \
libloc_pla_headers \
liblocation_api_headers \
libqmi_common_headers \
libqmi_cci_headers
LOCAL_CFLAGS += $(GNSS_CFLAGS)
include $(BUILD_SHARED_LIBRARY)

File diff suppressed because it is too large Load diff

View file

@ -1,550 +0,0 @@
/* Copyright (c) 2011-2020, 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.
*/
#ifndef LOC_API_V_0_2_H
#define LOC_API_V_0_2_H
#include <stdint.h>
#include <stdbool.h>
#include <LocApiBase.h>
#include <loc_api_v02_client.h>
#include <vector>
#include <functional>
#include <unordered_map>
#define LOC_SEND_SYNC_REQ(NAME, ID, REQ) \
int rv = true; \
locClientStatusEnumType st; \
locClientReqUnionType reqUnion; \
qmiLoc##NAME##IndMsgT_v02 ind; \
\
memset(&ind, 0, sizeof(ind)); \
reqUnion.p##NAME##Req = &REQ; \
\
st = locSyncSendReq(QMI_LOC_##ID##_REQ_V02, \
reqUnion, \
LOC_ENGINE_SYNC_REQUEST_TIMEOUT, \
QMI_LOC_##ID##_IND_V02, \
&ind); \
\
if (st != eLOC_CLIENT_SUCCESS || \
eQMI_LOC_SUCCESS_V02 != ind.status) { \
LOC_LOGE ("%s:%d]: Error : st = %d, ind.status = %d", \
__func__, __LINE__, st, ind.status); \
rv = false; \
}
using Resender = std::function<void()>;
using namespace loc_core;
typedef struct
{
uint32_t counter;
qmiLocSvSystemEnumT_v02 system;
qmiLocGnssSignalTypeMaskT_v02 gnssSignalType;
uint16_t gnssSvId;
qmiLocMeasFieldsValidMaskT_v02 validMask;
uint8_t cycleSlipCount;
} adrData;
typedef uint64_t GpsSvMeasHeaderFlags;
#define BIAS_GPSL1_VALID 0x00000001
#define BIAS_GPSL1_UNC_VALID 0x00000002
#define BIAS_GPSL1_GPSL5_VALID 0x00000004
#define BIAS_GPSL1_GPSL5_UNC_VALID 0x00000008
#define BIAS_GPSL1_GLOG1_VALID 0x00000010
#define BIAS_GPSL1_GLOG1_UNC_VALID 0x00000020
#define BIAS_GPSL1_GALE1_VALID 0x00000040
#define BIAS_GPSL1_GALE1_UNC_VALID 0x00000080
#define BIAS_GPSL1_BDSB1_VALID 0x00000100
#define BIAS_GPSL1_BDSB1_UNC_VALID 0x00000200
#define BIAS_GPSL1_NAVIC_VALID 0x00000400
#define BIAS_GPSL1_NAVIC_UNC_VALID 0x00000800
#define BIAS_GALE1_VALID 0x00001000
#define BIAS_GALE1_UNC_VALID 0x00002000
#define BIAS_GALE1_GALE5A_VALID 0x00004000
#define BIAS_GALE1_GALE5A_UNC_VALID 0x00008000
#define BIAS_BDSB1_VALID 0x00010000
#define BIAS_BDSB1_UNC_VALID 0x00020000
#define BIAS_BDSB1_BDSB1C_VALID 0x00040000
#define BIAS_BDSB1_BDSB1C_UNC_VALID 0x00080000
#define BIAS_BDSB1_BDSB2A_VALID 0x00100000
#define BIAS_BDSB1_BDSB2A_UNC_VALID 0x00200000
typedef struct {
uint64_t flags;
/* used directly */
float gpsL1;
float gpsL1Unc;
float gpsL1_gpsL5;
float gpsL1_gpsL5Unc;
float gpsL1_gloG1;
float gpsL1_gloG1Unc;
float gpsL1_galE1;
float gpsL1_galE1Unc;
float gpsL1_bdsB1;
float gpsL1_bdsB1Unc;
float gpsL1_navic;
float gpsL1_navicUnc;
/* used for intermediate computations */
float galE1;
float galE1Unc;
float galE1_galE5a;
float galE1_galE5aUnc;
float bdsB1;
float bdsB1Unc;
float bdsB1_bdsB1c;
float bdsB1_bdsB1cUnc;
float bdsB1_bdsB2a;
float bdsB1_bdsB2aUnc;
} timeBiases;
/* This class derives from the LocApiBase class.
The members of this class are responsible for converting
the Loc API V02 data structures into Loc Adapter data structures.
This class also implements some of the virtual functions that
handle the requests from loc engine. */
class LocApiV02 : public LocApiBase {
protected:
/* loc api v02 handle*/
locClientHandleType clientHandle;
private:
locClientEventMaskType mQmiMask;
bool mInSession;
GnssPowerMode mPowerMode;
bool mEngineOn;
bool mMeasurementsStarted;
std::vector<Resender> mResenders;
bool mMasterRegisterNotSupported;
uint32_t mCounter;
uint32_t mMinInterval;
std::vector<adrData> mADRdata;
GnssMeasurements* mGnssMeasurements;
bool mGPSreceived;
int mMsInWeek;
bool mAgcIsPresent;
timeBiases mTimeBiases;
size_t mBatchSize, mDesiredBatchSize;
size_t mTripBatchSize, mDesiredTripBatchSize;
bool mIsFirstFinalFixReported;
bool mIsFirstStartFixReq;
uint64_t mHlosQtimer1, mHlosQtimer2;
uint32_t mRefFCount;
// Below two member variables are for elapsedRealTime calculation
ElapsedRealtimeEstimator mMeasElapsedRealTimeCal;
ElapsedRealtimeEstimator mPositionElapsedRealTimeCal;
/* Convert event mask from loc eng to loc_api_v02 format */
static locClientEventMaskType convertMask(LOC_API_ADAPTER_EVENT_MASK_T mask);
/* Convert GPS LOCK from LocationAPI format to QMI format */
static qmiLocLockEnumT_v02 convertGpsLockFromAPItoQMI(GnssConfigGpsLock lock);
/* Convert GPS LOCK from QMI format to LocationAPI format */
static GnssConfigGpsLock convertGpsLockFromQMItoAPI(qmiLocLockEnumT_v02 lock);
/* Convert error from loc_api_v02 to loc eng format*/
static enum loc_api_adapter_err convertErr(locClientStatusEnumType status);
/* convert Ni Encoding type from QMI_LOC to loc eng format */
static GnssNiEncodingType convertNiEncoding(
qmiLocNiDataCodingSchemeEnumT_v02 loc_encoding);
/*convert NI notify verify type from QMI LOC to loc eng format*/
static bool convertNiNotifyVerifyType (GnssNiNotification *notif,
qmiLocNiNotifyVerifyEnumT_v02 notif_priv);
/*convert signal type to carrier frequency*/
static float convertSignalTypeToCarrierFrequency(
qmiLocGnssSignalTypeMaskT_v02 signalType,
uint8_t gloFrequency);
/*convert GnssMeasurement type from QMI LOC to loc eng format*/
bool convertGnssMeasurements (
const qmiLocEventGnssSvMeasInfoIndMsgT_v02& gnss_measurement_report_ptr,
int index, bool isExt, bool validDgnssSvMeas);
/* Convert APN Type mask */
static qmiLocApnTypeMaskT_v02 convertLocApnTypeMask(LocApnTypeMask mask);
static LocApnTypeMask convertQmiLocApnTypeMask(qmiLocApnTypeMaskT_v02 mask);
/* Convert Get Constellation QMI Ind info to GnssSvTypeConfig */
static void convertToGnssSvTypeConfig(
const qmiLocGetConstellationConfigIndMsgT_v02& ind,
GnssSvTypeConfig& config);
/* Convert GnssPowerMode to QMI Loc Power Mode Enum */
static qmiLocPowerModeEnumT_v02 convertPowerMode(GnssPowerMode powerMode);
void convertGnssMeasurementsHeader(const Gnss_LocSvSystemEnumType locSvSystemType,
const qmiLocEventGnssSvMeasInfoIndMsgT_v02& gnss_measurement_info);
/*convert LocGnssClock type from QMI LOC to loc eng format*/
int convertGnssClock (GnssMeasurementsClock& clock,
const qmiLocEventGnssSvMeasInfoIndMsgT_v02& gnss_measurement_info);
/* convert dgnss constellation mask from QMI loc to loc eng format */
static void convertGnssConestellationMask (
qmiLocGNSSConstellEnumT_v02 qmiConstellationEnum,
GnssConstellationTypeMask& constellationMask);
/* If Confidence value is less than 68%, then scale the accuracy value to 68%
confidence.*/
void scaleAccuracyTo68PercentConfidence(const uint8_t confidenceValue,
LocGpsLocation &gpsLocation,
const bool isCircularUnc);
/* convert position report to loc eng format and send the converted
position to loc eng */
void reportPosition
(const qmiLocEventPositionReportIndMsgT_v02 *location_report_ptr,
bool unpropagatedPosition = false);
/* convert satellite report to loc eng format and send the converted
report to loc eng */
void reportSv (const qmiLocEventGnssSvInfoIndMsgT_v02 *gnss_report_ptr);
void reportSvPolynomial (
const qmiLocEventGnssSvPolyIndMsgT_v02 *gnss_sv_poly_ptr);
void reportSvEphemeris (
uint32_t eventId, const locClientEventIndUnionType &eventPayload);
void populateGpsEphemeris(const qmiLocGpsEphemerisReportIndMsgT_v02 *,
GnssSvEphemerisReport &);
void populateGlonassEphemeris(const qmiLocGloEphemerisReportIndMsgT_v02 *,
GnssSvEphemerisReport &);
void populateBdsEphemeris(const qmiLocBdsEphemerisReportIndMsgT_v02 *,
GnssSvEphemerisReport &);
void populateGalEphemeris(const qmiLocGalEphemerisReportIndMsgT_v02 *,
GnssSvEphemerisReport &);
void populateQzssEphemeris(const qmiLocQzssEphemerisReportIndMsgT_v02 *,
GnssSvEphemerisReport &);
void populateCommonEphemeris(const qmiLocEphGnssDataStructT_v02 &, GnssEphCommon &);
void populateGpsTimeOfReport(const qmiLocGnssTimeStructT_v02 &, GnssSystemTimeStructType &);
void populateFeatureStatusReport(const qmiLocFeaturesStatusMaskT_v02 &featureStatusReport,
std::unordered_map<LocationQwesFeatureType, bool> &featureMap);
void reportLocEvent(const qmiLocEventReportIndMsgT_v02 *event_report_ptr);
/* convert system info to location api format and dispatch to
the registered adapter */
void reportSystemInfo(const qmiLocSystemInfoIndMsgT_v02* system_info_ptr);
void reportLocationRequestNotification(
const qmiLocLocationRequestNotificationIndMsgT_v02* loc_req_notif);
/* convert engine state report to loc eng format and send the converted
report to loc eng */
void reportEngineState (
const qmiLocEventEngineStateIndMsgT_v02 *engine_state_ptr);
/* convert fix session report to loc eng format and send the converted
report to loc eng */
void reportFixSessionState (
const qmiLocEventFixSessionStateIndMsgT_v02 *fix_session_state_ptr);
/* convert NMEA report to loc eng format and send the converted
report to loc eng */
void reportNmea (const qmiLocEventNmeaIndMsgT_v02 *nmea_report_ptr);
/* convert and report an ATL request to loc engine */
void reportAtlRequest(
const qmiLocEventLocationServerConnectionReqIndMsgT_v02
*server_request_ptr);
/* convert and report NI request to loc eng */
void reportNiRequest(
const qmiLocEventNiNotifyVerifyReqIndMsgT_v02 *ni_req_ptr);
/* report the xtra server info */
void reportXtraServerUrl(
const qmiLocEventInjectPredictedOrbitsReqIndMsgT_v02* server_request_ptr);
/* convert and report GNSS measurement data to loc eng */
void reportGnssMeasurementData(
const qmiLocEventGnssSvMeasInfoIndMsgT_v02& gnss_measurement_report_ptr);
void reportSvMeasurementInternal();
inline void resetSvMeasurementReport(){
memset(mGnssMeasurements, 0, sizeof(GnssMeasurements));
mGnssMeasurements->size = sizeof(GnssMeasurements);
mGnssMeasurements->gnssSvMeasurementSet.size = sizeof(GnssSvMeasurementSet);
mGnssMeasurements->gnssSvMeasurementSet.isNhz = false;
mGnssMeasurements->gnssSvMeasurementSet.svMeasSetHeader.size =
sizeof(GnssSvMeasurementHeader);
memset(&mTimeBiases, 0, sizeof(mTimeBiases));
mGPSreceived = false;
mMsInWeek = -1;
mAgcIsPresent = false;
}
void setGnssBiases();
/* convert and report ODCPI request */
void requestOdcpi(
const qmiLocEventWifiReqIndMsgT_v02& odcpiReq);
void registerEventMask(LOC_API_ADAPTER_EVENT_MASK_T adapterMask);
bool sendRequestForAidingData(locClientEventMaskType qmiMask);
locClientEventMaskType adjustMaskIfNoSessionOrEngineOff(locClientEventMaskType qmiMask);
bool cacheGnssMeasurementSupport();
void registerMasterClient();
int getGpsLock(uint8_t subType);
void getRobustLocationConfig(uint32_t sessionId, LocApiResponse* adapterResponse);
void getMinGpsWeek(uint32_t sessionId, LocApiResponse* adapterResponse);
/* Convert get blacklist sv info to GnssSvIdConfig */
void reportGnssSvIdConfig
(const qmiLocGetBlacklistSvIndMsgT_v02& getBlacklistSvIndMsg);
/* Convert get constellation info to GnssSvTypeConfig */
void reportGnssSvTypeConfig
(const qmiLocGetConstellationConfigIndMsgT_v02& getConstellationConfigIndMsg);
/* Inform ODCPI availability to Modem */
void wifiStatusInformSync();
void sendNfwNotification(GnssNfwNotification& notification);
LocationError queryBatchBuffer(size_t desiredSize,
size_t &allocatedSize, BatchingMode batchMode);
LocationError releaseBatchBuffer(BatchingMode batchMode);
void readModemLocations(Location* pLocationPiece, size_t count,
BatchingMode batchingMode, size_t& numbOfEntries);
void setOperationMode(GnssSuplMode mode);
bool needsNewTripBatchRestart(uint32_t newTripDistance, uint32_t newTripTBFInterval,
uint32_t &accumulatedDistance, uint32_t &numOfBatchedPositions);
void batchFullEvent(const qmiLocEventBatchFullIndMsgT_v02* batchFullInfo);
void batchStatusEvent(const qmiLocEventBatchingStatusIndMsgT_v02* batchStatusInfo);
void onDbtPosReportEvent(const qmiLocEventDbtPositionReportIndMsgT_v02* pDbtPosReport);
void geofenceBreachEvent(const qmiLocEventGeofenceBreachIndMsgT_v02* breachInfo);
void geofenceBreachEvent(const qmiLocEventGeofenceBatchedBreachIndMsgT_v02* batchedBreachInfo);
void geofenceStatusEvent(const qmiLocEventGeofenceGenAlertIndMsgT_v02* alertInfo);
void geofenceDwellEvent(const qmiLocEventGeofenceBatchedDwellIndMsgT_v02 *dwellEvent);
void reportLatencyInfo(const qmiLocLatencyInformationIndMsgT_v02* pLocLatencyInfo);
protected:
virtual enum loc_api_adapter_err
open(LOC_API_ADAPTER_EVENT_MASK_T mask);
virtual enum loc_api_adapter_err
close();
LocApiV02(LOC_API_ADAPTER_EVENT_MASK_T exMask,
ContextBase *context = NULL);
virtual ~LocApiV02();
public:
static LocApiBase* createLocApiV02(LOC_API_ADAPTER_EVENT_MASK_T exMask,
ContextBase* context);
/* event callback registered with the loc_api v02 interface */
virtual void eventCb(locClientHandleType client_handle,
uint32_t loc_event_id,
locClientEventIndUnionType loc_event_payload);
/* error callback, this function handles the service unavailable
error */
void errorCb(locClientHandleType handle,
locClientErrorEnumType errorId);
// Tracking
virtual void startFix(const LocPosMode& posMode, LocApiResponse *adapterResponse);
virtual void stopFix(LocApiResponse *adapterResponse);
void startTimeBasedTracking(const TrackingOptions& options, LocApiResponse* adapterResponse);
void stopTimeBasedTracking(LocApiResponse* adapterResponse);
void startDistanceBasedTracking(uint32_t sessionId, const LocationOptions& options,
LocApiResponse* adapterResponse);
void stopDistanceBasedTracking(uint32_t sessionId, LocApiResponse* adapterResponse);
// Batching
void startBatching(uint32_t sessionId, const LocationOptions& options, uint32_t accuracy,
uint32_t timeout, LocApiResponse* adapterResponse);
void stopBatching(uint32_t sessionId, LocApiResponse* adapterResponse);
LocationError startOutdoorTripBatchingSync(uint32_t tripDistance, uint32_t tripTbf,
uint32_t timeout);
void startOutdoorTripBatching(uint32_t tripDistance, uint32_t tripTbf, uint32_t timeout,
LocApiResponse* adapterResponse);
void reStartOutdoorTripBatching(uint32_t ongoingTripDistance, uint32_t ongoingTripInterval,
uint32_t batchingTimeout, LocApiResponse* adapterResponse);
LocationError stopOutdoorTripBatchingSync(bool deallocBatchBuffer = true);
void stopOutdoorTripBatching(bool deallocBatchBuffer = true,
LocApiResponse* adapterResponse = nullptr);
LocationError getBatchedLocationsSync(size_t count);
void getBatchedLocations(size_t count, LocApiResponse* adapterResponse);
LocationError getBatchedTripLocationsSync(size_t count, uint32_t accumulatedDistance);
void getBatchedTripLocations(size_t count, uint32_t accumulatedDistance,
LocApiResponse* adapterResponse);
virtual void setBatchSize(size_t size);
virtual void setTripBatchSize(size_t size);
LocationError queryAccumulatedTripDistanceSync(uint32_t &accumulatedTripDistance,
uint32_t &numOfBatchedPositions);
void queryAccumulatedTripDistance(
LocApiResponseData<LocApiBatchData>* adapterResponseData);
// Geofence
virtual void addGeofence(uint32_t clientId, const GeofenceOption& options,
const GeofenceInfo& info, LocApiResponseData<LocApiGeofenceData>* adapterResponseData);
virtual void removeGeofence(uint32_t hwId, uint32_t clientId, LocApiResponse* adapterResponse);
virtual void pauseGeofence(uint32_t hwId, uint32_t clientId, LocApiResponse* adapterResponse);
virtual void resumeGeofence(uint32_t hwId, uint32_t clientId, LocApiResponse* adapterResponse);
virtual void modifyGeofence(uint32_t hwId, uint32_t clientId,
const GeofenceOption& options, LocApiResponse* adapterResponse);
virtual void addToCallQueue(LocApiResponse* adapterResponse);
virtual void
setTime(LocGpsUtcTime time, int64_t timeReference, int uncertainty);
virtual void
injectPosition(double latitude, double longitude, float accuracy, bool onDemandCpi);
virtual void
injectPosition(const Location& location, bool onDemandCpi);
virtual void
injectPosition(const GnssLocationInfoNotification &locationInfo, bool onDemandCpi);
virtual void
deleteAidingData(const GnssAidingData& data, LocApiResponse *adapterResponse);
virtual void
informNiResponse(GnssNiResponse userResponse, const void* passThroughData);
virtual LocationError
setServerSync(const char* url, int len, LocServerType type);
virtual LocationError
setServerSync(unsigned int ip, int port, LocServerType type);
virtual void
atlOpenStatus(int handle, int is_succ, char* apn, uint32_t apnLen, AGpsBearerType bear,
LocAGpsType agpsType, LocApnTypeMask mask);
virtual void atlCloseStatus(int handle, int is_succ);
virtual LocationError setSUPLVersionSync(GnssConfigSuplVersion version);
virtual enum loc_api_adapter_err setNMEATypesSync(uint32_t typesMask);
virtual LocationError setLPPConfigSync(GnssConfigLppProfileMask profileMask);
virtual enum loc_api_adapter_err
setSensorPropertiesSync(bool gyroBiasVarianceRandomWalk_valid, float gyroBiasVarianceRandomWalk,
bool accelBiasVarianceRandomWalk_valid, float accelBiasVarianceRandomWalk,
bool angleBiasVarianceRandomWalk_valid, float angleBiasVarianceRandomWalk,
bool rateBiasVarianceRandomWalk_valid, float rateBiasVarianceRandomWalk,
bool velocityBiasVarianceRandomWalk_valid, float velocityBiasVarianceRandomWalk);
virtual enum loc_api_adapter_err
setSensorPerfControlConfigSync(int controlMode, int accelSamplesPerBatch,
int accelBatchesPerSec, int gyroSamplesPerBatch, int gyroBatchesPerSec,
int accelSamplesPerBatchHigh, int accelBatchesPerSecHigh,
int gyroSamplesPerBatchHigh, int gyroBatchesPerSecHigh, int algorithmConfig);
virtual LocationError
setAGLONASSProtocolSync(GnssConfigAGlonassPositionProtocolMask aGlonassProtocol);
virtual LocationError setLPPeProtocolCpSync(GnssConfigLppeControlPlaneMask lppeCP);
virtual LocationError setLPPeProtocolUpSync(GnssConfigLppeUserPlaneMask lppeUP);
virtual void getWwanZppFix();
virtual void
handleWwanZppFixIndication(const qmiLocGetAvailWwanPositionIndMsgT_v02 &zpp_ind);
virtual void
handleZppBestAvailableFixIndication(const qmiLocGetBestAvailablePositionIndMsgT_v02 &zpp_ind);
virtual void getBestAvailableZppFix();
virtual LocationError setGpsLockSync(GnssConfigGpsLock lock);
virtual void setConstrainedTuncMode(bool enabled, float tuncConstraint, uint32_t powerBudget,
LocApiResponse *adapterResponse=nullptr);
virtual void setPositionAssistedClockEstimatorMode(bool enabled,
LocApiResponse *adapterResponse=nullptr);
virtual void getGnssEnergyConsumed();
virtual void updateSystemPowerState(PowerStateType powerState);
virtual void requestForAidingData(GnssAidingDataSvMask svDataMask);
virtual void configRobustLocation(bool enable, bool enableForE911,
LocApiResponse *adapterResponse=nullptr);
virtual void configMinGpsWeek(uint16_t minGpsWeek,
LocApiResponse *adapterResponse=nullptr);
virtual LocationError setParameterSync(const GnssConfig & gnssConfig);
virtual void getParameter(uint32_t sessionId, GnssConfigFlagsMask flags,
LocApiResponse* adapterResponse=nullptr);
/*
Returns
Current value of GPS Lock on success
-1 on failure
*/
virtual int setSvMeasurementConstellation(const locClientEventMaskType mask);
virtual LocationError setXtraVersionCheckSync(uint32_t check);
virtual LocPosTechMask convertPosTechMask(qmiLocPosTechMaskT_v02 mask);
virtual LocNavSolutionMask convertNavSolutionMask(qmiLocNavSolutionMaskT_v02 mask);
virtual GnssConfigSuplVersion convertSuplVersion(const uint32_t suplVersion);
virtual GnssConfigLppeControlPlaneMask convertLppeCp(const uint32_t lppeControlPlaneMask);
virtual GnssConfigLppeUserPlaneMask convertLppeUp(const uint32_t lppeUserPlaneMask);
virtual LocationError setEmergencyExtensionWindowSync(const uint32_t emergencyExtensionSeconds);
virtual void setMeasurementCorrections(
const GnssMeasurementCorrections& gnssMeasurementCorrections);
virtual GnssSignalTypeMask convertQmiGnssSignalType(
qmiLocGnssSignalTypeMaskT_v02 qmiGnssSignalType);
void convertQmiBlacklistedSvConfigToGnssConfig(
const qmiLocGetBlacklistSvIndMsgT_v02& qmiBlacklistConfig,
GnssSvIdConfig& gnssBlacklistConfig);
virtual void convertQmiSecondaryConfigToGnssConfig(
qmiLocGNSSConstellEnumT_v02 qmiSecondaryBandConfig,
GnssSvTypeConfig& secondaryBandConfig);
/* Requests for SV/Constellation Control */
virtual LocationError setBlacklistSvSync(const GnssSvIdConfig& config);
virtual void setBlacklistSv(const GnssSvIdConfig& config,
LocApiResponse* adapterResponse=nullptr);
virtual void getBlacklistSv();
virtual void setConstellationControl(const GnssSvTypeConfig& config,
LocApiResponse *adapterResponse=nullptr);
virtual void getConstellationControl();
virtual void resetConstellationControl(LocApiResponse *adapterResponse=nullptr);
virtual void configConstellationMultiBand(const GnssSvTypeConfig& secondaryBandConfig,
LocApiResponse* adapterResponse=nullptr);
virtual void getConstellationMultiBandConfig(uint32_t sessionId,
LocApiResponse* adapterResponse=nullptr);
locClientStatusEnumType locSyncSendReq(uint32_t req_id, locClientReqUnionType req_payload,
uint32_t timeout_msec, uint32_t ind_id, void* ind_payload_ptr);
inline locClientStatusEnumType locClientSendReq(uint32_t req_id,
locClientReqUnionType req_payload) {
return ::locClientSendReq(clientHandle, req_id, req_payload);
}
};
extern "C" LocApiBase* getLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask,
ContextBase *context);
#endif //LOC_API_V_0_2_H

View file

@ -1,47 +0,0 @@
AM_CFLAGS = \
-I. \
$(LOCPLA_CFLAGS) \
$(GPSUTILS_CFLAGS) \
$(LOCCORE_CFLAGS) \
$(QMIFW_CFLAGS) \
-fno-short-enums \
-D__func__=__PRETTY_FUNCTION__ \
-DTARGET_USES_QCOM_BSP
libloc_api_v02_la_SOURCES = \
LocApiV02.cpp \
loc_api_v02_log.cpp \
loc_api_v02_client.cpp \
loc_api_sync_req.cpp \
location_service_v02.c
if USE_GLIB
libloc_api_v02_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
libloc_api_v02_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread -lcutils @GLIB_LIBS@ -shared -version-info 1:0:0
libloc_api_v02_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
else
libloc_api_v02_la_CFLAGS = $(AM_CFLAGS)
libloc_api_v02_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread -lcutils -shared -version-info 1:0:0
libloc_api_v02_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
endif
libloc_api_v02_la_CXXFLAGS = -std=c++0x
libloc_api_v02_la_LIBADD = -lstdc++ -ldl -lutils $(QMIFW_LIBS) $(GPSUTILS_LIBS) $(LOCCORE_LIBS)
library_include_HEADERS = \
location_service_v02.h \
loc_api_v02_log.h \
loc_api_v02_client.h \
loc_api_sync_req.h \
LocApiV02.h \
loc_util_log.h
library_includedir = $(pkgincludedir)/loc_api_v02
#Create and Install libraries
lib_LTLIBRARIES = libloc_api_v02.la
library_includedir = $(pkgincludedir)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = loc-api-v02.pc
EXTRA_DIST = $(pkgconfig_DATA)

View file

@ -1,90 +0,0 @@
# configure.ac -- Autoconf script for gps loc-api-v02
#
# Process this file with autoconf to produce a configure script
# Requires autoconf tool later than 2.61
AC_PREREQ(2.61)
# Initialize the gps loc-api-v02 package version 1.0.0
AC_INIT([loc-api-v02],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], [gps-utils])
AC_SUBST([GPSUTILS_CFLAGS])
AC_SUBST([GPSUTILS_LIBS])
PKG_CHECK_MODULES([LOCCORE], [loc-core])
AC_SUBST([LOCCORE_CFLAGS])
AC_SUBST([LOCCORE_LIBS])
PKG_CHECK_MODULES([QMIFW], [qmi-framework])
AC_SUBST([QMIFW_CFLAGS])
AC_SUBST([QMIFW_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 \
loc-api-v02.pc
])
AC_OUTPUT

View file

@ -1,10 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: loc-api-v02
Description: Loc Api V02
Version: @VERSION
Libs: -L${libdir} -lloc_api_v02
Cflags: -I${includedir} -I${includedir}/loc-api-v02

View file

@ -1,546 +0,0 @@
/* Copyright (c) 2011-2012, 2015-2016, 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.
*/
#include <stdio.h>
#include <assert.h>
#include <errno.h>
#include <sys/time.h>
#include <string.h>
#include <pthread.h>
#include <stdbool.h>
#include <stdint.h>
#include <loc_cfg.h>
#include "loc_api_v02_client.h"
#include "loc_api_sync_req.h"
#include "loc_api_v02_log.h"
#include <loc_pla.h>
/* Logging */
// Uncomment to log verbose logs
#define LOG_NDEBUG 1
// log debug logs
#define LOG_NDDEBUG 1
#define LOG_TAG "LocSvc_api_v02"
#include "loc_util_log.h"
#define LOC_SYNC_REQ_BUFFER_SIZE 8
pthread_mutex_t loc_sync_call_mutex = PTHREAD_MUTEX_INITIALIZER;
static bool loc_sync_call_initialized = false;
typedef struct {
pthread_mutex_t sync_req_lock;
/* Client ID */
locClientHandleType client_handle;
/* waiting conditional variable */
pthread_cond_t ind_arrived_cond;
/* Callback waiting data block, protected by loc_cb_data_mutex */
bool ind_is_selected; /* is cb selected? */
bool ind_is_waiting; /* is waiting? */
bool ind_has_arrived; /* callback has arrived */
uint32_t req_id; /* sync request */
void *recv_ind_payload_ptr; /* received payload */
uint32_t recv_ind_id; /* received ind */
} loc_sync_req_data_s_type;
typedef struct {
bool in_use; /* at least one sync call is active */
bool slot_in_use[LOC_SYNC_REQ_BUFFER_SIZE];
loc_sync_req_data_s_type slots[LOC_SYNC_REQ_BUFFER_SIZE];
} loc_sync_req_array_s_type;
/***************************************************************************
* DATA FOR ASYNCHRONOUS RPC PROCESSING
**************************************************************************/
loc_sync_req_array_s_type loc_sync_array;
/*===========================================================================
FUNCTION loc_sync_req_init
DESCRIPTION
Initialize this module
DEPENDENCIES
N/A
RETURN VALUE
none
SIDE EFFECTS
N/A
===========================================================================*/
void loc_sync_req_init()
{
LOC_LOGV(" %s:%d]:\n", __func__, __LINE__);
UTIL_READ_CONF_DEFAULT(LOC_PATH_GPS_CONF);
pthread_mutex_lock(&loc_sync_call_mutex);
if(true == loc_sync_call_initialized)
{
LOC_LOGD("%s:%d]:already initialized\n", __func__, __LINE__);
pthread_mutex_unlock(&loc_sync_call_mutex);
return;
}
loc_sync_array.in_use = false;
memset(loc_sync_array.slot_in_use, 0, sizeof(loc_sync_array.slot_in_use));
int i;
for (i = 0; i < LOC_SYNC_REQ_BUFFER_SIZE; i++)
{
loc_sync_req_data_s_type *slot = &loc_sync_array.slots[i];
pthread_mutex_init(&slot->sync_req_lock, NULL);
pthread_condattr_t condAttr;
pthread_condattr_init(&condAttr);
pthread_condattr_setclock(&condAttr, CLOCK_MONOTONIC);
pthread_cond_init(&slot->ind_arrived_cond, &condAttr);
pthread_condattr_destroy(&condAttr);
slot->client_handle = LOC_CLIENT_INVALID_HANDLE_VALUE;
slot->ind_is_selected = false; /* is ind selected? */
slot->ind_is_waiting = false; /* is waiting? */
slot->ind_has_arrived = false; /* callback has arrived */
slot->recv_ind_id = 0; /* ind to wait for */
slot->recv_ind_payload_ptr = NULL;
slot->req_id = 0; /* req id */
}
loc_sync_call_initialized = true;
pthread_mutex_unlock(&loc_sync_call_mutex);
}
/*===========================================================================
FUNCTION loc_sync_process_ind
DESCRIPTION
Wakes up blocked API calls to check if the needed callback has arrived
DEPENDENCIES
N/A
RETURN VALUE
none
SIDE EFFECTS
N/A
===========================================================================*/
void loc_sync_process_ind(
locClientHandleType client_handle, /* handle of the client */
uint32_t ind_id , /* ind id */
void *ind_payload_ptr, /* payload */
uint32_t ind_payload_size /* payload size */
)
{
LOC_LOGV("%s:%d]: received indication, handle = %p ind_id = %u \n",
__func__,__LINE__, client_handle, ind_id);
pthread_mutex_lock(&loc_sync_call_mutex);
if (!loc_sync_array.in_use)
{
LOC_LOGD("%s:%d]: loc_sync_array not in use \n",
__func__, __LINE__);
pthread_mutex_unlock(&loc_sync_call_mutex);
return;
}
bool in_use = false, consumed = false;
int i;
for (i = 0; i < LOC_SYNC_REQ_BUFFER_SIZE && !consumed; i++)
{
loc_sync_req_data_s_type *slot = &loc_sync_array.slots[i];
in_use |= loc_sync_array.slot_in_use[i];
pthread_mutex_lock(&slot->sync_req_lock);
if ( (loc_sync_array.slot_in_use[i]) && (slot->client_handle == client_handle)
&& (ind_id == slot->recv_ind_id) && (!slot->ind_has_arrived))
{
LOC_LOGV("%s:%d]: found slot %d selected for ind %u \n",
__func__, __LINE__, i, ind_id);
if( NULL != slot->recv_ind_payload_ptr &&
NULL != ind_payload_ptr && ind_payload_size > 0 )
{
LOC_LOGV("%s:%d]: copying ind payload size = %u \n",
__func__, __LINE__, ind_payload_size);
memcpy(slot->recv_ind_payload_ptr, ind_payload_ptr, ind_payload_size);
consumed = true;
}
/* Received a callback while waiting, wake up thread to check it */
if (slot->ind_is_waiting)
{
slot->recv_ind_id = ind_id;
pthread_cond_signal(&slot->ind_arrived_cond);
}
else
{
/* If callback arrives before wait, remember it */
LOC_LOGV("%s:%d]: ind %u arrived before wait was called \n",
__func__, __LINE__, ind_id);
slot->ind_has_arrived = true;
}
}
pthread_mutex_unlock(&slot->sync_req_lock);
}
if (!in_use) {
loc_sync_array.in_use = false;
}
pthread_mutex_unlock(&loc_sync_call_mutex);
}
/*===========================================================================
FUNCTION loc_alloc_slot
DESCRIPTION
Allocates a buffer slot for the synchronous API call
DEPENDENCIES
N/A
RETURN VALUE
Select ID (>=0) : successful
-1 : buffer full
SIDE EFFECTS
N/A
===========================================================================*/
static int loc_alloc_slot()
{
int i, select_id = -1; /* no free buffer */
pthread_mutex_lock(&loc_sync_call_mutex);
for (i = 0; i < LOC_SYNC_REQ_BUFFER_SIZE; i++)
{
if (!loc_sync_array.slot_in_use[i])
{
select_id = i;
loc_sync_array.slot_in_use[i] = 1;
loc_sync_array.in_use = true;
break;
}
}
pthread_mutex_unlock(&loc_sync_call_mutex);
LOC_LOGV("%s:%d]: returning slot %d\n",
__func__, __LINE__, select_id);
return select_id;
}
/*===========================================================================
FUNCTION loc_free_slot
DESCRIPTION
Frees a buffer slot after the synchronous API call
DEPENDENCIES
N/A
RETURN VALUE
None
SIDE EFFECTS
N/A
===========================================================================*/
static void loc_free_slot(int select_id)
{
int i;
loc_sync_req_data_s_type *slot;
pthread_mutex_lock(&loc_sync_call_mutex);
LOC_LOGD("%s:%d]: freeing slot %d\n", __func__, __LINE__, select_id);
loc_sync_array.slot_in_use[select_id] = 0;
slot = &loc_sync_array.slots[select_id];
slot->client_handle = LOC_CLIENT_INVALID_HANDLE_VALUE;
slot->ind_is_selected = false; /* is ind selected? */
slot->ind_is_waiting = false; /* is waiting? */
slot->ind_has_arrived = false; /* callback has arrived */
slot->recv_ind_id = 0; /* ind to wait for */
slot->recv_ind_payload_ptr = NULL;
slot->req_id = 0;
// check if all slots are now free
for (i = 0; i < LOC_SYNC_REQ_BUFFER_SIZE; i++)
{
if (loc_sync_array.slot_in_use[i]) break;
}
if (i >= LOC_SYNC_REQ_BUFFER_SIZE)
{
loc_sync_array.in_use = false;
}
pthread_mutex_unlock(&loc_sync_call_mutex);
}
/*===========================================================================
FUNCTION loc_sync_select_ind
DESCRIPTION
Selects which indication to wait for.
DEPENDENCIES
N/A
RETURN VALUE
Select ID (>=0) : successful
-ENOMEM : out of buffer
SIDE EFFECTS
N/A
===========================================================================*/
static int loc_sync_select_ind(
locClientHandleType client_handle, /* Client handle */
uint32_t ind_id, /* ind Id wait for */
uint32_t req_id, /* req id */
void * ind_payload_ptr /* ptr where payload should be copied to*/
)
{
int select_id = loc_alloc_slot();
LOC_LOGV("%s:%d]: client handle %p, ind_id %u, req_id %u \n",
__func__, __LINE__, client_handle, ind_id, req_id);
if (select_id < 0)
{
LOC_LOGE("%s:%d]: buffer full for this synchronous req %s \n",
__func__, __LINE__, loc_get_v02_event_name(req_id));
return -ENOMEM;
}
loc_sync_req_data_s_type *slot = &loc_sync_array.slots[select_id];
pthread_mutex_lock(&slot->sync_req_lock);
slot->client_handle = client_handle;
slot->ind_is_selected = true;
slot->ind_is_waiting = false;
slot->ind_has_arrived = false;
slot->recv_ind_id = ind_id;
slot->req_id = req_id;
slot->recv_ind_payload_ptr = ind_payload_ptr; //store the payload ptr
pthread_mutex_unlock(&slot->sync_req_lock);
return select_id;
}
/*===========================================================================
FUNCTION loc_sync_wait_for_ind
DESCRIPTION
Waits for a selected indication. The wait expires in timeout_seconds seconds.
If the function is called before an existing wait has finished, it will
immediately return error.
DEPENDENCIES
N/A
RETURN VALUE
0 on SUCCESS, -ve value on failure
SIDE EFFECTS
N/A
===========================================================================*/
static int loc_sync_wait_for_ind(
int select_id, /* ID from loc_sync_select_ind() */
int timeout_seconds, /* Timeout in this number of seconds */
uint32_t ind_id
)
{
if (select_id < 0 || select_id >= LOC_SYNC_REQ_BUFFER_SIZE || !loc_sync_array.slot_in_use[select_id])
{
LOC_LOGE("%s:%d]: invalid select_id: %d \n",
__func__, __LINE__, select_id);
return (-EINVAL);
}
loc_sync_req_data_s_type *slot = &loc_sync_array.slots[select_id];
int ret_val = 0; /* the return value of this function: 0 = no error */
int rc; /* return code from pthread calls */
struct timespec expire_time;
pthread_mutex_lock(&slot->sync_req_lock);
do
{
if (slot->ind_has_arrived)
{
ret_val = 0; /* success */
break;
}
if (slot->ind_is_waiting)
{
LOC_LOGW("%s:%d]: already waiting in this slot %d\n", __func__,
__LINE__, select_id);
ret_val = -EBUSY; // busy
break;
}
/* Calculate absolute expire time */
clock_gettime(CLOCK_MONOTONIC, &expire_time);
expire_time.tv_sec += timeout_seconds;
/* Take new wait request */
slot->ind_is_waiting = true;
/* Waiting */
rc = pthread_cond_timedwait(&slot->ind_arrived_cond,
&slot->sync_req_lock, &expire_time);
slot->ind_is_waiting = false;
if(rc == ETIMEDOUT)
{
LOC_LOGE("%s:%d]: slot %d, timed out for ind_id %s\n",
__func__, __LINE__, select_id, loc_get_v02_event_name(ind_id));
ret_val = -ETIMEDOUT; //time out
}
} while (0);
pthread_mutex_unlock(&slot->sync_req_lock);
loc_free_slot(select_id);
return ret_val;
}
/*===========================================================================
FUNCTION loc_sync_send_req
DESCRIPTION
Synchronous req call (thread safe)
DEPENDENCIES
N/A
RETURN VALUE
Loc API 2.0 status
SIDE EFFECTS
N/A
===========================================================================*/
locClientStatusEnumType loc_sync_send_req
(
locClientHandleType client_handle,
uint32_t req_id, /* req id */
locClientReqUnionType req_payload,
uint32_t timeout_msec,
uint32_t ind_id, //ind ID to block for, usually the same as req_id */
void *ind_payload_ptr /* can be NULL*/
)
{
locClientStatusEnumType status = eLOC_CLIENT_SUCCESS ;
int select_id;
int rc = 0;
// Select the callback we are waiting for
select_id = loc_sync_select_ind(client_handle, ind_id, req_id,
ind_payload_ptr);
if (select_id >= 0)
{
status = locClientSendReq (client_handle, req_id, req_payload);
LOC_LOGV("%s:%d]: select_id = %d,locClientSendReq returned %d\n",
__func__, __LINE__, select_id, status);
if (status != eLOC_CLIENT_SUCCESS )
{
loc_free_slot(select_id);
}
else
{
// Wait for the indication callback
if (( rc = loc_sync_wait_for_ind( select_id,
timeout_msec / 1000,
ind_id) ) < 0)
{
if ( rc == -ETIMEDOUT)
status = eLOC_CLIENT_FAILURE_TIMEOUT;
else
status = eLOC_CLIENT_FAILURE_INTERNAL;
// Callback waiting failed
LOC_LOGE("%s:%d]: loc_api_wait_for_ind failed, err %d, "
"select id %d, status %s", __func__, __LINE__, rc ,
select_id, loc_get_v02_client_status_name(status));
}
else
{
status = eLOC_CLIENT_SUCCESS;
LOC_LOGV("%s:%d]: success (select id %d)\n",
__func__, __LINE__, select_id);
}
}
} /* select id */
return status;
}

View file

@ -1,70 +0,0 @@
/* Copyright (c) 2011,2013,2016, 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.
*/
#ifndef LOC_SYNC_REQ_H
#define LOC_SYNC_REQ_H
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdbool.h>
#include <stdint.h>
#include "loc_api_v02_client.h"
#define LOC_ENGINE_SYNC_REQUEST_TIMEOUT (1000) // 1 second
#define LOC_ENGINE_SYNC_REQUEST_LONG_TIMEOUT (5000) // 5 seconds
/* Init function */
extern void loc_sync_req_init();
/* Process Loc API indications to wake up blocked user threads */
extern void loc_sync_process_ind(
locClientHandleType client_handle, /* handle of the client */
uint32_t ind_id , /* respInd id */
void *ind_payload_ptr, /* payload */
uint32_t ind_payload_size /* payload size */
);
/* Thread safe synchronous request, using Loc API status return code */
extern locClientStatusEnumType loc_sync_send_req
(
locClientHandleType client_handle,
uint32_t req_id, /* req id */
locClientReqUnionType req_payload,
uint32_t timeout_msec,
uint32_t ind_id, //ind ID to block for, usually the same as req_id */
void *ind_payload_ptr /* can be NULL*/
);
#ifdef __cplusplus
}
#endif
#endif /* LOC_SYNC_REQ_H */

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,298 +0,0 @@
/* Copyright (c) 2011-2015, 2018-2020 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.
*
*/
#include <loc_api_v02_log.h>
#include <location_service_v02.h>
DECLARE_TBL(loc_v02_event_name) =
{
NAME_VAL(QMI_LOC_GET_SUPPORTED_MSGS_REQ_V02),
NAME_VAL(QMI_LOC_GET_SUPPORTED_FIELDS_REQ_V02),
NAME_VAL(QMI_LOC_INFORM_CLIENT_REVISION_REQ_V02),
NAME_VAL(QMI_LOC_REG_EVENTS_REQ_V02),
NAME_VAL(QMI_LOC_START_REQ_V02),
NAME_VAL(QMI_LOC_STOP_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_POSITION_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GNSS_SV_INFO_IND_V02),
NAME_VAL(QMI_LOC_EVENT_NMEA_IND_V02),
NAME_VAL(QMI_LOC_EVENT_NI_NOTIFY_VERIFY_REQ_IND_V02),
NAME_VAL(QMI_LOC_EVENT_INJECT_TIME_REQ_IND_V02),
NAME_VAL(QMI_LOC_EVENT_INJECT_PREDICTED_ORBITS_REQ_IND_V02),
NAME_VAL(QMI_LOC_EVENT_INJECT_POSITION_REQ_IND_V02),
NAME_VAL(QMI_LOC_EVENT_ENGINE_STATE_IND_V02),
NAME_VAL(QMI_LOC_EVENT_FIX_SESSION_STATE_IND_V02),
NAME_VAL(QMI_LOC_EVENT_WIFI_REQ_IND_V02),
NAME_VAL(QMI_LOC_EVENT_SENSOR_STREAMING_READY_STATUS_IND_V02),
NAME_VAL(QMI_LOC_EVENT_TIME_SYNC_REQ_IND_V02),
NAME_VAL(QMI_LOC_EVENT_SET_SPI_STREAMING_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_LOCATION_SERVER_CONNECTION_REQ_IND_V02),
NAME_VAL(QMI_LOC_GET_SERVICE_REVISION_REQ_V02),
NAME_VAL(QMI_LOC_GET_FIX_CRITERIA_REQ_V02),
NAME_VAL(QMI_LOC_NI_USER_RESPONSE_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_PREDICTED_ORBITS_DATA_REQ_V02),
NAME_VAL(QMI_LOC_GET_PREDICTED_ORBITS_DATA_SOURCE_REQ_V02),
NAME_VAL(QMI_LOC_GET_PREDICTED_ORBITS_DATA_VALIDITY_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_UTC_TIME_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_POSITION_REQ_V02),
NAME_VAL(QMI_LOC_SET_ENGINE_LOCK_REQ_V02),
NAME_VAL(QMI_LOC_GET_ENGINE_LOCK_REQ_V02),
NAME_VAL(QMI_LOC_SET_SBAS_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_GET_SBAS_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_SET_NMEA_TYPES_REQ_V02),
NAME_VAL(QMI_LOC_GET_NMEA_TYPES_REQ_V02),
NAME_VAL(QMI_LOC_SET_LOW_POWER_MODE_REQ_V02),
NAME_VAL(QMI_LOC_GET_LOW_POWER_MODE_REQ_V02),
NAME_VAL(QMI_LOC_REGISTER_MASTER_CLIENT_REQ_V02),
NAME_VAL(QMI_LOC_SET_SERVER_REQ_V02),
NAME_VAL(QMI_LOC_GET_SERVER_REQ_V02),
NAME_VAL(QMI_LOC_DELETE_ASSIST_DATA_REQ_V02),
NAME_VAL(QMI_LOC_SET_XTRA_T_SESSION_CONTROL_REQ_V02),
NAME_VAL(QMI_LOC_GET_XTRA_T_SESSION_CONTROL_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_WIFI_POSITION_REQ_V02),
NAME_VAL(QMI_LOC_NOTIFY_WIFI_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_GET_REGISTERED_EVENTS_REQ_V02),
NAME_VAL(QMI_LOC_SET_OPERATION_MODE_REQ_V02),
NAME_VAL(QMI_LOC_GET_OPERATION_MODE_REQ_V02),
NAME_VAL(QMI_LOC_SET_SPI_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_SENSOR_DATA_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_TIME_SYNC_DATA_REQ_V02),
NAME_VAL(QMI_LOC_SET_CRADLE_MOUNT_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_GET_CRADLE_MOUNT_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_SET_EXTERNAL_POWER_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_GET_EXTERNAL_POWER_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_INFORM_LOCATION_SERVER_CONN_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_REQ_V02),
NAME_VAL(QMI_LOC_GET_PROTOCOL_CONFIG_PARAMETERS_REQ_V02),
NAME_VAL(QMI_LOC_SET_SENSOR_CONTROL_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_GET_SENSOR_CONTROL_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_SET_SENSOR_PROPERTIES_REQ_V02),
NAME_VAL(QMI_LOC_GET_SENSOR_PROPERTIES_REQ_V02),
NAME_VAL(QMI_LOC_SET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_REQ_V02),
NAME_VAL(QMI_LOC_GET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_SUPL_CERTIFICATE_REQ_V02),
NAME_VAL(QMI_LOC_DELETE_SUPL_CERTIFICATE_REQ_V02),
NAME_VAL(QMI_LOC_SET_POSITION_ENGINE_CONFIG_PARAMETERS_REQ_V02),
NAME_VAL(QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_NI_GEOFENCE_NOTIFICATION_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GEOFENCE_GEN_ALERT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GEOFENCE_BREACH_NOTIFICATION_IND_V02),
NAME_VAL(QMI_LOC_ADD_CIRCULAR_GEOFENCE_REQ_V02),
NAME_VAL(QMI_LOC_DELETE_GEOFENCE_REQ_V02),
NAME_VAL(QMI_LOC_QUERY_GEOFENCE_REQ_V02),
NAME_VAL(QMI_LOC_EDIT_GEOFENCE_REQ_V02),
NAME_VAL(QMI_LOC_GET_BEST_AVAILABLE_POSITION_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_MOTION_DATA_REQ_V02),
NAME_VAL(QMI_LOC_GET_NI_GEOFENCE_ID_LIST_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_GSM_CELL_INFO_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_NETWORK_INITIATED_MESSAGE_REQ_V02),
NAME_VAL(QMI_LOC_WWAN_OUT_OF_SERVICE_NOTIFICATION_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_PEDOMETER_CONTROL_IND_V02),
NAME_VAL(QMI_LOC_EVENT_MOTION_DATA_CONTROL_IND_V02),
NAME_VAL(QMI_LOC_PEDOMETER_REPORT_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_WCDMA_CELL_INFO_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_TDSCDMA_CELL_INFO_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_SUBSCRIBER_ID_REQ_V02),
NAME_VAL(QMI_LOC_SET_GEOFENCE_ENGINE_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_GET_GEOFENCE_ENGINE_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_GET_BATCH_SIZE_REQ_V02),
NAME_VAL(QMI_LOC_START_BATCHING_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_BATCH_FULL_NOTIFICATION_IND_V02),
NAME_VAL(QMI_LOC_EVENT_LIVE_BATCHED_POSITION_REPORT_IND_V02),
NAME_VAL(QMI_LOC_READ_FROM_BATCH_REQ_V02),
NAME_VAL(QMI_LOC_STOP_BATCHING_REQ_V02),
NAME_VAL(QMI_LOC_RELEASE_BATCH_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_INJECT_WIFI_AP_DATA_REQ_IND_V02),
NAME_VAL(QMI_LOC_INJECT_WIFI_AP_DATA_REQ_V02),
NAME_VAL(QMI_LOC_NOTIFY_WIFI_ATTACHMENT_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_NOTIFY_WIFI_ENABLED_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_GEOFENCE_BATCHED_BREACH_NOTIFICATION_IND_V02),
NAME_VAL(QMI_LOC_EVENT_VEHICLE_DATA_READY_STATUS_IND_V02),
NAME_VAL(QMI_LOC_INJECT_VEHICLE_SENSOR_DATA_REQ_V02),
NAME_VAL(QMI_LOC_GET_AVAILABLE_WWAN_POSITION_REQ_V02),
NAME_VAL(QMI_LOC_SET_PREMIUM_SERVICES_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_SET_XTRA_VERSION_CHECK_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_GNSS_MEASUREMENT_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_SV_POLYNOMIAL_REPORT_IND_V02),
NAME_VAL(QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG_V02),
NAME_VAL(QMI_LOC_ADD_GEOFENCE_CONTEXT_REQ_V02),
NAME_VAL(QMI_LOC_SET_GEOFENCE_ENGINE_CONTEXT_REQ_V02),
NAME_VAL(QMI_LOC_DELETE_GEOFENCE_CONTEXT_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_GEOFENCE_PROXIMITY_NOTIFICATION_IND_V02),
NAME_VAL(QMI_LOC_INJECT_GTP_CLIENT_DOWNLOADED_DATA_REQ_V02),
NAME_VAL(QMI_LOC_GDT_UPLOAD_BEGIN_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_GDT_UPLOAD_END_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_GDT_UPLOAD_BEGIN_STATUS_REQ_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GDT_UPLOAD_END_REQ_IND_V02),
NAME_VAL(QMI_LOC_START_DBT_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_DBT_POSITION_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_DBT_SESSION_STATUS_IND_V02),
NAME_VAL(QMI_LOC_STOP_DBT_REQ_V02),
NAME_VAL(QMI_LOC_SECURE_GET_AVAILABLE_POSITION_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_GEOFENCE_BATCHED_DWELL_NOTIFICATION_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GET_TIME_ZONE_INFO_IND_V02),
NAME_VAL(QMI_LOC_INJECT_TIME_ZONE_INFO_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_APCACHE_DATA_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_APDONOTCACHE_DATA_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_BATCHING_STATUS_IND_V02),
NAME_VAL(QMI_LOC_QUERY_AON_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_GTP_AP_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_GDT_DOWNLOAD_BEGIN_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_GDT_DOWNLOAD_READY_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_GDT_RECEIVE_DONE_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_GDT_DOWNLOAD_END_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_GDT_DOWNLOAD_BEGIN_REQ_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GDT_RECEIVE_DONE_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GDT_DOWNLOAD_END_REQ_IND_V02),
NAME_VAL(QMI_LOC_DELETE_GNSS_SERVICE_DATA_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_XTRA_DATA_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_XTRA_PCID_REQ_V02),
NAME_VAL(QMI_LOC_GET_SUPPORTED_FEATURE_REQ_V02),
NAME_VAL(QMI_LOC_SET_INTERNAL_STATUS_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_INTERNAL_STATUS_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_INJECT_SRN_AP_DATA_REQ_IND_V02),
NAME_VAL(QMI_LOC_INJECT_SRN_AP_DATA_REQ_V02),
NAME_VAL(QMI_LOC_CROWDSOURCE_MANAGER_CONTROL_REQ_V02),
NAME_VAL(QMI_LOC_CROWDSOURCE_MANAGER_READ_DATA_REQ_V02),
NAME_VAL(QMI_LOC_QUERY_XTRA_INFO_REQ_V02),
NAME_VAL(QMI_LOC_START_OUTDOOR_TRIP_BATCHING_REQ_V02),
NAME_VAL(QMI_LOC_QUERY_OTB_ACCUMULATED_DISTANCE_REQ_V02),
NAME_VAL(QMI_LOC_GET_FDCL_BS_LIST_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_FDCL_DATA_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_FDCL_SERVICE_REQ_IND_V02),
NAME_VAL(QMI_LOC_SET_BLACKLIST_SV_REQ_V02),
NAME_VAL(QMI_LOC_GET_BLACKLIST_SV_REQ_V02),
NAME_VAL(QMI_LOC_SET_CONSTELLATION_CONTROL_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_UNPROPAGATED_POSITION_REPORT_IND_V02),
NAME_VAL(QMI_LOC_GET_BS_OBS_DATA_REQ_V02),
NAME_VAL(QMI_LOC_GET_CONSTELLATION_CONTROL_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_BS_OBS_DATA_SERVICE_REQ_IND_V02),
NAME_VAL(QMI_LOC_SET_CONSTRAINED_TUNC_MODE_REQ_V02),
NAME_VAL(QMI_LOC_ENABLE_POSITION_ASSISTED_CLOCK_EST_REQ_V02),
NAME_VAL(QMI_LOC_QUERY_GNSS_ENERGY_CONSUMED_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_GPS_EPHEMERIS_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GLONASS_EPHEMERIS_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_BDS_EPHEMERIS_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GALILEO_EPHEMERIS_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_QZSS_EPHEMERIS_REPORT_IND_V02),
NAME_VAL(QMI_LOC_SYSTEM_INFO_REQ_V02),
NAME_VAL(QMI_LOC_GET_CONSTELLATION_CONTROL_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_UNPROPAGATED_POSITION_REPORT_IND_V02),
NAME_VAL(QMI_LOC_ENABLE_POSITION_INJECTION_TEST_MODE_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_TEST_POSITION_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_BS_OBS_DATA_SERVICE_REQ_IND_V02),
NAME_VAL(QMI_LOC_GET_BS_OBS_DATA_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_GPS_EPHEMERIS_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GLONASS_EPHEMERIS_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_BDS_EPHEMERIS_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GALILEO_EPHEMERIS_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_QZSS_EPHEMERIS_REPORT_IND_V02),
NAME_VAL(QMI_LOC_SET_CONSTRAINED_TUNC_MODE_REQ_V02),
NAME_VAL(QMI_LOC_ENABLE_POSITION_ASSISTED_CLOCK_EST_REQ_V02),
NAME_VAL(QMI_LOC_QUERY_GNSS_ENERGY_CONSUMED_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_REPORT_IND_V02),
NAME_VAL(QMI_LOC_GET_BAND_MEASUREMENT_METRICS_IND_V02),
NAME_VAL(QMI_LOC_LOCATION_REQUEST_NOTIFICATION_IND_V02),
NAME_VAL(QMI_LOC_INJECT_PLATFORM_POWER_STATE_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_PLATFORM_POWER_STATE_RESP_V02),
NAME_VAL(QMI_LOC_INJECT_PLATFORM_POWER_STATE_IND_V02),
NAME_VAL(QMI_LOC_SET_ROBUST_LOCATION_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_GET_ROBUST_LOCATION_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_SET_MIN_GPS_WEEK_NUMBER_REQ_V02),
NAME_VAL(QMI_LOC_GET_MIN_GPS_WEEK_NUMBER_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_QUERY_XTRA_INFO_REQ_IND_V02),
NAME_VAL(QMI_LOC_SET_PARAMETER_REQ_V02),
NAME_VAL(QMI_LOC_GET_PARAMETER_REQ_V02),
NAME_VAL(QMI_LOC_SET_MULTIBAND_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_GET_MULTIBAND_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_LATENCY_INFORMATION_IND_V02),
};
const char* loc_get_v02_event_name(uint32_t event)
{
return loc_get_name_from_val(loc_v02_event_name_tbl, (int64_t) event);
}
DECLARE_TBL(loc_v02_client_status_name) =
{
NAME_VAL(eLOC_CLIENT_SUCCESS),
NAME_VAL(eLOC_CLIENT_FAILURE_GENERAL),
NAME_VAL(eLOC_CLIENT_FAILURE_UNSUPPORTED),
NAME_VAL(eLOC_CLIENT_FAILURE_INVALID_PARAMETER),
NAME_VAL(eLOC_CLIENT_FAILURE_ENGINE_BUSY),
NAME_VAL(eLOC_CLIENT_FAILURE_PHONE_OFFLINE),
NAME_VAL(eLOC_CLIENT_FAILURE_TIMEOUT),
NAME_VAL(eLOC_CLIENT_FAILURE_SERVICE_NOT_PRESENT),
NAME_VAL(eLOC_CLIENT_FAILURE_SERVICE_VERSION_UNSUPPORTED),
NAME_VAL(eLOC_CLIENT_FAILURE_CLIENT_VERSION_UNSUPPORTED),
NAME_VAL(eLOC_CLIENT_FAILURE_INVALID_HANDLE),
NAME_VAL(eLOC_CLIENT_FAILURE_INTERNAL),
NAME_VAL(eLOC_CLIENT_FAILURE_NOT_INITIALIZED),
NAME_VAL(eLOC_CLIENT_FAILURE_NOT_ENOUGH_MEMORY),
NAME_VAL(eLOC_CLIENT_FAILURE_INVALID_MESSAGE_ID),
};
const char* loc_get_v02_client_status_name(locClientStatusEnumType status)
{
return loc_get_name_from_val(loc_v02_client_status_name_tbl, (int64_t) status);
}
DECLARE_TBL(loc_v02_qmi_status_name) =
{
NAME_VAL(eQMI_LOC_SUCCESS_V02),
NAME_VAL(eQMI_LOC_GENERAL_FAILURE_V02),
NAME_VAL(eQMI_LOC_UNSUPPORTED_V02),
NAME_VAL(eQMI_LOC_INVALID_PARAMETER_V02),
NAME_VAL(eQMI_LOC_ENGINE_BUSY_V02),
NAME_VAL(eQMI_LOC_PHONE_OFFLINE_V02),
NAME_VAL(eQMI_LOC_TIMEOUT_V02),
NAME_VAL(eQMI_LOC_CONFIG_NOT_SUPPORTED_V02),
NAME_VAL(eQMI_LOC_INSUFFICIENT_MEMORY_V02),
NAME_VAL(eQMI_LOC_MAX_GEOFENCE_PROGRAMMED_V02),
NAME_VAL(eQMI_LOC_XTRA_VERSION_CHECK_FAILURE_V02),
NAME_VAL(eQMI_LOC_GNSS_DISABLED_V02),
};
const char* loc_get_v02_qmi_status_name(qmiLocStatusEnumT_v02 status)
{
return loc_get_name_from_val(loc_v02_qmi_status_name_tbl, (int64_t) status);
}
DECLARE_TBL(loc_v02_qmi_reg_mk_status_name) =
{
NAME_VAL(eQMI_LOC_REGISTER_MASTER_CLIENT_SUCCESS_V02),
NAME_VAL(eQMI_LOC_REGISTER_MASTER_CLIENT_INVALID_KEY_V02),
NAME_VAL(eQMI_LOC_REGISTER_MASTER_CLIENT_ALREADY_HAVE_MASTER_CLIENT_V02),
NAME_VAL(eQMI_LOC_REGISTER_MASTER_CLIENT_INTERNAL_FAILURE_V02),
};
const char* loc_get_v02_qmi_reg_mk_status_name(qmiLocRegisterMasterClientStatusEnumT_v02 status)
{
return loc_get_name_from_val(loc_v02_qmi_reg_mk_status_name_tbl, (int64_t)status);
}

View file

@ -1,51 +0,0 @@
/* Copyright (c) 2011, 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.
*
*/
#ifndef LOC_API_V02_LOG_H
#define LOC_API_V02_LOG_H
#include <loc_log.h>
#include <loc_api_v02_client.h>
#ifdef __cplusplus
extern "C"
{
#endif
const char* loc_get_v02_event_name(uint32_t event);
const char* loc_get_v02_client_status_name(locClientStatusEnumType status);
const char* loc_get_v02_qmi_status_name(qmiLocStatusEnumT_v02 status);
const char* loc_get_v02_qmi_reg_mk_status_name(qmiLocRegisterMasterClientStatusEnumT_v02 status);
#ifdef __cplusplus
}
#endif
#endif /* LOC_API_V02_LOG_H */

View file

@ -1,78 +0,0 @@
/* Copyright (c) 2011-2012, 2014, 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.
*/
#ifndef LOC_UTIL_LOG_H
#define LOC_UTIL_LOG_H
#include <log_util.h>
#if defined(_ANDROID_)
#include "loc_api_v02_log.h"
#else // no _ANDROID_
#if defined(__LOC_API_V02_LOG_SILENT__)
#define MSG_LOG
#define LOC_LOGE(...) MSG_LOG(__VA_ARGS__);
#define LOC_LOGW(...) MSG_LOG(__VA_ARGS__);
#define LOC_LOGD(...) MSG_LOG(__VA_ARGS__);
#define LOC_LOGI(...) MSG_LOG(__VA_ARGS__);
#define LOC_LOGV(...) MSG_LOG(__VA_ARGS__);
#elif !defined(USE_GLIB)
// common for QNX and Griffon
//error logs
#define LOC_LOGE(...) printf(__VA_ARGS__)
//warning logs
#define LOC_LOGW(...) printf(__VA_ARGS__)
// debug logs
#define LOC_LOGD(...) printf(__VA_ARGS__)
//info logs
#define LOC_LOGI(...) printf(__VA_ARGS__)
//verbose logs
#define LOC_LOGV(...) printf(__VA_ARGS__)
#endif //__LOC_API_V02_LOG_SILENT__
//specific to OFF TARGET
#ifdef LOC_UTIL_TARGET_OFF_TARGET
# include <stdio.h>
# include <asm/errno.h>
# include <sys/time.h>
// get around strl*: not found in glibc
// TBD:look for presence of eglibc other libraries
// with strlcpy supported.
#define strlcpy(X,Y,Z) strcpy(X,Y)
#define strlcat(X,Y,Z) strcat(X,Y)
#endif //LOC_UTIL_TARGET_OFF_TARGET
#endif //_ANDROID_
#endif //LOC_UTIL_LOG_H

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,9 +0,0 @@
cc_library_headers {
name: "loc_sll_if_headers",
owner: "qti",
vendor: true,
export_include_dirs: ["."],
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,591 +0,0 @@
/* Copyright (c) 2020 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.
*/
// ============================================================================
// LocationApiMsg.proto
// Location Api messages definition - structs, enums etc
// ============================================================================
syntax = "proto3";
import "LocationApiDataTypes.proto";
// ============================================================================
// Proto file versioning
// ============================================================================
enum LocationApiMsgVersion {
LOCAPI_MSG_VER_INVALID = 0;
// Major changes - compatibility breakage. Bump the first byte of version i.e. 1.x to 2.0
LOCAPI_MSG_VER_MAJOR = 1;
// Minor - New features / API addition, new message/elemtent addition.
// Bump the last byte of version i.e. x.2 to x.3
// Minor version 4: GTP Single shot WWAN change
LOCAPI_MSG_VER_MINOR = 4;
}
// ============================================================================
// Enumerations
// ============================================================================
// List of message IDs supported by Location Remote API
enum PBELocMsgID {
PB_E_LOCAPI_UNDEFINED_MSG_ID = 0;
// registration
PB_E_LOCAPI_CLIENT_REGISTER_MSG_ID = 1;
PB_E_LOCAPI_CLIENT_DEREGISTER_MSG_ID = 2;
PB_E_LOCAPI_CAPABILILTIES_MSG_ID = 3;
PB_E_LOCAPI_HAL_READY_MSG_ID = 4;
// tracking session
PB_E_LOCAPI_START_TRACKING_MSG_ID = 5;
PB_E_LOCAPI_STOP_TRACKING_MSG_ID = 6;
PB_E_LOCAPI_UPDATE_CALLBACKS_MSG_ID = 7;
PB_E_LOCAPI_UPDATE_TRACKING_OPTIONS_MSG_ID = 8;
// control
// >> this message id has been deprecated
PB_E_LOCAPI_CONTROL_UPDATE_CONFIG_MSG_ID = 9; // this message id has been deprecated
PB_E_LOCAPI_CONTROL_DELETE_AIDING_DATA_MSG_ID = 10; // this message id has been deprecated
PB_E_LOCAPI_CONTROL_UPDATE_NETWORK_AVAILABILITY_MSG_ID = 11;
// Position reports
PB_E_LOCAPI_LOCATION_MSG_ID = 12;
PB_E_LOCAPI_LOCATION_INFO_MSG_ID = 13;
PB_E_LOCAPI_SATELLITE_VEHICLE_MSG_ID = 14;
PB_E_LOCAPI_NMEA_MSG_ID = 15;
PB_E_LOCAPI_DATA_MSG_ID = 16;
// Get API to retrieve info from GNSS engine
PB_E_LOCAPI_GET_GNSS_ENGERY_CONSUMED_MSG_ID = 17;
PB_E_LOCAPI_LOCATION_SYSTEM_INFO_MSG_ID = 18;
// engine position report
PB_E_LOCAPI_ENGINE_LOCATIONS_INFO_MSG_ID = 19;
// batching session
PB_E_LOCAPI_START_BATCHING_MSG_ID = 20;
PB_E_LOCAPI_STOP_BATCHING_MSG_ID = 21;
PB_E_LOCAPI_UPDATE_BATCHING_OPTIONS_MSG_ID = 22;
//batching reports
PB_E_LOCAPI_BATCHING_MSG_ID = 23;
// geofence session
PB_E_LOCAPI_ADD_GEOFENCES_MSG_ID = 24;
PB_E_LOCAPI_REMOVE_GEOFENCES_MSG_ID = 25;
PB_E_LOCAPI_MODIFY_GEOFENCES_MSG_ID = 26;
PB_E_LOCAPI_PAUSE_GEOFENCES_MSG_ID = 27;
PB_E_LOCAPI_RESUME_GEOFENCES_MSG_ID = 28;
//geofence breach
PB_E_LOCAPI_GEOFENCE_BREACH_MSG_ID = 29;
// Measurement reports
PB_E_LOCAPI_MEAS_MSG_ID = 30;
// Terrestria fix request/response msg
PB_E_LOCAPI_GET_SINGLE_TERRESTRIAL_POS_REQ_MSG_ID = 31;
PB_E_LOCAPI_GET_SINGLE_TERRESTRIAL_POS_RESP_MSG_ID = 32;
// ping
PB_E_LOCAPI_PINGTEST_MSG_ID = 99;
// integration API config request
PB_E_INTAPI_CONFIG_CONSTRAINTED_TUNC_MSG_ID = 200;
PB_E_INTAPI_CONFIG_POSITION_ASSISTED_CLOCK_ESTIMATOR_MSG_ID = 201;
PB_E_INTAPI_CONFIG_SV_CONSTELLATION_MSG_ID = 202;
PB_E_INTAPI_CONFIG_AIDING_DATA_DELETION_MSG_ID = 203;
PB_E_INTAPI_CONFIG_LEVER_ARM_MSG_ID = 204;
PB_E_INTAPI_CONFIG_ROBUST_LOCATION_MSG_ID = 205;
PB_E_INTAPI_CONFIG_MIN_GPS_WEEK_MSG_ID = 206;
PB_E_INTAPI_CONFIG_DEAD_RECKONING_ENGINE_MSG_ID = 207;
PB_E_INTAPI_CONFIG_MIN_SV_ELEVATION_MSG_ID = 208;
PB_E_INTAPI_CONFIG_CONSTELLATION_SECONDARY_BAND_MSG_ID = 209;
PB_E_INTAPI_CONFIG_ENGINE_RUN_STATE_MSG_ID = 210;
PB_E_INTAPI_CONFIG_USER_CONSENT_TERRESTRIAL_POSITIONING_MSG_ID = 211;
// integration API config retrieval request/response
PB_E_INTAPI_GET_ROBUST_LOCATION_CONFIG_REQ_MSG_ID = 300;
PB_E_INTAPI_GET_ROBUST_LOCATION_CONFIG_RESP_MSG_ID = 301;
PB_E_INTAPI_GET_MIN_GPS_WEEK_REQ_MSG_ID = 302;
PB_E_INTAPI_GET_MIN_GPS_WEEK_RESP_MSG_ID = 303;
PB_E_INTAPI_GET_MIN_SV_ELEVATION_REQ_MSG_ID = 304;
PB_E_INTAPI_GET_MIN_SV_ELEVATION_RESP_MSG_ID = 305;
PB_E_INTAPI_GET_CONSTELLATION_SECONDARY_BAND_CONFIG_REQ_MSG_ID = 306;
PB_E_INTAPI_GET_CONSTELLATION_SECONDARY_BAND_CONFIG_RESP_MSG_ID = 307;
}
enum PBClientType {
PB_LOCATION_CLIENT_TYPE_INVALID = 0;
PB_LOCATION_CLIENT_API = 1;
PB_LOCATION_INTEGRATION_API = 2;
}
enum PBLocationCallbacksMask {
PB_E_LOC_CB_INVALID = 0;
/**< Register for DBT location report */
PB_E_LOC_CB_DISTANCE_BASED_TRACKING_BIT = 1;
/**< Register for GNSS Location */
PB_E_LOC_CB_GNSS_LOCATION_INFO_BIT = 2;
/**< Register for GNSS SV */
PB_E_LOC_CB_GNSS_SV_BIT = 4;
/**< Register for GNSS NMEA */
PB_E_LOC_CB_GNSS_NMEA_BIT = 8;
/**< Register for GNSS DATA */
PB_E_LOC_CB_GNSS_DATA_BIT = 16;
/**< Register for Location system info */
PB_E_LOC_CB_SYSTEM_INFO_BIT = 32;
/**< Register for Batching */
PB_E_LOC_CB_BATCHING_BIT = 64;
/**< Register for Batching Status*/
PB_E_LOC_CB_BATCHING_STATUS_BIT = 128;
/**< Register for Geofence Breach */
PB_E_LOC_CB_GEOFENCE_BREACH_BIT = 256;
/**< Register for multiple engine reports */
PB_E_LOC_CB_ENGINE_LOCATIONS_INFO_BIT = 512;
/**< Register for simple location */
PB_E_LOC_CB_SIMPLE_LOCATION_INFO_BIT = 1024;
/**< Register for GNSS Measurements */
PB_E_LOC_CB_GNSS_MEAS_BIT = 2048;
}
enum PBEngineInfoCallbacksMask {
PB_E_ENGINE_INFO_CB_INVALID = 0;
/**< GNSS energy consumed */
// gnss energy consumed, once the info is delivered,
// this bit will be cleared
PB_E_ENGINE_INFO_CB_GNSS_ENERGY_CONSUMED_BIT = 1;
}
enum PBGeofenceBreachTypeMask {
PB_GEOFENCE_BREACH_INVALID = 0;
PB_GEOFENCE_BREACH_ENTER_BIT = 1;
PB_GEOFENCE_BREACH_EXIT_BIT = 2;
PB_GEOFENCE_BREACH_DWELL_IN_BIT = 4;
PB_GEOFENCE_BREACH_DWELL_OUT_BIT = 8;
}
// ============================================================================
// Messages
// ============================================================================
//*******************************
// Common data structure
//*******************************
message PBLocAPINmeaSerializedPayload {
uint64 timestamp = 1;
string nmea = 2;
}
message PBLocAPIBatchNotification {
PBBatchingStatus status = 1;
repeated PBLocation location = 2;
}
message PBLocAPIGeofenceBreachNotification {
uint64 timestamp = 1;
//type of breach - PBGeofenceBreachTypeMask
uint32 breachtype = 2;
//location associated with breach
PBLocation location = 3;
repeated uint32 id = 4;
}
message PBGeofenceOption {
// bitwise OR of PBGeofenceBreachTypeMask
uint32 breachTypeMask = 1;
// in milliseconds
uint32 responsiveness = 2;
// in seconds
uint32 dwellTime = 3;
}
message PBGeofenceInfo {
// in degrees
double latitude = 1;
// in degrees
double longitude = 2;
// in meters
double radius = 3;
}
message PBGeofencePayload {
uint32 gfClientId = 1;
PBGeofenceOption gfOption = 2;
PBGeofenceInfo gfInfo = 3;
}
message PBGeofencesAddedReqPayload {
repeated PBGeofencePayload gfPayload = 1;
}
message PBGeofencesReqClientIdPayload {
repeated uint32 gfIds = 1;
}
message PBGeofenceResponse {
uint32 clientId = 1;
PBLocationError error = 2;
}
message PBCollectiveResPayload {
repeated PBGeofenceResponse resp = 1;
}
//********************************************
// IPC message structure - client registration
//********************************************
// defintion for message with msg id of PB_E_LOCAPI_CLIENT_REGISTER_MSG_ID
message PBLocAPIClientRegisterReqMsg {
PBClientType mClientType = 1;
}
// defintion for message with msg id of PB_E_LOCAPI_CLIENT_DEREGISTER_MSG_ID
// LocAPIClientDeregisterReqMsg - no struct member.
// defintion for message with msg id of PB_E_LOCAPI_CAPABILILTIES_MSG_ID
message PBLocAPICapabilitiesIndMsg
{
// Bitwise OR of PBLocationCapabilitiesMask
uint64 capabilitiesMask = 1;
}
// defintion for message with msg id of PB_E_LOCAPI_HAL_READY_MSG_ID
// LocAPIHalReadyIndMsg - no struct member.
//*****************************************
// IPC message structure - generic response
//*****************************************
message PBLocAPIGenericRespMsg {
PBLocationError err = 1;
}
message PBLocAPICollectiveRespMsg {
PBCollectiveResPayload collectiveRes = 1;
}
//*********************************
// IPC message structure - tracking
//*********************************
// defintion for message with msg id of PB_E_LOCAPI_START_TRACKING_MSG_ID
message PBLocAPIStartTrackingReqMsg {
PBLocationOptions locOptions = 1;
}
// defintion for message with msg id of E_LOCAPI_STOP_TRACKING_MSG_ID
// LocAPIStopTrackingReqMsg - no struct member.
// defintion for message with msg id of PB_E_LOCAPI_UPDATE_CALLBACKS_MSG_ID
message PBLocAPIUpdateCallbacksReqMsg {
// bitwise OR of PBLocationCallbacksMask
uint32 locationCallbacks = 1;
}
// defintion for message with msg id of PB_E_LOCAPI_UPDATE_TRACKING_OPTIONS_MSG_ID
message PBLocAPIUpdateTrackingOptionsReqMsg {
PBLocationOptions locOptions = 1;
}
//*********************************
// IPC message structure - batching
//*********************************
// defintion for message with msg id of PB_E_LOCAPI_START_BATCHING_MSG_ID
message PBLocAPIStartBatchingReqMsg {
uint32 intervalInMs = 1;
uint32 distanceInMeters = 2;
PBBatchingMode batchingMode = 3;
}
// defintion for message with msg id of PB_E_LOCAPI_STOP_BATCHING_MSG_ID
// LocAPIStopBatchingReqMsg - no struct member.
// defintion for message with msg id of PB_E_LOCAPI_UPDATE_BATCHING_OPTIONS_MSG_ID
message PBLocAPIUpdateBatchingOptionsReqMsg {
uint32 intervalInMs = 1;
uint32 distanceInMeters = 2;
PBBatchingMode batchingMode = 3;
}
//*********************************
// IPC message structure - geofence
//*********************************
// defintion for message with msg id of PB_E_LOCAPI_ADD_GEOFENCES_MSG_ID
message PBLocAPIAddGeofencesReqMsg {
PBGeofencesAddedReqPayload geofences = 1;
}
// defintion for message with msg id of PB_E_LOCAPI_REMOVE_GEOFENCES_MSG_ID
message PBLocAPIRemoveGeofencesReqMsg {
PBGeofencesReqClientIdPayload gfClientIds = 1;
}
// defintion for message with msg id of PB_E_LOCAPI_MODIFY_GEOFENCES_MSG_ID
message PBLocAPIModifyGeofencesReqMsg {
PBGeofencesAddedReqPayload geofences = 1;
}
// defintion for message with msg id of PB_E_LOCAPI_PAUSE_GEOFENCES_MSG_ID
message PBLocAPIPauseGeofencesReqMsg {
PBGeofencesReqClientIdPayload gfClientIds = 1;
}
// defintion for message with msg id of PB_E_LOCAPI_RESUME_GEOFENCES_MSG_ID
message PBLocAPIResumeGeofencesReqMsg {
PBGeofencesReqClientIdPayload gfClientIds = 1;
}
//*********************************
// IPC message structure - control
//*********************************
// defintion for message with msg id of PB_E_LOCAPI_CONTROL_UPDATE_NETWORK_AVAILABILITY_MSG_ID
message PBLocAPIUpdateNetworkAvailabilityReqMsg {
bool mAvailability = 1;
}
// defintion for message with msg id of PB_E_LOCAPI_GET_GNSS_ENGERY_CONSUMED_MSG_ID
// LocAPIGetGnssEnergyConsumedReqMsg - no struct member.
//************************************
// IPC message structure - indications
//************************************
// defintion for message with msg id of PB_E_LOCAPI_LOCATION_MSG_ID
message PBLocAPILocationIndMsg {
PBLocation locationNotification = 1;
}
// defintion for message with msg id of PB_E_LOCAPI_BATCHING_MSG_ID
message PBLocAPIBatchingIndMsg {
PBLocAPIBatchNotification batchNotification = 1;
}
// defintion for message with msg id of PB_E_LOCAPI_GEOFENCE_BREACH_MSG_ID
message PBLocAPIGeofenceBreachIndMsg {
PBLocAPIGeofenceBreachNotification gfBreachNotification = 1;
}
// defintion for message with msg id of PB_E_LOCAPI_LOCATION_INFO_MSG_ID
message PBLocAPILocationInfoIndMsg {
PBGnssLocationInfoNotification gnssLocationInfoNotification = 1;
}
// defintion for message with msg id of PB_E_LOCAPI_ENGINE_LOCATIONS_INFO_MSG_ID
message PBLocAPIEngineLocationsInfoIndMsg {
// max array size - PBLocApiOutputEngineType::PB_LOC_OUTPUT_ENGINE_COUNT
repeated PBGnssLocationInfoNotification engineLocationsInfo = 1;
}
// defintion for message with msg id of PB_E_LOCAPI_SATELLITE_VEHICLE_MSG_ID
message PBLocAPISatelliteVehicleIndMsg {
PBLocApiGnssSvNotification gnssSvNotification = 1;
}
// defintion for message with msg id of PB_E_LOCAPI_NMEA_MSG_ID
message PBLocAPINmeaIndMsg {
PBLocAPINmeaSerializedPayload gnssNmeaNotification = 1;
}
// defintion for message with msg id of PB_E_LOCAPI_DATA_MSG_ID
message PBLocAPIDataIndMsg {
PBGnssDataNotification gnssDataNotification = 1;
}
// defintion for message with msg id of PB_E_LOCAPI_MEAS_MSG_ID
message PBLocAPIMeasIndMsg {
PBGnssMeasurementsNotification gnssMeasurementsNotification = 1;
}
// defintion for message with msg id of PB_E_LOCAPI_GET_TOTAL_ENGERY_CONSUMED_BY_GPS_ENGINE_MSG_ID
message PBLocAPIGnssEnergyConsumedIndMsg {
uint64 totalGnssEnergyConsumedSinceFirstBoot = 1;
}
// defintion for message with msg id of PB_E_LOCAPI_LOCATION_SYSTEM_INFO_MSG_ID
message PBLocAPILocationSystemInfoIndMsg {
PBLocationSystemInfo locationSystemInfo = 1;
}
//*******************************************************************
// IPC message structure - Single-shot Terrestrial fix
//*******************************************************************
message PBLocAPIGetSingleTerrestrialPosReqMsg {
uint32 timeoutMsec = 1;
PBTerrestrialTechMask techMask = 2;
float horQoS = 3;
};
message PBLocAPIGetSingleTerrestrialPosRespMsg {
PBLocationError errorCode = 1;
PBLocation location = 2;
};
//*******************************************************************
// IPC message structure - Location Integration API Configure Request
//*******************************************************************
// defintion for message with msg id of PB_E_INTAPI_CONFIG_CONSTRAINTED_TUNC_MSG_ID
message PBLocConfigConstrainedTuncReqMsg {
bool mEnable = 1;
float mTuncConstraint = 2;
uint32 mEnergyBudget = 3;
}
// defintion for message with msg id of PB_E_INTAPI_CONFIG_POSITION_ASSISTED_CLOCK_ESTIMATOR_MSG_ID
message PBLocConfigPositionAssistedClockEstimatorReqMsg {
bool mEnable = 1;
}
// defintion for message with msg id of PB_E_INTAPI_CONFIG_SV_CONSTELLATION_MSG_ID
message PBLocConfigSvConstellationReqMsg {
PBGnssSvTypeConfig mConstellationEnablementConfig = 1;
PBGnssSvIdConfig mBlacklistSvConfig = 2;
bool mResetToDefault = 3;
}
// defintion for message with msg id of PB_E_INTAPI_CONFIG_CONSTELLATION_SECONDARY_BAND_MSG_ID
message PBLocConfigConstellationSecondaryBandReqMsg {
PBGnssSvTypeConfig mSecondaryBandConfig = 1;
}
// defintion for message with msg id of PB_E_LOCAPI_CONTROL_DELETE_AIDING_DATA_MSG_ID
message PBLocConfigAidingDataDeletionReqMsg {
PBAidingData mAidingData = 1;
}
// defintion for message with msg id of PB_E_INTAPI_CONFIG_LEVER_ARM_MSG_ID
message PBLocConfigLeverArmReqMsg {
PBLIALeverArmConfigInfo mLeverArmConfigInfo = 1;
}
// defintion for message with msg id of PB_E_INTAPI_CONFIG_ROBUST_LOCATION_MSG_ID
message PBLocConfigRobustLocationReqMsg {
bool mEnable = 1;
bool mEnableForE911 = 2;
}
// defintion for message with msg id of PB_E_INTAPI_CONFIG_MIN_GPS_WEEK_MSG_ID
message PBLocConfigMinGpsWeekReqMsg {
uint32 mMinGpsWeek = 1;
}
// defintion for message with msg id of PB_E_INTAPI_CONFIG_DEAD_RECKONING_ENGINE_MSG_ID
message PBLocConfigDrEngineParamsReqMsg {
PBDeadReckoningEngineConfig mDreConfig = 1;
}
// defintion for message with msg id of PB_E_INTAPI_CONFIG_MIN_SV_ELEVATION_MSG_ID
message PBLocConfigMinSvElevationReqMsg {
uint32 mMinSvElevation = 1;
}
// defintion for message with msg id of PB_E_INTAPI_CONFIG_ENGINE_RUN_STATE_MSG_ID
message PBLocConfigEngineRunStateReqMsg {
PBLocApiPositioningEngineMask mEngType = 1;
PBLocEngineRunState mEngState = 2;
}
// defintion for message with msg id of
// PB_E_INTAPI_CONFIG_USER_CONSENT_TERRESTRIAL_POSITIONING_MSG_ID
message PBLocConfigUserConsentTerrestrialPositioningReqMsg {
bool userConsent = 1;
}
//******************************************************************************
// IPC message structure - Location Integration API Get request/response message
//******************************************************************************
// defintion for message with msg id of PB_E_INTAPI_GET_ROBUST_LOCATION_CONFIG_REQ_MSG_ID
// LocConfigGetRobustLocationConfigReqMsg - no struct member.
// defintion for message with msg id of PB_E_INTAPI_GET_ROBUST_LOCATION_CONFIG_RESP_MSG_ID
message PBLocConfigGetRobustLocationConfigRespMsg {
PBGnssConfigRobustLocation mRobustLoationConfig = 1;
}
// defintion for message with msg id of PB_E_INTAPI_GET_MIN_GPS_WEEK_REQ_MSG_ID
// LocConfigGetMinGpsWeekReqMsg - no struct member.
// defintion for message with msg id of PB_E_INTAPI_GET_MIN_SV_ELEVATION_RESP_MSG_ID
message PBLocConfigGetMinGpsWeekRespMsg {
uint32 mMinGpsWeek = 1;
}
// defintion for message with msg id of PB_E_INTAPI_GET_MIN_SV_ELEVATION_REQ_MSG_ID
// LocConfigGetMinSvElevationReqMsg - no struct member.
// defintion for message with msg id of PB_E_INTAPI_GET_MIN_SV_ELEVATION_RESP_MSG_ID
message PBLocConfigGetMinSvElevationRespMsg {
uint32 mMinSvElevation = 1;
}
// defintion for message with msg id of
// PB_E_INTAPI_GET_CONSTELLATION_SECONDARY_BAND_CONFIG_REQ_MSG_ID
// LocConfigGetConstellationSecondaryBandConfigReqMsg - no struct member.
// defintion for message with msg id of
// PB_E_INTAPI_GET_CONSTELLATION_SECONDARY_BAND_CONFIG_RESP_MSG_ID
message PBLocConfigGetConstltnSecondaryBandConfigRespMsg {
PBGnssSvTypeConfig mSecondaryBandConfig = 1;
}
//*****************************
// IPC message structure - ping
//*****************************
// defintion for message with msg id of PB_E_LOCAPI_PINGTEST_MSG_ID
message PBLocAPIPingTestReqMsg {
uint32 numberOfPing = 1;
repeated uint32 data = 2;
}
message PBLocAPIPingTestIndMsg {
uint32 numberOfPing = 1;
repeated uint32 data = 2;
}
//*******************************
// IPC message header structure
//*******************************
message PBLocAPIMsgHeader {
/**< Processor string*/
string mSocketName = 1;
/**< LocationMsgID */
PBELocMsgID msgId = 2;
/**< Location remote API message version */
uint32 msgVersion = 3;
/**< Message payload */
bytes payload = 4;
/**< payload size */
uint32 payloadSize = 5;
}

View file

@ -1,9 +0,0 @@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src
library_includedir = $(pkgincludedir)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = location-api-msg-proto.pc
EXTRA_DIST = $(pkgconfig_DATA)

View file

@ -1,72 +0,0 @@
# configure.ac -- Autoconf script for gps location-api-msg-proto
#
# Process this file with autoconf to produce a configure script
# Requires autoconf tool later than 2.61
AC_PREREQ(2.61)
# Initialize the location-api-msg-proto package version 1.0.0
AC_INIT([location-api-msg-proto],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
AC_ARG_WITH([glib],
AC_HELP_STRING([--with-glib],
[enable glib, building HLOS systems which use glib]))
PKG_CHECK_MODULES([GPSUTILS], [gps-utils])
AC_SUBST([GPSUTILS_CFLAGS])
AC_SUBST([GPSUTILS_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"
fi
AM_CONDITIONAL(USE_EXTERNAL_AP, test "x${with_external_ap}" = "xyes")
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 \
src/Makefile \
location-api-msg-proto.pc
])
AC_OUTPUT

View file

@ -1,38 +0,0 @@
/* Copyright (c) 2020 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.
*/
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: location-api-msg-proto
Description: location api msg protobuf library
Version: @VERSION@
Libs: -L${libdir} -llocation_api_msg_proto
Cflags: -I${includedir} -I${includedir}/location-api-msg-proto

View file

@ -1,159 +0,0 @@
#/bin/bash
##################################################################################################
## Copyright (c) 2020 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.
##################################################################################################
##################################################################################################
##
## location_api_msg_protobuf_gen.sh
## Description:
## Util script to compile the proto files using protoc to generate the header and C file.
## This is intended to be run once you have made a full build and if any changes are made to proto
## files or if any new proto files are added. This relieves the burden of developer in finding the
## path to protobuf work folder and running those commands.
##
## This script is also used in pre compile stage to compile the proto files so that the generated
## C and header file are based on the protoc compiler for that workspace (LV or LE).
##
## For more details, pls refer the below link
## - https://developers.google.com/protocol-buffers/docs/reference/cpp-generated
##
## Note:
## 1. Add any new .proto files to "src_proto_files" array
## 2. If protobuf package version is updated, update the values in this script too (variable -
## protobuf_package_ver).
##
##################################################################################################
echo;
echo "location_api_msg_protobuf_gen.sh"
echo "********************************"
# find workspace path
wsp_path=`repo info platform/hardware/qcom/gps 2>&1|grep -o "Mount path:.*"|sed 's/Mount path: //'|sed 's/hardware\/qcom\/gps//'`
echo "Workspace path is: $wsp_path"
# find manifest
manifest_info=`repo info . 2>/dev/null|grep "Manifest merge branch"|sed 's/Manifest merge branch: refs\/[a-z]*\///'`
echo "Manifest branch/AU is: $manifest_info"
if [ "$wsp_path" == "" ]
then
## this happens when this script runs as part of bitbake compilation in do_compile_prepend
echo "Wsp path is NULL"
if [ "$WORKSPACE" != "" ];then
# LE targets has root path in $WORKSPACE
wsp_path=$WORKSPACE"/"
elif [ "$SRC_DIR_ROOT" != "" ];then
# LV targets has root path in $SRC_DIR_ROOT
wsp_path=$SRC_DIR_ROOT"/"
else
## Compiling in <ROOT>/poky/build/tmp-glibc/work/sa415m-oe-linux-gnueabi/eng-hub-msg-proto/git-r1/gps-noship/eng-hub-msg-proto/
## 9 level up - <ROOT> of workspace
wsp_path="../../../../../../../../../"
fi
echo "do_compile_prepend: Wsp path is $wsp_path"
fi
## LV target
## - <ROOT>/meta-openembedded/meta-oe/recipes-devtools/protobuf/protobuf_3.6.1.bb
## SRCREV = "48cb18e5c419ddd23d9badcfe4e9df7bde1979b2"
## PV .= "+git${SRCPV}"
## eg: protobuf_package_ver="3.6.1+gitAUTOINC+48cb18e5c4-r0"
## Output path - <WSP>/poky/build/tmp-glibc/work/x86_64-linux/protobuf-native/
## LE target
## - <ROOT>/poky/meta-qti-bsp/recipes-devtools/protobuf/protobuf_3.3.0.bb
## SRCREV = "a6189acd18b00611c1dc7042299ad75486f08a1a"
## PV = "3.3.0+git${SRCPV}"
## eg: protobuf_package_ver="3.3.0+gitAUTOINC+a6189acd18-r0"
## Output path - <WSP>/poky/build/tmp-glibc/work/x86_64-linux/protobuf-native/
## EAP target
## - <ROOT>/sources/meta-openembedded/meta-oe/recipes-devtools/protobuf/protobuf_3.5.1.bb
## SRCREV = "106ffc04be1abf3ff3399f54ccf149815b287dd9"
## PV = "3.5.1+git${SRCPV}"
## eg: protobuf_package_ver="3.5.1+gitAUTOINC+106ffc04be-r0"
## Output path is different - <WSP>/build/tmp/work/x86_64-linux/protobuf-native/
## LE-PDK target
## - <ROOT>/poky/meta-qti-bsp/recipes-devtools/protobuf/protobuf_3.3.0.bb
## SRCREV = "a6189acd18b00611c1dc7042299ad75486f08a1a"
## PV = "3.3.0+git${SRCPV}"
## eg: protobuf_package_ver="3.3.0+gitAUTOINC+a6189acd18-r0"
## <WSP> will be "<ROOT>/src"
## Output path - eg: <WSP>/../build-qti-distro-fullstack-perf/tmp-glibc/work/x86_64-linux/protobuf-native
# protobuf native out path default - for LE/LV
protobuf_protoc_path=$wsp_path"poky/build/tmp-glibc/sysroots-components/x86_64/protobuf-native/usr/bin/protoc"
# find protoc path based on target type
if [ -e $wsp_path"sources/meta-qti-eap/recipes-location/location/gps-utils_git.bb" ]
then
manifest_info="LE-EAP"
protobuf_protoc_path=$wsp_path"build/tmp/sysroots-components/x86_64/protobuf-native/usr/bin/protoc"
elif [ -e "$wsp_path/../poky/qti-conf/set_bb_env.sh" ]
then
manifest_info="LE-PDK"
# find build folder and select first one if multiple build folders
build_folders=(`ls $wsp_path/../|grep build-`)
if [ ${#build_folders[@]} -eq 0 ]; then
echo "ERROR!! No build folders found..."
exit 1
fi
echo "LE PDK - Using build folder ${build_folders[0]}"
protobuf_protoc_path=$wsp_path"../"${build_folders[0]}"/tmp-glibc/sysroots-components/x86_64/protobuf-native/usr/bin/protoc"
elif [ -e $wsp_path"meta-qti-bsp/meta-qti-base/recipes-location/location/gps-utils_git.bb" ]
then
manifest_info="LV"
else
manifest_info="LE"
fi
echo "Target is $manifest_info"
echo "Binary protoc path is : $protobuf_protoc_path"
if ! [ -e $protobuf_protoc_path ]
then
echo "ERROR!! Protoc - $protobuf_protoc_path - is not found..."
exit 1
fi
## array of .proto files. Add any new .proto files to this array.
src_proto_files=(LocationApiDataTypes.proto LocationApiMsg.proto)
for src_file in ${src_proto_files[@]}; do
echo -e "\nProcessing $src_file"
## protoc --cpp_out=. EHMsg.proto
echo " >> Running protoc"
cmd=$protobuf_protoc_path' --proto_path=. --cpp_out=src '$src_file
eval $cmd
if [ $? -eq 0 ]; then
echo "SUCCESS !!! protoc compilation"
else
echo "ERROR!! protoc compilation failed"
exit 1
fi
done

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,787 +0,0 @@
/* Copyright (c) 2020 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.
*/
#ifndef LOCATION_API_PBMSGCONV_H
#define LOCATION_API_PBMSGCONV_H
#include <LocationApiMsg.h>
using namespace std;
using namespace loc_util;
#define LocApiPb_LOGd(fmt, ...) if (mPbDebugLogEnabled) { LOC_LOGd(fmt, ##__VA_ARGS__); }
#define LocApiPb_LOGv(fmt, ...) if (mPbVerboseLogEnabled) { LOC_LOGv(fmt, ##__VA_ARGS__); }
// LocationApiPbMsgConv - Class which handles conversion of rigid struct to protobuf
// messages and vice versa. This will be to serialize/deserialize message using protobuf to
// send across process or processor boundaries between different modules.
class LocationApiPbMsgConv {
public:
LocationApiPbMsgConv();
virtual ~LocationApiPbMsgConv() {}
// STRUCTURE CONVERSION
// ********************
// **** helper function for structure conversion to protobuf format
// GnssSvTypeConfig to PBGnssSvTypeConfig
int convertGnssSvTypeConfigToPB(const GnssSvTypeConfig &gnssSvTypeCfg,
PBGnssSvTypeConfig *pbGnssSvTypeCfg) const;
// GnssSvIdConfig to PBGnssSvIdConfig
int convertGnssSvIdConfigToPB(const GnssSvIdConfig &gnssSvIdCfg,
PBGnssSvIdConfig *pbgnssSvIdCfg) const;
// GnssAidingData to PBAidingData
int convertGnssAidingDataToPB(const GnssAidingData &gnssAidData,
PBAidingData *pbGnssAidData) const;
// LeverArmConfigInfo to PBLIALeverArmConfigInfo
int convertLeverArmConfigInfoToPB(const LeverArmConfigInfo &leverArmCfgInfo,
PBLIALeverArmConfigInfo *pbLeverArmCfgInfo) const;
// DeadReckoningEngineConfig to PBDeadReckoningEngineConfig
int convertDeadReckoningEngineConfigToPB(const DeadReckoningEngineConfig &drEngConfig,
PBDeadReckoningEngineConfig *pbDrEngConfig) const;
// LocationOptions to PBLocationOptions
int convertLocationOptionsToPB(const LocationOptions &locOpt,
PBLocationOptions *pbLocOpt) const;
// GeofencesAddedReqPayload to PBGeofencesAddedReqPayload
int convertGfAddedReqPayloadToPB(const GeofencesAddedReqPayload &gfAddReqPayload,
PBGeofencesAddedReqPayload *pbGfAddReqPayload) const;
// GeofencesReqClientIdPayload to PBGeofencesReqClientIdPayload
int convertGfReqClientIdPayloadToPB(const GeofencesReqClientIdPayload &gfReqClntIdPayload,
PBGeofencesReqClientIdPayload *pbgfReqClntIdPayload) const;
// CollectiveResPayload to PBCollectiveResPayload
int convertCollectiveResPayloadToPB(const CollectiveResPayload &collctResPload,
PBCollectiveResPayload *pbCollctResPload) const;
// LocAPIBatchNotification to PBLocAPIBatchNotification
int convertLocAPIBatchingNotifMsgToPB(const LocAPIBatchNotification &locApiBatchNotifMsg,
PBLocAPIBatchNotification *pbLocApiBatchNotifMsg) const;
// LocAPIGeofenceBreachNotification to PBLocAPIGeofenceBreachNotification
int convertLocAPIGfBreachNotifToPB(const LocAPIGeofenceBreachNotification &locApiGfBreachNotif,
PBLocAPIGeofenceBreachNotification *pbLocApiGfBreachNotif) const;
// GnssConfigRobustLocation to PBGnssConfigRobustLocation
int convertGnssConfigRobustLocationToPB(const GnssConfigRobustLocation &gnssCfgRbstLoc,
PBGnssConfigRobustLocation *pbGnssCfgRbstLoc) const;
// Location to PBLocation
int convertLocationToPB(const Location &location, PBLocation *pbLocation) const;
// GnssLocationInfoNotification to PBGnssLocationInfoNotification
int convertGnssLocInfoNotifToPB(const GnssLocationInfoNotification &gnssLocInfoNotif,
PBGnssLocationInfoNotification *pbgnssLocInfoNotif) const;
// GnssSvNotification to PBLocApiGnssSvNotification
int convertGnssSvNotifToPB(const GnssSvNotification &gnssSvNotif,
PBLocApiGnssSvNotification *pbGnssSvNotif) const;
// LocAPINmeaSerializedPayload to PBLocAPINmeaSerializedPayload
int convertLocAPINmeaSerializedPayloadToPB(
const LocAPINmeaSerializedPayload &locAPINmeaSerPload,
PBLocAPINmeaSerializedPayload *pbLocAPINmeaSerPload) const;
// GnssDataNotification to PBGnssDataNotification
int convertGnssDataNotifToPB(const GnssDataNotification &gnssDataNotif,
PBGnssDataNotification *pbGnssDataNotif) const;
// GnssMeasurementsNotification to PBGnssMeasurementsNotification
int convertGnssMeasNotifToPB(const GnssMeasurementsNotification &gnssMeasNotif,
PBGnssMeasurementsNotification *pbGnssMeasNotif) const;
// LocationSystemInfo to PBLocationSystemInfo
int convertLocSysInfoToPB(const LocationSystemInfo &locSysInfo,
PBLocationSystemInfo *pbLocSysInfo) const;
// Memory cleanup - Free up memory after PB conversion and serializing data
inline void freeUpPBLocAPIStartTrackingReqMsg(PBLocAPIStartTrackingReqMsg &pbLocApiStartTrack)
const {
// PBLocationOptions locOptions = 1;
pbLocApiStartTrack.clear_locoptions();
}
inline void freeUpPBLocAPIUpdateTrackingOptionsReqMsg(
PBLocAPIUpdateTrackingOptionsReqMsg &pbLocApiUpdtTrackOpt) const {
// PBLocationOptions locOptions = 1;
pbLocApiUpdtTrackOpt.clear_locoptions();
}
inline void freeUpPBLocAPICollectiveRespMsg(PBLocAPICollectiveRespMsg &pbLocApiCollctvRspMsg)
const {
// PBCollectiveResPayload - repeated PBGeofenceResponse resp = 1;
PBCollectiveResPayload cllctResPayld = pbLocApiCollctvRspMsg.collectiveres();
cllctResPayld.clear_resp();
// PBCollectiveResPayload collectiveRes = 1;
pbLocApiCollctvRspMsg.clear_collectiveres();
}
void freeUpPBLocAPIAddGeofencesReqMsg(PBLocAPIAddGeofencesReqMsg &pbLocApiAddGfReqMsg)
const {
// PBGeofencePayload - PBGeofenceOption gfOption = 2;
// PBGeofencePayload - PBGeofenceInfo gfInfo = 3;
// PBGeofencesAddedReqPayload - repeated PBGeofencePayload gfPayload = 1;
PBGeofencesAddedReqPayload gfAddReqPload = pbLocApiAddGfReqMsg.geofences();
uint32_t gfCount = gfAddReqPload.gfpayload_size();
for (uint32_t i=0; i < gfCount; i++) {
PBGeofencePayload pbGfPayload = gfAddReqPload.gfpayload(i);
pbGfPayload.clear_gfoption();
pbGfPayload.clear_gfinfo();
}
gfAddReqPload.clear_gfpayload();
// PBGeofencesAddedReqPayload geofences = 1;
pbLocApiAddGfReqMsg.clear_geofences();
}
inline void freeUpPBLocAPIRemoveGeofencesReqMsg(PBLocAPIRemoveGeofencesReqMsg &pbLocApiRemGf)
const {
// PBGeofencesReqClientIdPayload gfClientIds = 1;
pbLocApiRemGf.clear_gfclientids();
}
void freeUpPBLocAPIModifyGeofencesReqMsg(PBLocAPIModifyGeofencesReqMsg &pbLocApiModGf)
const {
// PBGeofencePayload - PBGeofenceOption gfOption = 2;
// PBGeofencePayload - PBGeofenceInfo gfInfo = 3;
// PBGeofencesAddedReqPayload - repeated PBGeofencePayload gfPayload = 1;
PBGeofencesAddedReqPayload gfModReqPload = pbLocApiModGf.geofences();
uint32_t gfCount = gfModReqPload.gfpayload_size();
for (uint32_t i=0; i < gfCount; i++) {
PBGeofencePayload pbGfPayload = gfModReqPload.gfpayload(i);
pbGfPayload.clear_gfoption();
pbGfPayload.clear_gfinfo();
}
gfModReqPload.clear_gfpayload();
// PBGeofencesAddedReqPayload geofences = 1;
pbLocApiModGf.clear_geofences();
}
inline void freeUpPBLocAPIPauseGeofencesReqMsg(PBLocAPIPauseGeofencesReqMsg &pbLocApiPauseGf)
const {
// PBGeofencesReqClientIdPayload gfClientIds = 1;
pbLocApiPauseGf.clear_gfclientids();
}
inline void freeUpPBLocAPIResumeGeofencesReqMsg(PBLocAPIResumeGeofencesReqMsg
&pbLocApiResumeGf) const {
// PBGeofencesReqClientIdPayload gfClientIds = 1;
pbLocApiResumeGf.clear_gfclientids();
}
inline void freeUpPBLocAPILocationIndMsg(PBLocAPILocationIndMsg &pbLocApiLocInd) const {
// PBLocation locationNotification = 1;
pbLocApiLocInd.clear_locationnotification();
}
inline void freeUpPBLocAPIBatchingIndMsg(PBLocAPIBatchingIndMsg &pbLocApiBatchInd) const {
// PBLocAPIBatchNotification - repeated PBLocation location = 2;
PBLocAPIBatchNotification batchNotif = pbLocApiBatchInd.batchnotification();
batchNotif.clear_location();
// PBLocAPIBatchNotification batchNotification = 1;
pbLocApiBatchInd.clear_batchnotification();
}
inline void freeUpPBLocAPIGeofenceBreachIndMsg(PBLocAPIGeofenceBreachIndMsg &pbLocApiGfBreach)
const {
// PBLocAPIGeofenceBreachNotification - PBLocation location = 3;
PBLocAPIGeofenceBreachNotification gfBreachNotif = pbLocApiGfBreach.gfbreachnotification();
gfBreachNotif.clear_location();
// PBLocAPIGeofenceBreachNotification gfBreachNotification = 1;
pbLocApiGfBreach.clear_gfbreachnotification();
}
void freeUpPBLocAPILocationInfoIndMsg(PBLocAPILocationInfoIndMsg &pbLocApiLocInfoInd)
const {
PBGnssLocationInfoNotification gnssLocInfoNotif =
pbLocApiLocInfoInd.gnsslocationinfonotification();
freeUpPBGnssLocationInfoNotification(gnssLocInfoNotif);
// PBGnssLocationInfoNotification gnssLocationInfoNotification = 1;
pbLocApiLocInfoInd.clear_gnsslocationinfonotification();
}
void freeUpPBLocAPIEngineLocationsInfoIndMsg(PBLocAPIEngineLocationsInfoIndMsg
&pbLocApiEngLocInfo) const {
uint32_t numEngLocInfo = pbLocApiEngLocInfo.enginelocationsinfo_size();
for (uint32_t i=0; i < numEngLocInfo; i++) {
PBGnssLocationInfoNotification gnssLocInfoNotif =
pbLocApiEngLocInfo.enginelocationsinfo(i);
freeUpPBGnssLocationInfoNotification(gnssLocInfoNotif);
}
// repeated PBGnssLocationInfoNotification engineLocationsInfo = 1;
pbLocApiEngLocInfo.clear_enginelocationsinfo();
}
void freeUpPBGnssLocationInfoNotification(PBGnssLocationInfoNotification &gnssLocInfoNotif)
const {
// PBLocApiSystemTimeStructUnion -
// - PBLocApiGnssSystemTimeStructType or
// - PBLocApiGnssGloTimeStructType
// PBLocApiGnssSystemTime - PBLocApiSystemTimeStructUnion u = 2;
// PBGnssLocationInfoNotification - PBLocation location = 1;
// PBGnssLocationInfoNotification - PBGnssLocationSvUsedInPosition svUsedInPosition = 24;
// PBGnssLocationInfoNotification - PBLocApiGnssLocationPositionDynamics bodyFrameData = 26;
// PBGnssLocationInfoNotification - PBLocApiGnssSystemTime gnssSystemTime = 27;
// PBGnssLocationInfoNotification - repeated PBGnssMeasUsageInfo measUsageInfo = 29;
// PBGnssLocationInfoNotification - PBLLAInfo llaVRPBased = 37;
// PBGnssLocationInfoNotification - repeated float enuVelocityVRPBased = 38;
PBLocApiGnssSystemTime gnssSysTime = gnssLocInfoNotif.gnsssystemtime();
PBLocApiSystemTimeStructUnion sysTimeStrctUnion = gnssSysTime.u();
switch (gnssSysTime.gnsssystemtimesrc()) {
case PB_GNSS_LOC_SV_SYSTEM_GPS:
// PBLocApiGnssSystemTimeStructType gpsSystemTime = 1;
sysTimeStrctUnion.clear_gpssystemtime();
break;
case PB_GNSS_LOC_SV_SYSTEM_GALILEO:
// PBLocApiGnssSystemTimeStructType galSystemTime = 2;
sysTimeStrctUnion.clear_galsystemtime();
break;
case PB_GNSS_LOC_SV_SYSTEM_BDS:
// PBLocApiGnssSystemTimeStructType bdsSystemTime = 3;
sysTimeStrctUnion.clear_bdssystemtime();
break;
case PB_GNSS_LOC_SV_SYSTEM_QZSS:
// PBLocApiGnssSystemTimeStructType qzssSystemTime = 4;
sysTimeStrctUnion.clear_qzsssystemtime();
break;
case PB_GNSS_LOC_SV_SYSTEM_GLONASS:
// PBLocApiGnssGloTimeStructType gloSystemTime = 5;
sysTimeStrctUnion.clear_glosystemtime();
break;
case PB_GNSS_LOC_SV_SYSTEM_NAVIC:
// PBLocApiGnssSystemTimeStructType navicSystemTime = 6;
sysTimeStrctUnion.clear_navicsystemtime();
break;
default:
break;
}
gnssSysTime.clear_u();
gnssLocInfoNotif.clear_location();
gnssLocInfoNotif.clear_svusedinposition();
gnssLocInfoNotif.clear_bodyframedata();
gnssLocInfoNotif.clear_gnsssystemtime();
gnssLocInfoNotif.clear_measusageinfo();
gnssLocInfoNotif.clear_llavrpbased();
gnssLocInfoNotif.clear_enuvelocityvrpbased();
return;
}
inline void freeUpPBLocAPISatelliteVehicleIndMsg(PBLocAPISatelliteVehicleIndMsg
&pbLocApiSatVehInd) const {
// PBLocApiGnssSvNotification - repeated PBLocApiGnssSv gnssSvs = 2;
PBLocApiGnssSvNotification pbGnssSvNotif = pbLocApiSatVehInd.gnsssvnotification();
pbGnssSvNotif.clear_gnsssvs();
// PBLocApiGnssSvNotification gnssSvNotification = 1;
pbLocApiSatVehInd.clear_gnsssvnotification();
}
inline void freeUpPBLocAPINmeaIndMsg(PBLocAPINmeaIndMsg &pbLocApiNmeaInd) const {
// PBLocAPINmeaSerializedPayload - string nmea = 2;
PBLocAPINmeaSerializedPayload nmeaSerPayLoad = pbLocApiNmeaInd.gnssnmeanotification();
nmeaSerPayLoad.clear_nmea();
// PBLocAPINmeaSerializedPayload gnssNmeaNotification = 1;
pbLocApiNmeaInd.clear_gnssnmeanotification();
}
inline void freeUpPBLocAPIDataIndMsg(PBLocAPIDataIndMsg &pbLocApiDataInd) const {
// PBGnssDataNotification - repeated uint64 gnssDataMask = 2;
// PBGnssDataNotification - repeated double jammerInd = 3;
// PBGnssDataNotification - repeated double agc = 4;
PBGnssDataNotification gnssDataNotif = pbLocApiDataInd.gnssdatanotification();
gnssDataNotif.clear_gnssdatamask();
gnssDataNotif.clear_jammerind();
gnssDataNotif.clear_agc();
// PBGnssDataNotification gnssDataNotification = 1;
pbLocApiDataInd.clear_gnssdatanotification();
}
inline void freeUpPBLocAPIMeasIndMsg(PBLocAPIMeasIndMsg &pbLocApiMeasInd) const {
// PBGnssMeasurementsNotification - repeated PBGnssMeasurementsData measurements = 1;
// PBGnssMeasurementsNotification - PBGnssMeasurementsClock clock = 2;
PBGnssMeasurementsNotification gnssMeasNotif =
pbLocApiMeasInd.gnssmeasurementsnotification();
gnssMeasNotif.clear_measurements();
gnssMeasNotif.clear_clock();
// PBGnssMeasurementsNotification gnssMeasurementsNotification = 1;
pbLocApiMeasInd.clear_gnssmeasurementsnotification();
}
inline void freeUpPBLocAPILocationSystemInfoIndMsg(PBLocAPILocationSystemInfoIndMsg
&pbLocApiLocSysInfoInd) const {
// PBLeapSecondChangeInfo - PBLocApiGnssSystemTimeStructType gpsTimestampLsChange = 1;
// PBLeapSecondSystemInfo- PBLeapSecondChangeInfo leapSecondChangeInfo = 3;
// PBLocationSystemInfo - PBLeapSecondSystemInfo leapSecondSysInfo = 2;
PBLocationSystemInfo pbLocSysInfo = pbLocApiLocSysInfoInd.locationsysteminfo();
PBLeapSecondSystemInfo pbLeapSecSysInfo = pbLocSysInfo.leapsecondsysinfo();
PBLeapSecondChangeInfo pbLeapSecChgInfo = pbLeapSecSysInfo.leapsecondchangeinfo();
pbLeapSecChgInfo.clear_gpstimestamplschange();
pbLeapSecSysInfo.clear_leapsecondchangeinfo();
pbLocSysInfo.clear_leapsecondsysinfo();
// PBLocationSystemInfo locationSystemInfo = 1;
pbLocApiLocSysInfoInd.clear_locationsysteminfo();
}
inline void freeUpPBLocConfigSvConstellationReqMsg(PBLocConfigSvConstellationReqMsg
&pbLocConfSvConst) const {
// PBGnssSvTypeConfig mConstellationEnablementConfig = 1;
pbLocConfSvConst.clear_mconstellationenablementconfig();
// PBGnssSvIdConfig mBlacklistSvConfig = 2;
pbLocConfSvConst.clear_mblacklistsvconfig();
}
inline void freeUpPBLocConConstllSecBandReqMsg(PBLocConfigConstellationSecondaryBandReqMsg
&pbLocCfgConstlSecBandReqMsg) const {
// PBGnssSvTypeConfig mSecondaryBandConfig = 1;
pbLocCfgConstlSecBandReqMsg.clear_msecondarybandconfig();
}
inline void freeUpPBLocConAidingDataDeletionReqMsg(PBLocConfigAidingDataDeletionReqMsg
&pbLocConfAidDataDel) const {
// PBAidingData mAidingData = 1;
pbLocConfAidDataDel.clear_maidingdata();
}
inline void freeUpPBLocConfigLeverArmReqMsg(PBLocConfigLeverArmReqMsg &pbLocConfLeverArm)
const {
// PBLIALeverArmConfigInfo - PBLIALeverArmParams gnssToVRP = 2;
// PBLIALeverArmConfigInfo - PBLIALeverArmParams drImuToGnss = 3;
// PBLIALeverArmConfigInfo - PBLIALeverArmParams veppImuToGnss = 4;
PBLIALeverArmConfigInfo pbLeverArmCfInfo = pbLocConfLeverArm.mleverarmconfiginfo();
pbLeverArmCfInfo.clear_gnsstovrp();
pbLeverArmCfInfo.clear_drimutognss();
pbLeverArmCfInfo.clear_veppimutognss();
// PBLIALeverArmConfigInfo mLeverArmConfigInfo = 1;
pbLocConfLeverArm.clear_mleverarmconfiginfo();
}
inline void freeUpPBLocConfDrEngineParamsReqMsg(PBLocConfigDrEngineParamsReqMsg
&pbLocCfgDrEngParamReq) const {
// PBDeadReckoningEngineConfig - PBLIABodyToSensorMountParams bodyToSensorMountParams = 2;
PBDeadReckoningEngineConfig pbDrEngineCfg = pbLocCfgDrEngParamReq.mdreconfig();
pbDrEngineCfg.clear_bodytosensormountparams();
// PBDeadReckoningEngineConfig mDreConfig = 1;
pbLocCfgDrEngParamReq.clear_mdreconfig();
}
inline void freeUpPBLocConGetRbstLocCfgRespMsg(PBLocConfigGetRobustLocationConfigRespMsg
&pbLocConfGetRobustLocConfg) const {
// PBGnssConfigRobustLocation - PBGnssConfigRobustLocationVersion version = 4;
PBGnssConfigRobustLocation pbGnssCfgRbstLoc =
pbLocConfGetRobustLocConfg.mrobustloationconfig();
pbGnssCfgRbstLoc.clear_version();
// PBGnssConfigRobustLocation mRobustLoationConfig = 1;
pbLocConfGetRobustLocConfg.clear_mrobustloationconfig();
}
inline void freeUpPBLocConfGetConstllSecBandCfgRespMsg(
PBLocConfigGetConstltnSecondaryBandConfigRespMsg &pbLocCfgGetConstlSecBandRespMsg)
const {
// PBGnssSvTypeConfig mSecondaryBandConfig = 1;
pbLocCfgGetConstlSecBandRespMsg.clear_msecondarybandconfig();
}
inline void freeUpPBLocAPIPingTestReqMsg(PBLocAPIPingTestReqMsg &pbLocApiPingTest) const {
// repeated uint32 data = 2;
pbLocApiPingTest.clear_data();
}
inline void freeUpPBLocAPIPingTestIndMsg(PBLocAPIPingTestIndMsg &pbLocApiPingTestIndMsg)
const {
// repeated uint32 data = 1;
pbLocApiPingTestIndMsg.clear_data();
}
// **** helper function to convert from protobuf struct to normal struct.
// PBCollectiveResPayload to CollectiveResPayload
int pbConvertToCollectiveResPayload(const PBCollectiveResPayload &pbClctResPayload,
CollectiveResPayload &clctResPayload) const;
// PBLocationOptions to LocationOptions
int pbConvertToLocationOptions(const PBLocationOptions &pbLocOpt,
LocationOptions &locOpt) const;
// PBGeofencesAddedReqPayload to GeofencesAddedReqPayload
int pbConvertToGfAddReqPayload(const PBGeofencesAddedReqPayload &pbGfAddReqPload,
GeofencesAddedReqPayload &gfAddReqPload) const;
// PBGeofencesReqClientIdPayload to GeofencesReqClientIdPayload
int pbConvertToGfReqClientIdPayload(const PBGeofencesReqClientIdPayload &pbGfReqClientIdPload,
GeofencesReqClientIdPayload &gfReqClientIdPload) const;
// PBLocAPIBatchNotification to LocAPIBatchNotification
int pbConvertToLocAPIBatchNotification(const PBLocAPIBatchNotification &pbLocBatchNotif,
LocAPIBatchNotification &locBatchNotif) const;
// PBLocAPIGeofenceBreachNotification to LocAPIGeofenceBreachNotification
int pbConvertToLocAPIGfBreachNotification(
const PBLocAPIGeofenceBreachNotification &pbLocApiGfBreachNotif,
LocAPIGeofenceBreachNotification &locApiGfBreachNotif) const;
// PBGnssLocationInfoNotification to GnssLocationInfoNotification
int pbConvertToGnssLocInfoNotif(const PBGnssLocationInfoNotification &pbGnssLocInfoNotif,
GnssLocationInfoNotification &gnssLocInfoNotif) const;
// PBLocApiGnssSvNotification to GnssSvNotification
int pbConvertToGnssSvNotif(const PBLocApiGnssSvNotification &pbGnssSvNotif,
GnssSvNotification &gnssSvNotif) const;
// PBLocAPINmeaSerializedPayload to LocAPINmeaSerializedPayload
int pbConvertToLocAPINmeaSerializedPayload(
const PBLocAPINmeaSerializedPayload &pbLocApiNmeaSerPayload,
LocAPINmeaSerializedPayload &locApiNmeaSerPayload) const;
// PBGnssDataNotification to GnssDataNotification
int pbConvertToGnssDataNotification(const PBGnssDataNotification &pbGnssDataNotif,
GnssDataNotification &gnssDataNotif) const;
// PBGnssMeasurementsNotification to GnssMeasurementsNotification
int pbConvertToGnssMeasNotification(const PBGnssMeasurementsNotification &pbGnssMeasNotif,
GnssMeasurementsNotification &gnssMeasNotif) const;
// PBLocation to Location
int pbConvertToLocation(const PBLocation &pbLoc, Location &loc) const;
// PBLocationSystemInfo to LocationSystemInfo
int pbConvertToLocationSystemInfo(const PBLocationSystemInfo &pbLocSysInfo,
LocationSystemInfo &locSysInfo) const;
// PBGnssSvTypeConfig to GnssSvTypeConfig
int pbConvertToGnssSvTypeConfig(const PBGnssSvTypeConfig &pbGnssSvTypeConfig,
GnssSvTypeConfig &gnssSvTypeConfig) const;
// PBGnssSvIdConfig to GnssSvIdConfig
int pbConvertToGnssSvIdConfig(const PBGnssSvIdConfig &pbGnssSvIdConfig,
GnssSvIdConfig &gnssSvIdConfig) const;
// PBAidingData to GnssAidingData
int pbConvertToGnssAidingData(const PBAidingData &pbGnssAidData,
GnssAidingData &gnssAidData) const;
// PBLIALeverArmConfigInfo to LeverArmConfigInfo
int pbConvertToLeverArmConfigInfo(const PBLIALeverArmConfigInfo &pbLeverArmCfgInfo,
LeverArmConfigInfo &leverArmCfgInfo) const;
// PBDeadReckoningEngineConfig to DeadReckoningEngineConfig
int pbConvertToDeadReckoningEngineConfig(const PBDeadReckoningEngineConfig &pbDrEngConfig,
DeadReckoningEngineConfig &drEngConfig) const;
// PBGnssConfigRobustLocation to GnssConfigRobustLocation
int pbConvertToGnssConfigRobustLocation(const PBGnssConfigRobustLocation &pbGnssCfgRobLoc,
GnssConfigRobustLocation &gnssCfgRobLoc) const;
// MASK CONVERSION
// ***************
// **** helper function for mask conversion to protobuf masks
// LocationCallbacksMask to PBLocationCallbacksMask
uint32_t getPBMaskForLocationCallbacksMask(const uint32_t &locCbMask) const;
// LocationCapabilitiesMask to PBLocationCapabilitiesMask
uint64_t getPBMaskForLocationCapabilitiesMask(const uint64_t &locCapabMask) const;
// **** helper function for mask conversion from protobuf masks to normal rigid values
// PBLocationCapabilitiesMask to LocationCapabilitiesMask
uint64_t getLocationCapabilitiesMaskFromPB(const uint64_t &pbLocCapabMask) const;
// PBLocationCallbacksMask to LocationCallbacksMask
uint32_t getLocationCallbacksMaskFromPB(const uint32_t &pbLocCbMask) const;
// ENUM CONVERSION
// **** helper function for enum conversion from protobuf enums to normal format.
ELocMsgID getEnumForPBELocMsgID(const PBELocMsgID &pbLocMsgId) const;
ClientType getEnumForPBClientType(const PBClientType &pbClntTyp) const;
LocationError getEnumForPBLocationError(const PBLocationError &pbLocErr) const;
BatchingMode getEnumForPBBatchingMode(const PBBatchingMode &pbBatchMode) const;
// PositioningEngineMask to/from PB PositioningEngineMask
uint32_t getPBMaskForPositioningEngineMask(const uint32_t &posEngMask) const;
uint32_t getEnumForPBPositioningEngineMask(const uint32_t &pbPosEngMask) const;
// LocEngineRunState to/from PB LocEngineRunState
LocEngineRunState getEnumForPBLocEngineRunState
(const PBLocEngineRunState &pbLocEngRunState) const;
uint32_t getPBEnumForLocEngineRunState(const LocEngineRunState& locEngineRunState) const;
// LocEngineRunState to/from PB LocEngineRunState
uint32_t getTerrestrialTechMaskFromPB(const uint32_t &pbTerrestrialTechMask) const;
uint32_t getPBMaskForTerrestrialTechMask(const uint32_t& terrestrialTechMask) const;
// **** helper function for enum conversion from normal format to protobuf enums.
PBBatchingMode getPBEnumForBatchingMode(const BatchingMode &batchMode) const;
PBLocationError getPBEnumForLocationError(const LocationError &locErr) const;
PBELocMsgID getPBEnumForELocMsgID(const ELocMsgID &eLocMsgId) const;
PBClientType getPBEnumForClientType(const ClientType &clientTyp) const;
private:
bool mPbDebugLogEnabled;
bool mPbVerboseLogEnabled;
// RIGID TO PROTOBUF FORMAT
// ************************
// **** helper function for structure conversion to protobuf format
// LeverArmParams to PBLIALeverArmParams
int convertLeverArmParamsToPB(const LeverArmParams &leverArmParams,
PBLIALeverArmParams *pbLeverArmParams) const;
// LeapSecondSystemInfo to PBLeapSecondSystemInfo
int convertLeapSecondSystemInfoToPB(const LeapSecondSystemInfo &leapSecSysInfo,
PBLeapSecondSystemInfo *pbLeapSecSysInfo) const;
// LeapSecondChangeInfo to PBLeapSecondChangeInfo
int convertLeapSecChgInfoToPB(const LeapSecondChangeInfo &leapSecChngInfo,
PBLeapSecondChangeInfo *pbLeapSecChngInfo) const;
// GnssSystemTimeStructType to PBLocApiGnssSystemTimeStructType
int convertGnssSystemTimeStructTypeToPB(const GnssSystemTimeStructType &gnssSysTimeStructType,
PBLocApiGnssSystemTimeStructType *pbGnssSysTimeStructType) const;
// GnssGloTimeStructType to PBLocApiGnssGloTimeStructType
int convertGnssGloTimeStructTypeToPB(const GnssGloTimeStructType &gnssGloTime,
PBLocApiGnssGloTimeStructType *pbgnssGloTime) const;
// GnssMeasurementsData to PBGnssMeasurementsData
int convertGnssMeasDataToPB(const GnssMeasurementsData &gnssMeasData,
PBGnssMeasurementsData *pbGnssMeasData) const;
// GnssMeasurementsClock to PBGnssMeasurementsClock
int convertGnssMeasClockToPB(const GnssMeasurementsClock &gnssMeasClock,
PBGnssMeasurementsClock *pbGnssMeasClock) const;
// GnssSv to PBLocApiGnssSv
int convertGnssSvToPB(const GnssSv &gnssSv, PBLocApiGnssSv *pbGnssSv) const;
// GnssLocationSvUsedInPosition to PBGnssLocationSvUsedInPosition
int convertGnssLocSvUsedInPosToPB(const GnssLocationSvUsedInPosition &gnssLocSvUsedInPos,
PBGnssLocationSvUsedInPosition *pbGnssLocSvUsedInPos) const;
// GnssSystemTime to PBLocApiGnssSystemTime
int convertGnssSystemTimeToPB(const GnssSystemTime &gnssSysTime,
PBLocApiGnssSystemTime *pbGnssSysTime) const;
// GnssLocationPositionDynamics & GnssLocationPositionDynamicsExt to
// PBLocApiGnssLocationPositionDynamics
int convertGnssLocationPositionDynamicsToPB(
const GnssLocationPositionDynamics &gnssLocPosDyn,
const GnssLocationPositionDynamicsExt &gnssLocPosDynExt,
PBLocApiGnssLocationPositionDynamics *pbGnssLocPosDyn) const;
// LLAInfo to PBLLAInfo
int convertLLAInfoToPB(const LLAInfo &llaInfo, PBLLAInfo *pbLlaInfo) const;
// GnssMeasUsageInfo to PBGnssMeasUsageInfo
int convertGnssMeasUsageInfoToPB(const GnssMeasUsageInfo &gnssMeasUsageInfo,
PBGnssMeasUsageInfo *pbGnssMeasUsageInfo) const;
// SystemTimeStructUnion to PBLocApiSystemTimeStructUnion
int convertSystemTimeStructUnionToPB(const Gnss_LocSvSystemEnumType &gnssLocSvSysEnumType,
const SystemTimeStructUnion &sysTimeStructUnion,
PBLocApiSystemTimeStructUnion *pbSysTimeStructUnion) const;
// GeofenceInfo to PBGeofenceInfo
int convertGeofenceInfoToPB(const GeofenceInfo &gfInfo, PBGeofenceInfo *pbGfInfo) const;
// GeofenceOption to PBGeofenceOption
int convertGeofenceOptionToPB(const GeofenceOption &gfOpt, PBGeofenceOption *pbGfOpt) const;
// BodyToSensorMountParams to PBLIABodyToSensorMountParams
int convertBodyToSensorMountParamsToPB(const BodyToSensorMountParams &bodyToSensorMntParams,
PBLIABodyToSensorMountParams *pbBodyToSensorMntParams) const;
// **** helper function for mask conversion to protobuf masks
// LeverArmTypeMask to PBLIALeverArmTypeMask
uint32_t getPBMaskForLeverArmTypeMask(const uint32_t &leverArmTypeMask) const;
// LocReqEngineTypeMask to PBLocReqEngineTypeMask
uint32_t getPBMaskForLocReqEngineTypeMask(const uint32_t &locReqEngTypeMask) const;
// GnssConfigRobustLocationValidMask to PBGnssConfigRobustLocationValidMask
uint32_t getPBMaskForGnssCfgRobustLocValidMask(
const uint32_t &gnssCfgRobustLocValidMask) const;
// LocationSystemInfoMask to PBLocationSystemInfoMask
uint32_t getPBMaskForLocSysInfoMask(const uint32_t &locSysInfoMask) const;
// GnssDataMask to PBGnssDataMask
uint64_t getPBMaskForGnssDataMask(const uint64_t &gnssDataMask) const;
// GnssAidingDataSvMask to PBLocApiGnssAidingDataSvMask
uint32_t getPBMaskForGnssAidingDataSvMask(const uint32_t &gnssAidDataSvMask) const;
// LeapSecondSysInfoMask to PBLeapSecondSysInfoMask
uint32_t getPBMaskForLeapSecondSysInfoMask(const uint32_t &leapSecSysInfoMask) const;
// GnssSystemTimeStructTypeFlags to PBGnssSystemTimeStructTypeFlag
uint32_t getPBMaskForGnssSystemTimeStructTypeFlags(
const uint32_t &gnssSysTimeStructTypeFlg) const;
// LocationFlagsMask to PBLocationFlagsMask
uint32_t getPBMaskForLocationFlagsMask(const uint32_t &locFlagsMask) const;
// LocationTechnologyMask to PBLocationTechnologyMask
uint32_t getPBMaskForLocationTechnologyMask(const uint32_t &locTechMask) const;
// GnssLocationInfoFlagMask (lower 32 bits) to PBGnssLocationInfoFlagMask
uint32_t getPBMaskForGnssLocationInfoFlagMask(const uint64_t &gnssLocInfoFlagMask) const;
// GnssLocationInfoFlagMask (upper 32 bits) to PBGnssLocationInfoExtFlagMask
uint32_t getPBMaskForGnssLocationInfoExtFlagMask(const uint64_t &gnssLocInfoFlagMask) const;
// GnssLocationNavSolutionMask to PBGnssLocationNavSolutionMask
uint32_t getPBMaskForGnssLocationNavSolutionMask(const uint32_t &gnssLocNavSolnMask) const;
// DrCalibrationStatusMask to PBLocApiDrCalibrationStatusMask
uint32_t getPBMaskForDrCalibrationStatusMask(const uint32_t &drCalibStatusMask) const;
// GnssMeasurementsDataFlagsMask to PBGnssMeasurementsDataFlagsMask
uint32_t getPBMaskForGnssMeasurementsDataFlagsMask(
const uint32_t &gnssMeasDataFlagsMask) const;
// GnssMeasurementsStateMask to PBGnssMeasurementsStateMask
uint32_t getPBMaskForGnssMeasurementsStateMask(const uint32_t &gnssMeasStateMask) const;
// GnssMeasurementsAdrStateMask to PBGnssMeasurementsAdrStateMask
uint32_t getPBMaskForGnssMeasurementsAdrStateMask(const uint32_t &gnssMeasAdrStateMask) const;
// GnssLocationPosDataMask/GnssLocationPosDataMaskExt to PBLocApiGnssLocationPosDataMask
uint32_t getPBMaskForGnssLocationPosDataMask(const uint32_t &gnssLocPosDataMask,
const uint32_t &gnssLocPosDataMaskExt) const;
// GnssMeasurementsClockFlagsMask to PBGnssMeasurementsClockFlagsMask
uint32_t getPBMaskForGnssMeasurementsClockFlagsMask(
const uint32_t &gnssMeasClockFlagsMask) const;
// GnssGloTimeStructTypeFlags to PBGnssGloTimeStructTypeFlags
uint32_t getPBMaskForGnssGloTimeStructTypeFlags(
const uint32_t &gnssGloTimeStructTypeFlags) const;
// GnssSvOptionsMask to PBLocApiGnssSvOptionsMask
uint32_t getPBMaskForGnssSvOptionsMask(const uint32_t &gnssSvOptMask) const;
// GnssSignalTypeMask to PBGnssSignalTypeMask
uint32_t getPBMaskForGnssSignalTypeMask(const uint32_t &gnssSignalTypeMask) const;
// GeofenceBreachTypeMask to PBGeofenceBreachTypeMask
uint32_t getPBMaskForGeofenceBreachTypeMask(const uint32_t &gfBreachTypeMask) const;
// DeadReckoningEngineConfigValidMask to PBDeadReckoningEngineConfigValidMask
uint64_t getPBMaskForDeadReckoningEngineConfigValidMask(
const uint64_t &drEngCfgValidMask) const;
// DrEngineAidingDataMask to PBDrEngineAidingDataMask
uint32_t getPBMaskForDrEngineAidingDataMask(const uint32_t &drEngAidDataMask) const;
// DrSolutionStatusMask to PBDrSolutionStatusMask
uint32_t getPBMaskForDrSolutionStatusMask(const uint32_t &drSolnStatusMask) const;
// **** helper function for enum conversion to protobuf enums
PBGnssSuplMode getPBEnumForGnssSuplMode(const GnssSuplMode &gnssSuplMode) const;
PBBatchingStatus getPBEnumForBatchingStatus(const BatchingStatus &batchStatus) const;
PBLocationReliability getPBEnumForLocationReliability(
const LocationReliability &locReliab) const;
PBLocApiOutputEngineType getPBEnumForLocOutputEngineType(
const LocOutputEngineType &locOpEng) const;
PBGnssMeasurementsMultipathIndicator getPBEnumForGnssMeasMultiPathIndic(
const GnssMeasurementsMultipathIndicator &gnssMeasMultiPathIndic) const;
PBLocApiGnss_LocSvSystemEnumType getPBEnumForGnssLocSvSystem(
const Gnss_LocSvSystemEnumType &gnssLocSvSysEnumType) const;
// PBLocationSessionStatus from/to loc_sess_status
PBLocationSessionStatus getPBEnumForLocSessionStatus(const loc_sess_status &status) const;
// ** Special enum conversion
// GnssSvType to PBLocApiGnss_LocSvSystemEnumType
PBLocApiGnss_LocSvSystemEnumType getPBGnssLocSvSysEnumFromGnssSvType(
const GnssSvType &gnssSvType) const;
// PROTOBUF TO LOCAL FORMAT
// ************************
// **** helper function for mask conversion from protobuf masks to normal rigid values
// PBLIALeverArmTypeMask to LeverArmTypeMask
uint32_t getLeverArmTypeMaskFromPB(const uint32_t &pbLeverTypeMask) const;
// PBGnssSvTypesMask to GnssSvTypesMask
uint64_t getGnssSvTypesMaskFromPB(const uint64_t &pbGnssSvTypesMask) const;
// PBLocApiGnssAidingDataSvMask to GnssAidingDataSvMask
uint32_t getGnssAidingDataSvMaskFromPB(const uint32_t &pbGnssAidDataSvMask) const;
// PBLocReqEngineTypeMask to LocReqEngineTypeMask
uint32_t getLocReqEngineTypeMaskFromPB(const uint32_t &pbLocReqEngTypeMask) const;
// PBLocationSystemInfoMask to LocationSystemInfoMask
uint32_t getLocationSystemInfoMaskFromPB(const uint32_t &pbLocSysInfoMask) const;
// PBGnssDataMask to GnssDataMask
uint64_t getGnssDataMaskFromPB(const uint64_t &pbGnssDataMask) const;
// PBLeapSecondSysInfoMask to LeapSecondSysInfoMask
uint32_t getLeapSecSysInfoMaskFromPB(const uint32_t &pbLeapSecSysInfoMask) const;
// PBLocApiGnssSystemTimeStructTypeFlags to GnssSystemTimeStructTypeFlags
uint32_t getGnssSystemTimeStructTypeFlagsFromPB(const uint32_t &pbGnssSysTimeStrctType) const;
// PBGnssSignalTypeMask to GnssSignalTypeMask
uint32_t getGnssSignalTypeMaskFromPB(const uint32_t &pbGnssSignalTypeMask) const;
// PBLocApiGnssSvOptionsMask to GnssSvOptionsMask
uint32_t getGnssSvOptionsMaskFromPB(const uint32_t &pbGnssSvOptMask) const;
// PBGeofenceBreachTypeMask to GeofenceBreachTypeMask
uint32_t getGfBreachTypeMaskFromPB(const uint32_t &pbGfBreackTypMask) const;
// PBLocationFlagsMask to LocationFlagsMask
uint32_t getLocationFlagsMaskFromPB(const uint32_t &pbLocFlagsMask) const;
// PBLocationTechnologyMask to LocationTechnologyMask
uint32_t getLocationTechnologyMaskFromPB(const uint32_t &pbLocTechMask) const;
// PBGnssMeasurementsClockFlagsMask to GnssMeasurementsClockFlagsMask
uint32_t getGnssMeasurementsClockFlagsMaskFromPB(const uint32_t &pbGnssMeasClockFlgMask) const;
// PBGnssMeasurementsDataFlagsMask to GnssMeasurementsDataFlagsMask
uint32_t getGnssMeasurementsDataFlagsMaskFromPB(const uint32_t &pbGnssMeasDataFlgMask) const;
// PBGnssMeasurementsAdrStateMask to GnssMeasurementsAdrStateMask
uint32_t getGnssMeasurementsAdrStateMaskFromPB(const uint32_t &pbGnssMeasAdrStateMask) const;
// PBGnssLocationInfoFlagMask to GnssLocationInfoFlagMask
uint64_t getGnssLocationInfoFlagMaskFromPB(const uint32_t &pbGnssLocInfoFlagMask,
const uint32_t &pbGnssLocInfoExtFlagMask) const;
// PBGnssLocationNavSolutionMask to GnssLocationNavSolutionMask
uint32_t getGnssLocationNavSolutionMaskFromPB(const uint32_t &pbGnssLocNavSoln) const;
// PBLocApiDrCalibrationStatusMask to DrCalibrationStatusMask
uint32_t getDrCalibrationStatusMaskFromPB(const uint32_t &pbDrCalibStatus) const;
// PBLocApiGnssLocationPosDataMask to GnssLocationPosDataMask
uint32_t getGnssLocationPosDataMaskFromPB(const uint32_t &pbGnssLocPosDataMask) const;
// PBLocApiGnssLocationPosDataMask to GnssLocationPosDataMaskExt
uint32_t getGnssLocationPosDataMaskExtFromPB(const uint32_t &pbGnssLocPosDataMask) const;
// PBGnssGloTimeStructTypeFlags to GnssGloTimeStructTypeFlags
uint32_t getGnssGloTimeStructTypeFlagsFromPB(const uint32_t &pbGnssGloTimeStruct) const;
// PBGnssConfigRobustLocationValidMask to GnssConfigRobustLocationValidMask
uint32_t getGnssConfigRobustLocationValidMaskFromPB(
const uint32_t &pbGnssCfgRobstLocValidMask) const;
// PBDeadReckoningEngineConfigValidMask to DeadReckoningEngineConfigValidMask
uint64_t getDeadReckoningEngineConfigValidMaskFromPB(const uint64_t &pbDrEngCfgVldMask) const;
// PBDrEngineAidingDataMask to DrEngineAidingDataMask
uint32_t getDrEngineAidingDataMaskFromPB(const uint32_t &pbDrEngAidDataMask) const;
// PBDrSolutionStatusMask to DrSolutionStatusMask
uint32_t getDrSolutionStatusMaskFromPB(const uint32_t &pbDrSolnStatusMask) const;
// **** helper function for enum conversion from protobuf enums to normal format.
GnssSuplMode getEnumForPBGnssSuplMode(const PBGnssSuplMode &pbGnssSuplMode) const;
BatchingStatus getEnumForPBBatchingStatus(const PBBatchingStatus &pbBatchStat) const;
GnssMeasurementsMultipathIndicator getEnumForPBGnssMeasMultipathIndic(
const PBGnssMeasurementsMultipathIndicator &pbGnssMeasMultipathIndic) const;
LocationReliability getEnumForPBLocReliability(
const PBLocationReliability &locReliability) const;
Gnss_LocSvSystemEnumType getEnumForPBGnssLocSvSystem(
const PBLocApiGnss_LocSvSystemEnumType &pbGnssLocSvSysEnumType) const;
LocOutputEngineType getEnumForPBLocOutputEngineType(
const PBLocApiOutputEngineType &pbLocOpEngType) const;
loc_sess_status getLocSessionStatusFromPB(const PBLocationSessionStatus &pbStatus) const;
// ** Special enum conversion
// PBLocApiGnss_LocSvSystemEnumType to GnssSvType
GnssSvType getGnssSvTypeFromPBGnssLocSvSystemEnumType(
const PBLocApiGnss_LocSvSystemEnumType &pbGnssLocSvSysEnum) const;
// **** helper function to convert from protobuf struct to normal struct.
// PBLIALeverArmParams to LeverArmParams
int pbConvertToLeverArmParams(const PBLIALeverArmParams &pbLeverArmParams,
LeverArmParams &leverArmParams) const;
// PBLeapSecondSystemInfo to LeapSecondSystemInfo
int pbConvertToLeapSecSysInfo(const PBLeapSecondSystemInfo &pbLeapSecSysInfo,
LeapSecondSystemInfo &leapSecSysInfo) const;
// PBLeapSecondChangeInfo to LeapSecondChangeInfo
int pbConvertToLeapSecChgInfo(const PBLeapSecondChangeInfo &pbLeapSecChgInfo,
LeapSecondChangeInfo &leapSecChgInfo) const;
// PBLocApiGnssSystemTimeStructType to GnssSystemTimeStructType
int pbConvertToGnssSystemTimeStructType(
const PBLocApiGnssSystemTimeStructType &pbGnssSysTimeStrct,
GnssSystemTimeStructType &gnssSysTimeStrct) const;
// PBGnssMeasurementsData to GnssMeasurementsData
int pbConvertToGnssMeasurementsData(const PBGnssMeasurementsData &pbGnssMeasData,
GnssMeasurementsData &gnssMeasData) const;
// PBGnssMeasurementsClock to GnssMeasurementsClock
int pbConvertToGnssMeasurementsClock(const PBGnssMeasurementsClock &pbGnssMeasClock,
GnssMeasurementsClock &gnssMeasClock) const;
// PBGnssLocationSvUsedInPosition to GnssLocationSvUsedInPosition
int pbConvertToGnssLocationSvUsedInPosition(
const PBGnssLocationSvUsedInPosition &pbGnssLocSvUsedInPos,
GnssLocationSvUsedInPosition &gnssLocSvUsedInPos) const;
// PBLLAInfo to LLAInfo
int pbConvertToLLAInfo(const PBLLAInfo &pbLlaInfo, LLAInfo &llaInfo) const;
// PBLocApiGnssLocationPositionDynamics to
// GnssLocationPositionDynamics & GnssLocationPositionDynamicsExt
int pbConvertToGnssLocationPositionDynamics(
const PBLocApiGnssLocationPositionDynamics &pbGnssLocPosDyn,
GnssLocationPositionDynamics &gnssLocPosDyn,
GnssLocationPositionDynamicsExt &gnssLocPosDynExt) const;
// PBLocApiGnssSystemTime to GnssSystemTime
int pbConvertToGnssSystemTime(const PBLocApiGnssSystemTime &pbGnssSysTime,
GnssSystemTime &gnssSysTime) const;
// PBGnssMeasUsageInfo to GnssMeasUsageInfo
int pbConvertToGnssMeasUsageInfo(const PBGnssMeasUsageInfo &pbGnssMeasUsageInfo,
GnssMeasUsageInfo &gnssMeasUsageInfo) const;
// PBLocApiSystemTimeStructUnion to SystemTimeStructUnion
int pbConvertToSystemTimeStructUnion(const Gnss_LocSvSystemEnumType &gnssLocSvSysEnumType,
const PBLocApiSystemTimeStructUnion &pbSysTimeStructUnion,
SystemTimeStructUnion &sysTimeStructUnion) const;
// PBLocApiGnssGloTimeStructType to GnssGloTimeStructType
int pbConvertToGnssGloTimeStructType(const PBLocApiGnssGloTimeStructType &pbGnssGloTime,
GnssGloTimeStructType &gnssGloTime) const;
// PBGeofenceOption to GeofenceOption
int pbConvertToGeofenceOption(const PBGeofenceOption &pbGfOpt, GeofenceOption &gfOpt) const;
// PBGeofenceInfo to GeofenceInfo
int pbConvertToGeofenceInfo(const PBGeofenceInfo &pbGfInfo, GeofenceInfo &gfInfo) const;
// PBLIABodyToSensorMountParams to BodyToSensorMountParams
int pbConvertToBodyToSensorMountParams(
const PBLIABodyToSensorMountParams &pbBody2SensorMntParam,
BodyToSensorMountParams &body2SensorMntParam) const;
};
#endif /* LOCATION_API_PBMSGCONV_H */

View file

@ -1,41 +0,0 @@
AM_CFLAGS = \
-I./ \
-D__STDC_FORMAT_MACROS \
-Dstrlcpy=g_strlcpy \
-Dstrlcat=g_strlcat \
$(GPSUTILS_CFLAGS) \
-std=c++14
ACLOCAL_AMFLAGS = -I m4
requiredlibs = \
$(GPSUTILS_LIBS) \
-lprotobuf
liblocation_api_msg_proto_la_SOURCES = \
LocationApiDataTypes.pb.cc \
LocationApiMsg.pb.cc \
LocationApiMsg.cpp \
LocationApiPbMsgConv.cpp
library_include_HEADERS = \
LocationApiMsg.h \
LocationApiDataTypes.pb.h \
LocationApiMsg.pb.h \
LocationApiPbMsgConv.h
if USE_GLIB
liblocation_api_msg_proto_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ -include glib.h
liblocation_api_msg_proto_la_LDFLAGS = -lstdc++ -g -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
liblocation_api_msg_proto_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ -include glib.h
else
liblocation_api_msg_proto_la_CFLAGS = $(AM_CFLAGS)
liblocation_api_msg_proto_la_LDFLAGS = -Wl,-z,defs -lpthread -shared -version-info 1:0:0
liblocation_api_msg_proto_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
endif
liblocation_api_msg_proto_la_LIBADD = $(requiredlibs) -ldl -lstdc++
library_includedir = $(pkgincludedir)
#Create and Install libraries
lib_LTLIBRARIES = liblocation_api_msg_proto.la

File diff suppressed because it is too large Load diff

View file

@ -1,200 +0,0 @@
/* Copyright (c) 2018-2020, 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.
*/
#ifndef LOCHAL_CLIENT_HANDLER_H
#define LOCHAL_CLIENT_HANDLER_H
#include <queue>
#include <mutex>
#include <log_util.h>
#include <loc_pla.h>
#ifdef NO_UNORDERED_SET_OR_MAP
#include <map>
#else
#include <unordered_map>
#endif
#include <LocationAPI.h>
#include <LocIpc.h>
#include <LocationApiPbMsgConv.h>
using namespace loc_util;
// forward declaration
class LocationApiService;
/******************************************************************************
LocHalDaemonClientHandler
******************************************************************************/
class LocHalDaemonClientHandler
{
public:
inline LocHalDaemonClientHandler(LocationApiService* service, const std::string& clientname,
ClientType clientType) :
mService(service),
mName(clientname),
mClientType(clientType),
mCapabilityMask(0),
mTracking(false),
mBatching(false),
mSessionId(0),
mBatchingId(0),
mBatchingMode(BATCHING_MODE_NO_AUTO_REPORT),
mLocationApi(nullptr),
mCallbacks{},
mPendingMessages(),
mGfPendingMessages(),
mSubscriptionMask(0),
mEngineInfoRequestMask(0),
mGeofenceIds(nullptr),
mIpcSender(createSender(clientname.c_str())) {
if (mClientType == LOCATION_CLIENT_API) {
updateSubscription(E_LOC_CB_GNSS_LOCATION_INFO_BIT);
// client has not yet subscribed to anything yet
mSubscriptionMask = 0;
mLocationApi = LocationAPI::createInstance(mCallbacks);
}
}
static shared_ptr<LocIpcSender> createSender(const string socket);
void cleanup();
// public APIs
void updateSubscription(uint32_t mask);
// when client stops the location session, then all callbacks
// related to location session need to be unsubscribed
void unsubscribeLocationSessionCb();
uint32_t startTracking();
uint32_t startTracking(LocationOptions & locOptions);
void stopTracking();
void updateTrackingOptions(LocationOptions & locOptions);
void onGnssEnergyConsumedInfoAvailable(LocAPIGnssEnergyConsumedIndMsg &msg);
void onControlResponseCb(LocationError err, ELocMsgID msgId);
void onGnssConfigCb(ELocMsgID configMsgId, const GnssConfig & gnssConfig);
bool hasPendingEngineInfoRequest(uint32_t mask);
void addEngineInfoRequst(uint32_t mask);
uint32_t startBatching(uint32_t minInterval, uint32_t minDistance, BatchingMode batchMode);
void stopBatching();
void updateBatchingOptions(uint32_t minInterval, uint32_t minDistance, BatchingMode batchMode);
uint32_t* addGeofences(size_t count, GeofenceOption*, GeofenceInfo*);
void removeGeofences(size_t count, uint32_t* ids);
void modifyGeofences(size_t count, uint32_t* ids, GeofenceOption* options);
void pauseGeofences(size_t count, uint32_t* ids);
void resumeGeofences(size_t count, uint32_t* ids);
//other API
void setGeofenceIds(size_t count, uint32_t* clientIds, uint32_t* sessionIds);
void eraseGeofenceIds(size_t count, uint32_t* clientIds);
uint32_t* getSessionIds(size_t count, uint32_t* clientIds);
uint32_t* getClientIds(size_t count, uint32_t* sessionIds);
// send terrestrial fix to the requesting LCA client
void sendTerrestrialFix(LocationError error, const Location& location);
inline shared_ptr<LocIpcSender> getIpcSender () {return mIpcSender;};
void pingTest();
bool mTracking;
bool mBatching;
BatchingMode mBatchingMode;
std::queue<ELocMsgID> mPendingMessages;
std::queue<ELocMsgID> mGfPendingMessages;
private:
inline ~LocHalDaemonClientHandler() {}
// Location API callback functions
void onCapabilitiesCallback(LocationCapabilitiesMask capabilitiesMask);
void onResponseCb(LocationError err, uint32_t id);
void onCollectiveResponseCallback(size_t count, LocationError *errs, uint32_t *ids);
void onTrackingCb(Location location);
void onBatchingCb(size_t count, Location* location, BatchingOptions batchOptions);
void onBatchingStatusCb(BatchingStatusInfo batchingStatus,
std::list<uint32_t>& listOfCompletedTrips);
void onGnssLocationInfoCb(GnssLocationInfoNotification gnssLocationInfoNotification);
void onGeofenceBreachCb(GeofenceBreachNotification geofenceBreachNotification);
void onEngLocationsInfoCb(uint32_t count,
GnssLocationInfoNotification* engLocationsInfoNotification);
void onGnssNiCb(uint32_t id, GnssNiNotification gnssNiNotification);
void onGnssSvCb(GnssSvNotification gnssSvNotification);
void onGnssNmeaCb(GnssNmeaNotification);
void onGnssDataCb(GnssDataNotification gnssDataNotification);
void onGnssMeasurementsCb(GnssMeasurementsNotification gnssMeasurementsNotification);
void onLocationSystemInfoCb(LocationSystemInfo);
void onLocationApiDestroyCompleteCb();
// send ipc message to this client for serialized payload
bool sendMessage(const char* msg, size_t msglen, ELocMsgID msg_id) {
bool retVal= LocIpc::send(*mIpcSender, reinterpret_cast<const uint8_t*>(msg), msglen);
if (retVal == false) {
struct timespec ts;
clock_gettime(CLOCK_BOOTTIME, &ts);
LOC_LOGe("failed: client %s, msg id: %d, msg size %d, err %s, "
"boot timestamp %" PRIu64" msec",
mName.c_str(), msg_id, msglen, strerror(errno),
(ts.tv_sec * 1000ULL + ts.tv_nsec/1000000));
}
return retVal;
}
uint32_t getSupportedTbf (uint32_t tbfMsec);
// pointer to parent service
LocationApiService* mService;
// name of this client
const std::string mName;
ClientType mClientType;
// LocationAPI interface
LocationCapabilitiesMask mCapabilityMask;
uint32_t mSessionId;
uint32_t mBatchingId;
LocationAPI* mLocationApi;
LocationCallbacks mCallbacks;
TrackingOptions mOptions;
BatchingOptions mBatchOptions;
// bitmask to hold this client's subscription
uint32_t mSubscriptionMask;
// bitmask to hold this client's request to engine info related subscription
uint32_t mEngineInfoRequestMask;
uint32_t* mGeofenceIds;
shared_ptr<LocIpcSender> mIpcSender;
std::unordered_map<uint32_t, uint32_t> mGfIdsMap; //geofence ID map, clientId-->session
};
#endif //LOCHAL_CLIENT_HANDLER_H

File diff suppressed because it is too large Load diff

View file

@ -1,317 +0,0 @@
/* Copyright (c) 2018-2020 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.
*/
#ifndef LOCATIONAPISERVICE_H
#define LOCATIONAPISERVICE_H
#include <string>
#include <mutex>
#include <MsgTask.h>
#include <loc_cfg.h>
#include <LocIpc.h>
#include <LocTimer.h>
#ifdef POWERMANAGER_ENABLED
#include <PowerEvtHandler.h>
#endif
#include <location_interface.h>
#include <LocationAPI.h>
#include <LocationApiMsg.h>
#include <LocHalDaemonClientHandler.h>
#ifdef NO_UNORDERED_SET_OR_MAP
#include <map>
#else
#include <unordered_map>
#endif
#undef LOG_TAG
#define LOG_TAG "LocSvc_HalDaemon"
typedef struct {
uint32_t autoStartGnss;
uint32_t gnssSessionTbfMs;
uint32_t deleteAllBeforeAutoStart;
uint32_t posEngineMask;
uint32_t positionMode;
} configParamToRead;
/******************************************************************************
LocationApiService
******************************************************************************/
typedef struct {
// this stores the client name and the command type that client requests
// the info will be used to send back command response
std::string clientName;
ELocMsgID configMsgId;
} ConfigReqClientData;
// periodic timer to perform maintenance work, e.g.: resource cleanup
// for location hal daemon
typedef std::unordered_map<std::string, shared_ptr<LocIpcSender>> ClientNameIpcSenderMap;
class MaintTimer : public LocTimer {
public:
MaintTimer(LocationApiService* locationApiService) :
mLocationApiService(locationApiService) {
};
~MaintTimer() = default;
public:
void timeOutCallback() override;
private:
LocationApiService* mLocationApiService;
};
class SingleTerrestrialFixTimer : public LocTimer {
public:
SingleTerrestrialFixTimer(LocationApiService* locationApiService,
std::string& clientName) :
mLocationApiService(locationApiService),
mClientName(clientName) {
}
~SingleTerrestrialFixTimer() {
}
public:
void timeOutCallback() override;
private:
LocationApiService* mLocationApiService;
const std::string mClientName;
};
// This keeps track of the client that requests single fix terrestrial position
// and the timer that will fire when the timeout value has reached
typedef std::unordered_map<std::string, SingleTerrestrialFixTimer>
SingleTerrestrialFixClientMap;
class LocationApiService
{
public:
// singleton instance
LocationApiService(const LocationApiService&) = delete;
LocationApiService& operator = (const LocationApiService&) = delete;
static LocationApiService* getInstance(
const configParamToRead & configParamRead) {
if (nullptr == mInstance) {
mInstance = new LocationApiService(configParamRead);
}
return mInstance;
}
static void destroy() {
if (nullptr != mInstance) {
delete mInstance;
mInstance = nullptr;
}
}
// APIs can be invoked by IPC
void processClientMsg(const char* data, uint32_t length);
// from IPC receiver
void onListenerReady(bool externalApIpc);
#ifdef POWERMANAGER_ENABLED
void onPowerEvent(PowerStateType powerState);
#endif
// other APIs
void deleteClientbyName(const std::string name);
// protobuf conversion util class
LocationApiPbMsgConv mPbufMsgConv;
static std::mutex mMutex;
// Utility routine used by maintenance timer
void performMaintenance();
// Utility routine used by gtp fix timeout timer
void gtpFixRequestTimeout(const std::string& clientName);
inline const MsgTask& getMsgTask() const {return mMsgTask;};
private:
// APIs can be invoked to process client's IPC messgage
void newClient(LocAPIClientRegisterReqMsg*);
void deleteClient(LocAPIClientDeregisterReqMsg*);
void startTracking(LocAPIStartTrackingReqMsg*);
void stopTracking(LocAPIStopTrackingReqMsg*);
void suspendAllTrackingSessions();
void resumeAllTrackingSessions();
void updateSubscription(LocAPIUpdateCallbacksReqMsg*);
void updateTrackingOptions(LocAPIUpdateTrackingOptionsReqMsg*);
void updateNetworkAvailability(bool availability);
void getGnssEnergyConsumed(const char* clientSocketName);
void getSingleTerrestrialPos(LocAPIGetSingleTerrestrialPosReqMsg*);
void startBatching(LocAPIStartBatchingReqMsg*);
void stopBatching(LocAPIStopBatchingReqMsg*);
void updateBatchingOptions(LocAPIUpdateBatchingOptionsReqMsg*);
void addGeofences(LocAPIAddGeofencesReqMsg*);
void removeGeofences(LocAPIRemoveGeofencesReqMsg*);
void modifyGeofences(LocAPIModifyGeofencesReqMsg*);
void pauseGeofences(LocAPIPauseGeofencesReqMsg*);
void resumeGeofences(LocAPIResumeGeofencesReqMsg*);
void pingTest(LocAPIPingTestReqMsg*);
inline uint32_t gnssUpdateConfig(const GnssConfig& config) {
uint32_t* sessionIds = mLocationControlApi->gnssUpdateConfig(config);
// in our usage, we only configure one setting at a time,
// so we have only one sessionId
uint32_t sessionId = 0;
if (sessionIds) {
sessionId = *sessionIds;
delete [] sessionIds;
}
return sessionId;
}
// Location control API callback
void onControlResponseCallback(LocationError err, uint32_t id);
void onControlCollectiveResponseCallback(size_t count, LocationError *errs, uint32_t *ids);
void onGnssConfigCallback(uint32_t sessionId, const GnssConfig& config);
void onGnssEnergyConsumedCb(uint64_t totalEnergyConsumedSinceFirstBoot);
// Callbacks for location api used service GTP WWAN fix request
void onCapabilitiesCallback(LocationCapabilitiesMask mask);
void onResponseCb(LocationError err, uint32_t id);
void onCollectiveResponseCallback(size_t count, LocationError *errs, uint32_t *ids);
void onGtpWwanTrackingCallback(Location location);
// Location configuration API requests
void configConstrainedTunc(
const LocConfigConstrainedTuncReqMsg* pMsg);
void configPositionAssistedClockEstimator(
const LocConfigPositionAssistedClockEstimatorReqMsg* pMsg);
void configConstellations(
const LocConfigSvConstellationReqMsg* pMsg);
void configConstellationSecondaryBand(
const LocConfigConstellationSecondaryBandReqMsg* pMsg);
void configAidingDataDeletion(
LocConfigAidingDataDeletionReqMsg* pMsg);
void configLeverArm(const LocConfigLeverArmReqMsg* pMsg);
void configRobustLocation(const LocConfigRobustLocationReqMsg* pMsg);
void configMinGpsWeek(const LocConfigMinGpsWeekReqMsg* pMsg);
void configDeadReckoningEngineParams(const LocConfigDrEngineParamsReqMsg* pMsg);
void configMinSvElevation(const LocConfigMinSvElevationReqMsg* pMsg);
void configEngineRunState(const LocConfigEngineRunStateReqMsg* pMsg);
void configUserConsentTerrestrialPositioning(
LocConfigUserConsentTerrestrialPositioningReqMsg* pMsg);
// Location configuration API get/read requests
void getGnssConfig(const LocAPIMsgHeader* pReqMsg,
GnssConfigFlagsBits configFlag);
void getConstellationSecondaryBandConfig(
const LocConfigGetConstellationSecondaryBandConfigReqMsg* pReqMsg);
// Location configuration API util routines
void addConfigRequestToMap(uint32_t sessionId,
const LocAPIMsgHeader* pMsg);
LocationApiService(const configParamToRead & configParamRead);
virtual ~LocationApiService();
// private utilities
inline LocHalDaemonClientHandler* getClient(const std::string& clientname) {
// find client from property db
auto client = mClients.find(clientname);
if (client == std::end(mClients)) {
LOC_LOGe("Failed to find client %s", clientname.c_str());
return nullptr;
}
return client->second;
}
inline LocHalDaemonClientHandler* getClient(const char* socketName) {
std::string clientname(socketName);
return getClient(clientname);
}
GnssInterface* getGnssInterface();
#ifdef POWERMANAGER_ENABLED
// power event observer
PowerEvtHandler* mPowerEventObserver;
#endif
// singleton instance
static LocationApiService *mInstance;
// IPC interface
LocIpc mIpc;
unique_ptr<LocIpcRecver> mBlockingRecver;
// Client propery database
std::unordered_map<std::string, LocHalDaemonClientHandler*> mClients;
std::unordered_map<uint32_t, ConfigReqClientData> mConfigReqs;
// Location Control API interface
uint32_t mLocationControlId;
LocationControlCallbacks mControlCallabcks;
LocationControlAPI *mLocationControlApi;
// Configration
const uint32_t mAutoStartGnss;
GnssSuplMode mPositionMode;
PowerStateType mPowerState;
// maintenance timer
MaintTimer mMaintTimer;
// msg task used by timers
const MsgTask mMsgTask;
// Terrestrial service related APIs
// Location api interface for single short wwan fix
LocationAPI* mGtpWwanSsLocationApi;
LocationCallbacks mGtpWwanSsLocationApiCallbacks;
trackingCallback mGtpWwanPosCallback;
// -1: not set, 0: user not opt-in, 1: user opt in
int mOptInTerrestrialService;
SingleTerrestrialFixClientMap mTerrestrialFixReqs;
};
#endif //LOCATIONAPISERVICE_H

View file

@ -1,67 +0,0 @@
AM_CFLAGS = \
-DDEBUG \
-I./ \
$(LOCCORE_CFLAGS) \
$(GPSUTILS_CFLAGS) \
$(LOCAPIMSGPROTO_CFLAGS) \
-std=c++11
if USE_SYSTEMD
AM_CFLAGS += -DINIT_SYSTEM_SYSTEMD
else
AM_CFLAGS += -DINIT_SYSTEM_SYSV
endif
if USE_FEATURE_AUTOMOTIVE
AM_CFLAGS += -DFEATURE_AUTOMOTIVE
endif
requiredlibs = \
$(LOCATIONAPI_LIBS) \
$(GPSUTILS_LIBS) \
$(LOCAPIMSGPROTO_LIBS) \
-lprotobuf
h_sources = \
LocHalDaemonClientHandler.h \
LocationApiService.h
c_sources = \
LocHalDaemonClientHandler.cpp \
LocationApiService.cpp \
main.cpp
if POWERMANAGER_ENABLED
AM_CFLAGS += $(PM_CFLAGS) -DPOWERMANAGER_ENABLED
c_sources += PowerEvtHandler.cpp
requiredlibs += $(PM_LIBS)
endif
location_hal_daemon_SOURCES = \
$(c_sources) $(h_sources)
######################
# Build location_hal_daemon
######################
if USE_GLIB
location_hal_daemon_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
location_hal_daemon_LDFLAGS = -lstdc++ -g -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared
location_hal_daemon_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
else
location_hal_daemon_CFLAGS = $(AM_CFLAGS)
location_hal_daemon_LDFLAGS = -Wl,-z,defs -lpthread -shared
location_hal_daemon_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
endif
location_hal_daemon_LDADD = $(requiredlibs) -lcutils -ldl
bin_PROGRAMS = location_hal_daemon
library_include_HEADERS = $(h_sources)
library_includedir = $(pkgincludedir)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = location-hal-daemon.pc
EXTRA_DIST = $(pkgconfig_DATA)

View file

@ -1,87 +0,0 @@
/* 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.
*/
#include <unistd.h>
#include <PowerEvtHandler.h>
#include <LocationApiService.h>
#include <log_util.h>
#include <syslog.h>
#define ACK_TIMEOUT_US 300000 // 300 msec
LocationApiService* PowerEvtHandler::mLocationApiService = nullptr;
PowerEvtHandler* PowerEvtHandler::getPwrEvtHandler(LocationApiService* locServiceApiObj) {
mLocationApiService = locServiceApiObj;
static PowerEvtHandler instance;
return &instance;
}
PowerEvtHandler::PowerEvtHandler() {
int ret = pwr_state_notification_register(PowerEvtHandler::pwrStateCb);
syslog(LOG_INFO, "PowerEvtHandler: register api returned: %d", ret);
}
PowerEvtHandler::~PowerEvtHandler() {
}
int PowerEvtHandler::pwrStateCb(power_state_t pwr_state) {
client_ack_t client_ack;
client_ack.ack = ERR;
PowerStateType powerState = POWER_STATE_UNKNOWN;
syslog(LOG_INFO, "PowerEvtHandler: pwrStateCb: %d", pwr_state.sys_state);
switch (pwr_state.sys_state) {
case SYS_SUSPEND:
client_ack.ack = SUSPEND_ACK;
powerState = POWER_STATE_SUSPEND;
break;
case SYS_RESUME:
client_ack.ack = RESUME_ACK;
powerState = POWER_STATE_RESUME;
break;
case SYS_SHUTDOWN:
client_ack.ack = SHUTDOWN_ACK;
powerState = POWER_STATE_SHUTDOWN;
break;
}
if (powerState != POWER_STATE_UNKNOWN) {
if (mLocationApiService) {
mLocationApiService->onPowerEvent(powerState);
}
}
//Allow some time to stop the session and write calibration data NVM.
usleep(ACK_TIMEOUT_US);
syslog(LOG_INFO, "PowerEvtHandler: pwrStateCb sending ack");
send_acknowledgement(client_ack);
return 0;
}

View file

@ -1,49 +0,0 @@
/* 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.
*/
#ifndef _POWER_EVENT_HANDLER_H_
#define _POWER_EVENT_HANDLER_H_
#include <power_state.h>
class LocationApiService;
class PowerEvtHandler
{
public:
static PowerEvtHandler* getPwrEvtHandler(LocationApiService*);
~PowerEvtHandler();
static int pwrStateCb(power_state_t pwr_state);
private:
PowerEvtHandler();
static LocationApiService* mLocationApiService;
};
#endif //_POWER_EVENT_HANDLER_H_

View file

@ -1,115 +0,0 @@
# configure.ac -- Autoconf script for gps location-hal-daemon
#
# Process this file with autoconf to produce a configure script
# Requires autoconf tool later than 2.61
AC_PREREQ(2.61)
# Initialize the location-hal-daemon package version 1.0.0
AC_INIT([location-hal-daemon],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([LOCCORE], [loc-core])
AC_SUBST([LOCCORE_CFLAGS])
AC_SUBST([LOCCORE_LIBS])
PKG_CHECK_MODULES([LOCATIONAPI], [location-api])
AC_SUBST([LOCATIONAPI_CFLAGS])
AC_SUBST([LOCATIONAPI_LIBS])
PKG_CHECK_MODULES([LOCHAL], [loc-hal])
AC_SUBST([LOCHAL_CFLAGS])
AC_SUBST([LOCHAL_LIBS])
PKG_CHECK_MODULES([GPSUTILS], [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([pwrmgrlib],
AC_HELP_STRING([--with-pwrmgrlib], [with power manager library]))
AM_CONDITIONAL(POWERMANAGER_ENABLED, test "x$with_pwrmgrlib" = "xyes")
AM_COND_IF(POWERMANAGER_ENABLED, [
PKG_CHECK_MODULES([PM], [powermanager])
AC_SUBST([PM_CFLAGS])
AC_SUBST([PM_LIBS])
])
AC_ARG_WITH([systemd],
AC_HELP_STRING([--with-systemd],
[systemd enable, building LE systems which has systemd]))
AM_CONDITIONAL(USE_SYSTEMD, test "x${with_systemd}" = "xyes")
AC_ARG_WITH([auto_feature],
AC_HELP_STRING([--with-auto_feature=@<:@dir@:>@],
[Using Automotive feature]),
[],
with_auto_feature=no)
if test "x$with_auto_feature" != "xno"; then
CPPFLAGS="${CPPFLAGS} -DFEATURE_AUTOMOTIVE"
fi
AM_CONDITIONAL(USE_FEATURE_AUTOMOTIVE, test "x${with_auto_feature}" = "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_CONFIG_FILES([ \
Makefile \
location-hal-daemon.pc
])
AC_OUTPUT

View file

@ -1,10 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: location-hal-daemon
Description: location hal daemon service
Version: @VERSION@
Libs: -L${libdir} -llocation-hal-daemon
Cflags: -I${includedir} -I${includedir}/location-hal-daemon

View file

@ -1,74 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2017-2018, 2020 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.
#
# Location Hal Daemon - init.d script for /usr/bin/location_hal_daemon
set -e
wait_for_dir_mount() {
while ! [ -d /dev ]
do
echo "waiting for /dev to mount"
done
}
create_set_folder() {
if [ ! -d "${1}" ]
then
mkdir -p "${1}"
chown -R "${2}" "${1}"
chmod "${3}" "${1}"
fi
}
# for location hal daemon
case "$1" in
start)
echo -n "Starting location_hal_initializer" > /dev/kmsg
wait_for_dir_mount
create_set_folder "/dev/socket/location" "gps:gps" 755
create_set_folder "/dev/socket/loc_client" "gps:locclient" 775
create_set_folder "/dev/socket/location/ehub" "gps:gps" 755
echo "Done creating folders for location hal daemon"
;;
stop)
echo -n "Stopping location_hal_initializer" > /dev/kmsg
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo -n "Usage location_hal_initializer { start | stop | restart }" >&2
exit 1
;;
esac
exit 0

View file

@ -1,168 +0,0 @@
/* Copyright (c) 2018-2020 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.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <grp.h>
#include <unistd.h>
#include <sys/prctl.h>
#include <sys/capability.h>
#include <loc_pla.h>
#include <loc_cfg.h>
#include <gps_extended_c.h>
#include <loc_misc_utils.h>
#include "LocationApiService.h"
#define HAL_DAEMON_VERSION "1.1.0"
// this function will block until the directory specified in
// dirName has been created
static inline void waitForDir(const char* dirName) {
// wait for parent direcoty to be created...
struct stat buf_stat;
while (1) {
LOC_LOGd("waiting for %s...", dirName);
int rc = stat(dirName, &buf_stat);
if (!rc) {
break;
}
usleep(100000); //100ms
}
LOC_LOGd("done");
}
int main(int argc, char *argv[])
{
configParamToRead configParamRead = {};
#if FEATURE_AUTOMOTIVE
// enable auto start by default with 100 ms TBF
configParamRead.autoStartGnss = 1;
configParamRead.gnssSessionTbfMs = 100;
#endif
const loc_param_s_type configTable[] =
{
{"AUTO_START_GNSS", &configParamRead.autoStartGnss, NULL, 'n'},
{"GNSS_SESSION_TBF_MS", &configParamRead.gnssSessionTbfMs, NULL, 'n'},
{"DELETE_ALL_BEFORE_AUTO_START", &configParamRead.deleteAllBeforeAutoStart, NULL, 'n'},
{"DELETE_ALL_ON_ENGINE_MASK", &configParamRead.posEngineMask, NULL, 'n'},
{"POSITION_MODE", &configParamRead.positionMode, NULL, 'n'},
};
// read configuration file
UTIL_READ_CONF(LOC_PATH_GPS_CONF, configTable);
if (configParamRead.positionMode != GNSS_SUPL_MODE_MSB) {
configParamRead.positionMode = GNSS_SUPL_MODE_STANDALONE;
}
LOC_LOGi("location hal daemon - ver %s", HAL_DAEMON_VERSION);
loc_boot_kpi_marker("L - Location Probe Start");
waitForDir(SOCKET_DIR_LOCATION);
waitForDir(SOCKET_LOC_CLIENT_DIR);
waitForDir(SOCKET_DIR_EHUB);
LOC_LOGd("starting loc_hal_daemon");
#ifdef INIT_SYSTEM_SYSV
// set supplementary groups for sysvinit
// For systemd, common supplementary groups are set via service files
char groupNames[LOC_MAX_PARAM_NAME] = "gps radio diag powermgr locclient inet vnw";
gid_t groupIds[LOC_PROCESS_MAX_NUM_GROUPS] = {};
char *splitGrpString[LOC_PROCESS_MAX_NUM_GROUPS];
int numGrps = loc_util_split_string(groupNames, splitGrpString,
LOC_PROCESS_MAX_NUM_GROUPS, ' ');
int numGrpIds=0;
for(int i=0; i<numGrps; i++) {
struct group* grp = getgrnam(splitGrpString[i]);
if (grp) {
groupIds[numGrpIds] = grp->gr_gid;
LOC_LOGd("Group %s = %d", splitGrpString[i], groupIds[numGrpIds]);
numGrpIds++;
}
}
if (0 != numGrpIds) {
if(-1 == setgroups(numGrpIds, groupIds)) {
LOC_LOGe("Error: setgroups failed %s", strerror(errno));
}
}
#endif
// check if this process started by root
if (0 == getuid()) {
#ifdef INIT_SYSTEM_SYSTEMD
// started as root.
LOC_LOGE("Error !!! location_hal_daemon started as root");
exit(1);
#else
// Set capabilities
struct __user_cap_header_struct cap_hdr = {};
cap_hdr.version = _LINUX_CAPABILITY_VERSION;
cap_hdr.pid = getpid();
if(prctl(PR_SET_KEEPCAPS, 1) < 0) {
LOC_LOGe("Error: prctl failed. %s", strerror(errno));
}
// Set the group id first and then set the effective userid, to gps.
if(-1 == setgid(GID_GPS)) {
LOC_LOGe("Error: setgid failed. %s", strerror(errno));
}
// Set user id
if(-1 == setuid(UID_GPS)) {
LOC_LOGe("Error: setuid failed. %s", strerror(errno));
}
// Set access to netmgr (QCMAP)
struct __user_cap_data_struct cap_data = {};
cap_data.permitted = (1 << CAP_NET_BIND_SERVICE) | (1 << CAP_NET_ADMIN);
cap_data.effective = cap_data.permitted;
LOC_LOGv("cap_data.permitted: %d", (int)cap_data.permitted);
if(capset(&cap_hdr, &cap_data)) {
LOC_LOGe("Error: capset failed. %s", strerror(errno));
}
#endif
}
// move to root dir
chdir("/");
// start listening for client events - will not return
if (!LocationApiService::getInstance(configParamRead)) {
LOC_LOGd("Failed to start LocationApiService.");
}
// should not reach here...
LOC_LOGd("done");
exit(0);
}

View file

@ -1,36 +0,0 @@
AM_CFLAGS = \
$(GPSUTILS_CFLAGS) \
-D__STDC_FORMAT_MACROS \
-Dstrlcpy=g_strlcpy \
-Dstrlcat=g_strlcat \
-std=c++11
ACLOCAL_AMFLAGS = -I m4
c_sources = \
ntrip-client-integration-api-testlib.cpp
libntripclient_integration_api_test_la_SOURCES = \
$(c_sources)
if USE_GLIB
libntripclient_integration_api_test_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ -include glib.h
libntripclient_integration_api_test_la_LDFLAGS = -lstdc++ -g -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
libntripclient_integration_api_test_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ -include glib.h
else
libntripclient_integration_api_test_la_CFLAGS = $(AM_CFLAGS)
libntripclient_integration_api_test_la_LDFLAGS = -Wl,-z,defs -lpthread -shared -version-info 1:0:0
libntripclient_integration_api_test_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
endif
libntripclient_integration_api_test_la_LIBADD = -ldl -lstdc++ $(GPSUTILS_LIBS)
#Create and Install libraries
library_include_HEADERS = $(h_sources)
lib_LTLIBRARIES = libntripclient_integration_api_test.la
library_includedir = $(pkgincludedir)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = ntrip-client-integration-api-testlib.pc
EXTRA_DIST = $(pkgconfig_DATA)

View file

@ -1,59 +0,0 @@
/* Copyright (c) 2020, 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.
*/
#ifndef NTRIP_CLIENT_INTEGRATION_API_H
#define NTRIP_CLIENT_INTEGRATION_API_H
#include <functional>
#ifdef __cplusplus
extern "C" {
#endif
/** @fn
@brief
CorrectionDataCb is for receiving correction data from NTRIP client.
*/
typedef std::function<void(uint8_t *correctionData, uint32_t lengthInBytes)>
CorrectionDataCb;
/** @brief API to start streaming for correction data.
PPE service shall call this API when it is ready to start receiving correction data.
*/
void startCorrectionDataStreaming(CorrectionDataCb corrDataCb);
/** @brief API to stop streaming for correction data.
PPE service shall call this API when it wants to stop receiving correction data.
*/
void stopCorrectionDataStreaming();
#ifdef __cplusplus
} // extern "C"
#endif
#endif //NTRIP_CLIENT_INTEGRATION_API_H

View file

@ -1,61 +0,0 @@
# configure.ac -- Autoconf script for ntrip-client
#
# Process this file with autoconf to produce a configure script
# Requires autoconf tool later than 2.61
AC_PREREQ(2.61)
# Initialize the ntrip client package version 1.0.0
AC_INIT([ntrip-client-integration-api-testlib],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], [gps-utils])
AC_SUBST([GPSUTILS_CFLAGS])
AC_SUBST([GPSUTILS_LIBS])
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 \
ntrip-client-integration-api-testlib.pc
])
AC_OUTPUT

View file

@ -1,48 +0,0 @@
/* Copyright (c) 2020, 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.
*/
#define LOG_TAG "NtripClientTestLib"
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>
#include <log_util.h>
#include <loc_cfg.h>
#include "NtripClientIntegrationApi.h"
void startCorrectionDataStreaming(CorrectionDataCb corrDataCb)
{
LOC_LOGi("Start correction data streaming\n");
}
void stopCorrectionDataStreaming()
{
LOC_LOGi("Stop correction data streaming\n");
}

View file

@ -1,10 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: ntrip client integration api test app
Description: NTRIP Client integration api test app
Version: @VERSION
Libs:
Cflags:

View file

@ -1,48 +0,0 @@
AM_CFLAGS = \
-DDEBUG \
-I src/ \
-I inc/ \
$(GPSUTILS_CFLAGS) \
$(LOCCLIENTAPI_CFLAGS) \
-std=c++11
ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS = -std=c++11
requiredlibs = \
$(GPSUTILS_LIBS) \
$(LOCCLIENTAPI_LIBS)
h_sources = \
inc/qapi_location.h
c_sources = \
src/qapi_location.cpp
liblocation_qapi_la_SOURCES = \
$(c_sources) $(h_sources)
######################
# Build location_qapi
######################
if USE_GLIB
liblocation_qapi_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
liblocation_qapi_la_LDFLAGS = -lstdc++ -g -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
liblocation_qapi_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
else
liblocation_qapi_la_CFLAGS = $(AM_CFLAGS)
liblocation_qapi_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread -shared -version-info 1:0:0
liblocation_qapi_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
endif
liblocation_qapi_la_LIBADD = $(requiredlibs) -lstdc++
#Create and Install libraries
library_include_HEADERS = $(h_sources)
lib_LTLIBRARIES = liblocation_qapi.la
library_includedir = $(pkgincludedir)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = location-qapi.pc
EXTRA_DIST = $(pkgconfig_DATA)

View file

@ -1,64 +0,0 @@
# configure.ac -- Autoconf script for gps location-qapi
#
# Process this file with autoconf to produce a configure script
# Requires autoconf tool later than 2.61
AC_PREREQ(2.61)
# Initialize the location_qapi package version 1.0.0
AC_INIT([location-qapi],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], [gps-utils])
AC_SUBST([GPSUTILS_CFLAGS])
AC_SUBST([GPSUTILS_LIBS])
PKG_CHECK_MODULES([LOCCLIENTAPI], [location-client-api])
AC_SUBST([LOCCLIENTAPI_CFLAGS])
AC_SUBST([LOCCLIENTAPI_LIBS])
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-qapi.pc
])
AC_OUTPUT

View file

@ -1,4 +0,0 @@
#########################################
# Timeout for Singleshot
#########################################
SINGLESHOT_TIMEOUT = 40000

View file

@ -1,865 +0,0 @@
/* Copyright (c) 2019-2020 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.
*/
#ifndef _QAPI_LOCATION_H_
#define _QAPI_LOCATION_H_
#include <stdint.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/** @addtogroup qapi_location
@{ */
/**
* GNSS location error codes.
*/
typedef enum {
QAPI_LOCATION_ERROR_SUCCESS = 0, /**< Success. */
QAPI_LOCATION_ERROR_GENERAL_FAILURE, /**< General failure. */
QAPI_LOCATION_ERROR_CALLBACK_MISSING, /**< Callback is missing. */
QAPI_LOCATION_ERROR_INVALID_PARAMETER, /**< Invalid parameter. */
QAPI_LOCATION_ERROR_ID_EXISTS, /**< ID already exists. */
QAPI_LOCATION_ERROR_ID_UNKNOWN, /**< ID is unknown. */
QAPI_LOCATION_ERROR_ALREADY_STARTED, /**< Already started. */
QAPI_LOCATION_ERROR_NOT_INITIALIZED, /**< Not initialized. */
QAPI_LOCATION_ERROR_GEOFENCES_AT_MAX, /**< Maximum number of geofences reached. */
QAPI_LOCATION_ERROR_NOT_SUPPORTED, /**< Not supported. */
QAPI_LOCATION_ERROR_TIMEOUT, /**< Timeout when asking single shot. */
QAPI_LOCATION_ERROR_LOAD_FAILURE, /**< GNSS engine could not get loaded. */
QAPI_LOCATION_ERROR_LOCATION_DISABLED, /**< Location module license is disabled. */
QAPI_LOCATION_ERROR_BEST_AVAIL_POS_INVALID, /**< Best available position is invalid. */
} qapi_Location_Error_t;
typedef uint16_t qapi_Location_Flags_Mask_t;
/**
* Flags to indicate which values are valid in a location.
*/
typedef enum {
QAPI_LOCATION_HAS_LAT_LONG_BIT = (1 << 0), /**< Location has a valid latitude and longitude. */
QAPI_LOCATION_HAS_ALTITUDE_BIT = (1 << 1), /**< Location has a valid altitude. */
QAPI_LOCATION_HAS_SPEED_BIT = (1 << 2), /**< Location has a valid speed. */
QAPI_LOCATION_HAS_BEARING_BIT = (1 << 3), /**< Location has a valid bearing. */
QAPI_LOCATION_HAS_ACCURACY_BIT = (1 << 4), /**< Location has valid accuracy. */
QAPI_LOCATION_HAS_VERTICAL_ACCURACY_BIT = (1 << 5), /**< Location has valid vertical accuracy. */
QAPI_LOCATION_HAS_SPEED_ACCURACY_BIT = (1 << 6), /**< Location has valid speed accuracy. */
QAPI_LOCATION_HAS_BEARING_ACCURACY_BIT = (1 << 7), /**< Location has valid bearing accuracy. */
QAPI_LOCATION_HAS_ALTITUDE_MSL_BIT = (1 << 8), /**< Location has valid altitude wrt mean sea level. */
QAPI_LOCATION_IS_BEST_AVAIL_POS_BIT = (1 << 9), /**< Location is the currently best available position. */
} qapi_Location_Flags_t;
/**
* Flags to indicate Geofence breach status.
*/
typedef enum {
QAPI_GEOFENCE_BREACH_ENTER = 0, /**< Entering Geofence breach. */
QAPI_GEOFENCE_BREACH_EXIT, /**< Exiting Geofence breach. */
QAPI_GEOFENCE_BREACH_DWELL_IN, /**< Dwelling in a breached Geofence. */
QAPI_GEOFENCE_BREACH_DWELL_OUT, /**< Dwelling outside of a breached Geofence. */
QAPI_GEOFENCE_BREACH_UNKNOWN, /**< Breach is unknown. */
} qapi_Geofence_Breach_t;
typedef uint16_t qapi_Geofence_Breach_Mask_t;
/** Flags to indicate Geofence breach mask bit. */
typedef enum {
QAPI_GEOFENCE_BREACH_ENTER_BIT = (1 << 0), /**< Breach enter bit. */
QAPI_GEOFENCE_BREACH_EXIT_BIT = (1 << 1), /**< Breach exit bit. */
QAPI_GEOFENCE_BREACH_DWELL_IN_BIT = (1 << 2), /**< Breach dwell in bit. */
QAPI_GEOFENCE_BREACH_DWELL_OUT_BIT = (1 << 3), /**< Breach dwell out bit. */
} qapi_Geofence_Breach_Mask_Bits_t;
typedef uint32_t qapi_Location_Capabilities_Mask_t;
/** Flags to indicate the capabilities bit. */
typedef enum {
QAPI_LOCATION_CAPABILITIES_TIME_BASED_TRACKING_BIT = (1 << 0), /**< Capabilities time-based tracking bit. */
QAPI_LOCATION_CAPABILITIES_TIME_BASED_BATCHING_BIT = (1 << 1), /**< Capabilities time-based batching bit. */
QAPI_LOCATION_CAPABILITIES_DISTANCE_BASED_TRACKING_BIT = (1 << 2), /**< Capabilities distance-based tracking bit. */
QAPI_LOCATION_CAPABILITIES_DISTANCE_BASED_BATCHING_BIT = (1 << 3), /**< Capabilities distance-based batching bit. */
QAPI_LOCATION_CAPABILITIES_GEOFENCE_BIT = (1 << 4), /**< Capabilities Geofence bit. */
QAPI_LOCATION_CAPABILITIES_GNSS_DATA_BIT = (1 << 5), /**< Capabilities Geofence bit. */
} qapi_Location_Capabilities_Mask_Bits_t;
/** Flags to indicate the constellation type. */
typedef enum {
QAPI_GNSS_SV_TYPE_UNKNOWN = 0, /**< Unknown. */
QAPI_GNSS_SV_TYPE_GPS, /**< GPS. */
QAPI_GNSS_SV_TYPE_SBAS, /**< SBAS. */
QAPI_GNSS_SV_TYPE_GLONASS, /**< GLONASS. */
QAPI_GNSS_SV_TYPE_QZSS, /**< QZSS. */
QAPI_GNSS_SV_TYPE_BEIDOU, /**< BEIDOU. */
QAPI_GNSS_SV_TYPE_GALILEO, /**< GALILEO. */
QAPI_MAX_NUMBER_OF_CONSTELLATIONS /**< Maximum number of constellations. */
} qapi_Gnss_Sv_t;
typedef enum {
QAPI_LOCATION_POWER_HIGH = 0, /**< Use all technologies available to calculate location. */
QAPI_LOCATION_POWER_LOW, /**< Use all low power technologies to calculate location. */
QAPI_LOCATION_POWER_MED, /**< Use only low and medium power technologies to calculate location */
} qapi_Location_Power_Level_t;
/** Structure for location information. */
typedef struct {
size_t size; /**< Size. Set to the size of qapi_Location_t. */
qapi_Location_Flags_Mask_t flags; /**< Bitwise OR of qapi_Location_Flags_t. */
uint64_t timestamp; /**< UTC timestamp for a location fix; milliseconds since Jan. 1, 1970. */
double latitude; /**< Latitude in degrees. */
double longitude; /**< Longitude in degrees. */
double altitude; /**< Altitude in meters above the WGS 84 reference ellipsoid. */
double altitudeMeanSeaLevel; /**< Altitude in meters with respect to mean sea level. */
float speed; /**< Speed in meters per second. */
float bearing; /**< Bearing in degrees; range: 0 to 360. */
float accuracy; /**< Accuracy in meters. */
float verticalAccuracy; /**< Vertical accuracy in meters. */
float speedAccuracy; /**< Speed accuracy in meters/second. */
float bearingAccuracy; /**< Bearing accuracy in degrees (0 to 359.999). */
} qapi_Location_t;
/** Structure for GNSS data information. */
typedef struct {
size_t size; /**< Size. Set to the size of #qapi_Gnss_Data_t. */
uint32_t jammerInd[QAPI_MAX_NUMBER_OF_CONSTELLATIONS]; /**< Jammer indication. */
} qapi_Gnss_Data_t;
/** Structure for location options. */
typedef struct {
size_t size; /**< Size. Set to the size of #qapi_Location_Options_t. */
uint32_t minInterval; /**< There are three different interpretations of this field,
depending if minDistance is 0 or not:
1. Time-based tracking (minDistance = 0). minInterval is the minimum
time interval in milliseconds that must elapse between final position reports.
2. Distance-based tracking (minDistance > 0). minInterval is the
maximum time period in milliseconds after the minimum distance
criteria has been met within which a location update must be provided.
If set to 0, an ideal value will be assumed by the engine.
3. Batching. minInterval is the minimum time interval in milliseconds that
must elapse between position reports.
*/
uint32_t minDistance; /**< Minimum distance in meters that must be traversed between position reports.
Setting this interval to 0 will be a pure time-based tracking/batching.
*/
} qapi_Location_Options_t;
/** Structure for Geofence options. */
typedef struct {
size_t size; /**< Size. Set to the size of #qapi_Geofence_Option_t. */
qapi_Geofence_Breach_Mask_t breachTypeMask; /**< Bitwise OR of #qapi_Geofence_Breach_Mask_Bits_t bits. */
uint32_t responsiveness; /**< Specifies in milliseconds the user-defined rate of detection for a Geofence
breach. This may impact the time lag between the actual breach event and
when it is reported. The gap between the actual breach and the time it
is reported depends on the user setting. The power implication is
inversely proportional to the responsiveness value set by the user.
The higher the responsiveness value, the lower the power implications,
and vice-versa. */
uint32_t dwellTime; /**< Dwell time is the time in milliseconds a user spends in the Geofence before
a dwell event is sent. */
} qapi_Geofence_Option_t;
/** Structure for Geofence information. */
typedef struct {
size_t size; /**< Size. Set to the size of #qapi_Geofence_Info_t. */
double latitude; /**< Latitude of the center of the Geofence in degrees. */
double longitude; /**< Longitude of the center of the Geofence in degrees. */
double radius; /**< Radius of the Geofence in meters. */
} qapi_Geofence_Info_t;
/** Structure for Geofence breach notification. */
typedef struct {
size_t size; /**< Size. Set to the size of #qapi_Geofence_Breach_Notification_t. */
size_t count; /**< Number of IDs in the array. */
uint32_t* ids; /**< Array of IDs that have been breached. */
qapi_Location_t location; /**< Location associated with a breach. */
qapi_Geofence_Breach_t type; /**< Type of breach. */
uint64_t timestamp; /**< Timestamp of the breach. */
} qapi_Geofence_Breach_Notification_t;
/* GNSS Location Callbacks */
/**
* @brief Provides the capabilities of the system.
It is called once after qapi_Loc_Init() is called.
@param[in] capabilitiesMask Bitwise OR of #qapi_Location_Capabilities_Mask_Bits_t.
@return None.
*/
typedef void(*qapi_Capabilities_Callback)(
qapi_Location_Capabilities_Mask_t capabilitiesMask
);
/**
* @brief Response callback, which is used by all tracking, batching
and Single Shot APIs.
It is called for every tracking, batching and single shot API.
@param[in] err #qapi_Location_Error_t associated with the request.
If this is not QAPI_LOCATION_ERROR_SUCCESS then id is not valid.
@param[in] id ID to be associated with the request.
@return None.
*/
typedef void(*qapi_Response_Callback)(
qapi_Location_Error_t err,
uint32_t id
);
/**
* @brief Collective response callback is used by Geofence APIs.
It is called for every Geofence API call.
@param[in] count Number of locations in arrays.
@param[in] err Array of #qapi_Location_Error_t associated with the request.
@param[in] ids Array of IDs to be associated with the request.
@return None.
*/
typedef void(*qapi_Collective_Response_Callback)(
size_t count,
qapi_Location_Error_t* err,
uint32_t* ids
);
/**
* @brief Tracking callback used for the qapi_Loc_Start_Tracking() API.
This is an optional function and can be NULL.
It is called when delivering a location in a tracking session.
@param[in] location Structure containing information related to the
tracked location.
@return None.
*/
typedef void(*qapi_Tracking_Callback)(
qapi_Location_t location
);
/**
* @brief Batching callback used for the qapi_Loc_Start_Batching() API.
This is an optional function and can be NULL.
It is called when delivering a location in a batching session.
@param[in] count Number of locations in an array.
@param[in] location Array of location structures containing information
related to the batched locations.
@return None.
*/
typedef void(*qapi_Batching_Callback)(
size_t count,
qapi_Location_t* location
);
/**
* @brief Geofence breach callback used for the qapi_Loc_Add_Geofences() API.
This is an optional function and can be NULL.
It is called when any number of geofences have a state change.
@param[in] geofenceBreachNotification Breach notification information.
@return None.
*/
typedef void(*qapi_Geofence_Breach_Callback)(
qapi_Geofence_Breach_Notification_t geofenceBreachNotification
);
/**
* @brief Single shot callback used for the qapi_Loc_Get_Single_Shot() API.
This is an optional function and can be NULL.
It is called when delivering a location in a single shot session
broadcasted to all clients, no matter if a session has started by client.
@param[in] location Structure containing information related to the
tracked location.
@param[in] err #qapi_Location_Error_t associated with the request.
This could be QAPI_LOCATION_ERROR_SUCCESS (location
is valid) or QAPI_LOCATION_ERROR_TIMEOUT (a timeout
occurred, location is not valid).
@return None.
*/
typedef void(*qapi_Single_Shot_Callback)(
qapi_Location_t location,
qapi_Location_Error_t err
);
/**
* @brief GNSS data callback used for the qapi_Loc_Start_Get_Gnss_Data() API.
This is an optional function and can be NULL.
It is called when delivering a GNSS Data structure. The GNSS data
structure contains useful information (e.g., jammer indication).
This callback will be called every second.
@param[in] gnssData Structure containing information related to the
requested GNSS Data.
@return None.
*/
typedef void(*qapi_Gnss_Data_Callback)(
qapi_Gnss_Data_t gnssData
);
/** Location callbacks requirements. */
typedef struct {
size_t size;
/**< Size. Set to the size of qapi_Location_Callbacks_t. */
qapi_Capabilities_Callback capabilitiesCb;
/**< Capabilities callback is mandatory. */
qapi_Response_Callback responseCb;
/**< Response callback is mandatory. */
qapi_Collective_Response_Callback collectiveResponseCb;
/**< Collective response callback is mandatory. */
qapi_Tracking_Callback trackingCb;
/**< Tracking callback is optional. */
qapi_Batching_Callback batchingCb;
/**< Batching callback is optional. */
qapi_Geofence_Breach_Callback geofenceBreachCb;
/**< Geofence breach callback is optional. */
qapi_Single_Shot_Callback singleShotCb;
/**< Single shot callback is optional. */
qapi_Gnss_Data_Callback gnssDataCb;
/**< GNSS data callback is optional. @newpagetable */
} qapi_Location_Callbacks_t;
/** Location client identifier. */
typedef uint32_t qapi_loc_client_id;
/**
* @brief Initializes a location session and registers the callbacks.
@param[out] pClientId Pointer to client ID type, where the unique identifier
for this location client is returned.
@param[in] pCallbacks Pointer to the structure with the callback
functions to be registered.
@return
QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
QAPI_LOCATION_ERROR_CALLBACK_MISSING -- One of the mandatory
callback functions is missing. \n
QAPI_LOCATION_ERROR_GENERAL_FAILURE -- There is an internal error. \n
QAPI_LOCATION_ERROR_ALREADY_STARTED -- A location session has
already been initialized.
*/
qapi_Location_Error_t qapi_Loc_Init(
qapi_loc_client_id* pClientId,
const qapi_Location_Callbacks_t* pCallbacks);
/**
* @brief De-initializes a location session.
@param[in] clientId Client identifier for the location client to be
deinitialized.
@return
QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
been initialized.
*/
qapi_Location_Error_t qapi_Loc_Deinit(
qapi_loc_client_id clientId);
/**
* @brief Sets the user buffer to be used for sending back callback data.
@param[in] clientId Client ID for which user buffer is to be set
@param[in] pUserBuffer User memory buffer to hold information passed
in callbacks. Note that since buffer is shared by all
the callbacks this has to be consumed at the user side
before it can be used by another callback to avoid any
potential race condition.
@param[in] bufferSize Size of user memory buffer to hold information passed
in callbacks. This size should be large enough to
accomodate the largest data size passed in a callback.
@return
QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
QAPI_LOCATION_ERROR_GENERAL_FAILURE -- There is an internal error. \n
*/
qapi_Location_Error_t qapi_Loc_Set_User_Buffer(
qapi_loc_client_id clientId,
uint8_t* pUserBuffer,
size_t bufferSize);
/**
* @brief Starts a tracking session, which returns a
session ID that will be used by the other tracking APIs and in
the response callback to match the command with a response. Locations are
reported on the tracking callback passed in qapi_Loc_Init() periodically
according to the location options.
responseCb returns:
QAPI_LOCATION_ERROR_SUCCESS if session was successfully started.
QAPI_LOCATION_ERROR_ALREADY_STARTED if a qapi_Loc_Start_Tracking session is already in progress.
QAPI_LOCATION_ERROR_CALLBACK_MISSING if no trackingCb was passed in qapi_Loc_Init().
QAPI_LOCATION_ERROR_INVALID_PARAMETER if pOptions parameter is invalid.
@param[in] clientId Client identifier for the location client.
@param[in] pOptions Pointer to a structure containing the options:
- minInterval -- There are two different interpretations of this field,
depending if minDistance is 0 or not:
1. Time-based tracking (minDistance = 0). minInterval is the minimum
time interval in milliseconds that must elapse between final position reports.
2. Distance-based tracking (minDistance > 0). minInterval is the
maximum time period in milliseconds after the minimum distance
criteria has been met within which a location update must be provided.
If set to 0, an ideal value will be assumed by the engine.
- minDistance -- Minimum distance in meters that must be traversed between position
reports. Setting this interval to 0 will be a pure time-based tracking.
@param[out] pSessionId Pointer to the session ID to be returned.
@return
QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
been initialized.
*/
qapi_Location_Error_t qapi_Loc_Start_Tracking(
qapi_loc_client_id clientId,
const qapi_Location_Options_t* pOptions,
uint32_t* pSessionId);
/**
* @brief Stops a tracking session associated with the id
parameter
responseCb returns:
QAPI_LOCATION_ERROR_SUCCESS if successful.
QAPI_LOCATION_ERROR_ID_UNKNOWN if clientId is not associated with a tracking session.
@param[in] clientId Client identifier for the location client.
@param[in] sessionId ID of the session to be stopped.
@return
QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
been initialized.
*/
qapi_Location_Error_t qapi_Loc_Stop_Tracking(
qapi_loc_client_id clientId,
uint32_t sessionId);
/**
* @brief Changes the location options of a
tracking session associated with the id parameter.
responseCb returns:
QAPI_LOCATION_ERROR_SUCCESS if successful.
QAPI_LOCATION_ERROR_INVALID_PARAMETER if pOptions parameter is invalid.
QAPI_LOCATION_ERROR_ID_UNKNOWN if clientId is not associated with a tracking session.
@param[in] clientId Client identifier for the location client.
@param[in] sessionId ID of the session to be changed.
@param[in] pOptions Pointer to a structure containing the options:
- minInterval -- There are two different interpretations of this field,
depending if minDistance is 0 or not:
1. Time-based tracking (minDistance = 0). minInterval is the minimum
time interval in milliseconds that must elapse between final position reports.
2. Distance-based tracking (minDistance > 0). minInterval is the
maximum time period in milliseconds after the minimum distance
criteria has been met within which a location update must be provided.
If set to 0, an ideal value will be assumed by the engine.
- minDistance -- Minimum distance in meters that must be traversed between position
reports. Setting this interval to 0 will be a pure time-based tracking.@tablebulletend
@return
QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
been initialized.
*/
qapi_Location_Error_t qapi_Loc_Update_Tracking_Options(
qapi_loc_client_id clientId,
uint32_t sessionId,
const qapi_Location_Options_t* pOptions);
/**
* @brief Starts a batching session, which returns a
session ID that will be used by the other batching APIs and in
the response callback to match the command with a response.
Locations are
reported on the batching callback passed in qapi_Loc_Init() periodically
according to the location options. A batching session starts tracking on
the low power processor and delivers them in batches by the
batching callback when the batch is full or when qapi_Loc_Get_Batched_Locations()
is called. This allows for the processor that calls this API to sleep
when the low power processor can batch locations in the background and
wake up the processor calling the API only when the batch is full,
thus saving power.
responseCb returns:
QAPI_LOCATION_ERROR_SUCCESS if session was successfully started.
QAPI_LOCATION_ERROR_ALREADY_STARTED if a qapi_Loc_Start_Batching session is already in progress.
QAPI_LOCATION_ERROR_CALLBACK_MISSING if no batchingCb was passed in qapi_Loc_Init().
QAPI_LOCATION_ERROR_INVALID_PARAMETER if pOptions parameter is invalid.
QAPI_LOCATION_ERROR_NOT_SUPPORTED if batching is not supported.
@param[in] clientId Client identifier for the location client.
@param[in] pOptions Pointer to a structure containing the options:
- minInterval -- minInterval is the minimum time interval in milliseconds that
must elapse between position reports.
- minDistance -- Minimum distance in meters that must be traversed between
position reports.@tablebulletend
@param[out] pSessionId Pointer to the session ID to be returned.
@return
QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
been initialized.
*/
qapi_Location_Error_t qapi_Loc_Start_Batching(
qapi_loc_client_id clientId,
const qapi_Location_Options_t* pOptions,
uint32_t* pSessionId);
/**
* @brief Stops a batching session associated with the id
parameter.
responseCb returns:
QAPI_LOCATION_ERROR_SUCCESS if successful.
QAPI_LOCATION_ERROR_ID_UNKNOWN if clientId is not associated with a batching session.
@param[in] clientId Client identifier for the location client.
@param[in] sessionId ID of the session to be stopped.
@return
QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
been initialized.
*/
qapi_Location_Error_t qapi_Loc_Stop_Batching(
qapi_loc_client_id clientId,
uint32_t sessionId);
/**
* @brief Changes the location options of a
batching session associated with the id parameter.
responseCb returns:
QAPI_LOCATION_ERROR_SUCCESS if successful.
QAPI_LOCATION_ERROR_INVALID_PARAMETER if pOptions parameter is invalid.
QAPI_LOCATION_ERROR_ID_UNKNOWN if clientId is not associated with a batching session.
@param[in] clientId Client identifier for the location client.
@param[in] sessionId ID of the session to be changed.
@param[in] pOptions Pointer to a structure containing the options:
- minInterval -- minInterval is the minimum time interval in milliseconds that
must elapse between position reports.
- minDistance -- Minimum distance in meters that must be traversed between
position reports.@tablebulletend
@return
QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
been initialized.
*/
qapi_Location_Error_t qapi_Loc_Update_Batching_Options(
qapi_loc_client_id clientId,
uint32_t sessionId,
const qapi_Location_Options_t* pOptions);
/**
* @brief Gets a number of locations that are
currently stored or batched on the low power processor, delivered by
the batching callback passed to qapi_Loc_Init(). Locations are then
deleted from the batch stored on the low power processor.
responseCb returns:
QAPI_LOCATION_ERROR_SUCCESS if successful, will be followed by batchingCallback call.
QAPI_LOCATION_ERROR_CALLBACK_MISSING if no batchingCb was passed in qapi_Loc_Init().
QAPI_LOCATION_ERROR_ID_UNKNOWN if clientId is not associated with a batching session.
@param[in] clientId Client identifier for the location client.
@param[in] sessionId ID of the session for which the number of locations is requested.
@param[in] count Number of requested locations. The client can set this to
MAXINT to get all the batched locations. If set to 0 no location
will be present in the callback function.
@return
QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
been initialized.
*/
qapi_Location_Error_t qapi_Loc_Get_Batched_Locations(
qapi_loc_client_id clientId,
uint32_t sessionId,
size_t count);
/**
* @brief Adds a specified number of Geofences and returns an
array of Geofence IDs that will be used by the other Geofence APIs,
as well as in the collective response callback to match the command with
a response. The Geofence breach callback delivers the status of each
Geofence according to the Geofence options for each.
collectiveResponseCb returns:
QAPI_LOCATION_ERROR_SUCCESS if session was successful
QAPI_LOCATION_ERROR_CALLBACK_MISSING if no geofenceBreachCb
QAPI_LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
QAPI_LOCATION_ERROR_NOT_SUPPORTED if geofence is not supported
@param[in] clientId Client identifier for the location client.
@param[in] count Number of Geofences to be added.
@param[in] pOptions Array of structures containing the options:
- breachTypeMask -- Bitwise OR of GeofenceBreachTypeMask bits
- responsiveness in milliseconds
- dwellTime in seconds @vertspace{-14}
@param[in] pInfo Array of structures containing the data:
- Latitude of the center of the Geofence in degrees
- Longitude of the center of the Geofence in degrees
- Radius of the Geofence in meters @vertspace{-14}
@param[out] pIdArray Array of IDs of Geofences to be returned.
@return
QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
been initialized.
*/
qapi_Location_Error_t qapi_Loc_Add_Geofences(
qapi_loc_client_id clientId,
size_t count,
const qapi_Geofence_Option_t* pOptions,
const qapi_Geofence_Info_t* pInfo,
uint32_t** pIdArray);
/**
* @brief Removes a specified number of Geofences.
collectiveResponseCb returns:
QAPI_LOCATION_ERROR_SUCCESS if session was successful
QAPI_LOCATION_ERROR_ID_UNKNOWN if clientId is not associated with a geofence session.
@param[in] clientId Client identifier for the location client.
@param[in] count Number of Geofences to be removed.
@param[in] pIDs Array of IDs of the Geofences to be removed.
@return
QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
been initialized.
*/
qapi_Location_Error_t qapi_Loc_Remove_Geofences(
qapi_loc_client_id clientId,
size_t count,
const uint32_t* pIDs);
/**
* @brief Modifies a specified number of Geofences.
collectiveResponseCb returns:
QAPI_LOCATION_ERROR_SUCCESS if session was successful
QAPI_LOCATION_ERROR_ID_UNKNOWN if clientId is not associated with a geofence session.
QAPI_LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
@param[in] clientId Client identifier for the location client.
@param[in] count Number of Geofences to be modified.
@param[in] pIDs Array of IDs of the Geofences to be modified.
@param[in] options Array of structures containing the options:
- breachTypeMask -- Bitwise OR of GeofenceBreachTypeMask bits
- responsiveness in milliseconds
- dwellTime in seconds @tablebulletend
@return
QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
been initialized.
*/
qapi_Location_Error_t qapi_Loc_Modify_Geofences(
qapi_loc_client_id clientId,
size_t count,
const uint32_t* pIDs,
const qapi_Geofence_Option_t* options);
/**
* @brief Pauses a specified number of Geofences, which is
similar to qapi_Loc_Remove_Geofences() except that they can be resumed
at any time.
collectiveResponseCb returns:
QAPI_LOCATION_ERROR_SUCCESS if session was successful
QAPI_LOCATION_ERROR_ID_UNKNOWN if clientId is not associated with a geofence session.
@param[in] clientId Client identifier for the location client.
@param[in] count Number of Geofences to be paused.
@param[in] pIDs Array of IDs of the Geofences to be paused.
@return
QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
been initialized.
*/
qapi_Location_Error_t qapi_Loc_Pause_Geofences(
qapi_loc_client_id clientId,
size_t count,
const uint32_t* pIDs);
/**
* @brief Resumes a specified number of Geofences that are
paused.
collectiveResponseCb returns:
QAPI_LOCATION_ERROR_SUCCESS if session was successful
QAPI_LOCATION_ERROR_ID_UNKNOWN if clientId is not associated with a geofence session.
@param[in] clientId Client identifier for the location client.
@param[in] count Number of Geofences to be resumed.
@param[in] pIDs Array of IDs of the Geofences to be resumed.
@return
QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
been initialized.
*/
qapi_Location_Error_t qapi_Loc_Resume_Geofences(
qapi_loc_client_id clientId,
size_t count,
const uint32_t* pIDs);
/**
* @brief Attempts a single location fix. It returns a session ID that
will be used by qapi_Loc_Cancel_Single_Shot API and in
the response callback to match the command with a response.
responseCb returns:
QAPI_LOCATION_ERROR_SUCCESS if session was successfully started.
QAPI_LOCATION_ERROR_CALLBACK_MISSING if no singleShotCb passed in qapi_Loc_Init().
QAPI_LOCATION_ERROR_INVALID_PARAMETER if anyparameter is invalid.
If responseCb reports LOCATION_ERROR_SUCESS, then the following is what
can happen to end the single shot session:
1) A location will be reported on the singleShotCb.
2) QAPI_LOCATION_ERROR_TIMEOUT will be reported on the singleShotCb.
3) The single shot session is canceled using the qapi_Loc_Cancel_Single_Shot API
In either of these cases, the session is considered complete and the session id will
no longer be valid.
@param[in] clientId Client identifier for the location client.
@param[in] powerLevel Indicates what available technologies to use to compute the location.
@param[out] pSessionId Pointer to the session ID to be returned.
@return
QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
been initialized.
*/
qapi_Location_Error_t qapi_Loc_Get_Single_Shot(
qapi_loc_client_id clientId,
qapi_Location_Power_Level_t powerLevel,
uint32_t* pSessionId);
/**
* @brief Cancels a single shot session.
responseCb returns:
QAPI_LOCATION_ERROR_SUCCESS if successful.
QAPI_LOCATION_ERROR_ID_UNKNOWN if clientId is not associated with a single shot session.
@param[in] clientId Client identifier for the location client.
@param[in] sessionId ID of the single shot session to be cancelled.
@return
QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
been initialized.
*/
qapi_Location_Error_t qapi_Loc_Cancel_Single_Shot(
qapi_loc_client_id clientId,
uint32_t sessionId);
/**
* @brief Starts a Get GNSS data session, which returns a
session ID that will be used by the qapi_Loc_Stop_Get_Gnss_Data() API and in
the response callback to match the command with a response. GNSS data is
reported on the GNSS data callback passed in qapi_Loc_Init() periodically
(every second until qapi_Loc_Stop_Get_Gnss_Data() is called).
responseCb returns: \n
QAPI_LOCATION_ERROR_SUCCESS if session was successfully started. \n
QAPI_LOCATION_ERROR_ALREADY_STARTED if a qapi_Loc_Start_Get_Gnss_Data() session is already in progress. \n
QAPI_LOCATION_ERROR_CALLBACK_MISSING if no gnssDataCb was passed in qapi_Loc_Init().
@param[in] clientId Client identifier for the location client.
@param[out] pSessionId Pointer to the session ID to be returned.
@return
QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
been initialized.
*/
qapi_Location_Error_t qapi_Loc_Start_Get_Gnss_Data(
qapi_loc_client_id clientId,
uint32_t* pSessionId);
/**
* @brief Stops a Get GNSS data session associated with the ID
parameter.
responseCb returns: \n
QAPI_LOCATION_ERROR_SUCCESS if successful. \n
QAPI_LOCATION_ERROR_ID_UNKNOWN if clientId is not associated with a Get GNSS data session.
@param[in] clientId Client identifier for the location client.
@param[in] sessionId ID of the session to be stopped.
@return
QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
been initialized.
*/
qapi_Location_Error_t qapi_Loc_Stop_Get_Gnss_Data(
qapi_loc_client_id clientId,
uint32_t sessionId);
/**
* @versiontable{2.0,2.45,
* Location 1.2.0 & Introduced. @tblendline
* }
*
* Fetches the best available position with the GNSS Engine.
It returns a session ID that will be sent in response callback
to match the command with a response.
responseCb returns:
QAPI_LOCATION_ERROR_CALLBACK_MISSING if no singleShotCb passed in qapi_Loc_Init().
QAPI_LOCATION_ERROR_INVALID_PARAMETER if any parameter is invalid.
QAPI_LOCATION_ERROR_SUCCESS if request was successfully placed to GNSS Engine.
If responseCb reports LOCATION_ERROR_SUCESS, then the following is what
can happen:
1) A location will be reported on the singleShotCb.
The location object would have QAPI_LOCATION_IS_BEST_AVAIL_POS_BIT
set in the flags field to indicate that this position is the best
available position and not a response to the singleshot request.
This location can have a large accuracy value, which must be
checked by the client if it suffices it's purpose.
@param[in] clientId Client identifier for the location client.
@param[out] pSessionId Pointer to the session ID to be returned.
@return
QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
QAPI_LOCATION_ERROR_ID_UNKNOWN -- Invalid client id provided. \n
QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No user space buffer is set. \n
QAPI_LOCATION_ERROR_CALLBACK_MISSING -- Singleshot callback is not set. \n
QAPI_LOCATION_ERROR_GENERAL_FAILURE -- Internal failure while processing
the request.
*/
qapi_Location_Error_t qapi_Loc_Get_Best_Available_Position(
qapi_loc_client_id clientId,
uint32_t* pSessionId);
/** @} */ /* end_addtogroup qapi_location */
#ifdef __cplusplus
}
#endif
#endif /* _QAPI_LOCATION_H_ */

View file

@ -1,10 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: location-qapi
Description: location qapi library
Version: @VERSION@
Libs: -L${libdir} -llocation_qapi
Cflags: -I${includedir} -I${includedir}/location-qapi

View file

@ -1,792 +0,0 @@
/* Copyright (c) 2019-2020 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.
*/
#define LOG_TAG "LocSvc_LocationQapi"
#include <loc_pla.h>
#include "log_util.h"
#include "loc_cfg.h"
#include "LocationClientApi.h"
#include "qapi_location.h"
#include <pthread.h>
#include <vector>
#include <string.h>
#include <LocTimer.h>
using namespace std;
using namespace loc_util;
using namespace location_client;
using Runnable = std::function<void()>;
class QapiTimer : public LocTimer {
public:
QapiTimer() : LocTimer(), mStarted(false) {}
inline ~QapiTimer() { stop(); }
inline void set(const time_t waitTimeMs, const Runnable& runable) {
mWaitTimeInMs = waitTimeMs;
mRunnable = runable;
}
inline void start() {
mStarted = true;
LocTimer::start(mWaitTimeInMs, false);
}
inline void start(const time_t waitTimeSec) {
mWaitTimeInMs = waitTimeSec * 1000;
start();
}
inline void stop() {
if (mStarted) {
LocTimer::stop();
mStarted = false;
}
}
inline void restart() { stop(); start(); }
inline void restart(const time_t waitTimeSec) { stop(); start(waitTimeSec); }
inline bool isStarted() { return mStarted; }
private:
// Override
inline virtual void timeOutCallback() override {
mStarted = false;
mRunnable();
}
private:
time_t mWaitTimeInMs;
Runnable mRunnable;
bool mStarted;
};
static pthread_mutex_t qMutex;
static bool qMutexInitDone = false;
static LocationClientApi* pLocClientApi = nullptr;
static LocationClientApi* pLocPassiveClientApi = nullptr;
static QapiTimer mTimer;
qapi_Location_Callbacks_t qLocationCallbacks;
static qapi_Location_t qCacheLocation;
static QapiTimer mPassiveTimer;
static qapi_Location_Error_t get_qapi_error(LocationResponse err)
{
switch (err)
{
case LOCATION_RESPONSE_SUCCESS: return QAPI_LOCATION_ERROR_SUCCESS;
case LOCATION_RESPONSE_UNKOWN_FAILURE: return QAPI_LOCATION_ERROR_GENERAL_FAILURE;
case LOCATION_RESPONSE_NOT_SUPPORTED: return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
default: return QAPI_LOCATION_ERROR_GENERAL_FAILURE;
}
}
static int32_t copy_to_user_space_buffer(
uint8_t* user_space_buffer,
uint32_t user_space_buffer_size,
uint8_t* data_ptr,
uint32_t data_size,
uint32_t offset) {
if (offset >= user_space_buffer_size) {
LOC_LOGe("Invalid offset %d, buffer size %d",
offset, user_space_buffer_size);
return -1;
}
memcpy((user_space_buffer + offset), data_ptr, data_size);
return 0;
}
static void print_qLocation_array(qapi_Location_t* qLocationArray, uint32_t length) {
for (uint32_t i = 0; i < length; i++) {
LOC_LOGv("LAT: %d.%d LON: %d.%d ALT: %d.%d ALT_MSL: %d.%d",
(int)qLocationArray[i].latitude,
(abs((int)(qLocationArray[i].latitude * 100000))) % 100000,
(int)qLocationArray[i].longitude,
(abs((int)(qLocationArray[i].longitude * 100000))) % 100000,
(int)qLocationArray[i].altitude,
(abs((int)(qLocationArray[i].altitude * 100))) % 100,
(int)qLocationArray[i].altitudeMeanSeaLevel,
(abs((int)(qLocationArray[i].altitudeMeanSeaLevel * 100))) % 100);
LOC_LOGv("SPEED: %d.%d BEAR: %d.%d TIME: 0x%x%x FLAGS: %u",
(int)qLocationArray[i].speed,
(abs((int)(qLocationArray[i].speed * 100))) % 100,
(int)qLocationArray[i].bearing,
(abs((int)(qLocationArray[i].bearing * 100))) % 100,
(int)(qLocationArray[i].timestamp >> 32),
(int)qLocationArray[i].timestamp, qLocationArray[i].flags);
LOC_LOGv("ACC: %d.%d VERT_ACC: %d.%d SPEED_ACC: %d.%d BEAR_ACC: %d.%d",
(int)qLocationArray[i].accuracy,
(abs((int)(qLocationArray[i].accuracy * 100))) % 100,
(int)qLocationArray[i].verticalAccuracy,
(abs((int)(qLocationArray[i].verticalAccuracy * 100))) % 100,
(int)qLocationArray[i].speedAccuracy,
(abs((int)(qLocationArray[i].speedAccuracy * 100))) % 100,
(int)qLocationArray[i].bearingAccuracy,
(abs((int)(qLocationArray[i].bearingAccuracy * 100))) % 100);
}
}
static void print_qGnssData(qapi_Gnss_Data_t* qGnssData) {
LOC_LOGv("JAMMER_GPS: %u JAMMER_GLONASS: %u",
qGnssData->jammerInd[QAPI_GNSS_SV_TYPE_GPS],
qGnssData->jammerInd[QAPI_GNSS_SV_TYPE_GLONASS]);
LOC_LOGv("JAMMER_BEIDOU: %u JAMMER_GALILEO: %u",
qGnssData->jammerInd[QAPI_GNSS_SV_TYPE_BEIDOU],
qGnssData->jammerInd[QAPI_GNSS_SV_TYPE_GALILEO]);
}
static void location_capabilities_callback(
LocationCapabilitiesMask capsMask)
{
LOC_LOGv("location_capabilities_callback!");
qLocationCallbacks.capabilitiesCb(
(qapi_Location_Capabilities_Mask_t)capsMask);
}
static void location_response_callback(
LocationResponse err)
{
qapi_Location_Error_t qErr;
qErr = get_qapi_error(err);
LOC_LOGv("location_response_callback!");
// hard-code id to 0 for now
uint32_t id = 0;
qLocationCallbacks.responseCb(qErr, id);
}
static void location_collective_response_callback(
vector<std::pair<Geofence, LocationResponse>>& responses)
{
qapi_Location_Error_t* qLocationErrorArray = NULL;
// hard-coded
qLocationErrorArray = new qapi_Location_Error_t[5];
uint32_t* ids = new uint32_t[5];
for (int i = 0; i < 5; i++) {
qLocationErrorArray[i] = QAPI_LOCATION_ERROR_SUCCESS;
}
LOC_LOGd("Invoking Collective Response Cb");
qLocationCallbacks.collectiveResponseCb(
5, qLocationErrorArray, ids);
delete[] qLocationErrorArray;
delete[] ids;
}
static void location_tracking_callback(
Location location)
{
qapi_Location_t qLocation = {};
bool bIsSingleShot = false;
// first check if location is valid
if (0 == location.flags) {
LOC_LOGd("Ignore invalid location");
return;
}
if (mTimer.isStarted()) {
LOC_LOGd("Timer was started, meaning this is singleshot");
if (nullptr != pLocClientApi) {
LOC_LOGd("Stop singleshot session");
pLocClientApi->stopPositionSession();
}
LOC_LOGd("Stop singleshot timer");
mTimer.stop();
bIsSingleShot = true;
}
qLocation.size = sizeof(qapi_Location_t);
qLocation.timestamp = location.timestamp;
qLocation.latitude = location.latitude;
qLocation.longitude = location.longitude;
qLocation.altitude = location.altitude;
// TODO
// qLocation.altitudeMeanSeaLevel = location.altitudeMeanSeaLevel;
qLocation.speed = location.speed;
qLocation.bearing = location.bearing;
qLocation.accuracy = location.horizontalAccuracy;
qLocation.flags = location.flags;
qLocation.flags &= ~QAPI_LOCATION_HAS_ALTITUDE_MSL_BIT;
qLocation.verticalAccuracy = location.verticalAccuracy;
qLocation.speedAccuracy = location.speedAccuracy;
qLocation.bearingAccuracy = location.bearingAccuracy;
print_qLocation_array(&qLocation, 1);
if (bIsSingleShot) {
LOC_LOGd("Invoking Singleshot Callback");
if (qLocationCallbacks.singleShotCb) {
qLocationCallbacks.singleShotCb(qLocation, QAPI_LOCATION_ERROR_SUCCESS);
} else {
LOC_LOGe("No singleshot cb registered");
}
} else {
LOC_LOGd("Invoking Tracking Callback");
if (qLocationCallbacks.trackingCb) {
qLocationCallbacks.trackingCb(qLocation);
}
else {
LOC_LOGe("No tracking cb registered");
}
}
}
static void gnss_location_tracking_callback(
GnssLocation gnsslocation)
{
qapi_Location_t qLocation = {};
bool bIsSingleShot = false;
// first check if location is valid
if (0 == gnsslocation.flags) {
LOC_LOGd("Ignore invalid location");
return;
}
if (mTimer.isStarted()) {
LOC_LOGd("Timer was started, meaning this is singleshot");
if (nullptr != pLocClientApi) {
LOC_LOGd("Stop singleshot session");
pLocClientApi->stopPositionSession();
}
LOC_LOGd("Stop singleshot timer");
mTimer.stop();
bIsSingleShot = true;
}
qLocation.size = sizeof(qapi_Location_t);
qLocation.timestamp = gnsslocation.timestamp;
qLocation.latitude = gnsslocation.latitude;
qLocation.longitude = gnsslocation.longitude;
qLocation.altitude = gnsslocation.altitude;
qLocation.altitudeMeanSeaLevel = gnsslocation.altitudeMeanSeaLevel;
qLocation.speed = gnsslocation.speed;
qLocation.bearing = gnsslocation.bearing;
qLocation.accuracy = gnsslocation.horizontalAccuracy;
qLocation.flags = gnsslocation.flags;
if (gnsslocation.gnssInfoFlags & GNSS_LOCATION_INFO_ALTITUDE_MEAN_SEA_LEVEL_BIT) {
qLocation.flags |= QAPI_LOCATION_HAS_ALTITUDE_MSL_BIT;
}
qLocation.verticalAccuracy = gnsslocation.verticalAccuracy;
qLocation.speedAccuracy = gnsslocation.speedAccuracy;
qLocation.bearingAccuracy = gnsslocation.bearingAccuracy;
print_qLocation_array(&qLocation, 1);
if (bIsSingleShot) {
LOC_LOGd("Invoking Singleshot Callback");
if (qLocationCallbacks.singleShotCb) {
qLocationCallbacks.singleShotCb(qLocation, QAPI_LOCATION_ERROR_SUCCESS);
} else {
LOC_LOGe("No singleshot cb registered");
}
} else {
LOC_LOGd("Invoking Tracking Callback");
if (qLocationCallbacks.trackingCb) {
qLocationCallbacks.trackingCb(qLocation);
}
else {
LOC_LOGe("No tracking cb registered");
}
}
}
static void loc_passive_capabilities_callback(
LocationCapabilitiesMask capsMask)
{
LOC_LOGv("loc_passive_capabilities_callback!");
}
static void loc_passive_tracking_callback(
GnssLocation gnsslocation)
{
qCacheLocation.size = sizeof(qapi_Location_t);
qCacheLocation.timestamp = gnsslocation.timestamp;
qCacheLocation.latitude = gnsslocation.latitude;
qCacheLocation.longitude = gnsslocation.longitude;
qCacheLocation.altitude = gnsslocation.altitude;
qCacheLocation.altitudeMeanSeaLevel = gnsslocation.altitudeMeanSeaLevel;
qCacheLocation.speed = gnsslocation.speed;
qCacheLocation.bearing = gnsslocation.bearing;
qCacheLocation.accuracy = gnsslocation.horizontalAccuracy;
qCacheLocation.flags = gnsslocation.flags;
if (gnsslocation.gnssInfoFlags & GNSS_LOCATION_INFO_ALTITUDE_MEAN_SEA_LEVEL_BIT) {
qCacheLocation.flags |= QAPI_LOCATION_HAS_ALTITUDE_MSL_BIT;
}
qCacheLocation.flags |= QAPI_LOCATION_IS_BEST_AVAIL_POS_BIT;
qCacheLocation.verticalAccuracy = gnsslocation.verticalAccuracy;
qCacheLocation.speedAccuracy = gnsslocation.speedAccuracy;
qCacheLocation.bearingAccuracy = gnsslocation.bearingAccuracy;
print_qLocation_array(&qCacheLocation, 1);
}
static void loc_passive_response_callback(
LocationResponse err)
{
LOC_LOGv("loc_passive_response_callback!");
}
struct MyClientCallbacks {
CapabilitiesCb capabilitycb;
ResponseCb responsecb;
CollectiveResponseCb collectivecb;
LocationCb locationcb;
};
static MyClientCallbacks gLocationCallbacks = {
location_capabilities_callback,
location_response_callback,
location_collective_response_callback,
location_tracking_callback,
};
#define LOC_PATH_QAPI_CONF_STR "/etc/qapi.conf"
const char LOC_PATH_QAPI_CONF[] = LOC_PATH_QAPI_CONF_STR;
static uint32_t gDebug = 0;
static uint32_t gSingleshotTimeout = 0;
static const loc_param_s_type gConfigTable[] =
{
{ "DEBUG_LEVEL", &gDebug, NULL, 'n' }
};
static const loc_param_s_type gQapiConfigTable[] =
{
{ "SINGLESHOT_TIMEOUT", &gSingleshotTimeout, NULL, 'n' }
};
/* Parameters we need in a configuration file specifically for QAPI:
SINGLESHOT_TIMEOUT
*/
extern "C" {
qapi_Location_Error_t qapi_Loc_Init(
qapi_loc_client_id* pClientId,
const qapi_Location_Callbacks_t* pCallbacks)
{
qapi_Location_Error_t retVal =
QAPI_LOCATION_ERROR_SUCCESS;
// read configuration file
UTIL_READ_CONF(LOC_PATH_GPS_CONF, gConfigTable);
LOC_LOGd("gDebug=%u LOC_PATH_GPS_CONF=%s", gDebug, LOC_PATH_GPS_CONF);
UTIL_READ_CONF(LOC_PATH_QAPI_CONF, gQapiConfigTable);
LOC_LOGd("gSingleshotTimeout=%u LOC_PATH_QAPI_CONF=%s", gSingleshotTimeout, LOC_PATH_QAPI_CONF);
MyClientCallbacks locationCallbacks = gLocationCallbacks;
LOC_LOGd("qapi_Loc_Init! pCallbacks %p"
"cap %p res %p col %p trk %p",
pCallbacks,
pCallbacks->capabilitiesCb,
pCallbacks->responseCb,
pCallbacks->collectiveResponseCb,
pCallbacks->trackingCb);
LOC_LOGd("qapi_Loc_Init! pCallbacks %p"
"bat %p gf %p ss %p gd %p",
pCallbacks,
pCallbacks->batchingCb,
pCallbacks->geofenceBreachCb,
pCallbacks->singleShotCb,
pCallbacks->gnssDataCb);
if (!qMutexInitDone)
{
pthread_mutex_init(&qMutex, NULL);
qMutexInitDone = true;
}
/* Input sanity */
if (NULL == pCallbacks->capabilitiesCb ||
NULL == pCallbacks->responseCb ||
NULL == pCallbacks->collectiveResponseCb)
{
return QAPI_LOCATION_ERROR_CALLBACK_MISSING;
}
/* Don't register callbacks not provided by client */
if (NULL == pCallbacks->trackingCb) {
locationCallbacks.locationcb = NULL;
}
pthread_mutex_lock(&qMutex);
do
{
qLocationCallbacks = *pCallbacks;
if (nullptr == pLocClientApi) {
pLocClientApi = new LocationClientApi(
location_capabilities_callback);
retVal = QAPI_LOCATION_ERROR_SUCCESS;
} else {
retVal = QAPI_LOCATION_ERROR_ALREADY_STARTED;
}
/* Start passive listener here in order to be able to satisfy
qapi_Loc_Get_Best_Available_Position call */
if (nullptr == pLocPassiveClientApi) {
pLocPassiveClientApi = new LocationClientApi(
loc_passive_capabilities_callback);
retVal = QAPI_LOCATION_ERROR_SUCCESS;
bool ret;
memset(&qCacheLocation, 0, sizeof(qCacheLocation));
qCacheLocation.flags |= QAPI_LOCATION_IS_BEST_AVAIL_POS_BIT;
GnssReportCbs gnnsReportCbs;
memset(&gnnsReportCbs, 0, sizeof(gnnsReportCbs));
gnnsReportCbs.gnssLocationCallback = loc_passive_tracking_callback;
ret = pLocPassiveClientApi->startPositionSession(
0, // both 0 means passive listener
gnnsReportCbs,
loc_passive_response_callback);
if (!ret) {
retVal = QAPI_LOCATION_ERROR_GENERAL_FAILURE;
}
} else {
retVal = QAPI_LOCATION_ERROR_ALREADY_STARTED;
}
*pClientId = 0;
} while (0);
pthread_mutex_unlock(&qMutex);
return retVal;
}
qapi_Location_Error_t qapi_Loc_Deinit(
qapi_loc_client_id clientId)
{
qapi_Location_Error_t retVal =
QAPI_LOCATION_ERROR_ID_UNKNOWN;
LOC_LOGd("gDebug=%u LOC_PATH_GPS_CONF=%s", gDebug, LOC_PATH_GPS_CONF);
LOC_LOGd("qapi_Loc_Deinit client %d", clientId);
pthread_mutex_lock(&qMutex);
if (nullptr != pLocClientApi) {
delete pLocClientApi;
pLocClientApi = nullptr;
retVal = QAPI_LOCATION_ERROR_SUCCESS;
}
pthread_mutex_unlock(&qMutex);
return retVal;
}
qapi_Location_Error_t qapi_Loc_Set_User_Buffer(
qapi_loc_client_id clientId,
uint8_t* pUserBuffer,
size_t bufferSize)
{
return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
}
qapi_Location_Error_t qapi_Loc_Start_Tracking(
qapi_loc_client_id clientId,
const qapi_Location_Options_t* pOptions,
uint32_t* pSessionId)
{
qapi_Location_Error_t retVal =
QAPI_LOCATION_ERROR_SUCCESS;
LOC_LOGd("qapi_Loc_Start_Tracking! pOptions=%p pSessionId=%p clientId=%d",
pOptions, pSessionId, clientId);
pthread_mutex_lock(&qMutex);
do {
if (NULL == pOptions)
{
LOC_LOGe("pOptions NULL");
retVal = QAPI_LOCATION_ERROR_INVALID_PARAMETER;
break;
}
LOC_LOGd("qapi_Loc_Start_Tracking! minInterval=%d minDistance=%d",
pOptions->minInterval,
pOptions->minDistance);
if (nullptr != pLocClientApi) {
bool ret;
ret = pLocClientApi->startPositionSession(
pOptions->minInterval,
pOptions->minDistance,
location_tracking_callback,
location_response_callback);
if (!ret) {
retVal = QAPI_LOCATION_ERROR_GENERAL_FAILURE;
}
} else {
retVal = QAPI_LOCATION_ERROR_GENERAL_FAILURE;
}
} while (0);
*pSessionId = 1;
pthread_mutex_unlock(&qMutex);
return retVal;
}
qapi_Location_Error_t qapi_Loc_Stop_Tracking(
qapi_loc_client_id clientId,
uint32_t sessionId)
{
qapi_Location_Error_t retVal =
QAPI_LOCATION_ERROR_SUCCESS;
LOC_LOGv("qapi_Loc_Stop_Tracking! clientId %d, sessionId %d",
clientId, sessionId);
pthread_mutex_lock(&qMutex);
if (nullptr != pLocClientApi) {
pLocClientApi->stopPositionSession();
} else {
retVal = QAPI_LOCATION_ERROR_GENERAL_FAILURE;
}
pthread_mutex_unlock(&qMutex);
return retVal;
}
qapi_Location_Error_t qapi_Loc_Update_Tracking_Options(
qapi_loc_client_id clientId,
uint32_t sessionId,
const qapi_Location_Options_t* pOptions)
{
return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
}
qapi_Location_Error_t qapi_Loc_Start_Batching(
qapi_loc_client_id clientId,
const qapi_Location_Options_t* pOptions,
uint32_t* pSessionId)
{
return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
}
qapi_Location_Error_t qapi_Loc_Stop_Batching(
qapi_loc_client_id clientId,
uint32_t sessionId)
{
return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
}
qapi_Location_Error_t qapi_Loc_Update_Batching_Options(
qapi_loc_client_id clientId,
uint32_t sessionId,
const qapi_Location_Options_t* pOptions)
{
return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
}
qapi_Location_Error_t qapi_Loc_Get_Batched_Locations(
qapi_loc_client_id clientId,
uint32_t sessionId,
size_t count)
{
return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
}
qapi_Location_Error_t qapi_Loc_Add_Geofences(
qapi_loc_client_id clientId,
size_t count,
const qapi_Geofence_Option_t* pOptions,
const qapi_Geofence_Info_t* pInfo,
uint32_t** pIdArray)
{
return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
}
qapi_Location_Error_t qapi_Loc_Remove_Geofences(
qapi_loc_client_id clientId,
size_t count,
const uint32_t* pIDs)
{
return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
}
qapi_Location_Error_t qapi_Loc_Modify_Geofences(
qapi_loc_client_id clientId,
size_t count,
const uint32_t* pIDs,
const qapi_Geofence_Option_t* options)
{
return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
}
qapi_Location_Error_t qapi_Loc_Pause_Geofences(
qapi_loc_client_id clientId,
size_t count,
const uint32_t* pIDs)
{
return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
}
qapi_Location_Error_t qapi_Loc_Resume_Geofences(
qapi_loc_client_id clientId,
size_t count,
const uint32_t* pIDs)
{
return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
}
qapi_Location_Error_t qapi_Loc_Get_Single_Shot(
qapi_loc_client_id clientId,
qapi_Location_Power_Level_t powerLevel,
uint32_t* pSessionId)
{
qapi_Location_Error_t retVal =
QAPI_LOCATION_ERROR_SUCCESS;
bool bFound = false;
qapi_Location_Options_t options;
LOC_LOGd("qapi_Loc_Get_Single_Shot! pSessionId=%p clientId=%d",
pSessionId, clientId);
pthread_mutex_lock(&qMutex);
do {
if (QAPI_LOCATION_POWER_HIGH != powerLevel &&
QAPI_LOCATION_POWER_LOW != powerLevel)
{
LOC_LOGe("powerLevel is invalid");
retVal = QAPI_LOCATION_ERROR_INVALID_PARAMETER;
break;
}
LOC_LOGd("qapi_Loc_Get_Single_Shot! powerLevel=%d",
powerLevel);
GnssReportCbs gnnsReportCbs;
memset(&gnnsReportCbs, 0, sizeof(gnnsReportCbs));
gnnsReportCbs.gnssLocationCallback = gnss_location_tracking_callback;
if (nullptr != pLocClientApi) {
bool ret;
ret = pLocClientApi->startPositionSession(
1000,
gnnsReportCbs,
location_response_callback);
if (!ret) {
retVal = QAPI_LOCATION_ERROR_GENERAL_FAILURE;
} else {
Runnable timerRunnable = [pLocClientApi] {
pLocClientApi->stopPositionSession();
if (qLocationCallbacks.singleShotCb) {
qapi_Location_t qLocation;
qLocationCallbacks.singleShotCb(qLocation, QAPI_LOCATION_ERROR_TIMEOUT);
} else {
LOC_LOGe("No singleshot cb registered");
}
};
mTimer.set(gSingleshotTimeout, timerRunnable);
mTimer.start();
}
} else {
retVal = QAPI_LOCATION_ERROR_GENERAL_FAILURE;
}
} while (0);
*pSessionId = 1;
pthread_mutex_unlock(&qMutex);
return retVal;
}
qapi_Location_Error_t qapi_Loc_Cancel_Single_Shot(
qapi_loc_client_id clientId,
uint32_t sessionId)
{
qapi_Location_Error_t retVal =
QAPI_LOCATION_ERROR_SUCCESS;
LOC_LOGv("qapi_Loc_Cancel_Single_Shot! clientId %d, sessionId %d",
clientId, sessionId);
pthread_mutex_lock(&qMutex);
if (mTimer.isStarted()) {
LOC_LOGd("Timer was started, singleshot session in progress");
if (nullptr != pLocClientApi) {
LOC_LOGd("Stop singleshot session");
pLocClientApi->stopPositionSession();
}
LOC_LOGd("Stop singleshot timer");
mTimer.stop();
} else {
LOC_LOGd("No singleshot session in progress!");
}
pthread_mutex_unlock(&qMutex);
return retVal;
}
qapi_Location_Error_t qapi_Loc_Start_Get_Gnss_Data(
qapi_loc_client_id clientId,
uint32_t* pSessionId)
{
return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
}
qapi_Location_Error_t qapi_Loc_Stop_Get_Gnss_Data(
qapi_loc_client_id clientId,
uint32_t sessionId)
{
return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
}
qapi_Location_Error_t qapi_Loc_Get_Best_Available_Position(
qapi_loc_client_id clientId,
uint32_t* pSessionId)
{
qapi_Location_Error_t retVal = QAPI_LOCATION_ERROR_SUCCESS;
LOC_LOGv("qapi_Loc_Get_Best_Available_Position! clientId %d", clientId);
pthread_mutex_lock(&qMutex);
do {
if (nullptr != pLocClientApi) {
Runnable timerRunnable = [] {
if (qLocationCallbacks.singleShotCb) {
qLocationCallbacks.singleShotCb(qCacheLocation, QAPI_LOCATION_ERROR_SUCCESS);
} else {
LOC_LOGe("No singleshot cb registered");
}
};
mPassiveTimer.set(500, timerRunnable);
mPassiveTimer.start();
} else {
retVal = QAPI_LOCATION_ERROR_GENERAL_FAILURE;
}
} while (0);
pthread_mutex_unlock(&qMutex);
return retVal;
}
} /* extern "C" */

View file

@ -1,7 +0,0 @@
cc_library_headers {
name: "libsynergyloc_api_headers",
export_include_dirs: ["."],
vendor: true,
}

View file

@ -1,40 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libsynergy_loc_api
# activate the following line for debug purposes only, comment out for production
#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
LOCAL_MODULE_TAGS := optional
LOCAL_VENDOR_MODULE := true
LOCAL_SHARED_LIBRARIES := \
libutils \
libcutils \
libqmi_cci \
libqmi_common_so \
libloc_core \
libgps.utils \
libdl \
liblog
LOCAL_SRC_FILES = \
SynergyLocApi.cpp
LOCAL_CFLAGS += \
-fno-short-enums \
-D_ANDROID_
## Includes
LOCAL_HEADER_LIBRARIES := \
libloc_core_headers \
libgps.utils_headers \
libloc_pla_headers \
loc_sll_if_headers \
liblocation_api_headers
LOCAL_CFLAGS += $(GNSS_CFLAGS)
include $(BUILD_SHARED_LIBRARY)

File diff suppressed because it is too large Load diff

View file

@ -1,189 +0,0 @@
/* Copyright (c) 2019-2020, 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.
*/
#ifndef SYNERGY_LOC_API_H
#define SYNERGY_LOC_API_H
#include <stdint.h>
#include <stdbool.h>
#include <LocApiBase.h>
#include <loc_sll_interface.h>
#include <vector>
#include <functional>
#define LOC_CLIENT_INVALID_HANDLE_VALUE (NULL)
using Resender = std::function<void()>;
using namespace std;
using namespace loc_core;
/* This class derives from the LocApiBase class.
The members of this class are responsible for converting
the Synergy Location API data structures into Loc Adapter data structures.
This class also implements some of the virtual functions that
handle the requests from loc engine. */
class SynergyLocApi : public LocApiBase {
protected:
private:
bool mInSession;
GnssPowerMode mPowerMode;
bool mEngineOn;
bool mMeasurementsStarted;
std::vector<Resender> mResenders;
bool mIsMasterRegistered;
bool mMasterRegisterNotSupported;
GnssSvMeasurementSet* mSvMeasurementSet;
LOC_API_ADAPTER_EVENT_MASK_T mSlMask;
const SllInterfaceReq *sllReqIf;
void registerEventMask(LOC_API_ADAPTER_EVENT_MASK_T adapterMask);
protected:
virtual enum loc_api_adapter_err
open(LOC_API_ADAPTER_EVENT_MASK_T mask);
virtual enum loc_api_adapter_err
close();
SynergyLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask,
ContextBase *context = NULL);
virtual ~SynergyLocApi();
public:
static LocApiBase* createSynergyLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask,
ContextBase* context);
virtual void startFix(const LocPosMode& posMode,
LocApiResponse *adapterResponse);
virtual void stopFix(LocApiResponse *adapterResponse);
virtual void setPositionMode(const LocPosMode& mode);
virtual void
setTime(LocGpsUtcTime time, int64_t timeReference, int uncertainty);
virtual int getNumSvUsed (uint64_t svUsedIdsMask, int totalSvCntInOneConstellation);
virtual void
injectPosition(const Location& location, bool onDemandCpi);
virtual void
injectPosition(const GnssLocationInfoNotification &locationInfo, bool onDemandCpi);
virtual void
deleteAidingData(const GnssAidingData& data, LocApiResponse *adapterResponse);
virtual void
informNiResponse(GnssNiResponse userResponse, const void* passThroughData);
virtual LocationError
setServerSync(const char* url, int len, LocServerType type);
virtual LocationError
setServerSync(unsigned int ip, int port, LocServerType type);
virtual void
atlOpenStatus(int handle, int is_succ, char* apn, uint32_t apnLen, AGpsBearerType bear,
LocAGpsType agpsType, LocApnTypeMask mask);
virtual void atlCloseStatus(int handle, int is_succ);
virtual LocationError setSUPLVersionSync(GnssConfigSuplVersion version);
virtual enum loc_api_adapter_err setNMEATypesSync(uint32_t typesMask);
virtual LocationError setLPPConfigSync(GnssConfigLppProfileMask profileMask);
virtual enum loc_api_adapter_err
setSensorPropertiesSync(bool gyroBiasVarianceRandomWalk_valid,
float gyroBiasVarianceRandomWalk,
bool accelBiasVarianceRandomWalk_valid,
float accelBiasVarianceRandomWalk,
bool angleBiasVarianceRandomWalk_valid,
float angleBiasVarianceRandomWalk,
bool rateBiasVarianceRandomWalk_valid,
float rateBiasVarianceRandomWalk,
bool velocityBiasVarianceRandomWalk_valid,
float velocityBiasVarianceRandomWalk);
virtual enum loc_api_adapter_err
setSensorPerfControlConfigSync(int controlMode, int accelSamplesPerBatch,
int accelBatchesPerSec, int gyroSamplesPerBatch, int gyroBatchesPerSec,
int accelSamplesPerBatchHigh, int accelBatchesPerSecHigh,
int gyroSamplesPerBatchHigh, int gyroBatchesPerSecHigh, int algorithmConfig);
virtual LocationError
setAGLONASSProtocolSync(GnssConfigAGlonassPositionProtocolMask aGlonassProtocol);
virtual LocationError setLPPeProtocolCpSync(GnssConfigLppeControlPlaneMask lppeCP);
virtual LocationError setLPPeProtocolUpSync(GnssConfigLppeUserPlaneMask lppeUP);
virtual void getWwanZppFix();
virtual void getBestAvailableZppFix();
virtual LocationError setGpsLockSync(GnssConfigGpsLock lock);
virtual void setConstrainedTuncMode(bool enabled,
float tuncConstraint,
uint32_t energyBudget,
LocApiResponse* adapterResponse=nullptr);
virtual void setPositionAssistedClockEstimatorMode(bool enabled,
LocApiResponse* adapterResponse=nullptr);
virtual void getGnssEnergyConsumed();
virtual void requestForAidingData(GnssAidingDataSvMask svDataMask);
virtual LocationError setXtraVersionCheckSync(uint32_t check);
virtual void startTimeBasedTracking(const TrackingOptions& options,
LocApiResponse* adapterResponse);
virtual void stopTimeBasedTracking(LocApiResponse* adapterResponse);
virtual void startDistanceBasedTracking(uint32_t sessionId, const LocationOptions& options,
LocApiResponse* adapterResponse);
virtual void stopDistanceBasedTracking(uint32_t sessionId,
LocApiResponse* adapterResponse = nullptr);
virtual GnssConfigSuplVersion convertSuplVersion(const uint32_t suplVersion);
virtual GnssConfigLppeControlPlaneMask convertLppeCp(const uint32_t lppeControlPlaneMask);
virtual GnssConfigLppeUserPlaneMask convertLppeUp(const uint32_t lppeUserPlaneMask);
/* Requests for SV/Constellation Control */
virtual LocationError setBlacklistSvSync(const GnssSvIdConfig& config);
virtual void setBlacklistSv(const GnssSvIdConfig& config,
LocApiResponse* adapterResponse=nullptr);
virtual void getBlacklistSv();
virtual void setConstellationControl(const GnssSvTypeConfig& config,
LocApiResponse *adapterResponse=nullptr);
virtual void getConstellationControl();
virtual void resetConstellationControl(LocApiResponse *adapterResponse=nullptr);
};
extern "C" LocApiBase* getLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask,
ContextBase *context);
#endif //SYNERGY_LOC_API_H

View file

@ -1,84 +0,0 @@
/* Copyright (c) 2011-2012, 2014, 2019, 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.
*/
#ifndef SYNERGY_LOCATION_UTIL_LOG_H
#define SYNERGY_LOCATION_UTIL_LOG_H
#include <log_util.h>
#if defined(_ANDROID_)
//#include "loc_api_v02_log.h"
#else // no _ANDROID_
#if defined(__LOC_API_V02_LOG_SILENT__)
#define MSG_LOG
#define LOC_LOGE(...) MSG_LOG(__VA_ARGS__);
#define LOC_LOGW(...) MSG_LOG(__VA_ARGS__);
#define LOC_LOGD(...) MSG_LOG(__VA_ARGS__);
#define LOC_LOGI(...) MSG_LOG(__VA_ARGS__);
#define LOC_LOGV(...) MSG_LOG(__VA_ARGS__);
#elif !defined(USE_GLIB)
// common for QNX and Griffon
#if !defined (_ANDROID_) && !defined(USE_GLIB)
//error logs
#define LOC_LOGE(...) printf(__VA_ARGS__)
//warning logs
#define LOC_LOGW(...) printf(__VA_ARGS__)
// debug logs
#define LOC_LOGD(...) printf(__VA_ARGS__)
//info logs
#define LOC_LOGI(...) printf(__VA_ARGS__)
//verbose logs
#define LOC_LOGV(...) printf(__VA_ARGS__)
#endif //!defined (_ANDROID_) && !defined(USE_GLIB)
#endif //__LOC_API_V02_LOG_SILENT__
#define loc_get_v02_event_name(X) #X
#define loc_get_v02_client_status_name(X) #X
#define loc_get_v02_qmi_status_name(X) #X
//specific to OFF TARGET
#ifdef LOC_UTIL_TARGET_OFF_TARGET
# include <stdio.h>
# include <asm/errno.h>
# include <sys/time.h>
// get around strl*: not found in glibc
// TBD:look for presence of eglibc other libraries
// with strlcpy supported.
#define strlcpy(X, Y, Z) strcpy(X, Y)
#define strlcat(X, Y, Z) strcat(X, Y)
#endif //LOC_UTIL_TARGET_OFF_TARGET
#endif //_ANDROID_
#endif //SYNERGY_LOCATION_UTIL_LOG_H