From c85c8ff673e4347cea911b353de120f639b39b83 Mon Sep 17 00:00:00 2001 From: Dante Russo Date: Tue, 28 Feb 2017 16:45:47 -0800 Subject: LocationAPI implementation Implementation of LocationAPI into gps hal to be a common API that is called into by platform specific APIs. Change-Id: Ie5a7bd217d4ae2175ad49e6aca2fb6ecd4702f3b CRs-fixed: 1112712 --- core/LocAdapterBase.cpp | 47 ++++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 19 deletions(-) (limited to 'core/LocAdapterBase.cpp') diff --git a/core/LocAdapterBase.cpp b/core/LocAdapterBase.cpp index 166fd91..27132b7 100644 --- a/core/LocAdapterBase.cpp +++ b/core/LocAdapterBase.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, 2016-2017The 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 @@ -50,6 +50,16 @@ LocAdapterBase::LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask, mLocApi->addAdapter(this); } +uint32_t LocAdapterBase::mSessionIdCounter(1); + +uint32_t LocAdapterBase::generateSessionId() +{ + if (++mSessionIdCounter == 0xFFFFFFFF) + mSessionIdCounter = 1; + + return mSessionIdCounter; +} + void LocAdapterBase::handleEngineUpEvent() { if (mLocAdapterProxyBase) { @@ -65,32 +75,31 @@ void LocAdapterBase::handleEngineDownEvent() } void LocAdapterBase:: - reportPosition(UlpLocation &location, - GpsLocationExtended &locationExtended, - void* locationExt, - enum loc_sess_status status, - LocPosTechMask loc_technology_mask) { - if (mLocAdapterProxyBase == NULL || - !mLocAdapterProxyBase->reportPosition(location, - locationExtended, - status, - loc_technology_mask)) { + reportPositionEvent(const UlpLocation& location, + const GpsLocationExtended& locationExtended, + enum loc_sess_status status, + LocPosTechMask loc_technology_mask, + bool fromUlp) { + if (mLocAdapterProxyBase != NULL) { + mLocAdapterProxyBase->reportPositionEvent((UlpLocation&)location, + (GpsLocationExtended&)locationExtended, + status, + loc_technology_mask); + } else { DEFAULT_IMPL() } } void LocAdapterBase:: - reportSv(LocGnssSvStatus &svStatus, - GpsLocationExtended &locationExtended, - void* svExt) + reportSvEvent(const GnssSvNotification& svNotify, bool fromUlp) DEFAULT_IMPL() void LocAdapterBase:: - reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet) + reportSvMeasurementEvent(GnssSvMeasurementSet &svMeasurementSet) DEFAULT_IMPL() void LocAdapterBase:: - reportSvPolynomial(GnssSvPolynomial &svPolynomial) + reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial) DEFAULT_IMPL() void LocAdapterBase:: @@ -99,7 +108,7 @@ DEFAULT_IMPL() void LocAdapterBase:: - reportNmea(const char* nmea, int length) + reportNmeaEvent(const char* nmea, size_t length, bool fromUlp) DEFAULT_IMPL() bool LocAdapterBase:: @@ -140,11 +149,11 @@ bool LocAdapterBase:: DEFAULT_IMPL(false) bool LocAdapterBase:: - requestNiNotify(LocGpsNiNotification ¬ify, const void* data) + requestNiNotifyEvent(GnssNiNotification ¬ify, const void* data) DEFAULT_IMPL(false) void LocAdapterBase:: - reportGnssMeasurementData(LocGnssData &gnssMeasurementData) + reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurementsNotify) DEFAULT_IMPL() bool LocAdapterBase:: -- cgit v1.2.3