[automerger skipped] DO NOT MERGE - Merge PPRL.190205.001 into master am: 37c8eb716e -s ours am: 6d6ec39bc8 -s ours
am: 347a21bbc0 -s ours
am skip reason: subject contains skip directive

Change-Id: Icf0a0ba64d5589e85cdac7c34aa0ab74201801b9
diff --git a/sdm845/android/location_api/GnssAPIClient.cpp b/sdm845/android/location_api/GnssAPIClient.cpp
index f0b6f76..61b8b38 100644
--- a/sdm845/android/location_api/GnssAPIClient.cpp
+++ b/sdm845/android/location_api/GnssAPIClient.cpp
@@ -166,6 +166,10 @@
     memset(&mTrackingOptions, 0, sizeof(TrackingOptions));
     mTrackingOptions.size = sizeof(TrackingOptions);
     mTrackingOptions.minInterval = minIntervalMs;
+    if (IGnss::GnssPositionRecurrence::RECURRENCE_SINGLE == recurrence) {
+        mTrackingOptions.minInterval =
+                std::numeric_limits<decltype(mTrackingOptions.minInterval)>::max();
+    }
     mTrackingOptions.minDistance = preferredAccuracyMeters;
     if (mode == IGnss::GnssPositionMode::STANDALONE)
         mTrackingOptions.mode = GNSS_SUPL_MODE_STANDALONE;
diff --git a/sdm845/core/LocApiBase.cpp b/sdm845/core/LocApiBase.cpp
index c317d59..d06fddf 100644
--- a/sdm845/core/LocApiBase.cpp
+++ b/sdm845/core/LocApiBase.cpp
@@ -273,7 +273,7 @@
     // print the location info before delivering
     LOC_LOGD("flags: %d\n  source: %d\n  latitude: %f\n  longitude: %f\n  "
              "altitude: %f\n  speed: %f\n  bearing: %f\n  accuracy: %f\n  "
-             "timestamp: %" PRId64 "\n  rawDataSize: %d\n  rawData: %p\n  "
+             "timestamp: %" PRId64 "\n"
              "Session status: %d\n Technology mask: %u\n "
              "SV used in fix (gps/glo/bds/gal/qzss) : \
              (%" PRIx64 "/%" PRIx64 "/%" PRIx64 "/%" PRIx64 "/%" PRIx64 ")",
@@ -281,8 +281,7 @@
              location.gpsLocation.latitude, location.gpsLocation.longitude,
              location.gpsLocation.altitude, location.gpsLocation.speed,
              location.gpsLocation.bearing, location.gpsLocation.accuracy,
-             location.gpsLocation.timestamp, location.rawDataSize,
-             location.rawData, status, loc_technology_mask,
+             location.gpsLocation.timestamp, status, loc_technology_mask,
              locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask,
              locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask,
              locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask,
diff --git a/sdm845/core/SystemStatus.cpp b/sdm845/core/SystemStatus.cpp
index d3f654a..2fea31e 100644
--- a/sdm845/core/SystemStatus.cpp
+++ b/sdm845/core/SystemStatus.cpp
@@ -1690,7 +1690,7 @@
 bool SystemStatus::eventConnectionStatus(bool connected, int8_t type)
 {
     // send networkinof dataitem to systemstatus observer clients
-    SystemStatusNetworkInfo s(type, "", "", false, connected, false);
+    SystemStatusNetworkInfo s(type, "", "", connected);
     mSysStatusObsvr.notify({&s});
 
     return true;
diff --git a/sdm845/core/SystemStatus.h b/sdm845/core/SystemStatus.h
index 8674b07..e86f94b 100644
--- a/sdm845/core/SystemStatus.h
+++ b/sdm845/core/SystemStatus.h
@@ -468,7 +468,6 @@
             int32_t type=0,
             std::string typeName="",
             string subTypeName="",
-            bool available=false,
             bool connected=false,
             bool roaming=false) :
             NetworkInfoDataItemBase(
@@ -476,7 +475,7 @@
                     type,
                     typeName,
                     subTypeName,
-                    available,
+                    connected && (!roaming),
                     connected,
                     roaming),
             mSrcObjPtr(nullptr) {}
@@ -486,15 +485,7 @@
         mType = itemBase.getType();
     }
     inline bool equals(const SystemStatusNetworkInfo& peer) {
-        if ((mAllTypes == peer.mAllTypes) &&
-            (mTypeName == peer.mTypeName) &&
-            (mSubTypeName == peer.mSubTypeName) &&
-            (mAvailable == peer.mAvailable) &&
-            (mConnected == peer.mConnected) &&
-            (mRoaming == peer.mRoaming)) {
-            return true;
-        }
-        return false;
+        return (mAllTypes == peer.mAllTypes);
     }
     inline virtual SystemStatusItemBase& collate(SystemStatusItemBase& curInfo) {
         uint64_t allTypes = (static_cast<SystemStatusNetworkInfo&>(curInfo)).mAllTypes;
@@ -525,8 +516,9 @@
             RilServiceInfoDataItemBase() {}
     inline SystemStatusServiceInfo(const RilServiceInfoDataItemBase& itemBase) :
             RilServiceInfoDataItemBase(itemBase) {}
-    inline bool equals(const SystemStatusServiceInfo& /*peer*/) {
-        return true;
+    inline bool equals(const SystemStatusServiceInfo& peer) {
+        return static_cast<const RilServiceInfoDataItemBase&>(peer) ==
+                static_cast<const RilServiceInfoDataItemBase&>(*this);
     }
 };
 
@@ -538,8 +530,9 @@
             RilCellInfoDataItemBase() {}
     inline SystemStatusRilCellInfo(const RilCellInfoDataItemBase& itemBase) :
             RilCellInfoDataItemBase(itemBase) {}
-    inline bool equals(const SystemStatusRilCellInfo& /*peer*/) {
-        return true;
+    inline bool equals(const SystemStatusRilCellInfo& peer) {
+        return static_cast<const RilCellInfoDataItemBase&>(peer) ==
+                static_cast<const RilCellInfoDataItemBase&>(*this);
     }
 };
 
diff --git a/sdm845/core/data-items/DataItemConcreteTypesBase.h b/sdm845/core/data-items/DataItemConcreteTypesBase.h
index 065366d..bcb8d72 100644
--- a/sdm845/core/data-items/DataItemConcreteTypesBase.h
+++ b/sdm845/core/data-items/DataItemConcreteTypesBase.h
@@ -236,8 +236,7 @@
     NetworkInfoDataItemBase(
     NetworkType initialType, int32_t type, string typeName, string subTypeName,
     bool available, bool connected, bool roaming ):
-            mAllTypes((initialType >= TYPE_UNKNOWN || initialType < TYPE_MOBILE) ?
-                      0 : (1<<initialType)),
+            mAllTypes(typeToAllTypes(initialType)),
             mType(type),
             mTypeName(typeName),
             mSubTypeName(subTypeName),
@@ -263,7 +262,9 @@
     bool mRoaming;
 protected:
     DataItemId mId;
-
+    inline uint64_t typeToAllTypes(NetworkType type) {
+        return (type >= TYPE_UNKNOWN || type < TYPE_MOBILE) ?  0 : (1<<type);
+    }
 };
 
 class ServiceStatusDataItemBase : public IDataItemCore {
@@ -313,24 +314,42 @@
 
 class RilServiceInfoDataItemBase : public IDataItemCore {
 public:
-    RilServiceInfoDataItemBase() :
-        mId(RILSERVICEINFO_DATA_ITEM_ID) {}
-    virtual ~RilServiceInfoDataItemBase() {}
+    inline RilServiceInfoDataItemBase() :
+            mData(nullptr), mId(RILSERVICEINFO_DATA_ITEM_ID) {}
+    inline virtual ~RilServiceInfoDataItemBase() { if (nullptr != mData) free(mData); }
     inline virtual DataItemId getId() { return mId; }
     virtual void stringify(string& /*valueStr*/) {}
     virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
+    inline RilServiceInfoDataItemBase(const RilServiceInfoDataItemBase& peer) :
+            RilServiceInfoDataItemBase() {
+        peer.setPeerData(*this);
+    }
+    inline virtual bool operator==(const RilServiceInfoDataItemBase& other) const {
+        return other.mData == mData;
+    }
+    inline virtual void setPeerData(RilServiceInfoDataItemBase& /*peer*/) const {}
+    void* mData;
 protected:
     DataItemId mId;
 };
 
 class RilCellInfoDataItemBase : public IDataItemCore {
 public:
-    RilCellInfoDataItemBase() :
-        mId(RILCELLINFO_DATA_ITEM_ID) {}
-    virtual ~RilCellInfoDataItemBase() {}
+    inline RilCellInfoDataItemBase() :
+            mData(nullptr), mId(RILCELLINFO_DATA_ITEM_ID) {}
+    inline virtual ~RilCellInfoDataItemBase() { if (nullptr != mData) free(mData); }
     inline virtual DataItemId getId() { return mId; }
     virtual void stringify(string& /*valueStr*/) {}
     virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
+    inline RilCellInfoDataItemBase(const RilCellInfoDataItemBase& peer) :
+            RilCellInfoDataItemBase() {
+        peer.setPeerData(*this);
+    }
+    inline virtual bool operator==(const RilCellInfoDataItemBase& other) const {
+        return other.mData == mData;
+    }
+    inline virtual void setPeerData(RilCellInfoDataItemBase& /*peer*/) const {}
+    void* mData;
 protected:
     DataItemId mId;
 };
diff --git a/sdm845/gnss/GnssAdapter.cpp b/sdm845/gnss/GnssAdapter.cpp
index 9cc4edf..04750b6 100644
--- a/sdm845/gnss/GnssAdapter.cpp
+++ b/sdm845/gnss/GnssAdapter.cpp
@@ -196,32 +196,32 @@
 }
 
 void
-GnssAdapter::convertLocation(Location& out, const LocGpsLocation& locGpsLocation,
+GnssAdapter::convertLocation(Location& out, const UlpLocation& ulpLocation,
                              const GpsLocationExtended& locationExtended,
                              const LocPosTechMask techMask)
 {
     memset(&out, 0, sizeof(Location));
     out.size = sizeof(Location);
-    if (LOC_GPS_LOCATION_HAS_LAT_LONG & locGpsLocation.flags) {
+    if (LOC_GPS_LOCATION_HAS_LAT_LONG & ulpLocation.gpsLocation.flags) {
         out.flags |= LOCATION_HAS_LAT_LONG_BIT;
-        out.latitude = locGpsLocation.latitude;
-        out.longitude = locGpsLocation.longitude;
+        out.latitude = ulpLocation.gpsLocation.latitude;
+        out.longitude = ulpLocation.gpsLocation.longitude;
     }
-    if (LOC_GPS_LOCATION_HAS_ALTITUDE & locGpsLocation.flags) {
+    if (LOC_GPS_LOCATION_HAS_ALTITUDE & ulpLocation.gpsLocation.flags) {
         out.flags |= LOCATION_HAS_ALTITUDE_BIT;
-        out.altitude = locGpsLocation.altitude;
+        out.altitude = ulpLocation.gpsLocation.altitude;
     }
-    if (LOC_GPS_LOCATION_HAS_SPEED & locGpsLocation.flags) {
+    if (LOC_GPS_LOCATION_HAS_SPEED & ulpLocation.gpsLocation.flags) {
         out.flags |= LOCATION_HAS_SPEED_BIT;
-        out.speed = locGpsLocation.speed;
+        out.speed = ulpLocation.gpsLocation.speed;
     }
-    if (LOC_GPS_LOCATION_HAS_BEARING & locGpsLocation.flags) {
+    if (LOC_GPS_LOCATION_HAS_BEARING & ulpLocation.gpsLocation.flags) {
         out.flags |= LOCATION_HAS_BEARING_BIT;
-        out.bearing = locGpsLocation.bearing;
+        out.bearing = ulpLocation.gpsLocation.bearing;
     }
-    if (LOC_GPS_LOCATION_HAS_ACCURACY & locGpsLocation.flags) {
+    if (LOC_GPS_LOCATION_HAS_ACCURACY & ulpLocation.gpsLocation.flags) {
         out.flags |= LOCATION_HAS_ACCURACY_BIT;
-        out.accuracy = locGpsLocation.accuracy;
+        out.accuracy = ulpLocation.gpsLocation.accuracy;
     }
     if (GPS_LOCATION_EXTENDED_HAS_VERT_UNC & locationExtended.flags) {
         out.flags |= LOCATION_HAS_VERTICAL_ACCURACY_BIT;
@@ -235,7 +235,7 @@
         out.flags |= LOCATION_HAS_BEARING_ACCURACY_BIT;
         out.bearingAccuracy = locationExtended.bearing_unc;
     }
-    out.timestamp = locGpsLocation.timestamp;
+    out.timestamp = ulpLocation.gpsLocation.timestamp;
     if (LOC_POS_TECH_MASK_SATELLITE & techMask) {
         out.techMask |= LOCATION_TECHNOLOGY_GNSS_BIT;
     }
@@ -265,6 +265,11 @@
         out.hdop = locationExtended.hdop;
         out.vdop = locationExtended.vdop;
     }
+    if (GPS_LOCATION_EXTENDED_HAS_EXT_DOP & locationExtended.flags) {
+        out.flags |= GNSS_LOCATION_INFO_EXT_DOP_BIT;
+        out.gdop = locationExtended.extDOP.GDOP;
+        out.tdop = locationExtended.extDOP.TDOP;
+    }
     if (GPS_LOCATION_EXTENDED_HAS_MAG_DEV & locationExtended.flags) {
         out.flags |= GNSS_LOCATION_INFO_MAGNETIC_DEVIATION_BIT;
         out.magneticDeviation = locationExtended.magneticDeviation;
@@ -321,6 +326,53 @@
         out.flags |= GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_AZIMUTH_BIT;
         out.horUncEllipseOrientAzimuth = locationExtended.horUncEllipseOrientAzimuth;
     }
+    if (GPS_LOCATION_EXTENDED_HAS_GNSS_SV_USED_DATA & locationExtended.flags) {
+        out.flags |= GNSS_LOCATION_INFO_GNSS_SV_USED_DATA_BIT;
+        out.svUsedInPosition.gpsSvUsedIdsMask =
+                locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask;
+        out.svUsedInPosition.gloSvUsedIdsMask =
+                locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask;
+        out.svUsedInPosition.galSvUsedIdsMask =
+                locationExtended.gnss_sv_used_ids.gal_sv_used_ids_mask;
+        out.svUsedInPosition.bdsSvUsedIdsMask =
+                locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask;
+        out.svUsedInPosition.qzssSvUsedIdsMask =
+                locationExtended.gnss_sv_used_ids.qzss_sv_used_ids_mask;
+    }
+    if (GPS_LOCATION_EXTENDED_HAS_NAV_SOLUTION_MASK & locationExtended.flags) {
+        out.flags |= GNSS_LOCATION_INFO_NAV_SOLUTION_MASK_BIT;
+        out.navSolutionMask = locationExtended.navSolutionMask;
+    }
+    if (GPS_LOCATION_EXTENDED_HAS_POS_TECH_MASK & locationExtended.flags) {
+        out.flags |= GPS_LOCATION_EXTENDED_HAS_POS_TECH_MASK;
+        out.posTechMask = locationExtended.tech_mask;
+    }
+    if (GPS_LOCATION_EXTENDED_HAS_POS_DYNAMICS_DATA & locationExtended.flags) {
+        out.flags |= GPS_LOCATION_EXTENDED_HAS_POS_DYNAMICS_DATA;
+        if (locationExtended.bodyFrameData.bodyFrameDatamask &
+                LOCATION_NAV_DATA_HAS_LONG_ACCEL_BIT) {
+            out.bodyFrameData.bodyFrameDataMask |= LOCATION_NAV_DATA_HAS_LONG_ACCEL_BIT;
+        }
+        if (locationExtended.bodyFrameData.bodyFrameDatamask &
+                LOCATION_NAV_DATA_HAS_LAT_ACCEL_BIT) {
+            out.bodyFrameData.bodyFrameDataMask |= LOCATION_NAV_DATA_HAS_LAT_ACCEL_BIT;
+        }
+        if (locationExtended.bodyFrameData.bodyFrameDatamask &
+                LOCATION_NAV_DATA_HAS_VERT_ACCEL_BIT) {
+            out.bodyFrameData.bodyFrameDataMask |= LOCATION_NAV_DATA_HAS_VERT_ACCEL_BIT;
+        }
+        if (locationExtended.bodyFrameData.bodyFrameDatamask & LOCATION_NAV_DATA_HAS_YAW_RATE_BIT) {
+            out.bodyFrameData.bodyFrameDataMask |= LOCATION_NAV_DATA_HAS_YAW_RATE_BIT;
+        }
+        if (locationExtended.bodyFrameData.bodyFrameDatamask & LOCATION_NAV_DATA_HAS_PITCH_BIT) {
+            out.bodyFrameData.bodyFrameDataMask |= LOCATION_NAV_DATA_HAS_PITCH_BIT;
+        }
+        out.bodyFrameData.longAccel = locationExtended.bodyFrameData.longAccel;
+        out.bodyFrameData.latAccel = locationExtended.bodyFrameData.latAccel;
+        out.bodyFrameData.vertAccel = locationExtended.bodyFrameData.vertAccel;
+        out.bodyFrameData.yawRate = locationExtended.bodyFrameData.yawRate;
+        out.bodyFrameData.pitch = locationExtended.bodyFrameData.pitch;
+    }
 }
 
 inline uint32_t
@@ -1702,7 +1754,7 @@
 {
     LOC_API_ADAPTER_EVENT_MASK_T mask = 0;
     for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
-        if (it->second.trackingCb != nullptr) {
+        if (it->second.trackingCb != nullptr || it->second.gnssLocationInfoCb != nullptr) {
             mask |= LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT;
         }
         if (it->second.gnssNiCb != nullptr) {
@@ -1909,7 +1961,7 @@
 GnssAdapter::hasTrackingCallback(LocationAPI* client)
 {
     auto it = mClientData.find(client);
-    return (it != mClientData.end() && it->second.trackingCb);
+    return (it != mClientData.end() && (it->second.trackingCb || it->second.gnssLocationInfoCb));
 }
 
 bool
@@ -2740,15 +2792,15 @@
         }
 
         for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
-            if (nullptr != it->second.trackingCb) {
-                Location location = {};
-                convertLocation(location, ulpLocation.gpsLocation, locationExtended, techMask);
-                it->second.trackingCb(location);
-            }
             if (nullptr != it->second.gnssLocationInfoCb) {
                 GnssLocationInfoNotification locationInfo = {};
                 convertLocationInfo(locationInfo, locationExtended);
+                convertLocation(locationInfo.location, ulpLocation, locationExtended, techMask);
                 it->second.gnssLocationInfoCb(locationInfo);
+            } else if (nullptr != it->second.trackingCb) {
+                Location location = {};
+                convertLocation(location, ulpLocation, locationExtended, techMask);
+                it->second.trackingCb(location);
             }
         }
     }
@@ -2766,15 +2818,6 @@
             reportNmea(sentence.c_str(), sentence.length());
         }
     }
-
-    // Free the allocated memory for rawData
-    UlpLocation* gp = (UlpLocation*)&(ulpLocation);
-    if (gp != NULL && gp->rawData != NULL)
-    {
-        delete (char*)gp->rawData;
-        gp->rawData = NULL;
-        gp->rawDataSize = 0;
-    }
 }
 
 void
diff --git a/sdm845/gnss/GnssAdapter.h b/sdm845/gnss/GnssAdapter.h
index 9d54e6a..ad512da 100644
--- a/sdm845/gnss/GnssAdapter.h
+++ b/sdm845/gnss/GnssAdapter.h
@@ -156,7 +156,7 @@
 
     /*==== CONVERSION ===================================================================*/
     static void convertOptions(LocPosMode& out, const TrackingOptions& trackingOptions);
-    static void convertLocation(Location& out, const LocGpsLocation& locGpsLocation,
+    static void convertLocation(Location& out, const UlpLocation& ulpLocation,
                                 const GpsLocationExtended& locationExtended,
                                 const LocPosTechMask techMask);
     static void convertLocationInfo(GnssLocationInfoNotification& out,
diff --git a/sdm845/location/ILocationAPI.h b/sdm845/location/ILocationAPI.h
new file mode 100644
index 0000000..422bbe4
--- /dev/null
+++ b/sdm845/location/ILocationAPI.h
@@ -0,0 +1,194 @@
+/* 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 ILOCATIONAPI_H
+#define ILOCATIONAPI_H
+
+#include "LocationDataTypes.h"
+
+class ILocationAPI
+{
+public:
+    virtual ~ILocationAPI(){};
+
+    /** @brief Updates/changes the callbacks that will be called.
+        mandatory callbacks must be present for callbacks to be successfully updated
+        no return value */
+    virtual void updateCallbacks(LocationCallbacks&) = 0;
+
+    /* ================================== TRACKING ================================== */
+
+    /** @brief Starts a tracking session, which returns a session id that will be
+       used by the other tracking APIs and also in the responseCallback to match command
+       with response. locations are reported on the registered trackingCallback
+       periodically according to TrackingOptions.
+       @return session id
+        responseCallback returns:
+                LOCATION_ERROR_SUCCESS if session was successfully started
+                LOCATION_ERROR_ALREADY_STARTED if a startTracking session is already in progress
+                LOCATION_ERROR_CALLBACK_MISSING if no trackingCallback was passed
+                LOCATION_ERROR_INVALID_PARAMETER if LocationOptions parameter is invalid */
+    virtual uint32_t startTracking(TrackingOptions&) = 0;
+
+    /** @brief Stops a tracking session associated with id parameter.
+        responseCallback returns:
+                LOCATION_ERROR_SUCCESS if successful
+                LOCATION_ERROR_ID_UNKNOWN if id is not associated with a tracking session */
+    virtual void stopTracking(uint32_t id) = 0;
+
+    /** @brief Changes the TrackingOptions of a tracking session associated with id.
+        responseCallback returns:
+                LOCATION_ERROR_SUCCESS if successful
+                LOCATION_ERROR_INVALID_PARAMETER if LocationOptions parameters are invalid
+                LOCATION_ERROR_ID_UNKNOWN if id is not associated with a tracking session */
+    virtual void updateTrackingOptions(uint32_t id, TrackingOptions&) = 0;
+
+    /* ================================== BATCHING ================================== */
+
+    /** @brief starts a batching session, which returns a session id that will be
+       used by the other batching APIs and also in the responseCallback to match command
+       with response. locations are reported on the batchingCallback passed in createInstance
+       periodically according to LocationOptions. A batching session starts tracking on
+       the low power processor and delivers them in batches by the batchingCallback when
+       the batch is full or when getBatchedLocations is called. This allows for the processor
+       that calls this API to sleep when the low power processor can batch locations in the
+       backgroup and wake up the processor calling the API only when the batch is full, thus
+       saving power.
+       @return session id
+        responseCallback returns:
+                LOCATION_ERROR_SUCCESS if session was successful
+                LOCATION_ERROR_ALREADY_STARTED if a startBatching session is already in progress
+                LOCATION_ERROR_CALLBACK_MISSING if no batchingCallback
+                LOCATION_ERROR_INVALID_PARAMETER if a parameter is invalid
+                LOCATION_ERROR_NOT_SUPPORTED if batching is not supported */
+    virtual uint32_t startBatching(BatchingOptions&) = 0;
+
+    /** @brief Stops a batching session associated with id parameter.
+        responseCallback returns:
+                LOCATION_ERROR_SUCCESS if successful
+                LOCATION_ERROR_ID_UNKNOWN if id is not associated with batching session */
+    virtual void stopBatching(uint32_t id) = 0;
+
+    /** @brief Changes the LocationOptions of a batching session associated with id.
+        responseCallback returns:
+                LOCATION_ERROR_SUCCESS if successful
+                LOCATION_ERROR_INVALID_PARAMETER if LocationOptions parameters are invalid
+                LOCATION_ERROR_ID_UNKNOWN if id is not associated with a batching session */
+    virtual void updateBatchingOptions(uint32_t id, BatchingOptions&) = 0;
+
+    /** @brief Gets a number of locations that are currently stored/batched
+       on the low power processor, delivered by the batchingCallback passed in createInstance.
+       Location are then deleted from the batch stored on the low power processor.
+        responseCallback returns:
+                LOCATION_ERROR_SUCCESS if successful, will be followed by batchingCallback call
+                LOCATION_ERROR_CALLBACK_MISSING if no batchingCallback
+                LOCATION_ERROR_ID_UNKNOWN if id is not associated with a batching session */
+    virtual void getBatchedLocations(uint32_t id, size_t count) = 0;
+
+    /* ================================== GEOFENCE ================================== */
+
+    /** @brief Adds any number of geofences and returns an array of geofence ids that
+       will be used by the other geofence APIs and also in the collectiveResponseCallback to
+       match command with response. The geofenceBreachCallback will deliver the status of each
+       geofence according to the GeofenceOption for each. The geofence id array returned will
+       be valid until the collectiveResponseCallback is called and has returned.
+       @return id array
+        collectiveResponseCallback returns:
+                LOCATION_ERROR_SUCCESS if session was successful
+                LOCATION_ERROR_CALLBACK_MISSING if no geofenceBreachCallback
+                LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+                LOCATION_ERROR_NOT_SUPPORTED if geofence is not supported */
+    virtual uint32_t* addGeofences(size_t count, GeofenceOption*, GeofenceInfo*) = 0;
+
+    /** @brief Removes any number of geofences. Caller should delete ids array after
+       removeGeofences returneds.
+        collectiveResponseCallback returns:
+                LOCATION_ERROR_SUCCESS if successful
+                LOCATION_ERROR_ID_UNKNOWN if id is not associated with a geofence session */
+    virtual void removeGeofences(size_t count, uint32_t* ids) = 0;
+
+    /** @brief Modifies any number of geofences. Caller should delete ids array after
+       modifyGeofences returns.
+        collectiveResponseCallback returns:
+                LOCATION_ERROR_SUCCESS if successful
+                LOCATION_ERROR_ID_UNKNOWN if id is not associated with a geofence session
+                LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid */
+    virtual void modifyGeofences(size_t count, uint32_t* ids, GeofenceOption* options) = 0;
+
+    /** @brief Pauses any number of geofences, which is similar to removeGeofences,
+       only that they can be resumed at any time. Caller should delete ids array after
+       pauseGeofences returns.
+        collectiveResponseCallback returns:
+                LOCATION_ERROR_SUCCESS if successful
+                LOCATION_ERROR_ID_UNKNOWN if id is not associated with a geofence session */
+    virtual void pauseGeofences(size_t count, uint32_t* ids) = 0;
+
+    /** @brief Resumes any number of geofences that are currently paused. Caller should
+       delete ids array after resumeGeofences returns.
+        collectiveResponseCallback returns:
+                LOCATION_ERROR_SUCCESS if successful
+                LOCATION_ERROR_ID_UNKNOWN if id is not associated with a geofence session */
+    virtual void resumeGeofences(size_t count, uint32_t* ids) = 0;
+
+    /* ================================== GNSS ====================================== */
+
+     /** @brief gnssNiResponse is called in response to a gnssNiCallback.
+        responseCallback returns:
+                LOCATION_ERROR_SUCCESS if session was successful
+                LOCATION_ERROR_INVALID_PARAMETER if any parameters in GnssNiResponse are invalid
+                LOCATION_ERROR_ID_UNKNOWN if id does not match a gnssNiCallback */
+    virtual void gnssNiResponse(uint32_t id, GnssNiResponse response) = 0;
+};
+
+class ILocationControlAPI
+{
+public:
+    virtual ~ILocationControlAPI(){};
+
+    /** @brief Updates the gnss specific configuration, which returns a session id array
+       with an id for each of the bits set in GnssConfig.flags, order from low bits to high bits.
+       The response for each config that is set will be returned in collectiveResponseCallback.
+       The session id array returned will be valid until the collectiveResponseCallback is called
+       and has returned. This effect is global for all clients of ILocationAPI.
+        collectiveResponseCallback returns:
+                LOCATION_ERROR_SUCCESS if session was successful
+                LOCATION_ERROR_INVALID_PARAMETER if any other parameters are invalid
+                LOCATION_ERROR_GENERAL_FAILURE if failure for any other reason */
+    virtual uint32_t* gnssUpdateConfig(GnssConfig config) = 0;
+
+    /** @brief Delete specific gnss aiding data for testing, which returns a session id
+       that will be returned in responseCallback to match command with response.
+       Only allowed in userdebug builds. This effect is global for all clients of ILocationAPI.
+        responseCallback returns:
+                LOCATION_ERROR_SUCCESS if successful
+                LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+                LOCATION_ERROR_NOT_SUPPORTED if build is not userdebug */
+    virtual uint32_t gnssDeleteAidingData(GnssAidingData& data) = 0;
+};
+
+#endif /* ILOCATIONAPI_H */
diff --git a/sdm845/location/LocationAPI.h b/sdm845/location/LocationAPI.h
index 682a376..f4f31f9 100644
--- a/sdm845/location/LocationAPI.h
+++ b/sdm845/location/LocationAPI.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017 The Linux Foundation. All rights reserved.
+/* Copyright (c) 2017-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
@@ -26,862 +26,12 @@
  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef LOCATION_H
-#define LOCATION_H
+#ifndef LOCATIONAPI_H
+#define LOCATIONAPI_H
 
-#include <vector>
-#include <stdint.h>
-#include <functional>
-#include <list>
+#include "ILocationAPI.h"
 
-#define GNSS_NI_REQUESTOR_MAX  256
-#define GNSS_NI_MESSAGE_ID_MAX 2048
-#define GNSS_SV_MAX 64
-#define GNSS_MEASUREMENTS_MAX 64
-#define GNSS_UTC_TIME_OFFSET   (3657)
-
-#define GNSS_BUGREPORT_GPS_MIN  (1)
-#define GNSS_BUGREPORT_SBAS_MIN (120)
-#define GNSS_BUGREPORT_GLO_MIN  (1)
-#define GNSS_BUGREPORT_QZSS_MIN (193)
-#define GNSS_BUGREPORT_BDS_MIN  (1)
-#define GNSS_BUGREPORT_GAL_MIN  (1)
-
-typedef enum {
-    LOCATION_ERROR_SUCCESS = 0,
-    LOCATION_ERROR_GENERAL_FAILURE,
-    LOCATION_ERROR_CALLBACK_MISSING,
-    LOCATION_ERROR_INVALID_PARAMETER,
-    LOCATION_ERROR_ID_EXISTS,
-    LOCATION_ERROR_ID_UNKNOWN,
-    LOCATION_ERROR_ALREADY_STARTED,
-    LOCATION_ERROR_GEOFENCES_AT_MAX,
-    LOCATION_ERROR_NOT_SUPPORTED
-} LocationError;
-
-// Flags to indicate which values are valid in a Location
-typedef uint16_t LocationFlagsMask;
-typedef enum {
-    LOCATION_HAS_LAT_LONG_BIT          = (1<<0), // location has valid latitude and longitude
-    LOCATION_HAS_ALTITUDE_BIT          = (1<<1), // location has valid altitude
-    LOCATION_HAS_SPEED_BIT             = (1<<2), // location has valid speed
-    LOCATION_HAS_BEARING_BIT           = (1<<3), // location has valid bearing
-    LOCATION_HAS_ACCURACY_BIT          = (1<<4), // location has valid accuracy
-    LOCATION_HAS_VERTICAL_ACCURACY_BIT = (1<<5), // location has valid vertical accuracy
-    LOCATION_HAS_SPEED_ACCURACY_BIT    = (1<<6), // location has valid speed accuracy
-    LOCATION_HAS_BEARING_ACCURACY_BIT  = (1<<7), // location has valid bearing accuracy
-} LocationFlagsBits;
-
-typedef uint16_t LocationTechnologyMask;
-typedef enum {
-    LOCATION_TECHNOLOGY_GNSS_BIT     = (1<<0), // location was calculated using GNSS
-    LOCATION_TECHNOLOGY_CELL_BIT     = (1<<1), // location was calculated using Cell
-    LOCATION_TECHNOLOGY_WIFI_BIT     = (1<<2), // location was calculated using WiFi
-    LOCATION_TECHNOLOGY_SENSORS_BIT  = (1<<3), // location was calculated using Sensors
-} LocationTechnologyBits;
-
-typedef enum {
-    LOCATION_RELIABILITY_NOT_SET = 0,
-    LOCATION_RELIABILITY_VERY_LOW,
-    LOCATION_RELIABILITY_LOW,
-    LOCATION_RELIABILITY_MEDIUM,
-    LOCATION_RELIABILITY_HIGH,
-} LocationReliability;
-
-typedef uint32_t GnssLocationInfoFlagMask;
-typedef enum {
-    GNSS_LOCATION_INFO_ALTITUDE_MEAN_SEA_LEVEL_BIT      = (1<<0), // valid altitude mean sea level
-    GNSS_LOCATION_INFO_DOP_BIT                          = (1<<1), // valid pdop, hdop, and vdop
-    GNSS_LOCATION_INFO_MAGNETIC_DEVIATION_BIT           = (1<<2), // valid magnetic deviation
-    GNSS_LOCATION_INFO_HOR_RELIABILITY_BIT              = (1<<3), // valid horizontal reliability
-    GNSS_LOCATION_INFO_VER_RELIABILITY_BIT              = (1<<4), // valid vertical reliability
-    GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MAJOR_BIT = (1<<5), // valid elipsode semi major
-    GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MINOR_BIT = (1<<6), // valid elipsode semi minor
-    GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_AZIMUTH_BIT    = (1<<7),// valid accuracy elipsode azimuth
-} GnssLocationInfoFlagBits;
-
-typedef enum {
-    GEOFENCE_BREACH_ENTER = 0,
-    GEOFENCE_BREACH_EXIT,
-    GEOFENCE_BREACH_DWELL_IN,
-    GEOFENCE_BREACH_DWELL_OUT,
-    GEOFENCE_BREACH_UNKNOWN,
-} GeofenceBreachType;
-
-typedef uint16_t GeofenceBreachTypeMask;
-typedef enum {
-    GEOFENCE_BREACH_ENTER_BIT     = (1<<0),
-    GEOFENCE_BREACH_EXIT_BIT      = (1<<1),
-    GEOFENCE_BREACH_DWELL_IN_BIT  = (1<<2),
-    GEOFENCE_BREACH_DWELL_OUT_BIT = (1<<3),
-} GeofenceBreachTypeBits;
-
-typedef enum {
-    GEOFENCE_STATUS_AVAILABILE_NO = 0,
-    GEOFENCE_STATUS_AVAILABILE_YES,
-} GeofenceStatusAvailable;
-
-typedef uint32_t LocationCapabilitiesMask;
-typedef enum {
-    // supports startTracking API with minInterval param
-    LOCATION_CAPABILITIES_TIME_BASED_TRACKING_BIT           = (1<<0),
-    // supports startBatching API with minInterval param
-    LOCATION_CAPABILITIES_TIME_BASED_BATCHING_BIT           = (1<<1),
-    // supports startTracking API with minDistance param
-    LOCATION_CAPABILITIES_DISTANCE_BASED_TRACKING_BIT       = (1<<2),
-    // supports startBatching API with minDistance param
-    LOCATION_CAPABILITIES_DISTANCE_BASED_BATCHING_BIT       = (1<<3),
-    // supports addGeofences API
-    LOCATION_CAPABILITIES_GEOFENCE_BIT                      = (1<<4),
-    // supports GnssMeasurementsCallback
-    LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT             = (1<<5),
-    // supports startTracking/startBatching API with LocationOptions.mode of MSB (Ms Based)
-    LOCATION_CAPABILITIES_GNSS_MSB_BIT                      = (1<<6),
-    // supports startTracking/startBatching API with LocationOptions.mode of MSA (MS Assisted)
-    LOCATION_CAPABILITIES_GNSS_MSA_BIT                      = (1<<7),
-    // supports debug nmea sentences in the debugNmeaCallback
-    LOCATION_CAPABILITIES_DEBUG_NMEA_BIT                    = (1<<8),
-    // support outdoor trip batching
-    LOCATION_CAPABILITIES_OUTDOOR_TRIP_BATCHING_BIT         = (1<<9),
-    // support constellation enablement
-    LOCATION_CAPABILITIES_CONSTELLATION_ENABLEMENT_BIT      = (1<<10),
-    // support agpm
-    LOCATION_CAPABILITIES_AGPM_BIT                          = (1<<11),
-} LocationCapabilitiesBits;
-
-typedef enum {
-    LOCATION_TECHNOLOGY_TYPE_GNSS = 0,
-} LocationTechnologyType;
-
-// Configures how GPS is locked when GPS is disabled (through GnssDisable)
-typedef enum {
-    GNSS_CONFIG_GPS_LOCK_NONE = 0, // gps is not locked when GPS is disabled (GnssDisable)
-    GNSS_CONFIG_GPS_LOCK_MO,       // gps mobile originated (MO) is locked when GPS is disabled
-    GNSS_CONFIG_GPS_LOCK_NI,       // gps network initiated (NI) is locked when GPS is disabled
-    GNSS_CONFIG_GPS_LOCK_MO_AND_NI,// gps MO and NI is locked when GPS is disabled
-} GnssConfigGpsLock;
-
-// SUPL version
-typedef enum {
-    GNSS_CONFIG_SUPL_VERSION_1_0_0 = 1,
-    GNSS_CONFIG_SUPL_VERSION_2_0_0,
-    GNSS_CONFIG_SUPL_VERSION_2_0_2,
-} GnssConfigSuplVersion;
-
-// LTE Positioning Profile
-typedef enum {
-    GNSS_CONFIG_LPP_PROFILE_RRLP_ON_LTE = 0,              // RRLP on LTE (Default)
-    GNSS_CONFIG_LPP_PROFILE_USER_PLANE,                   // LPP User Plane (UP) on LTE
-    GNSS_CONFIG_LPP_PROFILE_CONTROL_PLANE,                // LPP_Control_Plane (CP)
-    GNSS_CONFIG_LPP_PROFILE_USER_PLANE_AND_CONTROL_PLANE, // Both LPP UP and CP
-} GnssConfigLppProfile;
-
-// Technology for LPPe Control Plane
-typedef uint16_t GnssConfigLppeControlPlaneMask;
-typedef enum {
-    GNSS_CONFIG_LPPE_CONTROL_PLANE_DBH_BIT                  = (1<<0), // DBH
-    GNSS_CONFIG_LPPE_CONTROL_PLANE_WLAN_AP_MEASUREMENTS_BIT = (1<<1), // WLAN_AP_MEASUREMENTS
-    GNSS_CONFIG_LPPE_CONTROL_PLANE_SRN_AP_MEASUREMENTS_BIT = (1<<2), // SRN_AP_MEASUREMENTS
-    GNSS_CONFIG_LPPE_CONTROL_PLANE_SENSOR_BARO_MEASUREMENTS_BIT = (1<<3),
-                                                             // SENSOR_BARO_MEASUREMENTS
-} GnssConfigLppeControlPlaneBits;
-
-// Technology for LPPe User Plane
-typedef uint16_t GnssConfigLppeUserPlaneMask;
-typedef enum {
-    GNSS_CONFIG_LPPE_USER_PLANE_DBH_BIT                  = (1<<0), // DBH
-    GNSS_CONFIG_LPPE_USER_PLANE_WLAN_AP_MEASUREMENTS_BIT = (1<<1), // WLAN_AP_MEASUREMENTS
-    GNSS_CONFIG_LPPE_USER_PLANE_SRN_AP_MEASUREMENTS_BIT = (1<<2), // SRN_AP_MEASUREMENTS
-    GNSS_CONFIG_LPPE_USER_PLANE_SENSOR_BARO_MEASUREMENTS_BIT = (1<<3),
-                                                            // SENSOR_BARO_MEASUREMENTS
-} GnssConfigLppeUserPlaneBits;
-
-// Positioning Protocol on A-GLONASS system
-typedef uint16_t GnssConfigAGlonassPositionProtocolMask;
-typedef enum {
-    GNSS_CONFIG_RRC_CONTROL_PLANE_BIT = (1<<0),  // RRC Control Plane
-    GNSS_CONFIG_RRLP_USER_PLANE_BIT   = (1<<1),  // RRLP User Plane
-    GNSS_CONFIG_LLP_USER_PLANE_BIT    = (1<<2),  // LPP User Plane
-    GNSS_CONFIG_LLP_CONTROL_PLANE_BIT = (1<<3),  // LPP Control Plane
-} GnssConfigAGlonassPositionProtocolBits;
-
-typedef enum {
-    GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_NO = 0,
-    GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_YES,
-} GnssConfigEmergencyPdnForEmergencySupl;
-
-typedef enum {
-    GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_NO = 0,
-    GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_YES,
-} GnssConfigSuplEmergencyServices;
-
-typedef uint16_t GnssConfigSuplModeMask;
-typedef enum {
-    GNSS_CONFIG_SUPL_MODE_MSB_BIT = (1<<0),
-    GNSS_CONFIG_SUPL_MODE_MSA_BIT = (1<<1),
-} GnssConfigSuplModeBits;
-
-typedef uint32_t GnssConfigFlagsMask;
-typedef enum {
-    GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT                   = (1<<0),
-    GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT               = (1<<1),
-    GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT        = (1<<2),
-    GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT                = (1<<3),
-    GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT         = (1<<4),
-    GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT            = (1<<5),
-    GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT = (1<<6),
-    GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT         = (1<<7),
-    GNSS_CONFIG_FLAGS_SUPL_EM_SERVICES_BIT                 = (1<<8),
-    GNSS_CONFIG_FLAGS_SUPL_MODE_BIT                        = (1<<9),
-    GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT               = (1<<10)
-} GnssConfigFlagsBits;
-
-typedef enum {
-    GNSS_NI_ENCODING_TYPE_NONE = 0,
-    GNSS_NI_ENCODING_TYPE_GSM_DEFAULT,
-    GNSS_NI_ENCODING_TYPE_UTF8,
-    GNSS_NI_ENCODING_TYPE_UCS2,
-} GnssNiEncodingType;
-
-typedef enum {
-    GNSS_NI_TYPE_VOICE = 0,
-    GNSS_NI_TYPE_SUPL,
-    GNSS_NI_TYPE_CONTROL_PLANE,
-    GNSS_NI_TYPE_EMERGENCY_SUPL
-} GnssNiType;
-
-typedef uint16_t GnssNiOptionsMask;
-typedef enum {
-    GNSS_NI_OPTIONS_NOTIFICATION_BIT     = (1<<0),
-    GNSS_NI_OPTIONS_VERIFICATION_BIT     = (1<<1),
-    GNSS_NI_OPTIONS_PRIVACY_OVERRIDE_BIT = (1<<2),
-} GnssNiOptionsBits;
-
-typedef enum {
-    GNSS_NI_RESPONSE_ACCEPT = 1,
-    GNSS_NI_RESPONSE_DENY,
-    GNSS_NI_RESPONSE_NO_RESPONSE,
-    GNSS_NI_RESPONSE_IGNORE,
-} GnssNiResponse;
-
-typedef enum {
-    GNSS_SV_TYPE_UNKNOWN = 0,
-    GNSS_SV_TYPE_GPS,
-    GNSS_SV_TYPE_SBAS,
-    GNSS_SV_TYPE_GLONASS,
-    GNSS_SV_TYPE_QZSS,
-    GNSS_SV_TYPE_BEIDOU,
-    GNSS_SV_TYPE_GALILEO,
-} GnssSvType;
-
-typedef enum {
-    GNSS_EPH_TYPE_UNKNOWN = 0,
-    GNSS_EPH_TYPE_EPHEMERIS,
-    GNSS_EPH_TYPE_ALMANAC,
-} GnssEphemerisType;
-
-typedef enum {
-    GNSS_EPH_SOURCE_UNKNOWN = 0,
-    GNSS_EPH_SOURCE_DEMODULATED,
-    GNSS_EPH_SOURCE_SUPL_PROVIDED,
-    GNSS_EPH_SOURCE_OTHER_SERVER_PROVIDED,
-    GNSS_EPH_SOURCE_LOCAL,
-} GnssEphemerisSource;
-
-typedef enum {
-    GNSS_EPH_HEALTH_UNKNOWN = 0,
-    GNSS_EPH_HEALTH_GOOD,
-    GNSS_EPH_HEALTH_BAD,
-} GnssEphemerisHealth;
-
-typedef uint16_t GnssSvOptionsMask;
-typedef enum {
-    GNSS_SV_OPTIONS_HAS_EPHEMER_BIT =           (1<<0),
-    GNSS_SV_OPTIONS_HAS_ALMANAC_BIT =           (1<<1),
-    GNSS_SV_OPTIONS_USED_IN_FIX_BIT =           (1<<2),
-    GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT = (1<<3),
-} GnssSvOptionsBits;
-
-typedef enum {
-    GNSS_ASSISTANCE_TYPE_SUPL = 0,
-    GNSS_ASSISTANCE_TYPE_C2K,
-} GnssAssistanceType;
-
-typedef enum {
-    GNSS_SUPL_MODE_STANDALONE = 0,
-    GNSS_SUPL_MODE_MSB,
-    GNSS_SUPL_MODE_MSA,
-} GnssSuplMode;
-
-typedef enum {
-    BATCHING_MODE_ROUTINE = 0,   // positions are reported when batched positions memory is full
-    BATCHING_MODE_TRIP,          // positions are reported when a certain distance is covered
-    BATCHING_MODE_NO_AUTO_REPORT // no report of positions automatically, instead queried on demand
-} BatchingMode;
-
-typedef enum {
-    BATCHING_STATUS_TRIP_COMPLETED = 0,
-    BATCHING_STATUS_POSITION_AVAILABE,
-    BATCHING_STATUS_POSITION_UNAVAILABLE
-} BatchingStatus;
-
-typedef uint16_t GnssMeasurementsAdrStateMask;
-typedef enum {
-    GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_UNKNOWN         = 0,
-    GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_VALID_BIT       = (1<<0),
-    GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_RESET_BIT       = (1<<1),
-    GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_CYCLE_SLIP_BIT  = (1<<2),
-} GnssMeasurementsAdrStateBits;
-
-typedef uint32_t GnssMeasurementsDataFlagsMask;
-typedef enum {
-    GNSS_MEASUREMENTS_DATA_SV_ID_BIT                        = (1<<0),
-    GNSS_MEASUREMENTS_DATA_SV_TYPE_BIT                      = (1<<1),
-    GNSS_MEASUREMENTS_DATA_STATE_BIT                        = (1<<2),
-    GNSS_MEASUREMENTS_DATA_RECEIVED_SV_TIME_BIT             = (1<<3),
-    GNSS_MEASUREMENTS_DATA_RECEIVED_SV_TIME_UNCERTAINTY_BIT = (1<<4),
-    GNSS_MEASUREMENTS_DATA_CARRIER_TO_NOISE_BIT             = (1<<5),
-    GNSS_MEASUREMENTS_DATA_PSEUDORANGE_RATE_BIT             = (1<<6),
-    GNSS_MEASUREMENTS_DATA_PSEUDORANGE_RATE_UNCERTAINTY_BIT = (1<<7),
-    GNSS_MEASUREMENTS_DATA_ADR_STATE_BIT                    = (1<<8),
-    GNSS_MEASUREMENTS_DATA_ADR_BIT                          = (1<<9),
-    GNSS_MEASUREMENTS_DATA_ADR_UNCERTAINTY_BIT              = (1<<10),
-    GNSS_MEASUREMENTS_DATA_CARRIER_FREQUENCY_BIT            = (1<<11),
-    GNSS_MEASUREMENTS_DATA_CARRIER_CYCLES_BIT               = (1<<12),
-    GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_BIT                = (1<<13),
-    GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_UNCERTAINTY_BIT    = (1<<14),
-    GNSS_MEASUREMENTS_DATA_MULTIPATH_INDICATOR_BIT          = (1<<15),
-    GNSS_MEASUREMENTS_DATA_SIGNAL_TO_NOISE_RATIO_BIT        = (1<<16),
-    GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT       = (1<<17),
-} GnssMeasurementsDataFlagsBits;
-
-typedef uint32_t GnssMeasurementsStateMask;
-typedef enum {
-    GNSS_MEASUREMENTS_STATE_UNKNOWN_BIT               = 0,
-    GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT             = (1<<0),
-    GNSS_MEASUREMENTS_STATE_BIT_SYNC_BIT              = (1<<1),
-    GNSS_MEASUREMENTS_STATE_SUBFRAME_SYNC_BIT         = (1<<2),
-    GNSS_MEASUREMENTS_STATE_TOW_DECODED_BIT           = (1<<3),
-    GNSS_MEASUREMENTS_STATE_MSEC_AMBIGUOUS_BIT        = (1<<4),
-    GNSS_MEASUREMENTS_STATE_SYMBOL_SYNC_BIT           = (1<<5),
-    GNSS_MEASUREMENTS_STATE_GLO_STRING_SYNC_BIT       = (1<<6),
-    GNSS_MEASUREMENTS_STATE_GLO_TOD_DECODED_BIT       = (1<<7),
-    GNSS_MEASUREMENTS_STATE_BDS_D2_BIT_SYNC_BIT       = (1<<8),
-    GNSS_MEASUREMENTS_STATE_BDS_D2_SUBFRAME_SYNC_BIT  = (1<<9),
-    GNSS_MEASUREMENTS_STATE_GAL_E1BC_CODE_LOCK_BIT    = (1<<10),
-    GNSS_MEASUREMENTS_STATE_GAL_E1C_2ND_CODE_LOCK_BIT = (1<<11),
-    GNSS_MEASUREMENTS_STATE_GAL_E1B_PAGE_SYNC_BIT     = (1<<12),
-    GNSS_MEASUREMENTS_STATE_SBAS_SYNC_BIT             = (1<<13),
-} GnssMeasurementsStateBits;
-
-typedef enum {
-    GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_UNKNOWN = 0,
-    GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_PRESENT,
-    GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_NOT_PRESENT,
-} GnssMeasurementsMultipathIndicator;
-
-typedef uint32_t GnssMeasurementsClockFlagsMask;
-typedef enum {
-    GNSS_MEASUREMENTS_CLOCK_FLAGS_LEAP_SECOND_BIT                  = (1<<0),
-    GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_BIT                         = (1<<1),
-    GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_UNCERTAINTY_BIT             = (1<<2),
-    GNSS_MEASUREMENTS_CLOCK_FLAGS_FULL_BIAS_BIT                    = (1<<3),
-    GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_BIT                         = (1<<4),
-    GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_UNCERTAINTY_BIT             = (1<<5),
-    GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_BIT                        = (1<<6),
-    GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_UNCERTAINTY_BIT            = (1<<7),
-    GNSS_MEASUREMENTS_CLOCK_FLAGS_HW_CLOCK_DISCONTINUITY_COUNT_BIT = (1<<8),
-} GnssMeasurementsClockFlagsBits;
-
-typedef uint32_t GnssAidingDataSvMask;
-typedef enum {
-    GNSS_AIDING_DATA_SV_EPHEMERIS_BIT    = (1<<0), // ephemeris
-    GNSS_AIDING_DATA_SV_ALMANAC_BIT      = (1<<1), // almanac
-    GNSS_AIDING_DATA_SV_HEALTH_BIT       = (1<<2), // health
-    GNSS_AIDING_DATA_SV_DIRECTION_BIT    = (1<<3), // direction
-    GNSS_AIDING_DATA_SV_STEER_BIT        = (1<<4), // steer
-    GNSS_AIDING_DATA_SV_ALMANAC_CORR_BIT = (1<<5), // almanac correction
-    GNSS_AIDING_DATA_SV_BLACKLIST_BIT    = (1<<6), // blacklist SVs
-    GNSS_AIDING_DATA_SV_SA_DATA_BIT      = (1<<7), // sensitivity assistance data
-    GNSS_AIDING_DATA_SV_NO_EXIST_BIT     = (1<<8), // SV does not exist
-    GNSS_AIDING_DATA_SV_IONOSPHERE_BIT   = (1<<9), // ionosphere correction
-    GNSS_AIDING_DATA_SV_TIME_BIT         = (1<<10),// reset satellite time
-} GnssAidingDataSvBits;
-
-typedef uint32_t GnssAidingDataSvTypeMask;
-typedef enum {
-    GNSS_AIDING_DATA_SV_TYPE_GPS_BIT      = (1<<0),
-    GNSS_AIDING_DATA_SV_TYPE_GLONASS_BIT  = (1<<1),
-    GNSS_AIDING_DATA_SV_TYPE_QZSS_BIT     = (1<<2),
-    GNSS_AIDING_DATA_SV_TYPE_BEIDOU_BIT   = (1<<3),
-    GNSS_AIDING_DATA_SV_TYPE_GALILEO_BIT  = (1<<4),
-} GnssAidingDataSvTypeBits;
-
-typedef struct {
-    GnssAidingDataSvMask svMask;         // bitwise OR of GnssAidingDataSvBits
-    GnssAidingDataSvTypeMask svTypeMask; // bitwise OR of GnssAidingDataSvTypeBits
-} GnssAidingDataSv;
-
-typedef uint32_t GnssAidingDataCommonMask;
-typedef enum {
-    GNSS_AIDING_DATA_COMMON_POSITION_BIT      = (1<<0), // position estimate
-    GNSS_AIDING_DATA_COMMON_TIME_BIT          = (1<<1), // reset all clock values
-    GNSS_AIDING_DATA_COMMON_UTC_BIT           = (1<<2), // UTC estimate
-    GNSS_AIDING_DATA_COMMON_RTI_BIT           = (1<<3), // RTI
-    GNSS_AIDING_DATA_COMMON_FREQ_BIAS_EST_BIT = (1<<4), // frequency bias estimate
-    GNSS_AIDING_DATA_COMMON_CELLDB_BIT        = (1<<5), // all celldb info
-} GnssAidingDataCommonBits;
-
-typedef struct {
-    GnssAidingDataCommonMask mask; // bitwise OR of GnssAidingDataCommonBits
-} GnssAidingDataCommon;
-
-typedef struct {
-    bool deleteAll;              // if true, delete all aiding data and ignore other params
-    GnssAidingDataSv sv;         // SV specific aiding data
-    GnssAidingDataCommon common; // common aiding data
-} GnssAidingData;
-
-typedef struct {
-    size_t size;             // set to sizeof(Location)
-    LocationFlagsMask flags; // bitwise OR of LocationFlagsBits to mark which params are valid
-    uint64_t timestamp;      // UTC timestamp for location fix, milliseconds since January 1, 1970
-    double latitude;         // in degrees
-    double longitude;        // in degrees
-    double altitude;         // in meters above the WGS 84 reference ellipsoid
-    float speed;             // in meters per second
-    float bearing;           // in degrees; range [0, 360)
-    float accuracy;          // in meters
-    float verticalAccuracy;  // in meters
-    float speedAccuracy;     // in meters/second
-    float bearingAccuracy;   // in degrees (0 to 359.999)
-    LocationTechnologyMask techMask;
-} Location;
-
-struct LocationOptions {
-    size_t size;          // set to sizeof(LocationOptions)
-    uint32_t minInterval; // in milliseconds
-    uint32_t minDistance; // in meters. if minDistance > 0, gnssSvCallback/gnssNmeaCallback/
-                          // gnssMeasurementsCallback may not be called
-    GnssSuplMode mode;    // Standalone/MS-Based/MS-Assisted
-
-    inline LocationOptions() :
-            size(0), minInterval(0), minDistance(0), mode(GNSS_SUPL_MODE_STANDALONE) {}
-};
-
-typedef enum {
-    GNSS_POWER_MODE_INVALID = 0,
-    GNSS_POWER_MODE_M1,  /* Improved Accuracy Mode */
-    GNSS_POWER_MODE_M2,  /* Normal Mode */
-    GNSS_POWER_MODE_M3,  /* Background Mode */
-    GNSS_POWER_MODE_M4,  /* Background Mode */
-    GNSS_POWER_MODE_M5   /* Background Mode */
-} GnssPowerMode;
-
-struct TrackingOptions : LocationOptions {
-    GnssPowerMode powerMode; /* Power Mode to be used for time based tracking
-                                sessions */
-    uint32_t tbm;  /* Time interval between measurements specified in millis.
-                      Applicable to background power modes */
-
-    inline TrackingOptions() :
-            LocationOptions(), powerMode(GNSS_POWER_MODE_INVALID), tbm(0) {}
-    inline TrackingOptions(size_t s, GnssPowerMode m, uint32_t t) :
-            LocationOptions(), powerMode(m), tbm(t) { LocationOptions::size = s; }
-    inline TrackingOptions(const LocationOptions& options) :
-            LocationOptions(options), powerMode(GNSS_POWER_MODE_INVALID), tbm(0) {}
-    inline void setLocationOptions(const LocationOptions& options) {
-        minInterval = options.minInterval;
-        minDistance = options.minDistance;
-        mode = options.mode;
-    }
-};
-
-struct BatchingOptions : LocationOptions {
-    BatchingMode batchingMode;
-
-    inline BatchingOptions() :
-            LocationOptions(), batchingMode(BATCHING_MODE_ROUTINE) {}
-    inline BatchingOptions(size_t s, BatchingMode m) :
-            LocationOptions(), batchingMode(m) { LocationOptions::size = s; }
-    inline BatchingOptions(const LocationOptions& options) :
-            LocationOptions(options), batchingMode(BATCHING_MODE_ROUTINE) {}
-    inline void setLocationOptions(const LocationOptions& options) {
-        minInterval = options.minInterval;
-        minDistance = options.minDistance;
-        mode = options.mode;
-    }
-};
-
-typedef struct {
-    size_t size;
-    BatchingStatus batchingStatus;
-} BatchingStatusInfo;
-
-typedef struct {
-    size_t size;                            // set to sizeof(GeofenceOption)
-    GeofenceBreachTypeMask breachTypeMask;  // bitwise OR of GeofenceBreachTypeBits
-    uint32_t responsiveness;                // in milliseconds
-    uint32_t dwellTime;                     // in seconds
-} GeofenceOption;
-
-typedef struct  {
-    size_t size;      // set to sizeof(GeofenceInfo)
-    double latitude;  // in degrees
-    double longitude; // in degrees
-    double radius;    // in meters
-} GeofenceInfo;
-
-typedef struct {
-    size_t size;             // set to sizeof(GeofenceBreachNotification)
-    size_t count;            // number of ids in array
-    uint32_t* ids;           // array of ids that have breached
-    Location location;       // location associated with breach
-    GeofenceBreachType type; // type of breach
-    uint64_t timestamp;      // timestamp of breach
-} GeofenceBreachNotification;
-
-typedef struct {
-    size_t size;                       // set to sizeof(GeofenceBreachNotification)
-    GeofenceStatusAvailable available; // GEOFENCE_STATUS_AVAILABILE_NO/_YES
-    LocationTechnologyType techType;   // GNSS
-} GeofenceStatusNotification;
-
-typedef struct {
-    size_t size;                        // set to sizeof(GnssLocationInfo)
-    GnssLocationInfoFlagMask flags;     // bitwise OR of GnssLocationInfoBits for param validity
-    float altitudeMeanSeaLevel;         // altitude wrt mean sea level
-    float pdop;                         // position dilusion of precision
-    float hdop;                         // horizontal dilusion of precision
-    float vdop;                         // vertical dilusion of precision
-    float magneticDeviation;            // magnetic deviation
-    LocationReliability horReliability; // horizontal reliability
-    LocationReliability verReliability; // vertical reliability
-    float horUncEllipseSemiMajor;       // horizontal elliptical accuracy semi-major axis
-    float horUncEllipseSemiMinor;       // horizontal elliptical accuracy semi-minor axis
-    float horUncEllipseOrientAzimuth;   // horizontal elliptical accuracy azimuth
-} GnssLocationInfoNotification;
-
-typedef struct {
-    size_t size;                           // set to sizeof(GnssNiNotification)
-    GnssNiType type;                       // type of NI (Voice, SUPL, Control Plane)
-    GnssNiOptionsMask options;             // bitwise OR of GnssNiOptionsBits
-    uint32_t timeout;                      // time (seconds) to wait for user input
-    GnssNiResponse timeoutResponse;        // the response that should be sent when timeout expires
-    char requestor[GNSS_NI_REQUESTOR_MAX]; // the requestor that is making the request
-    GnssNiEncodingType requestorEncoding;  // the encoding type for requestor
-    char message[GNSS_NI_MESSAGE_ID_MAX];  // the message to show user
-    GnssNiEncodingType messageEncoding;    // the encoding type for message
-    char extras[GNSS_NI_MESSAGE_ID_MAX];
-} GnssNiNotification;
-
-typedef struct {
-    size_t size;       // set to sizeof(GnssSv)
-    uint16_t svId;     // Unique Identifier
-    GnssSvType type;   // type of SV (GPS, SBAS, GLONASS, QZSS, BEIDOU, GALILEO)
-    float cN0Dbhz;     // signal strength
-    float elevation;   // elevation of SV (in degrees)
-    float azimuth;     // azimuth of SV (in degrees)
-    GnssSvOptionsMask gnssSvOptionsMask; // Bitwise OR of GnssSvOptionsBits
-    float carrierFrequencyHz; // carrier frequency of the signal tracked
-} GnssSv;
-
-struct GnssConfigSetAssistanceServer {
-    size_t size;             // set to sizeof(GnssConfigSetAssistanceServer)
-    GnssAssistanceType type; // SUPL or C2K
-    const char* hostName;    // null terminated string
-    uint32_t port;           // port of server
-
-    inline bool equals(const GnssConfigSetAssistanceServer& config) {
-        if (config.type == type && config.port == port &&
-               ((NULL == config.hostName && NULL == hostName) ||
-                (NULL != config.hostName && NULL != hostName &&
-                     0 == strcmp(config.hostName, hostName)))) {
-            return true;
-        }
-        return false;
-    }
-};
-
-typedef struct {
-    size_t size;                               // set to sizeof(GnssMeasurementsData)
-    GnssMeasurementsDataFlagsMask flags;       // bitwise OR of GnssMeasurementsDataFlagsBits
-    int16_t svId;
-    GnssSvType svType;
-    double timeOffsetNs;
-    GnssMeasurementsStateMask stateMask;       // bitwise OR of GnssMeasurementsStateBits
-    int64_t receivedSvTimeNs;
-    int64_t receivedSvTimeUncertaintyNs;
-    double carrierToNoiseDbHz;
-    double pseudorangeRateMps;
-    double pseudorangeRateUncertaintyMps;
-    GnssMeasurementsAdrStateMask adrStateMask; // bitwise OR of GnssMeasurementsAdrStateBits
-    double adrMeters;
-    double adrUncertaintyMeters;
-    float carrierFrequencyHz;
-    int64_t carrierCycles;
-    double carrierPhase;
-    double carrierPhaseUncertainty;
-    GnssMeasurementsMultipathIndicator multipathIndicator;
-    double signalToNoiseRatioDb;
-    double agcLevelDb;
-} GnssMeasurementsData;
-
-typedef struct {
-    size_t size;                          // set to sizeof(GnssMeasurementsClock)
-    GnssMeasurementsClockFlagsMask 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;
-} GnssMeasurementsClock;
-
-typedef struct {
-    size_t size;                 // set to sizeof(GnssSvNotification)
-    size_t count;                // number of SVs in the GnssSv array
-    GnssSv gnssSvs[GNSS_SV_MAX]; // information on a number of SVs
-} GnssSvNotification;
-
-typedef struct {
-    size_t size;         // set to sizeof(GnssNmeaNotification)
-    uint64_t timestamp;  // timestamp
-    const char* nmea;    // nmea text
-    size_t length;       // length of the nmea text
-} GnssNmeaNotification;
-
-typedef struct {
-    size_t size;         // set to sizeof(GnssMeasurementsNotification)
-    size_t count;        // number of items in GnssMeasurements array
-    GnssMeasurementsData measurements[GNSS_MEASUREMENTS_MAX];
-    GnssMeasurementsClock clock; // clock
-} GnssMeasurementsNotification;
-
-typedef uint32_t GnssSvId;
-
-struct GnssSvIdSource{
-    size_t size;                 // set to sizeof(GnssSvIdSource)
-    GnssSvType constellation;    // constellation for the sv to blacklist
-    GnssSvId svId;           // sv id to blacklist
-};
-inline bool operator ==(GnssSvIdSource const& left, GnssSvIdSource const& right) {
-    return left.size == right.size &&
-            left.constellation == right.constellation && left.svId == right.svId;
-}
-
-#define GNSS_SV_CONFIG_ALL_BITS_ENABLED_MASK ((uint64_t)0xFFFFFFFFFFFFFFFF)
-typedef struct {
-    size_t size; // set to sizeof(GnssSvIdConfig)
-
-    // GLONASS - SV 65 maps to bit 0
-#define GNSS_SV_CONFIG_GLO_INITIAL_SV_ID 65
-#define GNSS_SV_CONFIG_GLO_LAST_SV_ID 88
-    uint64_t gloBlacklistSvMask;
-
-    // BEIDOU - SV 201 maps to bit 0
-#define GNSS_SV_CONFIG_BDS_INITIAL_SV_ID 201
-#define GNSS_SV_CONFIG_BDS_LAST_SV_ID 237
-    uint64_t bdsBlacklistSvMask;
-
-    // QZSS - SV 193 maps to bit 0
-#define GNSS_SV_CONFIG_QZSS_INITIAL_SV_ID 193
-#define GNSS_SV_CONFIG_QZSS_LAST_SV_ID 200
-    uint64_t qzssBlacklistSvMask;
-
-    // GAL - SV 301 maps to bit 0
-#define GNSS_SV_CONFIG_GAL_INITIAL_SV_ID 301
-#define GNSS_SV_CONFIG_GAL_LAST_SV_ID 336
-    uint64_t galBlacklistSvMask;
-} GnssSvIdConfig;
-
-struct GnssConfig{
-    size_t size;  // set to sizeof(GnssConfig)
-    GnssConfigFlagsMask flags; // bitwise OR of GnssConfigFlagsBits to mark which params are valid
-    GnssConfigGpsLock gpsLock;
-    GnssConfigSuplVersion suplVersion;
-    GnssConfigSetAssistanceServer assistanceServer;
-    GnssConfigLppProfile lppProfile;
-    GnssConfigLppeControlPlaneMask lppeControlPlaneMask;
-    GnssConfigLppeUserPlaneMask lppeUserPlaneMask;
-    GnssConfigAGlonassPositionProtocolMask aGlonassPositionProtocolMask;
-    GnssConfigEmergencyPdnForEmergencySupl emergencyPdnForEmergencySupl;
-    GnssConfigSuplEmergencyServices suplEmergencyServices;
-    GnssConfigSuplModeMask suplModeMask; //bitwise OR of GnssConfigSuplModeBits
-    std::vector<GnssSvIdSource> blacklistedSvIds;
-
-    inline bool equals(const GnssConfig& config) {
-        if (flags == config.flags &&
-                gpsLock == config.gpsLock &&
-                suplVersion == config.suplVersion &&
-                assistanceServer.equals(config.assistanceServer) &&
-                lppProfile == config.lppProfile &&
-                lppeControlPlaneMask == config.lppeControlPlaneMask &&
-                lppeUserPlaneMask == config.lppeUserPlaneMask &&
-                aGlonassPositionProtocolMask == config.aGlonassPositionProtocolMask &&
-                emergencyPdnForEmergencySupl == config.emergencyPdnForEmergencySupl &&
-                suplEmergencyServices == config.suplEmergencyServices &&
-                suplModeMask == config.suplModeMask  &&
-                blacklistedSvIds == config.blacklistedSvIds) {
-            return true;
-        }
-        return false;
-    }
-};
-
-typedef struct {
-    size_t size;                        // set to sizeof
-    bool                                mValid;
-    Location                            mLocation;
-    double                              verticalAccuracyMeters;
-    double                              speedAccuracyMetersPerSecond;
-    double                              bearingAccuracyDegrees;
-    timespec                            mUtcReported;
-} GnssDebugLocation;
-
-typedef struct {
-    size_t size;                        // set to sizeof
-    bool                                mValid;
-    int64_t                             timeEstimate;
-    float                               timeUncertaintyNs;
-    float                               frequencyUncertaintyNsPerSec;
-} GnssDebugTime;
-
-typedef struct {
-    size_t size;                        // set to sizeof
-    uint32_t                            svid;
-    GnssSvType                          constellation;
-    GnssEphemerisType                   mEphemerisType;
-    GnssEphemerisSource                 mEphemerisSource;
-    GnssEphemerisHealth                 mEphemerisHealth;
-    float                               ephemerisAgeSeconds;
-    bool                                serverPredictionIsAvailable;
-    float                               serverPredictionAgeSeconds;
-} GnssDebugSatelliteInfo;
-
-typedef struct {
-    size_t size;                        // set to sizeof
-    GnssDebugLocation                   mLocation;
-    GnssDebugTime                       mTime;
-    std::vector<GnssDebugSatelliteInfo> mSatelliteInfo;
-} GnssDebugReport;
-
-/* Provides the capabilities of the system
-   capabilities callback is called once soon after createInstance is called */
-typedef std::function<void(
-    LocationCapabilitiesMask capabilitiesMask // bitwise OR of LocationCapabilitiesBits
-)> capabilitiesCallback;
-
-/* Used by tracking, batching, and miscellanous APIs
-   responseCallback is called for every Tracking, Batching API, and Miscellanous API */
-typedef std::function<void(
-    LocationError err, // if not SUCCESS, then id is not valid
-    uint32_t id        // id to be associated to the request
-)> responseCallback;
-
-/* Used by APIs that gets more than one LocationError in it's response
-   collectiveResponseCallback is called for every geofence API call.
-   ids array and LocationError array are only valid until collectiveResponseCallback returns. */
-typedef std::function<void(
-    size_t count, // number of locations in arrays
-    LocationError* errs, // array of LocationError associated to the request
-    uint32_t* ids // array of ids to be associated to the request
-)> collectiveResponseCallback;
-
-/* Used for startTracking API, optional can be NULL
-   trackingCallback is called when delivering a location in a tracking session
-   broadcasted to all clients, no matter if a session has started by client */
-typedef std::function<void(
-    Location location
-)> trackingCallback;
-
-/* Used for startBatching API, optional can be NULL
-   batchingCallback is called when delivering locations in a batching session.
-   broadcasted to all clients, no matter if a session has started by client */
-typedef std::function<void(
-    size_t count,      // number of locations in array
-    Location* location, // array of locations
-    BatchingOptions batchingOptions // Batching options
-)> batchingCallback;
-
-typedef std::function<void(
-    BatchingStatusInfo batchingStatus, // batch status
-    std::list<uint32_t> & listOfCompletedTrips
-)> batchingStatusCallback;
-
-/* Gives GNSS Location information, optional can be NULL
-    gnssLocationInfoCallback is called only during a tracking session
-    broadcasted to all clients, no matter if a session has started by client */
-typedef std::function<void(
-    GnssLocationInfoNotification gnssLocationInfoNotification
-)> gnssLocationInfoCallback;
-
-/* Used for addGeofences API, optional can be NULL
-   geofenceBreachCallback is called when any number of geofences have a state change */
-typedef std::function<void(
-    GeofenceBreachNotification geofenceBreachNotification
-)> geofenceBreachCallback;
-
-/* Used for addGeofences API, optional can be NULL
-       geofenceStatusCallback is called when any number of geofences have a status change */
-typedef std::function<void(
-    GeofenceStatusNotification geofenceStatusNotification
-)> geofenceStatusCallback;
-
-/* Network Initiated request, optional can be NULL
-   This callback should be responded to by calling gnssNiResponse */
-typedef std::function<void(
-    uint32_t id, // id that should be used to respond by calling gnssNiResponse
-    GnssNiNotification gnssNiNotification
-)> gnssNiCallback;
-
-/* Gives GNSS SV information, optional can be NULL
-    gnssSvCallback is called only during a tracking session
-    broadcasted to all clients, no matter if a session has started by client */
-typedef std::function<void(
-    GnssSvNotification gnssSvNotification
-)> gnssSvCallback;
-
-/* Gives GNSS NMEA data, optional can be NULL
-    gnssNmeaCallback is called only during a tracking session
-    broadcasted to all clients, no matter if a session has started by client */
-typedef std::function<void(
-    GnssNmeaNotification gnssNmeaNotification
-)> gnssNmeaCallback;
-
-/* Gives GNSS Measurements information, optional can be NULL
-    gnssMeasurementsCallback is called only during a tracking session
-    broadcasted to all clients, no matter if a session has started by client */
-typedef std::function<void(
-    GnssMeasurementsNotification gnssMeasurementsNotification
-)> gnssMeasurementsCallback;
-
-/* Provides the current GNSS configuration to the client */
-typedef std::function<void(
-    GnssConfig& config
-)> gnssConfigCallback;
-
-typedef struct {
-    size_t size; // set to sizeof(LocationCallbacks)
-    capabilitiesCallback capabilitiesCb;             // mandatory
-    responseCallback responseCb;                     // mandatory
-    collectiveResponseCallback collectiveResponseCb; // mandatory
-    trackingCallback trackingCb;                     // optional
-    batchingCallback batchingCb;                     // optional
-    geofenceBreachCallback geofenceBreachCb;         // optional
-    geofenceStatusCallback geofenceStatusCb;         // optional
-    gnssLocationInfoCallback gnssLocationInfoCb;     // optional
-    gnssNiCallback gnssNiCb;                         // optional
-    gnssSvCallback gnssSvCb;                         // optional
-    gnssNmeaCallback gnssNmeaCb;                     // optional
-    gnssMeasurementsCallback gnssMeasurementsCb;     // optional
-    batchingStatusCallback batchingStatusCb;         // optional
-} LocationCallbacks;
-
-class LocationAPI
+class LocationAPI : public ILocationAPI
 {
 private:
     LocationAPI();
@@ -901,7 +51,7 @@
     /* updates/changes the callbacks that will be called.
         mandatory callbacks must be present for callbacks to be successfully updated
         no return value */
-    void updateCallbacks(LocationCallbacks&);
+    virtual void updateCallbacks(LocationCallbacks&) override;
 
     /* ================================== TRACKING ================================== */
 
@@ -914,20 +64,20 @@
                 LOCATION_ERROR_ALREADY_STARTED if a startTracking session is already in progress
                 LOCATION_ERROR_CALLBACK_MISSING if no trackingCallback was passed in createInstance
                 LOCATION_ERROR_INVALID_PARAMETER if TrackingOptions parameter is invalid */
-    uint32_t startTracking(TrackingOptions&); // returns session id
+    virtual uint32_t startTracking(TrackingOptions&) override;
 
     /* stopTracking stops a tracking session associated with id parameter.
         responseCallback returns:
                 LOCATION_ERROR_SUCCESS if successful
                 LOCATION_ERROR_ID_UNKNOWN if id is not associated with a tracking session */
-    void stopTracking(uint32_t id);
+    virtual void stopTracking(uint32_t id) override;
 
     /* updateTrackingOptions changes the TrackingOptions of a tracking session associated with id
         responseCallback returns:
                 LOCATION_ERROR_SUCCESS if successful
                 LOCATION_ERROR_INVALID_PARAMETER if TrackingOptions parameters are invalid
                 LOCATION_ERROR_ID_UNKNOWN if id is not associated with a tracking session */
-    void updateTrackingOptions(uint32_t id, TrackingOptions&);
+    virtual void updateTrackingOptions(uint32_t id, TrackingOptions&) override;
 
     /* ================================== BATCHING ================================== */
 
@@ -946,20 +96,20 @@
                 LOCATION_ERROR_CALLBACK_MISSING if no batchingCallback was passed in createInstance
                 LOCATION_ERROR_INVALID_PARAMETER if a parameter is invalid
                 LOCATION_ERROR_NOT_SUPPORTED if batching is not supported */
-    uint32_t startBatching(BatchingOptions&); // returns session id
+    virtual uint32_t startBatching(BatchingOptions&) override;
 
     /* stopBatching stops a batching session associated with id parameter.
         responseCallback returns:
                 LOCATION_ERROR_SUCCESS if successful
                 LOCATION_ERROR_ID_UNKNOWN if id is not associated with batching session */
-    void stopBatching(uint32_t id);
+    virtual void stopBatching(uint32_t id) override;
 
     /* updateBatchingOptions changes the BatchingOptions of a batching session associated with id
         responseCallback returns:
                 LOCATION_ERROR_SUCCESS if successful
                 LOCATION_ERROR_INVALID_PARAMETER if BatchingOptions parameters are invalid
                 LOCATION_ERROR_ID_UNKNOWN if id is not associated with a batching session */
-    void updateBatchingOptions(uint32_t id, BatchingOptions&);
+    virtual void updateBatchingOptions(uint32_t id, BatchingOptions&) override;
 
     /* getBatchedLocations gets a number of locations that are currently stored/batched
        on the low power processor, delivered by the batchingCallback passed in createInstance.
@@ -968,7 +118,7 @@
                 LOCATION_ERROR_SUCCESS if successful, will be followed by batchingCallback call
                 LOCATION_ERROR_CALLBACK_MISSING if no batchingCallback was passed in createInstance
                 LOCATION_ERROR_ID_UNKNOWN if id is not associated with a batching session */
-    void getBatchedLocations(uint32_t id, size_t count);
+    virtual void getBatchedLocations(uint32_t id, size_t count) override;
 
     /* ================================== GEOFENCE ================================== */
 
@@ -982,14 +132,14 @@
                 LOCATION_ERROR_CALLBACK_MISSING if no geofenceBreachCallback
                 LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
                 LOCATION_ERROR_NOT_SUPPORTED if geofence is not supported */
-    uint32_t* addGeofences(size_t count, GeofenceOption*, GeofenceInfo*); // returns id array
+    virtual uint32_t* addGeofences(size_t count, GeofenceOption*, GeofenceInfo*) override;
 
     /* removeGeofences removes any number of geofences. Caller should delete ids array after
        removeGeofences returneds.
         collectiveResponseCallback returns:
                 LOCATION_ERROR_SUCCESS if successful
                 LOCATION_ERROR_ID_UNKNOWN if id is not associated with a geofence session */
-    void removeGeofences(size_t count, uint32_t* ids);
+    virtual void removeGeofences(size_t count, uint32_t* ids) override;
 
     /* modifyGeofences modifies any number of geofences. Caller should delete ids array after
        modifyGeofences returns.
@@ -997,7 +147,7 @@
                 LOCATION_ERROR_SUCCESS if successful
                 LOCATION_ERROR_ID_UNKNOWN if id is not associated with a geofence session
                 LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid */
-    void modifyGeofences(size_t count, uint32_t* ids, GeofenceOption* options);
+    virtual void modifyGeofences(size_t count, uint32_t* ids, GeofenceOption* options) override;
 
     /* pauseGeofences pauses any number of geofences, which is similar to removeGeofences,
        only that they can be resumed at any time. Caller should delete ids array after
@@ -1005,14 +155,14 @@
         collectiveResponseCallback returns:
                 LOCATION_ERROR_SUCCESS if successful
                 LOCATION_ERROR_ID_UNKNOWN if id is not associated with a geofence session */
-    void pauseGeofences(size_t count, uint32_t* ids);
+    virtual void pauseGeofences(size_t count, uint32_t* ids) override;
 
     /* resumeGeofences resumes any number of geofences that are currently paused. Caller should
        delete ids array after resumeGeofences returns.
         collectiveResponseCallback returns:
                 LOCATION_ERROR_SUCCESS if successful
                 LOCATION_ERROR_ID_UNKNOWN if id is not associated with a geofence session */
-    void resumeGeofences(size_t count, uint32_t* ids);
+    virtual void resumeGeofences(size_t count, uint32_t* ids) override;
 
     /* ================================== GNSS ====================================== */
 
@@ -1021,7 +171,7 @@
                 LOCATION_ERROR_SUCCESS if session was successful
                 LOCATION_ERROR_INVALID_PARAMETER if any parameters in GnssNiResponse are invalid
                 LOCATION_ERROR_ID_UNKNOWN if id does not match a gnssNiCallback */
-    void gnssNiResponse(uint32_t id, GnssNiResponse response);
+    virtual void gnssNiResponse(uint32_t id, GnssNiResponse response) override;
 };
 
 typedef struct {
@@ -1031,7 +181,7 @@
     gnssConfigCallback gnssConfigCb;                 // optional
 } LocationControlCallbacks;
 
-class LocationControlAPI
+class LocationControlAPI : public ILocationControlAPI
 {
 private:
     LocationControlAPI();
@@ -1080,7 +230,7 @@
                 LOCATION_ERROR_SUCCESS if session was successful
                 LOCATION_ERROR_INVALID_PARAMETER if any other parameters are invalid
                 LOCATION_ERROR_GENERAL_FAILURE if failure for any other reason */
-    uint32_t* gnssUpdateConfig(GnssConfig config);
+    virtual uint32_t* gnssUpdateConfig(GnssConfig config) override;
 
     /* gnssGetConfig fetches the current constellation and SV configuration
        on the GNSS engine.
@@ -1104,7 +254,7 @@
                 LOCATION_ERROR_SUCCESS if successful
                 LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
                 LOCATION_ERROR_NOT_SUPPORTED if build is not userdebug */
-    uint32_t gnssDeleteAidingData(GnssAidingData& data);
+    virtual uint32_t gnssDeleteAidingData(GnssAidingData& data) override;
 };
 
-#endif /* LOCATION_H */
+#endif /* LOCATIONAPI_H */
diff --git a/sdm845/location/LocationDataTypes.h b/sdm845/location/LocationDataTypes.h
new file mode 100644
index 0000000..7152151
--- /dev/null
+++ b/sdm845/location/LocationDataTypes.h
@@ -0,0 +1,1087 @@
+/* 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 LOCATIONDATATYPES_H
+#define LOCATIONDATATYPES_H
+
+#include <vector>
+#include <stdint.h>
+#include <functional>
+#include <list>
+
+#define GNSS_NI_REQUESTOR_MAX  (256)
+#define GNSS_NI_MESSAGE_ID_MAX (2048)
+#define GNSS_SV_MAX            (64)
+#define GNSS_MEASUREMENTS_MAX  (64)
+#define GNSS_UTC_TIME_OFFSET   (3657)
+
+#define GNSS_BUGREPORT_GPS_MIN  (1)
+#define GNSS_BUGREPORT_SBAS_MIN (120)
+#define GNSS_BUGREPORT_GLO_MIN  (1)
+#define GNSS_BUGREPORT_QZSS_MIN (193)
+#define GNSS_BUGREPORT_BDS_MIN  (1)
+#define GNSS_BUGREPORT_GAL_MIN  (1)
+
+typedef enum {
+    LOCATION_ERROR_SUCCESS = 0,
+    LOCATION_ERROR_GENERAL_FAILURE,
+    LOCATION_ERROR_CALLBACK_MISSING,
+    LOCATION_ERROR_INVALID_PARAMETER,
+    LOCATION_ERROR_ID_EXISTS,
+    LOCATION_ERROR_ID_UNKNOWN,
+    LOCATION_ERROR_ALREADY_STARTED,
+    LOCATION_ERROR_GEOFENCES_AT_MAX,
+    LOCATION_ERROR_NOT_SUPPORTED
+} LocationError;
+
+// Flags to indicate which values are valid in a Location
+typedef uint16_t LocationFlagsMask;
+typedef enum {
+    LOCATION_HAS_LAT_LONG_BIT          = (1<<0), // location has valid latitude and longitude
+    LOCATION_HAS_ALTITUDE_BIT          = (1<<1), // location has valid altitude
+    LOCATION_HAS_SPEED_BIT             = (1<<2), // location has valid speed
+    LOCATION_HAS_BEARING_BIT           = (1<<3), // location has valid bearing
+    LOCATION_HAS_ACCURACY_BIT          = (1<<4), // location has valid accuracy
+    LOCATION_HAS_VERTICAL_ACCURACY_BIT = (1<<5), // location has valid vertical accuracy
+    LOCATION_HAS_SPEED_ACCURACY_BIT    = (1<<6), // location has valid speed accuracy
+    LOCATION_HAS_BEARING_ACCURACY_BIT  = (1<<7), // location has valid bearing accuracy
+} LocationFlagsBits;
+
+typedef uint16_t LocationTechnologyMask;
+typedef enum {
+    LOCATION_TECHNOLOGY_GNSS_BIT     = (1<<0), // location was calculated using GNSS
+    LOCATION_TECHNOLOGY_CELL_BIT     = (1<<1), // location was calculated using Cell
+    LOCATION_TECHNOLOGY_WIFI_BIT     = (1<<2), // location was calculated using WiFi
+    LOCATION_TECHNOLOGY_SENSORS_BIT  = (1<<3), // location was calculated using Sensors
+} LocationTechnologyBits;
+
+typedef enum {
+    LOCATION_RELIABILITY_NOT_SET = 0,
+    LOCATION_RELIABILITY_VERY_LOW,
+    LOCATION_RELIABILITY_LOW,
+    LOCATION_RELIABILITY_MEDIUM,
+    LOCATION_RELIABILITY_HIGH,
+} LocationReliability;
+
+typedef uint32_t GnssLocationNavSolutionMask;
+typedef enum {
+    LOCATION_SBAS_CORRECTION_IONO_BIT  = (1<<0), // SBAS ionospheric correction is used
+    LOCATION_SBAS_CORRECTION_FAST_BIT  = (1<<1), // SBAS fast correction is used
+    LOCATION_SBAS_CORRECTION_LONG_BIT  = (1<<2), // SBAS long-tem correction is used
+    LOCATION_SBAS_INTEGRITY_BIT        = (1<<3), // SBAS integrity information is used
+    LOCATION_NAV_CORRECTION_DGNSS_BIT  = (1<<4), // Position Report is DGNSS corrected
+    LOCATION_NAV_CORRECTION_RTK_BIT    = (1<<5), // Position Report is RTK corrected
+    LOCATION_NAV_CORRECTION_PPP_BIT    = (1<<6) // Position Report is PPP corrected
+} GnssLocationNavSolutionBits;
+
+typedef uint32_t GnssLocationPosTechMask;
+typedef enum {
+    LOCATION_POS_TECH_DEFAULT_BIT                  = 0,
+    LOCATION_POS_TECH_SATELLITE_BIT                = (1<<0),
+    LOCATION_POS_TECH_CELLID_BIT                   = (1<<1),
+    LOCATION_POS_TECH_WIFI_BIT                     = (1<<2),
+    LOCATION_POS_TECH_SENSORS_BIT                  = (1<<3),
+    LOCATION_POS_TECH_REFERENCE_LOCATION_BIT       = (1<<4),
+    LOCATION_POS_TECH_INJECTED_COARSE_POSITION_BIT = (1<<5),
+    LOCATION_POS_TECH_AFLT_BIT                     = (1<<6),
+    LOCATION_POS_TECH_HYBRID_BIT                   = (1<<7),
+    LOCATION_POS_TECH_PPE_BIT                      = (1<<8)
+} GnssLocationPosTechBits;
+
+typedef uint32_t GnssLocationPosDataMask;
+typedef enum {
+    LOCATION_NAV_DATA_HAS_LONG_ACCEL_BIT  = (1<<0), // Navigation data has Forward Acceleration
+    LOCATION_NAV_DATA_HAS_LAT_ACCEL_BIT   = (1<<1), // Navigation data has Sideward Acceleration
+    LOCATION_NAV_DATA_HAS_VERT_ACCEL_BIT  = (1<<2), // Navigation data has Vertical Acceleration
+    LOCATION_NAV_DATA_HAS_YAW_RATE_BIT    = (1<<3), // Navigation data has Heading Rate
+    LOCATION_NAV_DATA_HAS_PITCH_BIT       = (1<<4)  // Navigation data has Body pitch
+} GnssLocationPosDataBits;
+
+typedef uint32_t GnssLocationInfoFlagMask;
+typedef enum {
+    GNSS_LOCATION_INFO_ALTITUDE_MEAN_SEA_LEVEL_BIT      = (1<<0), // valid altitude mean sea level
+    GNSS_LOCATION_INFO_DOP_BIT                          = (1<<1), // valid pdop, hdop, and vdop
+    GNSS_LOCATION_INFO_MAGNETIC_DEVIATION_BIT           = (1<<2), // valid magnetic deviation
+    GNSS_LOCATION_INFO_HOR_RELIABILITY_BIT              = (1<<3), // valid horizontal reliability
+    GNSS_LOCATION_INFO_VER_RELIABILITY_BIT              = (1<<4), // valid vertical reliability
+    GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MAJOR_BIT = (1<<5), // valid elipsode semi major
+    GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MINOR_BIT = (1<<6), // valid elipsode semi minor
+    GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_AZIMUTH_BIT    = (1<<7), // valid accuracy elipsode azimuth
+    GNSS_LOCATION_INFO_GNSS_SV_USED_DATA_BIT            = (1<<8), // valid gnss sv used in pos data
+    GNSS_LOCATION_INFO_NAV_SOLUTION_MASK_BIT            = (1<<9), // valid navSolutionMask
+    GNSS_LOCATION_INFO_POS_TECH_MASK_BIT                = (1<<10),// valid LocPosTechMask
+    GNSS_LOCATION_INFO_SV_SOURCE_INFO_BIT               = (1<<11),// valid LocSvInfoSource
+    GNSS_LOCATION_INFO_POS_DYNAMICS_DATA_BIT            = (1<<12),// valid position dynamics data
+    GNSS_LOCATION_INFO_GPS_TIME_BIT                     = (1<<13),// valid GPS Time
+    GNSS_LOCATION_INFO_EXT_DOP_BIT                      = (1<<14) // valid gdop, tdop
+} GnssLocationInfoFlagBits;
+
+typedef enum {
+    GEOFENCE_BREACH_ENTER = 0,
+    GEOFENCE_BREACH_EXIT,
+    GEOFENCE_BREACH_DWELL_IN,
+    GEOFENCE_BREACH_DWELL_OUT,
+    GEOFENCE_BREACH_UNKNOWN,
+} GeofenceBreachType;
+
+typedef uint16_t GeofenceBreachTypeMask;
+typedef enum {
+    GEOFENCE_BREACH_ENTER_BIT     = (1<<0),
+    GEOFENCE_BREACH_EXIT_BIT      = (1<<1),
+    GEOFENCE_BREACH_DWELL_IN_BIT  = (1<<2),
+    GEOFENCE_BREACH_DWELL_OUT_BIT = (1<<3),
+} GeofenceBreachTypeBits;
+
+typedef enum {
+    GEOFENCE_STATUS_AVAILABILE_NO = 0,
+    GEOFENCE_STATUS_AVAILABILE_YES,
+} GeofenceStatusAvailable;
+
+typedef uint32_t LocationCapabilitiesMask;
+typedef enum {
+    // supports startTracking API with minInterval param
+    LOCATION_CAPABILITIES_TIME_BASED_TRACKING_BIT           = (1<<0),
+    // supports startBatching API with minInterval param
+    LOCATION_CAPABILITIES_TIME_BASED_BATCHING_BIT           = (1<<1),
+    // supports startTracking API with minDistance param
+    LOCATION_CAPABILITIES_DISTANCE_BASED_TRACKING_BIT       = (1<<2),
+    // supports startBatching API with minDistance param
+    LOCATION_CAPABILITIES_DISTANCE_BASED_BATCHING_BIT       = (1<<3),
+    // supports addGeofences API
+    LOCATION_CAPABILITIES_GEOFENCE_BIT                      = (1<<4),
+    // supports GnssMeasurementsCallback
+    LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT             = (1<<5),
+    // supports startTracking/startBatching API with LocationOptions.mode of MSB (Ms Based)
+    LOCATION_CAPABILITIES_GNSS_MSB_BIT                      = (1<<6),
+    // supports startTracking/startBatching API with LocationOptions.mode of MSA (MS Assisted)
+    LOCATION_CAPABILITIES_GNSS_MSA_BIT                      = (1<<7),
+    // supports debug nmea sentences in the debugNmeaCallback
+    LOCATION_CAPABILITIES_DEBUG_NMEA_BIT                    = (1<<8),
+    // support outdoor trip batching
+    LOCATION_CAPABILITIES_OUTDOOR_TRIP_BATCHING_BIT         = (1<<9),
+    // support constellation enablement
+    LOCATION_CAPABILITIES_CONSTELLATION_ENABLEMENT_BIT      = (1<<10),
+    // support agpm
+    LOCATION_CAPABILITIES_AGPM_BIT                          = (1<<11),
+} LocationCapabilitiesBits;
+
+typedef enum {
+    LOCATION_TECHNOLOGY_TYPE_GNSS = 0,
+} LocationTechnologyType;
+
+// Configures how GPS is locked when GPS is disabled (through GnssDisable)
+typedef enum {
+    GNSS_CONFIG_GPS_LOCK_NONE = 0, // gps is not locked when GPS is disabled (GnssDisable)
+    GNSS_CONFIG_GPS_LOCK_MO,       // gps mobile originated (MO) is locked when GPS is disabled
+    GNSS_CONFIG_GPS_LOCK_NI,       // gps network initiated (NI) is locked when GPS is disabled
+    GNSS_CONFIG_GPS_LOCK_MO_AND_NI,// gps MO and NI is locked when GPS is disabled
+} GnssConfigGpsLock;
+
+// SUPL version
+typedef enum {
+    GNSS_CONFIG_SUPL_VERSION_1_0_0 = 1,
+    GNSS_CONFIG_SUPL_VERSION_2_0_0,
+    GNSS_CONFIG_SUPL_VERSION_2_0_2,
+} GnssConfigSuplVersion;
+
+// LTE Positioning Profile
+typedef enum {
+    GNSS_CONFIG_LPP_PROFILE_RRLP_ON_LTE = 0,              // RRLP on LTE (Default)
+    GNSS_CONFIG_LPP_PROFILE_USER_PLANE,                   // LPP User Plane (UP) on LTE
+    GNSS_CONFIG_LPP_PROFILE_CONTROL_PLANE,                // LPP_Control_Plane (CP)
+    GNSS_CONFIG_LPP_PROFILE_USER_PLANE_AND_CONTROL_PLANE, // Both LPP UP and CP
+} GnssConfigLppProfile;
+
+// Technology for LPPe Control Plane
+typedef uint16_t GnssConfigLppeControlPlaneMask;
+typedef enum {
+    GNSS_CONFIG_LPPE_CONTROL_PLANE_DBH_BIT                  = (1<<0), // DBH
+    GNSS_CONFIG_LPPE_CONTROL_PLANE_WLAN_AP_MEASUREMENTS_BIT = (1<<1), // WLAN_AP_MEASUREMENTS
+    GNSS_CONFIG_LPPE_CONTROL_PLANE_SRN_AP_MEASUREMENTS_BIT = (1<<2), // SRN_AP_MEASUREMENTS
+    GNSS_CONFIG_LPPE_CONTROL_PLANE_SENSOR_BARO_MEASUREMENTS_BIT = (1<<3),
+                                                             // SENSOR_BARO_MEASUREMENTS
+} GnssConfigLppeControlPlaneBits;
+
+// Technology for LPPe User Plane
+typedef uint16_t GnssConfigLppeUserPlaneMask;
+typedef enum {
+    GNSS_CONFIG_LPPE_USER_PLANE_DBH_BIT                  = (1<<0), // DBH
+    GNSS_CONFIG_LPPE_USER_PLANE_WLAN_AP_MEASUREMENTS_BIT = (1<<1), // WLAN_AP_MEASUREMENTS
+    GNSS_CONFIG_LPPE_USER_PLANE_SRN_AP_MEASUREMENTS_BIT = (1<<2), // SRN_AP_MEASUREMENTS
+    GNSS_CONFIG_LPPE_USER_PLANE_SENSOR_BARO_MEASUREMENTS_BIT = (1<<3),
+                                                            // SENSOR_BARO_MEASUREMENTS
+} GnssConfigLppeUserPlaneBits;
+
+// Positioning Protocol on A-GLONASS system
+typedef uint16_t GnssConfigAGlonassPositionProtocolMask;
+typedef enum {
+    GNSS_CONFIG_RRC_CONTROL_PLANE_BIT = (1<<0),  // RRC Control Plane
+    GNSS_CONFIG_RRLP_USER_PLANE_BIT   = (1<<1),  // RRLP User Plane
+    GNSS_CONFIG_LLP_USER_PLANE_BIT    = (1<<2),  // LPP User Plane
+    GNSS_CONFIG_LLP_CONTROL_PLANE_BIT = (1<<3),  // LPP Control Plane
+} GnssConfigAGlonassPositionProtocolBits;
+
+typedef enum {
+    GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_NO = 0,
+    GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_YES,
+} GnssConfigEmergencyPdnForEmergencySupl;
+
+typedef enum {
+    GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_NO = 0,
+    GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_YES,
+} GnssConfigSuplEmergencyServices;
+
+typedef uint16_t GnssConfigSuplModeMask;
+typedef enum {
+    GNSS_CONFIG_SUPL_MODE_MSB_BIT = (1<<0),
+    GNSS_CONFIG_SUPL_MODE_MSA_BIT = (1<<1),
+} GnssConfigSuplModeBits;
+
+typedef uint32_t GnssConfigFlagsMask;
+typedef enum {
+    GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT                   = (1<<0),
+    GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT               = (1<<1),
+    GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT        = (1<<2),
+    GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT                = (1<<3),
+    GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT         = (1<<4),
+    GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT            = (1<<5),
+    GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT = (1<<6),
+    GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT         = (1<<7),
+    GNSS_CONFIG_FLAGS_SUPL_EM_SERVICES_BIT                 = (1<<8),
+    GNSS_CONFIG_FLAGS_SUPL_MODE_BIT                        = (1<<9),
+    GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT               = (1<<10)
+} GnssConfigFlagsBits;
+
+typedef enum {
+    GNSS_NI_ENCODING_TYPE_NONE = 0,
+    GNSS_NI_ENCODING_TYPE_GSM_DEFAULT,
+    GNSS_NI_ENCODING_TYPE_UTF8,
+    GNSS_NI_ENCODING_TYPE_UCS2,
+} GnssNiEncodingType;
+
+typedef enum {
+    GNSS_NI_TYPE_VOICE = 0,
+    GNSS_NI_TYPE_SUPL,
+    GNSS_NI_TYPE_CONTROL_PLANE,
+    GNSS_NI_TYPE_EMERGENCY_SUPL
+} GnssNiType;
+
+typedef uint16_t GnssNiOptionsMask;
+typedef enum {
+    GNSS_NI_OPTIONS_NOTIFICATION_BIT     = (1<<0),
+    GNSS_NI_OPTIONS_VERIFICATION_BIT     = (1<<1),
+    GNSS_NI_OPTIONS_PRIVACY_OVERRIDE_BIT = (1<<2),
+} GnssNiOptionsBits;
+
+typedef enum {
+    GNSS_NI_RESPONSE_ACCEPT = 1,
+    GNSS_NI_RESPONSE_DENY,
+    GNSS_NI_RESPONSE_NO_RESPONSE,
+    GNSS_NI_RESPONSE_IGNORE,
+} GnssNiResponse;
+
+typedef enum {
+    GNSS_SV_TYPE_UNKNOWN = 0,
+    GNSS_SV_TYPE_GPS,
+    GNSS_SV_TYPE_SBAS,
+    GNSS_SV_TYPE_GLONASS,
+    GNSS_SV_TYPE_QZSS,
+    GNSS_SV_TYPE_BEIDOU,
+    GNSS_SV_TYPE_GALILEO,
+} GnssSvType;
+
+typedef enum {
+    GNSS_EPH_TYPE_UNKNOWN = 0,
+    GNSS_EPH_TYPE_EPHEMERIS,
+    GNSS_EPH_TYPE_ALMANAC,
+} GnssEphemerisType;
+
+typedef enum {
+    GNSS_EPH_SOURCE_UNKNOWN = 0,
+    GNSS_EPH_SOURCE_DEMODULATED,
+    GNSS_EPH_SOURCE_SUPL_PROVIDED,
+    GNSS_EPH_SOURCE_OTHER_SERVER_PROVIDED,
+    GNSS_EPH_SOURCE_LOCAL,
+} GnssEphemerisSource;
+
+typedef enum {
+    GNSS_EPH_HEALTH_UNKNOWN = 0,
+    GNSS_EPH_HEALTH_GOOD,
+    GNSS_EPH_HEALTH_BAD,
+} GnssEphemerisHealth;
+
+typedef uint16_t GnssSvOptionsMask;
+typedef enum {
+    GNSS_SV_OPTIONS_HAS_EPHEMER_BIT = (1<<0),
+    GNSS_SV_OPTIONS_HAS_ALMANAC_BIT = (1<<1),
+    GNSS_SV_OPTIONS_USED_IN_FIX_BIT = (1<<2),
+    GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT = (1<<3),
+} GnssSvOptionsBits;
+
+typedef enum {
+    GNSS_ASSISTANCE_TYPE_SUPL = 0,
+    GNSS_ASSISTANCE_TYPE_C2K,
+} GnssAssistanceType;
+
+typedef enum {
+    GNSS_SUPL_MODE_STANDALONE = 0,
+    GNSS_SUPL_MODE_MSB,
+    GNSS_SUPL_MODE_MSA,
+} GnssSuplMode;
+
+typedef enum {
+    BATCHING_MODE_ROUTINE = 0,   // positions are reported when batched positions memory is full
+    BATCHING_MODE_TRIP,          // positions are reported when a certain distance is covered
+    BATCHING_MODE_NO_AUTO_REPORT // no report of positions automatically, instead queried on demand
+} BatchingMode;
+
+typedef enum {
+    BATCHING_STATUS_TRIP_COMPLETED = 0,
+    BATCHING_STATUS_POSITION_AVAILABE,
+    BATCHING_STATUS_POSITION_UNAVAILABLE
+} BatchingStatus;
+
+typedef uint16_t GnssMeasurementsAdrStateMask;
+typedef enum {
+    GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_UNKNOWN         = 0,
+    GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_VALID_BIT       = (1<<0),
+    GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_RESET_BIT       = (1<<1),
+    GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_CYCLE_SLIP_BIT  = (1<<2),
+} GnssMeasurementsAdrStateBits;
+
+typedef uint32_t GnssMeasurementsDataFlagsMask;
+typedef enum {
+    GNSS_MEASUREMENTS_DATA_SV_ID_BIT                        = (1<<0),
+    GNSS_MEASUREMENTS_DATA_SV_TYPE_BIT                      = (1<<1),
+    GNSS_MEASUREMENTS_DATA_STATE_BIT                        = (1<<2),
+    GNSS_MEASUREMENTS_DATA_RECEIVED_SV_TIME_BIT             = (1<<3),
+    GNSS_MEASUREMENTS_DATA_RECEIVED_SV_TIME_UNCERTAINTY_BIT = (1<<4),
+    GNSS_MEASUREMENTS_DATA_CARRIER_TO_NOISE_BIT             = (1<<5),
+    GNSS_MEASUREMENTS_DATA_PSEUDORANGE_RATE_BIT             = (1<<6),
+    GNSS_MEASUREMENTS_DATA_PSEUDORANGE_RATE_UNCERTAINTY_BIT = (1<<7),
+    GNSS_MEASUREMENTS_DATA_ADR_STATE_BIT                    = (1<<8),
+    GNSS_MEASUREMENTS_DATA_ADR_BIT                          = (1<<9),
+    GNSS_MEASUREMENTS_DATA_ADR_UNCERTAINTY_BIT              = (1<<10),
+    GNSS_MEASUREMENTS_DATA_CARRIER_FREQUENCY_BIT            = (1<<11),
+    GNSS_MEASUREMENTS_DATA_CARRIER_CYCLES_BIT               = (1<<12),
+    GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_BIT                = (1<<13),
+    GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_UNCERTAINTY_BIT    = (1<<14),
+    GNSS_MEASUREMENTS_DATA_MULTIPATH_INDICATOR_BIT          = (1<<15),
+    GNSS_MEASUREMENTS_DATA_SIGNAL_TO_NOISE_RATIO_BIT        = (1<<16),
+    GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT       = (1<<17),
+} GnssMeasurementsDataFlagsBits;
+
+typedef uint32_t GnssMeasurementsStateMask;
+typedef enum {
+    GNSS_MEASUREMENTS_STATE_UNKNOWN_BIT               = 0,
+    GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT             = (1<<0),
+    GNSS_MEASUREMENTS_STATE_BIT_SYNC_BIT              = (1<<1),
+    GNSS_MEASUREMENTS_STATE_SUBFRAME_SYNC_BIT         = (1<<2),
+    GNSS_MEASUREMENTS_STATE_TOW_DECODED_BIT           = (1<<3),
+    GNSS_MEASUREMENTS_STATE_MSEC_AMBIGUOUS_BIT        = (1<<4),
+    GNSS_MEASUREMENTS_STATE_SYMBOL_SYNC_BIT           = (1<<5),
+    GNSS_MEASUREMENTS_STATE_GLO_STRING_SYNC_BIT       = (1<<6),
+    GNSS_MEASUREMENTS_STATE_GLO_TOD_DECODED_BIT       = (1<<7),
+    GNSS_MEASUREMENTS_STATE_BDS_D2_BIT_SYNC_BIT       = (1<<8),
+    GNSS_MEASUREMENTS_STATE_BDS_D2_SUBFRAME_SYNC_BIT  = (1<<9),
+    GNSS_MEASUREMENTS_STATE_GAL_E1BC_CODE_LOCK_BIT    = (1<<10),
+    GNSS_MEASUREMENTS_STATE_GAL_E1C_2ND_CODE_LOCK_BIT = (1<<11),
+    GNSS_MEASUREMENTS_STATE_GAL_E1B_PAGE_SYNC_BIT     = (1<<12),
+    GNSS_MEASUREMENTS_STATE_SBAS_SYNC_BIT             = (1<<13),
+} GnssMeasurementsStateBits;
+
+typedef enum {
+    GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_UNKNOWN = 0,
+    GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_PRESENT,
+    GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_NOT_PRESENT,
+} GnssMeasurementsMultipathIndicator;
+
+typedef uint32_t GnssMeasurementsClockFlagsMask;
+typedef enum {
+    GNSS_MEASUREMENTS_CLOCK_FLAGS_LEAP_SECOND_BIT                  = (1<<0),
+    GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_BIT                         = (1<<1),
+    GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_UNCERTAINTY_BIT             = (1<<2),
+    GNSS_MEASUREMENTS_CLOCK_FLAGS_FULL_BIAS_BIT                    = (1<<3),
+    GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_BIT                         = (1<<4),
+    GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_UNCERTAINTY_BIT             = (1<<5),
+    GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_BIT                        = (1<<6),
+    GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_UNCERTAINTY_BIT            = (1<<7),
+    GNSS_MEASUREMENTS_CLOCK_FLAGS_HW_CLOCK_DISCONTINUITY_COUNT_BIT = (1<<8),
+} GnssMeasurementsClockFlagsBits;
+
+typedef uint32_t GnssAidingDataSvMask;
+typedef enum {
+    GNSS_AIDING_DATA_SV_EPHEMERIS_BIT    = (1<<0), // ephemeris
+    GNSS_AIDING_DATA_SV_ALMANAC_BIT      = (1<<1), // almanac
+    GNSS_AIDING_DATA_SV_HEALTH_BIT       = (1<<2), // health
+    GNSS_AIDING_DATA_SV_DIRECTION_BIT    = (1<<3), // direction
+    GNSS_AIDING_DATA_SV_STEER_BIT        = (1<<4), // steer
+    GNSS_AIDING_DATA_SV_ALMANAC_CORR_BIT = (1<<5), // almanac correction
+    GNSS_AIDING_DATA_SV_BLACKLIST_BIT    = (1<<6), // blacklist SVs
+    GNSS_AIDING_DATA_SV_SA_DATA_BIT      = (1<<7), // sensitivity assistance data
+    GNSS_AIDING_DATA_SV_NO_EXIST_BIT     = (1<<8), // SV does not exist
+    GNSS_AIDING_DATA_SV_IONOSPHERE_BIT   = (1<<9), // ionosphere correction
+    GNSS_AIDING_DATA_SV_TIME_BIT         = (1<<10),// reset satellite time
+} GnssAidingDataSvBits;
+
+typedef uint32_t GnssAidingDataSvTypeMask;
+typedef enum {
+    GNSS_AIDING_DATA_SV_TYPE_GPS_BIT      = (1<<0),
+    GNSS_AIDING_DATA_SV_TYPE_GLONASS_BIT  = (1<<1),
+    GNSS_AIDING_DATA_SV_TYPE_QZSS_BIT     = (1<<2),
+    GNSS_AIDING_DATA_SV_TYPE_BEIDOU_BIT   = (1<<3),
+    GNSS_AIDING_DATA_SV_TYPE_GALILEO_BIT  = (1<<4),
+} GnssAidingDataSvTypeBits;
+
+typedef enum
+{
+    GNSS_LOC_SV_SYSTEM_GPS                    = 1,
+    /**< GPS satellite. */
+    GNSS_LOC_SV_SYSTEM_GALILEO                = 2,
+    /**< GALILEO satellite. */
+    GNSS_LOC_SV_SYSTEM_SBAS                   = 3,
+    /**< SBAS satellite. */
+    GNSS_LOC_SV_SYSTEM_COMPASS                = 4,
+    /**< COMPASS satellite. */
+    GNSS_LOC_SV_SYSTEM_GLONASS                = 5,
+    /**< GLONASS satellite. */
+    GNSS_LOC_SV_SYSTEM_BDS                    = 6,
+    /**< BDS satellite. */
+    GNSS_LOC_SV_SYSTEM_QZSS                   = 7
+    /**< QZSS satellite. */
+} Gnss_LocSvSystemEnumType;
+
+typedef uint32_t GnssSystemTimeStructTypeFlags;
+typedef enum {
+    GNSS_SYSTEM_TIME_WEEK_VALID             = (1 << 0),
+    GNSS_SYSTEM_TIME_WEEK_MS_VALID          = (1 << 1),
+    GNSS_SYSTEM_CLK_TIME_BIAS_VALID         = (1 << 2),
+    GNSS_SYSTEM_CLK_TIME_BIAS_UNC_VALID     = (1 << 3),
+    GNSS_SYSTEM_REF_FCOUNT_VALID            = (1 << 4),
+    GNSS_SYSTEM_NUM_CLOCK_RESETS_VALID      = (1 << 5)
+} GnssSystemTimeTypeBits;
+
+typedef uint32_t GnssGloTimeStructTypeFlags;
+typedef enum {
+    GNSS_CLO_DAYS_VALID                     = (1 << 0),
+    GNSS_GLOS_MSEC_VALID                    = (1 << 1),
+    GNSS_GLO_CLK_TIME_BIAS_VALID            = (1 << 2),
+    GNSS_GLO_CLK_TIME_BIAS_UNC_VALID        = (1 << 3),
+    GNSS_GLO_REF_FCOUNT_VALID               = (1 << 4),
+    GNSS_GLO_NUM_CLOCK_RESETS_VALID         = (1 << 5),
+    GNSS_GLO_FOUR_YEAR_VALID                = (1 << 6)
+} GnssGloTimeTypeBits;
+
+typedef struct {
+    GnssAidingDataSvMask svMask;         // bitwise OR of GnssAidingDataSvBits
+    GnssAidingDataSvTypeMask svTypeMask; // bitwise OR of GnssAidingDataSvTypeBits
+} GnssAidingDataSv;
+
+typedef uint32_t GnssAidingDataCommonMask;
+typedef enum {
+    GNSS_AIDING_DATA_COMMON_POSITION_BIT      = (1<<0), // position estimate
+    GNSS_AIDING_DATA_COMMON_TIME_BIT          = (1<<1), // reset all clock values
+    GNSS_AIDING_DATA_COMMON_UTC_BIT           = (1<<2), // UTC estimate
+    GNSS_AIDING_DATA_COMMON_RTI_BIT           = (1<<3), // RTI
+    GNSS_AIDING_DATA_COMMON_FREQ_BIAS_EST_BIT = (1<<4), // frequency bias estimate
+    GNSS_AIDING_DATA_COMMON_CELLDB_BIT        = (1<<5), // all celldb info
+} GnssAidingDataCommonBits;
+
+typedef struct {
+    GnssAidingDataCommonMask mask; // bitwise OR of GnssAidingDataCommonBits
+} GnssAidingDataCommon;
+
+typedef struct {
+    bool deleteAll;              // if true, delete all aiding data and ignore other params
+    GnssAidingDataSv sv;         // SV specific aiding data
+    GnssAidingDataCommon common; // common aiding data
+} GnssAidingData;
+
+typedef struct {
+    size_t size;             // set to sizeof(Location)
+    LocationFlagsMask flags; // bitwise OR of LocationFlagsBits to mark which params are valid
+    uint64_t timestamp;      // UTC timestamp for location fix, milliseconds since January 1, 1970
+    double latitude;         // in degrees
+    double longitude;        // in degrees
+    double altitude;         // in meters above the WGS 84 reference ellipsoid
+    float speed;             // in meters per second
+    float bearing;           // in degrees; range [0, 360)
+    float accuracy;          // in meters
+    float verticalAccuracy;  // in meters
+    float speedAccuracy;     // in meters/second
+    float bearingAccuracy;   // in degrees (0 to 359.999)
+    LocationTechnologyMask techMask;
+} Location;
+
+struct LocationOptions {
+    size_t size;          // set to sizeof(LocationOptions)
+    uint32_t minInterval; // in milliseconds
+    uint32_t minDistance; // in meters. if minDistance > 0, gnssSvCallback/gnssNmeaCallback/
+                          // gnssMeasurementsCallback may not be called
+    GnssSuplMode mode;    // Standalone/MS-Based/MS-Assisted
+
+    inline LocationOptions() :
+            size(0), minInterval(0), minDistance(0), mode(GNSS_SUPL_MODE_STANDALONE) {}
+};
+
+typedef enum {
+    GNSS_POWER_MODE_INVALID = 0,
+    GNSS_POWER_MODE_M1,  /* Improved Accuracy Mode */
+    GNSS_POWER_MODE_M2,  /* Normal Mode */
+    GNSS_POWER_MODE_M3,  /* Background Mode */
+    GNSS_POWER_MODE_M4,  /* Background Mode */
+    GNSS_POWER_MODE_M5   /* Background Mode */
+} GnssPowerMode;
+
+struct TrackingOptions : LocationOptions {
+    GnssPowerMode powerMode; /* Power Mode to be used for time based tracking
+                                sessions */
+    uint32_t tbm;  /* Time interval between measurements.
+                      Applicable to background power modes */
+
+    inline TrackingOptions() :
+            LocationOptions(), powerMode(GNSS_POWER_MODE_INVALID), tbm(0) {}
+    inline TrackingOptions(size_t s, GnssPowerMode m, uint32_t t) :
+            LocationOptions(), powerMode(m), tbm(t) { LocationOptions::size = s; }
+    inline TrackingOptions(const LocationOptions& options) :
+            LocationOptions(options), powerMode(GNSS_POWER_MODE_INVALID), tbm(0) {}
+    inline void setLocationOptions(const LocationOptions& options) {
+        minInterval = options.minInterval;
+        minDistance = options.minDistance;
+        mode = options.mode;
+    }
+};
+
+struct BatchingOptions : LocationOptions {
+    BatchingMode batchingMode;
+
+    inline BatchingOptions() :
+            LocationOptions(), batchingMode(BATCHING_MODE_ROUTINE) {}
+    inline BatchingOptions(size_t s, BatchingMode m) :
+            LocationOptions(), batchingMode(m) { LocationOptions::size = s; }
+    inline BatchingOptions(const LocationOptions& options) :
+            LocationOptions(options), batchingMode(BATCHING_MODE_ROUTINE) {}
+    inline void setLocationOptions(const LocationOptions& options) {
+        minInterval = options.minInterval;
+        minDistance = options.minDistance;
+        mode = options.mode;
+    }
+};
+
+typedef struct {
+    size_t size;
+    BatchingStatus batchingStatus;
+} BatchingStatusInfo;
+
+typedef struct {
+    size_t size;                            // set to sizeof(GeofenceOption)
+    GeofenceBreachTypeMask breachTypeMask;  // bitwise OR of GeofenceBreachTypeBits
+    uint32_t responsiveness;                // in milliseconds
+    uint32_t dwellTime;                     // in seconds
+} GeofenceOption;
+
+typedef struct {
+    size_t size;      // set to sizeof(GeofenceInfo)
+    double latitude;  // in degrees
+    double longitude; // in degrees
+    double radius;    // in meters
+} GeofenceInfo;
+
+typedef struct {
+    size_t size;             // set to sizeof(GeofenceBreachNotification)
+    size_t count;            // number of ids in array
+    uint32_t* ids;           // array of ids that have breached
+    Location location;       // location associated with breach
+    GeofenceBreachType type; // type of breach
+    uint64_t timestamp;      // timestamp of breach
+} GeofenceBreachNotification;
+
+typedef struct {
+    size_t size;                       // set to sizeof(GeofenceBreachNotification)
+    GeofenceStatusAvailable available; // GEOFENCE_STATUS_AVAILABILE_NO/_YES
+    LocationTechnologyType techType;   // GNSS
+} GeofenceStatusNotification;
+
+typedef struct {
+    uint64_t gpsSvUsedIdsMask;
+    uint64_t gloSvUsedIdsMask;
+    uint64_t galSvUsedIdsMask;
+    uint64_t bdsSvUsedIdsMask;
+    uint64_t qzssSvUsedIdsMask;
+} GnssLocationSvUsedInPosition;
+
+/** @struct
+    Body Frame parameters
+*/
+typedef struct {
+    GnssLocationPosDataMask bodyFrameDataMask; // Contains Body frame LocPosDataMask bits
+    float longAccel;                           // Forward Acceleration in body frame (m/s2)
+    float latAccel;                            // Sideward Acceleration in body frame (m/s2)
+    float vertAccel;                           // Vertical Acceleration in body frame (m/s2)
+    float yawRate;                             // Heading Rate (Radians/second)
+    float pitch;                               // Body pitch (Radians)
+} GnssLocationPositionDynamics;
+
+typedef struct {
+    /** Validity mask for below fields */
+    GnssSystemTimeStructTypeFlags 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;
+} GnssSystemTimeStructType;
+
+typedef struct {
+    /** 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 */
+    GnssGloTimeStructTypeFlags 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;
+} GnssGloTimeStructType;
+
+typedef union {
+    GnssSystemTimeStructType gpsSystemTime;
+    GnssSystemTimeStructType galSystemTime;
+    GnssSystemTimeStructType bdsSystemTime;
+    GnssSystemTimeStructType qzssSystemTime;
+    GnssGloTimeStructType gloSytemTime;
+} SystemTimeStructUnion;
+    /** Time applicability of PVT report */
+typedef struct {
+    /** Specifies GNSS system time reported. Mandatory field */
+    Gnss_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
+     */
+    SystemTimeStructUnion u;
+} GnssSystemTime;
+
+typedef struct {
+    size_t size;                        // set to sizeof(GnssLocationInfo)
+    GnssLocationInfoFlagMask flags;     // bitwise OR of GnssLocationInfoBits for param validity
+    float altitudeMeanSeaLevel;         // altitude wrt mean sea level
+    float pdop;                         // position dilusion of precision
+    float hdop;                         // horizontal dilusion of precision
+    float vdop;                         // vertical dilusion of precision
+    float gdop;                         // geometric  dilution of precision
+    float tdop;                         // time dilution of precision
+    float magneticDeviation;            // magnetic deviation
+    LocationReliability horReliability; // horizontal reliability
+    LocationReliability verReliability; // vertical reliability
+    float horUncEllipseSemiMajor;       // horizontal elliptical accuracy semi-major axis
+    float horUncEllipseSemiMinor;       // horizontal elliptical accuracy semi-minor axis
+    float horUncEllipseOrientAzimuth;   // horizontal elliptical accuracy azimuth
+    float northVelocity;                // North Velocity.Unit: Meters/sec
+    float eastVelocity;                 // East Velocity
+    float upVelocity;
+    float northVelocityStdDeviation;
+    float eastVelocityStdDeviation;
+    float upVelocityStdDeviation;
+    GnssLocationSvUsedInPosition svUsedInPosition;// Gnss sv used in position data
+    GnssLocationNavSolutionMask navSolutionMask;  // Nav solution mask to indicate sbas corrections
+    GnssLocationPosTechMask posTechMask;          // Position technology used in computing this fix
+    GnssLocationPositionDynamics bodyFrameData;   // Body Frame Dynamics: 4wayAcceleration and
+                                                  // pitch set with validity
+    GnssSystemTime gnssSystemTime;            // GNSS System Time
+    Location location;
+} GnssLocationInfoNotification;
+
+typedef struct {
+    size_t size;                           // set to sizeof(GnssNiNotification)
+    GnssNiType type;                       // type of NI (Voice, SUPL, Control Plane)
+    GnssNiOptionsMask options;             // bitwise OR of GnssNiOptionsBits
+    uint32_t timeout;                      // time (seconds) to wait for user input
+    GnssNiResponse timeoutResponse;        // the response that should be sent when timeout expires
+    char requestor[GNSS_NI_REQUESTOR_MAX]; // the requestor that is making the request
+    GnssNiEncodingType requestorEncoding;  // the encoding type for requestor
+    char message[GNSS_NI_MESSAGE_ID_MAX];  // the message to show user
+    GnssNiEncodingType messageEncoding;    // the encoding type for message
+    char extras[GNSS_NI_MESSAGE_ID_MAX];
+} GnssNiNotification;
+
+typedef struct {
+    size_t size;       // set to sizeof(GnssSv)
+    uint16_t svId;     // Unique Identifier
+    GnssSvType type;   // type of SV (GPS, SBAS, GLONASS, QZSS, BEIDOU, GALILEO)
+    float cN0Dbhz;     // signal strength
+    float elevation;   // elevation of SV (in degrees)
+    float azimuth;     // azimuth of SV (in degrees)
+    GnssSvOptionsMask gnssSvOptionsMask; // Bitwise OR of GnssSvOptionsBits
+    float carrierFrequencyHz; // carrier frequency of the signal tracked
+} GnssSv;
+
+struct GnssConfigSetAssistanceServer {
+    size_t size;             // set to sizeof(GnssConfigSetAssistanceServer)
+    GnssAssistanceType type; // SUPL or C2K
+    const char* hostName;    // null terminated string
+    uint32_t port;           // port of server
+
+    inline bool equals(const GnssConfigSetAssistanceServer& config) {
+        if (config.type == type && config.port == port &&
+               ((NULL == config.hostName && NULL == hostName) ||
+                (NULL != config.hostName && NULL != hostName &&
+                     0 == strcmp(config.hostName, hostName)))) {
+            return true;
+        }
+        return false;
+    }
+};
+
+typedef struct {
+    size_t size;                               // set to sizeof(GnssMeasurementsData)
+    GnssMeasurementsDataFlagsMask flags;       // bitwise OR of GnssMeasurementsDataFlagsBits
+    int16_t svId;
+    GnssSvType svType;
+    double timeOffsetNs;
+    GnssMeasurementsStateMask stateMask;       // bitwise OR of GnssMeasurementsStateBits
+    int64_t receivedSvTimeNs;
+    int64_t receivedSvTimeUncertaintyNs;
+    double carrierToNoiseDbHz;
+    double pseudorangeRateMps;
+    double pseudorangeRateUncertaintyMps;
+    GnssMeasurementsAdrStateMask adrStateMask; // bitwise OR of GnssMeasurementsAdrStateBits
+    double adrMeters;
+    double adrUncertaintyMeters;
+    float carrierFrequencyHz;
+    int64_t carrierCycles;
+    double carrierPhase;
+    double carrierPhaseUncertainty;
+    GnssMeasurementsMultipathIndicator multipathIndicator;
+    double signalToNoiseRatioDb;
+    double agcLevelDb;
+} GnssMeasurementsData;
+
+typedef struct {
+    size_t size;                          // set to sizeof(GnssMeasurementsClock)
+    GnssMeasurementsClockFlagsMask 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;
+} GnssMeasurementsClock;
+
+typedef struct {
+    size_t size;                 // set to sizeof(GnssSvNotification)
+    size_t count;                // number of SVs in the GnssSv array
+    GnssSv gnssSvs[GNSS_SV_MAX]; // information on a number of SVs
+} GnssSvNotification;
+
+typedef struct {
+    size_t size;         // set to sizeof(GnssNmeaNotification)
+    uint64_t timestamp;  // timestamp
+    const char* nmea;    // nmea text
+    size_t length;       // length of the nmea text
+} GnssNmeaNotification;
+
+typedef struct {
+    size_t size;         // set to sizeof(GnssMeasurementsNotification)
+    size_t count;        // number of items in GnssMeasurements array
+    GnssMeasurementsData measurements[GNSS_MEASUREMENTS_MAX];
+    GnssMeasurementsClock clock; // clock
+} GnssMeasurementsNotification;
+
+typedef uint32_t GnssSvId;
+
+struct GnssSvIdSource{
+    size_t size;                 // set to sizeof(GnssSvIdSource)
+    GnssSvType constellation;    // constellation for the sv to blacklist
+    GnssSvId svId;           // sv id to blacklist
+};
+inline bool operator ==(GnssSvIdSource const& left, GnssSvIdSource const& right) {
+    return left.size == right.size &&
+            left.constellation == right.constellation && left.svId == right.svId;
+}
+
+#define GNSS_SV_CONFIG_ALL_BITS_ENABLED_MASK ((uint64_t)0xFFFFFFFFFFFFFFFF)
+typedef struct {
+    size_t size; // set to sizeof(GnssSvIdConfig)
+
+    // GLONASS - SV 65 maps to bit 0
+#define GNSS_SV_CONFIG_GLO_INITIAL_SV_ID 65
+#define GNSS_SV_CONFIG_GLO_LAST_SV_ID 88
+    uint64_t gloBlacklistSvMask;
+
+    // BEIDOU - SV 201 maps to bit 0
+#define GNSS_SV_CONFIG_BDS_INITIAL_SV_ID 201
+#define GNSS_SV_CONFIG_BDS_LAST_SV_ID 237
+    uint64_t bdsBlacklistSvMask;
+
+    // QZSS - SV 193 maps to bit 0
+#define GNSS_SV_CONFIG_QZSS_INITIAL_SV_ID 193
+#define GNSS_SV_CONFIG_QZSS_LAST_SV_ID 200
+    uint64_t qzssBlacklistSvMask;
+
+    // GAL - SV 301 maps to bit 0
+#define GNSS_SV_CONFIG_GAL_INITIAL_SV_ID 301
+#define GNSS_SV_CONFIG_GAL_LAST_SV_ID 336
+    uint64_t galBlacklistSvMask;
+} GnssSvIdConfig;
+
+struct GnssConfig{
+    size_t size;  // set to sizeof(GnssConfig)
+    GnssConfigFlagsMask flags; // bitwise OR of GnssConfigFlagsBits to mark which params are valid
+    GnssConfigGpsLock gpsLock;
+    GnssConfigSuplVersion suplVersion;
+    GnssConfigSetAssistanceServer assistanceServer;
+    GnssConfigLppProfile lppProfile;
+    GnssConfigLppeControlPlaneMask lppeControlPlaneMask;
+    GnssConfigLppeUserPlaneMask lppeUserPlaneMask;
+    GnssConfigAGlonassPositionProtocolMask aGlonassPositionProtocolMask;
+    GnssConfigEmergencyPdnForEmergencySupl emergencyPdnForEmergencySupl;
+    GnssConfigSuplEmergencyServices suplEmergencyServices;
+    GnssConfigSuplModeMask suplModeMask; //bitwise OR of GnssConfigSuplModeBits
+    std::vector<GnssSvIdSource> blacklistedSvIds;
+
+    inline bool equals(const GnssConfig& config) {
+        if (flags == config.flags &&
+                gpsLock == config.gpsLock &&
+                suplVersion == config.suplVersion &&
+                assistanceServer.equals(config.assistanceServer) &&
+                lppProfile == config.lppProfile &&
+                lppeControlPlaneMask == config.lppeControlPlaneMask &&
+                lppeUserPlaneMask == config.lppeUserPlaneMask &&
+                aGlonassPositionProtocolMask == config.aGlonassPositionProtocolMask &&
+                emergencyPdnForEmergencySupl == config.emergencyPdnForEmergencySupl &&
+                suplEmergencyServices == config.suplEmergencyServices &&
+                suplModeMask == config.suplModeMask  &&
+                blacklistedSvIds == config.blacklistedSvIds) {
+            return true;
+        }
+        return false;
+    }
+};
+
+typedef struct {
+    size_t size;                        // set to sizeof
+    bool                                mValid;
+    Location                            mLocation;
+    double                              verticalAccuracyMeters;
+    double                              speedAccuracyMetersPerSecond;
+    double                              bearingAccuracyDegrees;
+    timespec                            mUtcReported;
+} GnssDebugLocation;
+
+typedef struct {
+    size_t size;                        // set to sizeof
+    bool                                mValid;
+    int64_t                             timeEstimate;
+    float                               timeUncertaintyNs;
+    float                               frequencyUncertaintyNsPerSec;
+} GnssDebugTime;
+
+typedef struct {
+    size_t size;                        // set to sizeof
+    uint32_t                            svid;
+    GnssSvType                          constellation;
+    GnssEphemerisType                   mEphemerisType;
+    GnssEphemerisSource                 mEphemerisSource;
+    GnssEphemerisHealth                 mEphemerisHealth;
+    float                               ephemerisAgeSeconds;
+    bool                                serverPredictionIsAvailable;
+    float                               serverPredictionAgeSeconds;
+} GnssDebugSatelliteInfo;
+
+typedef struct {
+    size_t size;                        // set to sizeof
+    GnssDebugLocation                   mLocation;
+    GnssDebugTime                       mTime;
+    std::vector<GnssDebugSatelliteInfo> mSatelliteInfo;
+} GnssDebugReport;
+
+/* Provides the capabilities of the system
+   capabilities callback is called once soon after createInstance is called */
+typedef std::function<void(
+    LocationCapabilitiesMask capabilitiesMask // bitwise OR of LocationCapabilitiesBits
+)> capabilitiesCallback;
+
+/* Used by tracking, batching, and miscellanous APIs
+   responseCallback is called for every Tracking, Batching API, and Miscellanous API */
+typedef std::function<void(
+    LocationError err, // if not SUCCESS, then id is not valid
+    uint32_t id        // id to be associated to the request
+)> responseCallback;
+
+/* Used by APIs that gets more than one LocationError in it's response
+   collectiveResponseCallback is called for every geofence API call.
+   ids array and LocationError array are only valid until collectiveResponseCallback returns. */
+typedef std::function<void(
+    size_t count, // number of locations in arrays
+    LocationError* errs, // array of LocationError associated to the request
+    uint32_t* ids // array of ids to be associated to the request
+)> collectiveResponseCallback;
+
+/* Used for startTracking API, optional can be NULL
+   trackingCallback is called when delivering a location in a tracking session
+   broadcasted to all clients, no matter if a session has started by client */
+typedef std::function<void(
+    Location location
+)> trackingCallback;
+
+/* Used for startBatching API, optional can be NULL
+   batchingCallback is called when delivering locations in a batching session.
+   broadcasted to all clients, no matter if a session has started by client */
+typedef std::function<void(
+    size_t count,      // number of locations in array
+    Location* location, // array of locations
+    BatchingOptions batchingOptions // Batching options
+)> batchingCallback;
+
+typedef std::function<void(
+    BatchingStatusInfo batchingStatus, // batch status
+    std::list<uint32_t> & listOfCompletedTrips
+)> batchingStatusCallback;
+
+/* Gives GNSS Location information, optional can be NULL
+    gnssLocationInfoCallback is called only during a tracking session
+    broadcasted to all clients, no matter if a session has started by client */
+typedef std::function<void(
+    GnssLocationInfoNotification gnssLocationInfoNotification
+)> gnssLocationInfoCallback;
+
+/* Used for addGeofences API, optional can be NULL
+   geofenceBreachCallback is called when any number of geofences have a state change */
+typedef std::function<void(
+    GeofenceBreachNotification geofenceBreachNotification
+)> geofenceBreachCallback;
+
+/* Used for addGeofences API, optional can be NULL
+       geofenceStatusCallback is called when any number of geofences have a status change */
+typedef std::function<void(
+    GeofenceStatusNotification geofenceStatusNotification
+)> geofenceStatusCallback;
+
+/* Network Initiated request, optional can be NULL
+   This callback should be responded to by calling gnssNiResponse */
+typedef std::function<void(
+    uint32_t id, // id that should be used to respond by calling gnssNiResponse
+    GnssNiNotification gnssNiNotification
+)> gnssNiCallback;
+
+/* Gives GNSS SV information, optional can be NULL
+    gnssSvCallback is called only during a tracking session
+    broadcasted to all clients, no matter if a session has started by client */
+typedef std::function<void(
+    GnssSvNotification gnssSvNotification
+)> gnssSvCallback;
+
+/* Gives GNSS NMEA data, optional can be NULL
+    gnssNmeaCallback is called only during a tracking session
+    broadcasted to all clients, no matter if a session has started by client */
+typedef std::function<void(
+    GnssNmeaNotification gnssNmeaNotification
+)> gnssNmeaCallback;
+
+/* Gives GNSS Measurements information, optional can be NULL
+    gnssMeasurementsCallback is called only during a tracking session
+    broadcasted to all clients, no matter if a session has started by client */
+typedef std::function<void(
+    GnssMeasurementsNotification gnssMeasurementsNotification
+)> gnssMeasurementsCallback;
+
+/* Provides the current GNSS configuration to the client */
+typedef std::function<void(
+    GnssConfig& config
+)> gnssConfigCallback;
+
+typedef struct {
+    size_t size; // set to sizeof(LocationCallbacks)
+    capabilitiesCallback capabilitiesCb;             // mandatory
+    responseCallback responseCb;                     // mandatory
+    collectiveResponseCallback collectiveResponseCb; // mandatory
+    trackingCallback trackingCb;                     // optional
+    batchingCallback batchingCb;                     // optional
+    geofenceBreachCallback geofenceBreachCb;         // optional
+    geofenceStatusCallback geofenceStatusCb;         // optional
+    gnssLocationInfoCallback gnssLocationInfoCb;     // optional
+    gnssNiCallback gnssNiCb;                         // optional
+    gnssSvCallback gnssSvCb;                         // optional
+    gnssNmeaCallback gnssNmeaCb;                     // optional
+    gnssMeasurementsCallback gnssMeasurementsCb;     // optional
+    batchingStatusCallback batchingStatusCb;         // optional
+} LocationCallbacks;
+
+#endif /* LOCATIONDATATYPES_H */
diff --git a/sdm845/location/Makefile.am b/sdm845/location/Makefile.am
index 3688cc8..fccdf94 100644
--- a/sdm845/location/Makefile.am
+++ b/sdm845/location/Makefile.am
@@ -26,7 +26,9 @@
 library_include_HEADERS = \
     LocationAPI.h \
     LocationAPIClientBase.h \
-    location_interface.h
+    location_interface.h \
+    LocationDataTypes.h \
+    ILocationAPI.h
 
 #Create and Install libraries
 lib_LTLIBRARIES = liblocation_api.la
diff --git a/sdm845/utils/gps_extended_c.h b/sdm845/utils/gps_extended_c.h
index 01f469d..66ca61b 100644
--- a/sdm845/utils/gps_extended_c.h
+++ b/sdm845/utils/gps_extended_c.h
@@ -133,13 +133,6 @@
     /* Provider indicator for HYBRID or GPS */
     uint16_t        position_source;
     LocPosTechMask  tech_mask;
-    /*allows HAL to pass additional information related to the location */
-    int             rawDataSize;         /* in # of bytes */
-    void            * rawData;
-    bool            is_indoor;
-    float           floor_number;
-    char            map_url[GPS_LOCATION_MAP_URL_SIZE];
-    unsigned char   map_index[GPS_LOCATION_MAP_INDEX_SIZE];
 } UlpLocation;
 
 typedef struct {
@@ -746,25 +739,6 @@
 #define ULP_GNSS_SV_POLY_BIT_VELO_COEFF             (1<<ULP_GNSS_SV_POLY_VELO_COEFF)
 #define ULP_GNSS_SV_POLY_BIT_ENHANCED_IOD           (1<<ULP_GNSS_SV_POLY_ENHANCED_IOD)
 
-
-typedef enum
-{
-    GNSS_LOC_SV_SYSTEM_GPS                    = 1,
-    /**< GPS satellite. */
-    GNSS_LOC_SV_SYSTEM_GALILEO                = 2,
-    /**< GALILEO satellite. */
-    GNSS_LOC_SV_SYSTEM_SBAS                   = 3,
-    /**< SBAS satellite. */
-    GNSS_LOC_SV_SYSTEM_COMPASS                = 4,
-    /**< COMPASS satellite. */
-    GNSS_LOC_SV_SYSTEM_GLONASS                = 5,
-    /**< GLONASS satellite. */
-    GNSS_LOC_SV_SYSTEM_BDS                    = 6,
-    /**< BDS satellite. */
-    GNSS_LOC_SV_SYSTEM_QZSS                   = 7
-    /**< QZSS satellite. */
-} Gnss_LocSvSystemEnumType;
-
 typedef enum
 {
     GNSS_LOC_FREQ_SOURCE_INVALID = 0,
diff --git a/sdm845/utils/loc_cfg.cpp b/sdm845/utils/loc_cfg.cpp
index 8037979..ad7aba2 100644
--- a/sdm845/utils/loc_cfg.cpp
+++ b/sdm845/utils/loc_cfg.cpp
@@ -454,7 +454,6 @@
     unsigned int loc_feature_mask;
     char platform_list[LOC_MAX_PARAM_STRING];
     char baseband[LOC_MAX_PARAM_STRING];
-    char lean_targets[LOC_MAX_PARAM_STRING];
     unsigned int sglte_target;
     char feature_gtp_cell_proc[LOC_MAX_PARAM_STRING];
     char feature_gtp_waa[LOC_MAX_PARAM_STRING];
@@ -499,7 +498,6 @@
     {"IZAT_FEATURE_MASK",   &conf.loc_feature_mask,    NULL, 'n'},
     {"PLATFORMS",           &conf.platform_list,       NULL, 's'},
     {"BASEBAND",            &conf.baseband,            NULL, 's'},
-    {"LEAN_TARGETS",        &conf.lean_targets,        NULL, 's'},
     {"HARDWARE_TYPE",       &conf.auto_platform,       NULL, 's'},
 };
 
@@ -541,7 +539,6 @@
     FILE* conf_fp = nullptr;
     char platform_name[PROPERTY_VALUE_MAX], baseband_name[PROPERTY_VALUE_MAX];
     char autoplatform_name[PROPERTY_VALUE_MAX];
-    int lean_target=0;
     unsigned int loc_service_mask=0;
     char config_mask = 0;
     unsigned char proc_list_length=0;
@@ -573,8 +570,6 @@
     loc_get_platform_name(platform_name, sizeof(platform_name));
     //Get baseband name from ro.baseband property
     loc_get_target_baseband(baseband_name, sizeof(baseband_name));
-    lean_target = loc_identify_lean_target();
-    LOC_LOGD("%s:%d]: lean target:%d", __func__, __LINE__, lean_target);
     //Identify if this is an automotive platform
     loc_get_auto_platform_name(autoplatform_name,sizeof(autoplatform_name));
 
@@ -915,13 +910,6 @@
             }
         }
 
-        nstrings = loc_util_split_string(conf.lean_targets, split_strings, MAX_NUM_STRINGS, ' ');
-        if(!strcmp("DISABLED", split_strings[0]) && lean_target) {
-            LOC_LOGD("%s:%d]: Disabled for lean targets\n", __func__, __LINE__);
-            child_proc[j].proc_status = DISABLED;
-            continue;
-        }
-
         if((config_mask & CONFIG_MASK_TARGET_CHECK) &&
            (config_mask & CONFIG_MASK_BASEBAND_CHECK) &&
            (config_mask & CONFIG_MASK_AUTOPLATFORM_CHECK) &&
diff --git a/sdm845/utils/loc_target.cpp b/sdm845/utils/loc_target.cpp
index 0855528..569f3a7 100644
--- a/sdm845/utils/loc_target.cpp
+++ b/sdm845/utils/loc_target.cpp
@@ -206,16 +206,3 @@
     LOC_LOGW("HAL: %s returned %d", __FUNCTION__, gTarget);
     return gTarget;
 }
-
-/*Reads the property ro.lean to identify if this is a lean target
-  Returns:
-  0 if not a lean and mean target
-  1 if this is a lean and mean target
-*/
-int loc_identify_lean_target()
-{
-    char lean_target[PROPERTY_VALUE_MAX];
-    property_get("ro.lean", lean_target, "");
-    LOC_LOGD("%s:%d]: lean target: %s\n", __func__, __LINE__, lean_target);
-    return !(strncmp(lean_target, "true", PROPERTY_VALUE_MAX));
-}
diff --git a/sdm845/utils/loc_target.h b/sdm845/utils/loc_target.h
index 47a67d9..172b475 100644
--- a/sdm845/utils/loc_target.h
+++ b/sdm845/utils/loc_target.h
@@ -55,12 +55,6 @@
   of atleast PROPERTY_VALUE_MAX*/
 void loc_get_auto_platform_name(char *platform_name, int array_length);
 
-/*Reads the property ro.lean to identify if this is a lean target
-  Returns:
-  0 if not a lean and mean target
-  1 if this is a lean and mean target*/
-int loc_identify_lean_target();
-
 /* Please remember to update 'target_name' in loc_log.cpp,
    if do any changes to this enum. */
 typedef enum {