2018-03-13 13:11:02 -04:00
|
|
|
/* Copyright (c) 2011-2014, 2016-2018 The Linux Foundation. All rights reserved.
|
2013-08-07 21:40:27 -04:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
2017-04-28 06:24:07 -04:00
|
|
|
#define LOG_NDEBUG 0
|
2013-08-07 21:40:27 -04:00
|
|
|
#define LOG_TAG "LocSvc_LocAdapterBase"
|
|
|
|
|
|
|
|
#include <dlfcn.h>
|
|
|
|
#include <LocAdapterBase.h>
|
|
|
|
#include <loc_target.h>
|
2016-09-12 20:20:55 -04:00
|
|
|
#include <log_util.h>
|
2014-01-24 14:35:16 -05:00
|
|
|
#include <LocAdapterProxyBase.h>
|
2013-08-07 21:40:27 -04:00
|
|
|
|
|
|
|
namespace loc_core {
|
|
|
|
|
|
|
|
// This is the top level class, so the constructor will
|
|
|
|
// always gets called. Here we prepare for the default.
|
|
|
|
// But if getLocApi(targetEnumType target) is overriden,
|
|
|
|
// the right locApi should get created.
|
|
|
|
LocAdapterBase::LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
|
2018-05-15 13:21:09 -04:00
|
|
|
ContextBase* context, bool isMaster,
|
|
|
|
LocAdapterProxyBase *adapterProxyBase) :
|
|
|
|
mIsMaster(isMaster), mEvtMask(mask), mContext(context),
|
2014-01-24 14:35:16 -05:00
|
|
|
mLocApi(context->getLocApi()), mLocAdapterProxyBase(adapterProxyBase),
|
|
|
|
mMsgTask(context->getMsgTask())
|
2013-08-07 21:40:27 -04:00
|
|
|
{
|
2013-10-23 14:28:51 -04:00
|
|
|
mLocApi->addAdapter(this);
|
2013-08-07 21:40:27 -04:00
|
|
|
}
|
|
|
|
|
2017-02-28 19:45:47 -05:00
|
|
|
uint32_t LocAdapterBase::mSessionIdCounter(1);
|
|
|
|
|
|
|
|
uint32_t LocAdapterBase::generateSessionId()
|
|
|
|
{
|
|
|
|
if (++mSessionIdCounter == 0xFFFFFFFF)
|
|
|
|
mSessionIdCounter = 1;
|
|
|
|
|
|
|
|
return mSessionIdCounter;
|
|
|
|
}
|
|
|
|
|
2014-01-24 14:35:16 -05:00
|
|
|
void LocAdapterBase::handleEngineUpEvent()
|
|
|
|
{
|
|
|
|
if (mLocAdapterProxyBase) {
|
|
|
|
mLocAdapterProxyBase->handleEngineUpEvent();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void LocAdapterBase::handleEngineDownEvent()
|
|
|
|
{
|
|
|
|
if (mLocAdapterProxyBase) {
|
|
|
|
mLocAdapterProxyBase->handleEngineDownEvent();
|
|
|
|
}
|
|
|
|
}
|
2013-08-07 21:40:27 -04:00
|
|
|
|
|
|
|
void LocAdapterBase::
|
2017-02-28 19:45:47 -05:00
|
|
|
reportPositionEvent(const UlpLocation& location,
|
|
|
|
const GpsLocationExtended& locationExtended,
|
|
|
|
enum loc_sess_status status,
|
|
|
|
LocPosTechMask loc_technology_mask,
|
2018-06-07 19:54:35 -04:00
|
|
|
bool /*fromEngineHub*/,
|
|
|
|
GnssDataNotification* pDataNotify,
|
|
|
|
int msInWeek)
|
|
|
|
{
|
2017-02-28 19:45:47 -05:00
|
|
|
if (mLocAdapterProxyBase != NULL) {
|
|
|
|
mLocAdapterProxyBase->reportPositionEvent((UlpLocation&)location,
|
|
|
|
(GpsLocationExtended&)locationExtended,
|
|
|
|
status,
|
|
|
|
loc_technology_mask);
|
|
|
|
} else {
|
2015-01-20 17:42:26 -05:00
|
|
|
DEFAULT_IMPL()
|
|
|
|
}
|
|
|
|
}
|
2013-08-07 21:40:27 -04:00
|
|
|
|
|
|
|
void LocAdapterBase::
|
2018-03-30 20:10:59 -04:00
|
|
|
reportSvEvent(const GnssSvNotification& /*svNotify*/,
|
2018-06-07 15:03:55 -04:00
|
|
|
bool /*fromEngineHub*/)
|
2013-08-07 21:40:27 -04:00
|
|
|
DEFAULT_IMPL()
|
|
|
|
|
2015-01-16 01:24:40 -05:00
|
|
|
void LocAdapterBase::
|
2017-07-03 09:00:31 -04:00
|
|
|
reportSvMeasurementEvent(GnssSvMeasurementSet &/*svMeasurementSet*/)
|
2015-01-16 01:24:40 -05:00
|
|
|
DEFAULT_IMPL()
|
|
|
|
|
|
|
|
void LocAdapterBase::
|
2017-07-03 09:00:31 -04:00
|
|
|
reportSvPolynomialEvent(GnssSvPolynomial &/*svPolynomial*/)
|
2015-01-16 01:24:40 -05:00
|
|
|
DEFAULT_IMPL()
|
2013-08-07 21:40:27 -04:00
|
|
|
|
2018-08-22 12:45:25 -04:00
|
|
|
void LocAdapterBase::
|
|
|
|
reportSvEphemerisEvent(GnssSvEphemerisReport &/*svEphemeris*/)
|
|
|
|
DEFAULT_IMPL()
|
|
|
|
|
|
|
|
|
2013-08-07 21:40:27 -04:00
|
|
|
void LocAdapterBase::
|
2017-07-03 09:00:31 -04:00
|
|
|
reportStatus(LocGpsStatusValue /*status*/)
|
2013-08-07 21:40:27 -04:00
|
|
|
DEFAULT_IMPL()
|
|
|
|
|
|
|
|
|
|
|
|
void LocAdapterBase::
|
2018-06-07 15:03:55 -04:00
|
|
|
reportNmeaEvent(const char* /*nmea*/, size_t /*length*/)
|
2013-08-07 21:40:27 -04:00
|
|
|
DEFAULT_IMPL()
|
|
|
|
|
2018-06-07 19:54:35 -04:00
|
|
|
void LocAdapterBase::
|
|
|
|
reportDataEvent(const GnssDataNotification& /*dataNotify*/,
|
|
|
|
int /*msInWeek*/)
|
|
|
|
DEFAULT_IMPL()
|
|
|
|
|
2013-08-07 21:40:27 -04:00
|
|
|
bool LocAdapterBase::
|
2017-07-03 09:00:31 -04:00
|
|
|
reportXtraServer(const char* /*url1*/, const char* /*url2*/,
|
|
|
|
const char* /*url3*/, const int /*maxlength*/)
|
2013-08-07 21:40:27 -04:00
|
|
|
DEFAULT_IMPL(false)
|
|
|
|
|
|
|
|
bool LocAdapterBase::
|
|
|
|
requestXtraData()
|
|
|
|
DEFAULT_IMPL(false)
|
|
|
|
|
|
|
|
bool LocAdapterBase::
|
|
|
|
requestTime()
|
|
|
|
DEFAULT_IMPL(false)
|
|
|
|
|
|
|
|
bool LocAdapterBase::
|
|
|
|
requestLocation()
|
|
|
|
DEFAULT_IMPL(false)
|
|
|
|
|
|
|
|
bool LocAdapterBase::
|
2018-03-13 13:11:02 -04:00
|
|
|
requestATL(int /*connHandle*/, LocAGpsType /*agps_type*/,
|
|
|
|
LocApnTypeMask /*apn_type_mask*/)
|
2013-08-07 21:40:27 -04:00
|
|
|
DEFAULT_IMPL(false)
|
|
|
|
|
|
|
|
bool LocAdapterBase::
|
2017-07-03 09:00:31 -04:00
|
|
|
releaseATL(int /*connHandle*/)
|
2013-08-07 21:40:27 -04:00
|
|
|
DEFAULT_IMPL(false)
|
|
|
|
|
|
|
|
bool LocAdapterBase::
|
2017-07-03 09:00:31 -04:00
|
|
|
requestNiNotifyEvent(const GnssNiNotification &/*notify*/, const void* /*data*/)
|
2013-08-07 21:40:27 -04:00
|
|
|
DEFAULT_IMPL(false)
|
2014-04-01 16:34:07 -04:00
|
|
|
|
2014-12-15 20:47:50 -05:00
|
|
|
void LocAdapterBase::
|
2017-08-09 21:40:51 -04:00
|
|
|
reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& /*measurements*/,
|
|
|
|
int /*msInWeek*/)
|
2014-12-15 20:47:50 -05:00
|
|
|
DEFAULT_IMPL()
|
2016-08-02 21:34:04 -04:00
|
|
|
|
|
|
|
bool LocAdapterBase::
|
2017-07-03 09:00:31 -04:00
|
|
|
reportWwanZppFix(LocGpsLocation &/*zppLoc*/)
|
2016-08-02 21:34:04 -04:00
|
|
|
DEFAULT_IMPL(false)
|
|
|
|
|
2018-01-22 19:04:50 -05:00
|
|
|
bool LocAdapterBase::
|
|
|
|
reportZppBestAvailableFix(LocGpsLocation& /*zppLoc*/,
|
|
|
|
GpsLocationExtended& /*location_extended*/, LocPosTechMask /*tech_mask*/)
|
|
|
|
DEFAULT_IMPL(false)
|
|
|
|
|
2018-05-20 09:59:46 -04:00
|
|
|
void LocAdapterBase::reportGnssSvIdConfigEvent(const GnssSvIdConfig& /*config*/)
|
|
|
|
DEFAULT_IMPL()
|
|
|
|
|
|
|
|
void LocAdapterBase::reportGnssSvTypeConfigEvent(const GnssSvTypeConfig& /*config*/)
|
|
|
|
DEFAULT_IMPL()
|
2018-01-22 19:04:50 -05:00
|
|
|
|
2018-04-08 14:05:14 -04:00
|
|
|
bool LocAdapterBase::
|
|
|
|
requestOdcpiEvent(OdcpiRequestInfo& /*request*/)
|
|
|
|
DEFAULT_IMPL(false)
|
|
|
|
|
2018-09-11 18:36:47 -04:00
|
|
|
bool LocAdapterBase::
|
|
|
|
reportGnssEngEnergyConsumedEvent(uint64_t /*energyConsumedSinceFirstBoot*/)
|
|
|
|
DEFAULT_IMPL(false)
|
|
|
|
|
2018-08-22 12:45:25 -04:00
|
|
|
bool LocAdapterBase::
|
|
|
|
reportDeleteAidingDataEvent(GnssAidingData & /*aidingData*/)
|
|
|
|
DEFAULT_IMPL(false)
|
2013-08-07 21:40:27 -04:00
|
|
|
} // namespace loc_core
|