summaryrefslogtreecommitdiff
path: root/gnss/aidl/default/Gnss.cpp
diff options
context:
space:
mode:
authorHaamed Gheibi <haamed@google.com>2022-02-04 13:47:26 -0800
committerHaamed Gheibi <haamed@google.com>2022-02-04 13:55:47 -0800
commitf99b35c293439db0b7436b47b939eb8c7bf21b51 (patch)
tree6cd9b0719554809447c845616317cca5409b93ae /gnss/aidl/default/Gnss.cpp
parenta028272dee9220e6810cbdcfb2328c34f8afe4c2 (diff)
parent332dead340bb196c6ba3f6978e8fb53966c74bf7 (diff)
Merge TP1A.220120.003
Change-Id: Ie5eba313ee102e452f5f96942ed2f3a7bb4e8f01
Diffstat (limited to 'gnss/aidl/default/Gnss.cpp')
-rw-r--r--gnss/aidl/default/Gnss.cpp39
1 files changed, 37 insertions, 2 deletions
diff --git a/gnss/aidl/default/Gnss.cpp b/gnss/aidl/default/Gnss.cpp
index e296351d95..c11a99ae9b 100644
--- a/gnss/aidl/default/Gnss.cpp
+++ b/gnss/aidl/default/Gnss.cpp
@@ -20,6 +20,8 @@
#include <inttypes.h>
#include <log/log.h>
#include "AGnss.h"
+#include "DeviceFileReader.h"
+#include "GnssAntennaInfo.h"
#include "GnssBatching.h"
#include "GnssConfiguration.h"
#include "GnssDebug.h"
@@ -28,10 +30,14 @@
#include "GnssNavigationMessageInterface.h"
#include "GnssPsds.h"
#include "GnssVisibilityControl.h"
+#include "MeasurementCorrectionsInterface.h"
+#include "NmeaFixInfo.h"
#include "Utils.h"
namespace aidl::android::hardware::gnss {
+using ::android::hardware::gnss::common::NmeaFixInfo;
using ::android::hardware::gnss::common::Utils;
+
using ndk::ScopedAStatus;
using GnssSvInfo = IGnssCallback::GnssSvInfo;
@@ -62,6 +68,12 @@ ScopedAStatus Gnss::setCallback(const std::shared_ptr<IGnssCallback>& callback)
return ScopedAStatus::ok();
}
+std::unique_ptr<GnssLocation> Gnss::getLocationFromHW() {
+ std::string inputStr =
+ ::android::hardware::gnss::common::DeviceFileReader::Instance().getLocationData();
+ return ::android::hardware::gnss::common::NmeaFixInfo::getAidlLocationFromInputStr(inputStr);
+}
+
ScopedAStatus Gnss::start() {
ALOGD("start()");
if (mIsActive) {
@@ -82,9 +94,14 @@ ScopedAStatus Gnss::start() {
auto svStatus = filterBlocklistedSatellites(Utils::getMockSvInfoList());
this->reportSvStatus(svStatus);
+ auto currentLocation = getLocationFromHW();
mGnssPowerIndication->notePowerConsumption();
- const auto location = Utils::getMockLocation();
- this->reportLocation(location);
+ if (currentLocation != nullptr) {
+ this->reportLocation(*currentLocation);
+ } else {
+ const auto location = Utils::getMockLocation();
+ this->reportLocation(location);
+ }
std::this_thread::sleep_for(std::chrono::milliseconds(mMinIntervalMs));
}
});
@@ -264,4 +281,22 @@ ndk::ScopedAStatus Gnss::getExtensionGnssVisibilityControl(
return ndk::ScopedAStatus::ok();
}
+ndk::ScopedAStatus Gnss::getExtensionGnssAntennaInfo(
+ std::shared_ptr<IGnssAntennaInfo>* iGnssAntennaInfo) {
+ ALOGD("Gnss::getExtensionGnssAntennaInfo");
+
+ *iGnssAntennaInfo = SharedRefBase::make<GnssAntennaInfo>();
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus Gnss::getExtensionMeasurementCorrections(
+ std::shared_ptr<measurement_corrections::IMeasurementCorrectionsInterface>*
+ iMeasurementCorrections) {
+ ALOGD("Gnss::getExtensionMeasurementCorrections");
+
+ *iMeasurementCorrections =
+ SharedRefBase::make<measurement_corrections::MeasurementCorrectionsInterface>();
+ return ndk::ScopedAStatus::ok();
+}
+
} // namespace aidl::android::hardware::gnss