Merge "Merge "Copy position mode to dummy ULP proxy""
This commit is contained in:
commit
876321818f
2 changed files with 42 additions and 28 deletions
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -37,11 +37,19 @@ class LocAdapterBase;
|
|||
|
||||
class UlpProxyBase {
|
||||
public:
|
||||
inline UlpProxyBase() {}
|
||||
LocPosMode mPosMode;
|
||||
bool mFixSet;
|
||||
inline UlpProxyBase() {
|
||||
mPosMode.mode = LOC_POSITION_MODE_INVALID;
|
||||
mFixSet = false;
|
||||
}
|
||||
inline virtual ~UlpProxyBase() {}
|
||||
inline virtual bool sendStartFix() { return false;}
|
||||
inline virtual bool sendStopFix() { return false;}
|
||||
inline virtual bool sendFixMode(LocPosMode ¶ms) { return false;}
|
||||
inline virtual bool sendStartFix() { mFixSet = true; return false; }
|
||||
inline virtual bool sendStopFix() { mFixSet = false; return false; }
|
||||
inline virtual bool sendFixMode(LocPosMode ¶ms) {
|
||||
mPosMode = params;
|
||||
return false;
|
||||
}
|
||||
inline virtual bool reportPosition(UlpLocation &location,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* locationExt,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -52,22 +52,6 @@ void LocInternalAdapter::stopFixInt() {
|
|||
void LocInternalAdapter::getZppInt() {
|
||||
sendMsg(new LocEngGetZpp(mLocEngAdapter));
|
||||
}
|
||||
void LocInternalAdapter::setUlpProxy(UlpProxyBase* ulp) {
|
||||
struct LocSetUlpProxy : public LocMsg {
|
||||
LocAdapterBase* mAdapter;
|
||||
UlpProxyBase* mUlp;
|
||||
inline LocSetUlpProxy(LocAdapterBase* adapter, UlpProxyBase* ulp) :
|
||||
LocMsg(), mAdapter(adapter), mUlp(ulp) {
|
||||
}
|
||||
virtual void proc() const {
|
||||
LOC_LOGV("%s] ulp %p adapter %p", __func__,
|
||||
mUlp, mAdapter);
|
||||
mAdapter->setUlpProxy(mUlp);
|
||||
}
|
||||
};
|
||||
|
||||
sendMsg(new LocSetUlpProxy(mLocEngAdapter, ulp));
|
||||
}
|
||||
|
||||
LocEngAdapter::LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
|
||||
void* owner, ContextBase* context,
|
||||
|
@ -95,6 +79,23 @@ LocEngAdapter::~LocEngAdapter()
|
|||
LOC_LOGV("LocEngAdapter deleted");
|
||||
}
|
||||
|
||||
void LocInternalAdapter::setUlpProxy(UlpProxyBase* ulp) {
|
||||
struct LocSetUlpProxy : public LocMsg {
|
||||
LocAdapterBase* mAdapter;
|
||||
UlpProxyBase* mUlp;
|
||||
inline LocSetUlpProxy(LocAdapterBase* adapter, UlpProxyBase* ulp) :
|
||||
LocMsg(), mAdapter(adapter), mUlp(ulp) {
|
||||
}
|
||||
virtual void proc() const {
|
||||
LOC_LOGV("%s] ulp %p adapter %p", __func__,
|
||||
mUlp, mAdapter);
|
||||
mAdapter->setUlpProxy(mUlp);
|
||||
}
|
||||
};
|
||||
|
||||
sendMsg(new LocSetUlpProxy(mLocEngAdapter, ulp));
|
||||
}
|
||||
|
||||
void LocEngAdapter::setUlpProxy(UlpProxyBase* ulp)
|
||||
{
|
||||
if (ulp == mUlp) {
|
||||
|
@ -102,18 +103,24 @@ void LocEngAdapter::setUlpProxy(UlpProxyBase* ulp)
|
|||
//and we get the same object back for UlpProxyBase . Do nothing
|
||||
return;
|
||||
}
|
||||
delete mUlp;
|
||||
|
||||
LOC_LOGV("%s] %p", __func__, ulp);
|
||||
if (NULL == ulp) {
|
||||
LOC_LOGE("%s:%d]: ulp pointer is NULL", __func__, __LINE__);
|
||||
ulp = new UlpProxyBase();
|
||||
}
|
||||
mUlp = ulp;
|
||||
|
||||
if (LOC_POSITION_MODE_INVALID != mFixCriteria.mode) {
|
||||
if (LOC_POSITION_MODE_INVALID != mUlp->mPosMode.mode) {
|
||||
// need to send this mode and start msg to ULP
|
||||
mUlp->sendFixMode(mFixCriteria);
|
||||
mUlp->sendStartFix();
|
||||
ulp->sendFixMode(mUlp->mPosMode);
|
||||
}
|
||||
|
||||
if(mUlp->mFixSet) {
|
||||
ulp->sendStartFix();
|
||||
}
|
||||
|
||||
delete mUlp;
|
||||
mUlp = ulp;
|
||||
}
|
||||
|
||||
void LocInternalAdapter::reportPosition(UlpLocation &location,
|
||||
|
@ -294,4 +301,3 @@ void LocEngAdapter::handleEngineUpEvent()
|
|||
{
|
||||
sendMsg(new LocEngUp(mOwner));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue