diff options
author | Bruno Martins <bgcngm@gmail.com> | 2018-03-14 23:42:25 +0000 |
---|---|---|
committer | Cosme Domínguez Díaz <cosme.ddiaz@gmail.com> | 2018-03-16 00:50:43 +0100 |
commit | 122f2ed00414cf416b67c6dee10131b0f3e28bea (patch) | |
tree | 04057c48ef75a874573f880e5ea3a3ede58fdd95 /gps/android/AGnss.cpp | |
parent | d725d2ed80359098e6b1952f942421cabd844b2a (diff) |
msm8996-common: Update GPS HIDL HAL from upstream
* Tag: LA.UM.6.6.r1-06700-89xx.0
Change-Id: If746b12bcbc3e414aa9ba9f421040edd0f815638
Diffstat (limited to 'gps/android/AGnss.cpp')
-rw-r--r-- | gps/android/AGnss.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/gps/android/AGnss.cpp b/gps/android/AGnss.cpp index 6213a08..3602e85 100644 --- a/gps/android/AGnss.cpp +++ b/gps/android/AGnss.cpp @@ -30,12 +30,23 @@ namespace gnss { namespace V1_0 { namespace implementation { -sp<IAGnssCallback> AGnss::sAGnssCbIface = nullptr; +static AGnss* spAGnss = nullptr; AGnss::AGnss(Gnss* gnss) : mGnss(gnss) { + spAGnss = this; +} + +AGnss::~AGnss() { + spAGnss = nullptr; } void AGnss::agnssStatusIpV4Cb(AGnssExtStatusIpV4 status){ + if (nullptr != spAGnss) { + spAGnss->statusIpV4Cb(status); + } +} + +void AGnss::statusIpV4Cb(AGnssExtStatusIpV4 status) { IAGnssCallback::AGnssStatusIpV4 st = {}; switch (status.type) { @@ -72,9 +83,13 @@ void AGnss::agnssStatusIpV4Cb(AGnssExtStatusIpV4 status){ } st.ipV4Addr = status.ipV4Addr; - auto r = sAGnssCbIface->agnssStatusIpV4Cb(st); - if (!r.isOk()) { - LOC_LOGE("Error invoking AGNSS status cb %s", r.description().c_str()); + if (mAGnssCbIface != nullptr) { + auto r = mAGnssCbIface->agnssStatusIpV4Cb(st); + if (!r.isOk()) { + LOC_LOGw("Error invoking AGNSS status cb %s", r.description().c_str()); + } + } else { + LOC_LOGw("setCallback has not been called yet"); } } @@ -86,7 +101,7 @@ Return<void> AGnss::setCallback(const sp<IAGnssCallback>& callback) { } // Save the interface - sAGnssCbIface = callback; + mAGnssCbIface = callback; AgpsCbInfo cbInfo = {}; cbInfo.statusV4Cb = (void*)agnssStatusIpV4Cb; |