diff options
author | Isaac Chen <isaacchen@isaacchen.cn> | 2018-12-31 10:55:08 +0100 |
---|---|---|
committer | TingyiChen <tingyi364@gmail.com> | 2019-08-13 11:54:40 +0200 |
commit | e5c53750f06e9d9739b45ec108260ead7ff80941 (patch) | |
tree | fe1d84884caefc481e994ae9c59c84b11fddd408 /gps/android/GnssMeasurement.cpp | |
parent | 3ac2a0309619515c9ac27a5b6ec7c212b86dc355 (diff) |
wayne-common: Synchorize gps to P
* QC Tag: LA.UM.7.2.r1-04900-sdm660.0
Signed-off-by: Isaac Chen <isaacchen@isaacchen.cn>
Change-Id: I34383e8fbf394b774f83f8d662873e8786ff1bbf
Diffstat (limited to 'gps/android/GnssMeasurement.cpp')
-rw-r--r-- | gps/android/GnssMeasurement.cpp | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/gps/android/GnssMeasurement.cpp b/gps/android/GnssMeasurement.cpp index 8cbfabd..2578a85 100644 --- a/gps/android/GnssMeasurement.cpp +++ b/gps/android/GnssMeasurement.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. * Not a Contribution */ /* @@ -27,7 +27,7 @@ namespace android { namespace hardware { namespace gnss { -namespace V1_0 { +namespace V1_1 { namespace implementation { void GnssMeasurement::GnssMeasurementDeathRecipient::serviceDied( @@ -52,8 +52,9 @@ GnssMeasurement::~GnssMeasurement() { } // Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow. + Return<IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback( - const sp<IGnssMeasurementCallback>& callback) { + const sp<V1_0::IGnssMeasurementCallback>& callback) { Return<IGnssMeasurement::GnssMeasurementStatus> ret = IGnssMeasurement::GnssMeasurementStatus::ERROR_GENERIC; @@ -72,9 +73,10 @@ Return<IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback( } mGnssMeasurementCbIface = callback; - mGnssMeasurementCbIface->linkToDeath(mGnssMeasurementDeathRecipient, 0 /*cookie*/); + mGnssMeasurementCbIface->linkToDeath(mGnssMeasurementDeathRecipient, 0); return mApi->measurementSetCallback(callback); + } Return<void> GnssMeasurement::close() { @@ -87,13 +89,43 @@ Return<void> GnssMeasurement::close() { mGnssMeasurementCbIface->unlinkToDeath(mGnssMeasurementDeathRecipient); mGnssMeasurementCbIface = nullptr; } + if (mGnssMeasurementCbIface_1_1 != nullptr) { + mGnssMeasurementCbIface_1_1->unlinkToDeath(mGnssMeasurementDeathRecipient); + mGnssMeasurementCbIface_1_1 = nullptr; + } mApi->measurementClose(); return Void(); } +// Methods from ::android::hardware::gnss::V1_1::IGnssMeasurement follow. +Return<GnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback_1_1( + const sp<IGnssMeasurementCallback>& callback, bool /*enableFullTracking*/) { + + Return<IGnssMeasurement::GnssMeasurementStatus> ret = + IGnssMeasurement::GnssMeasurementStatus::ERROR_GENERIC; + if (mGnssMeasurementCbIface_1_1 != nullptr) { + LOC_LOGE("%s]: GnssMeasurementCallback is already set", __FUNCTION__); + return IGnssMeasurement::GnssMeasurementStatus::ERROR_ALREADY_INIT; + } + + if (callback == nullptr) { + LOC_LOGE("%s]: callback is nullptr", __FUNCTION__); + return ret; + } + if (mApi == nullptr) { + LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__); + return ret; + } + + mGnssMeasurementCbIface_1_1 = callback; + mGnssMeasurementCbIface_1_1->linkToDeath(mGnssMeasurementDeathRecipient, 0); + + return mApi->measurementSetCallback_1_1(callback); +} + } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace gnss } // namespace hardware } // namespace android |