Supported synchronized fixed location and measurement from device files
Replace NMEA by one row fixed location data
Test: atest VtsHalGnssTargetTest
Test: launch_cvd -cpus 16 -memory_mb 16192 --start_gnss_proxy --gnss_file_path=/usr/local/google/home/yuchenhe/Downloads/raw.txt --fixed_location_file_path=/google/data/rw/users/yu/yuchenhe/input.txt
Bug: 213225295
Merged-In: Ide7bbb3e81a90414496084691227bd95a2e7af18
Change-Id: Ide7bbb3e81a90414496084691227bd95a2e7af18
diff --git a/gnss/common/utils/default/include/Constants.h b/gnss/common/utils/default/include/Constants.h
index f205ba6..489413e 100644
--- a/gnss/common/utils/default/include/Constants.h
+++ b/gnss/common/utils/default/include/Constants.h
@@ -36,6 +36,7 @@
// Location replay constants
constexpr char GNSS_PATH[] = "/dev/gnss0";
+constexpr char FIXED_LOCATION_PATH[] = "/dev/gnss1";
constexpr int INPUT_BUFFER_SIZE = 256;
constexpr char CMD_GET_LOCATION[] = "CMD_GET_LOCATION";
constexpr char CMD_GET_RAWMEASUREMENT[] = "CMD_GET_RAWMEASUREMENT";
diff --git a/gnss/common/utils/default/include/GnssReplayUtils.h b/gnss/common/utils/default/include/GnssReplayUtils.h
index 32c0e58..d1bbed4 100644
--- a/gnss/common/utils/default/include/GnssReplayUtils.h
+++ b/gnss/common/utils/default/include/GnssReplayUtils.h
@@ -37,10 +37,14 @@
struct ReplayUtils {
static std::string getGnssPath();
+ static std::string getFixedLocationPath();
+
static std::string getDataFromDeviceFile(const std::string& command, int mMinIntervalMs);
static bool hasGnssDeviceFile();
+ static bool hasFixedLocationDeviceFile();
+
static bool isGnssRawMeasurement(const std::string& inputStr);
static bool isNMEA(const std::string& inputStr);
diff --git a/gnss/common/utils/default/include/v2_1/GnssTemplate.h b/gnss/common/utils/default/include/v2_1/GnssTemplate.h
index fbf04b3..473e587 100644
--- a/gnss/common/utils/default/include/v2_1/GnssTemplate.h
+++ b/gnss/common/utils/default/include/v2_1/GnssTemplate.h
@@ -31,6 +31,7 @@
#include <cutils/properties.h>
#include "DeviceFileReader.h"
+#include "FixLocationParser.h"
#include "GnssAntennaInfo.h"
#include "GnssConfiguration.h"
#include "GnssDebug.h"
@@ -38,7 +39,6 @@
#include "GnssMeasurementCorrections.h"
#include "GnssReplayUtils.h"
#include "MockLocation.h"
-#include "NmeaFixInfo.h"
#include "Utils.h"
namespace android::hardware::gnss::common::implementation {
@@ -162,9 +162,12 @@
template <class T_IGnss>
std::unique_ptr<V2_0::GnssLocation> GnssTemplate<T_IGnss>::getLocationFromHW() {
mHardwareModeChecked = true;
+ if (!ReplayUtils::hasFixedLocationDeviceFile()) {
+ return nullptr;
+ }
std::string inputStr =
::android::hardware::gnss::common::DeviceFileReader::Instance().getLocationData();
- return NmeaFixInfo::getLocationFromInputStr(inputStr);
+ return FixLocationParser::getLocationFromInputStr(inputStr);
}
template <class T_IGnss>