sm8250-common: import location from LA.UM.9.12.r1-13500.01-SMxx50.QSSI12.0

Change-Id: If93ba9b50dc3bb07a4ba81694187e99f58dd172c
This commit is contained in:
SGCMarkus 2022-03-23 21:42:45 +01:00
parent 72410cf795
commit 64ab05b033
103 changed files with 92521 additions and 0 deletions

File diff suppressed because it is too large Load diff

View file

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

@ -0,0 +1,11 @@
Location Client Api doc
1. Steps to generate doxygen Api doc:
run
mkclientapidoc.sh [output-path]
default output-path is docs/
default doxgen configuration file is LocationClientApiDoxygen.conf
2. below file will be generated:
html/
-HTML output, where the html/index.html is the home page.

View file

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

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

View file

@ -0,0 +1,86 @@
#!/bin/bash
#==========================================================================
#Copyright (c) 2018, The Linux Foundation. All rights reserved.
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are
#met:
#* Redistributions of source code must retain the above copyright
#notice, this list of conditions and the following disclaimer.
#* Redistributions in binary form must reproduce the above
#copyright notice, this list of conditions and the following
#disclaimer in the documentation and/or other materials provided
#with the distribution.
#* Neither the name of The Linux Foundation nor the names of its
#contributors may be used to endorse or promote products derived
#from this software without specific prior written permission.
#
#THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
#WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
#MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
#ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
#BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
#CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
#SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
#BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
#WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
#OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
#IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#==========================================================================
#==========================================================================
#
# Usage:
# mkclientapidoc.sh [output-path]
#
# Note, this script requires the existence of the doxygen tool -
# This script can be called from any directory
#==========================================================================
DIR="$( cd "$( dirname "$0" )" && pwd )"
# the default doxygen configuration is LocationClientApiDoxygen.conf
CONFIG=$DIR/LocationClientApiDoxygen.conf
OUT="docs"
# Show help message if requested, otherwise create output folder
if [ -n "$1" ]
then
if [ "$1" == "-h" ] || [ "$1" == "--help" ]
then
echo "$0 [output-path]"
echo " e.g. $0"
echo " $0 docs"
exit
else
OUT=$1
if [ ! -d $OUT ]
then
mkdir -p $OUT
fi
fi
fi
which doxygen
if [ "$?" == 0 ]
then
# Use ? here to seperate patterns as / in path will be regarded as splitter by default
sed -i "s?^OUTPUT_DIRECTORY .*?OUTPUT_DIRECTORY = $OUT?" $CONFIG
sed -i "s?^INPUT .*?INPUT = $DIR/inc?" $CONFIG
doxygen $CONFIG > /dev/null 2>&1
else
echo "This script requires doxygen tool be to installed. "
echo "You can install is with e.g. sudo apt-get install doxygen"
exit 1
fi
if [ ! -e $OUT/html/index.html ]
then
echo "Error building Location Client Api doc files."
exit 2
fi
echo
echo "doxygen docs for Location Client Api available at: $OUT/html"

View file

@ -0,0 +1,74 @@
/* 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

@ -0,0 +1,62 @@
/* 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

@ -0,0 +1,239 @@
/* 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

@ -0,0 +1,847 @@
/* 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 */