summaryrefslogtreecommitdiffstats
path: root/gnss
diff options
context:
space:
mode:
authorYu-Han Yang <yuhany@google.com>2019-12-03 20:54:53 -0800
committerYu-Han Yang <yuhany@google.com>2020-01-22 21:20:42 -0800
commit5fe14fa9ec6bcc89018875fa1f25d6e94002fecd (patch)
treed8a57e7999b061f95903e320b692a4d48233b815 /gnss
parent4b229a44195d26114c870c4b9d6b03ecc63bfb22 (diff)
downloadplatform_hardware_interfaces-5fe14fa9ec6bcc89018875fa1f25d6e94002fecd.tar.gz
platform_hardware_interfaces-5fe14fa9ec6bcc89018875fa1f25d6e94002fecd.tar.bz2
platform_hardware_interfaces-5fe14fa9ec6bcc89018875fa1f25d6e94002fecd.zip
Add Inter-Signal Bias fields
Bug: 147500886 Test: on cuttlefish Change-Id: Id50d1f6a60e758e8c02b7a1c4bbdfd73f62ffeb7
Diffstat (limited to 'gnss')
-rw-r--r--gnss/2.1/Android.bp1
-rw-r--r--gnss/2.1/IGnssMeasurementCallback.hal113
-rw-r--r--gnss/2.1/types.hal46
-rw-r--r--gnss/2.1/vts/functional/gnss_hal_test_cases.cpp28
-rw-r--r--gnss/common/utils/default/Utils.cpp27
5 files changed, 208 insertions, 7 deletions
diff --git a/gnss/2.1/Android.bp b/gnss/2.1/Android.bp
index 8b0c374469..c615f1da23 100644
--- a/gnss/2.1/Android.bp
+++ b/gnss/2.1/Android.bp
@@ -7,6 +7,7 @@ hidl_interface {
enabled: true,
},
srcs: [
+ "types.hal",
"IGnss.hal",
"IGnssCallback.hal",
"IGnssMeasurement.hal",
diff --git a/gnss/2.1/IGnssMeasurementCallback.hal b/gnss/2.1/IGnssMeasurementCallback.hal
index ca6175f508..0385abd467 100644
--- a/gnss/2.1/IGnssMeasurementCallback.hal
+++ b/gnss/2.1/IGnssMeasurementCallback.hal
@@ -17,24 +17,115 @@
package android.hardware.gnss@2.1;
import @1.0::IGnssMeasurementCallback;
-import @1.1::IGnssMeasurementCallback;
import @2.0::IGnssMeasurementCallback;
import @2.0::ElapsedRealtime;
+import GnssSignalType;
/** The callback interface to report measurements from the HAL. */
interface IGnssMeasurementCallback extends @2.0::IGnssMeasurementCallback {
/**
- * Extends a GNSS Measurement, adding a basebandCN0DbHz.
+ * Flags to indicate what fields in GnssMeasurement are valid.
+ */
+ enum GnssMeasurementFlags : uint32_t {
+ /** A valid 'snr' is stored in the data structure. */
+ HAS_SNR = 1 << 0,
+ /** A valid 'carrier frequency' is stored in the data structure. */
+ HAS_CARRIER_FREQUENCY = 1 << 9,
+ /** A valid 'carrier cycles' is stored in the data structure. */
+ HAS_CARRIER_CYCLES = 1 << 10,
+ /** A valid 'carrier phase' is stored in the data structure. */
+ HAS_CARRIER_PHASE = 1 << 11,
+ /** A valid 'carrier phase uncertainty' is stored in the data structure. */
+ HAS_CARRIER_PHASE_UNCERTAINTY = 1 << 12,
+ /** A valid automatic gain control is stored in the data structure. */
+ HAS_AUTOMATIC_GAIN_CONTROL = 1 << 13,
+ /** A valid receiver inter-signal bias is stored in the data structure. */
+ HAS_RECEIVER_ISB = 1 << 16,
+ /** A valid receiver inter-signal bias uncertainty is stored in the data structure. */
+ HAS_RECEIVER_ISB_UNCERTAINTY = 1 << 17,
+ /** A valid satellite inter-signal bias is stored in the data structure. */
+ HAS_SATELLITE_ISB = 1 << 18,
+ /** A valid satellite inter-signal bias uncertainty is stored in the data structure. */
+ HAS_SATELLITE_ISB_UNCERTAINTY = 1 << 19
+ };
+
+
+ /**
+ * Extends a GNSS Measurement, adding basebandCN0DbHz, GnssMeasurementFlags,
+ * receiverInterSignalBiasNs, receiverInterSignalBiasUncertaintyNs, satelliteInterSignalBiasNs
+ * and satelliteInterSignalBiasUncertaintyNs.
*/
struct GnssMeasurement {
/**
* GNSS measurement information for a single satellite and frequency, as in the 2.0 version
* of the HAL.
+ *
+ * In this version of the HAL, the field 'flags' in the v2_0.v1_1.v1_0 struct is deprecated,
+ * and is no longer used by the framework. The GNSS measurement flags are instead reported
+ * in @2.1::IGnssMeasurementCallback.GnssMeasurement.flags.
+ *
*/
@2.0::IGnssMeasurementCallback.GnssMeasurement v2_0;
/**
+ * A set of flags indicating the validity of the fields in this data
+ * structure.
+ *
+ * Fields for which there is no corresponding flag must be filled in
+ * with a valid value. For convenience, these are marked as mandatory.
+ *
+ * Others fields may have invalid information in them, if not marked as
+ * valid by the corresponding bit in flags.
+ */
+ bitfield<GnssMeasurementFlags> flags;
+
+ /**
+ * The receiver inter-signal bias (ISB) in nanoseconds.
+ *
+ * This value is the estimated receiver-side inter-system (different from the constellation
+ * in GnssClock.referenceSignalForIsb) bias and inter-frequency (different from the carrier
+ * frequency in GnssClock.referenceSignalForIsb) bias. The reported receiver ISB
+ * must include signal delays caused by
+ *
+ * - Receiver inter-constellation bias
+ * - Receiver inter-frequency bias
+ * - Receiver inter-code bias
+ *
+ * The value does not include the inter-frequency Ionospheric bias.
+ *
+ * The receiver ISB of GnssClock.referenceSignalForIsb is defined to be 0.0 nanoseconds.
+ */
+ double receiverInterSignalBiasNs;
+
+ /**
+ * 1-sigma uncertainty associated with the receiver inter-signal bias in nanoseconds.
+ */
+ double receiverInterSignalBiasUncertaintyNs;
+
+ /**
+ * The satellite inter-signal bias in nanoseconds.
+ *
+ * This value is the satellite-and-control-segment-side inter-system (different from the
+ * constellation in GnssClock.referenceSignalForIsb) bias and inter-frequency (different
+ * from the carrier frequency in GnssClock.referenceSignalForIsb) bias, including:
+ *
+ * - Master clock bias (e.g., GPS-GAL Time Offset (GGTO), GPT-UTC Time Offset (TauGps),
+ * BDS-GLO Time Offset (BGTO))
+ * - Group delay (e.g., Total Group Delay (TGD))
+ * - Satellite inter-signal bias, which includes satellite inter-frequency bias (GLO only),
+ * and satellite inter-code bias (e.g., Differential Code Bias (DCB)).
+ *
+ * The receiver ISB of GnssClock.referenceSignalForIsb is defined to be 0.0 nanoseconds.
+ */
+ double satelliteInterSignalBiasNs;
+
+ /**
+ * 1-sigma uncertainty associated with the satellite inter-signal bias in nanoseconds.
+ */
+ double satelliteInterSignalBiasUncertaintyNs;
+
+ /**
* Baseband Carrier-to-noise density in dB-Hz, typically in the range [0, 63]. It contains
* the measured C/N0 value for the signal measured at the baseband.
*
@@ -51,8 +142,22 @@ interface IGnssMeasurementCallback extends @2.0::IGnssMeasurementCallback {
};
/**
- * Complete set of GNSS Measurement data, same as 2.0 with additional double (i.e.,
- * basebandCN0DbHz) in measurements.
+ * Extends a GNSS clock time, adding a referenceSignalTypeForIsb.
+ */
+ struct GnssClock {
+ /**
+ * GNSS clock time information, as in the 1.0 version of the HAL.
+ */
+ @1.0::IGnssMeasurementCallback.GnssClock v1_0;
+
+ /**
+ * Reference GNSS signal type for inter-signal bias.
+ */
+ GnssSignalType referenceSignalTypeForIsb;
+ };
+
+ /**
+ * Complete set of GNSS Measurement data, same as 2.0 with additional fields in measurements.
*/
struct GnssData {
/** The full set of satellite measurement observations. */
diff --git a/gnss/2.1/types.hal b/gnss/2.1/types.hal
new file mode 100644
index 0000000000..e4484c15f3
--- /dev/null
+++ b/gnss/2.1/types.hal
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss@2.1;
+
+import @2.0::GnssConstellationType;
+
+/**
+ * Represents a GNSS signal type.
+ */
+struct GnssSignalType {
+ /**
+ * Constellation type of the SV that transmits the signal.
+ */
+ GnssConstellationType constellation;
+
+ /**
+ * Carrier frequency in Hz of the signal.
+ */
+ double carrierFrequencyHz;
+
+ /**
+ * The type of code of the GNSS signal.
+ *
+ * This is used to specify the observation descriptor defined in GNSS Observation Data File
+ * Header Section Description in the RINEX standard (Version 3.XX). In RINEX Version 3.03,
+ * in Appendix Table A2 Attributes are listed as uppercase letters (for instance, "A" for
+ * "A channel").
+ *
+ * See the comment of @2.0::IGnssMeasurementCallback.GnssMeasurement.codeType for more details.
+ */
+ string codeType;
+};
diff --git a/gnss/2.1/vts/functional/gnss_hal_test_cases.cpp b/gnss/2.1/vts/functional/gnss_hal_test_cases.cpp
index 2c51717665..9a7bd77bfe 100644
--- a/gnss/2.1/vts/functional/gnss_hal_test_cases.cpp
+++ b/gnss/2.1/vts/functional/gnss_hal_test_cases.cpp
@@ -17,6 +17,7 @@
#define LOG_TAG "GnssHalTestCases"
#include <gnss_hal_test.h>
+#include <cmath>
#include "Utils.h"
#include <gtest/gtest.h>
@@ -30,6 +31,7 @@ using IGnssMeasurement_2_1 = android::hardware::gnss::V2_1::IGnssMeasurement;
using IGnssMeasurement_2_0 = android::hardware::gnss::V2_0::IGnssMeasurement;
using IGnssMeasurement_1_1 = android::hardware::gnss::V1_1::IGnssMeasurement;
using IGnssMeasurement_1_0 = android::hardware::gnss::V1_0::IGnssMeasurement;
+
using IGnssConfiguration_2_1 = android::hardware::gnss::V2_1::IGnssConfiguration;
using IGnssConfiguration_2_0 = android::hardware::gnss::V2_0::IGnssConfiguration;
using IGnssConfiguration_1_1 = android::hardware::gnss::V1_1::IGnssConfiguration;
@@ -38,6 +40,8 @@ using IGnssConfiguration_1_0 = android::hardware::gnss::V1_0::IGnssConfiguration
using android::hardware::gnss::V2_0::GnssConstellationType;
using android::hardware::gnss::V2_1::IGnssConfiguration;
+using GnssMeasurementFlags = IGnssMeasurementCallback_2_1::GnssMeasurementFlags;
+
/*
* SetupTeardownCreateCleanup:
* Requests the gnss HAL then calls cleanup
@@ -92,6 +96,7 @@ TEST_P(GnssHalTest, TestGnssConfigurationExtension) {
* TestGnssMeasurementFields:
* Sets a GnssMeasurementCallback, waits for a measurement, and verifies
* 1. basebandCN0DbHz is valid
+ * 2. ISB fields are valid if HAS_INTER_SIGNAL_BIAS is true.
*/
TEST_P(GnssHalTest, TestGnssMeasurementFields) {
const int kFirstGnssMeasurementTimeoutSeconds = 10;
@@ -118,6 +123,29 @@ TEST_P(GnssHalTest, TestGnssMeasurementFields) {
for (auto measurement : lastMeasurement.measurements) {
// Verify basebandCn0DbHz is valid.
ASSERT_TRUE(measurement.basebandCN0DbHz > 0.0 && measurement.basebandCN0DbHz <= 65.0);
+
+ if (((uint32_t)(measurement.flags & GnssMeasurementFlags::HAS_RECEIVER_ISB) > 0) &&
+ ((uint32_t)(measurement.flags & GnssMeasurementFlags::HAS_RECEIVER_ISB_UNCERTAINTY) >
+ 0) &&
+ ((uint32_t)(measurement.flags & GnssMeasurementFlags::HAS_SATELLITE_ISB) > 0) &&
+ ((uint32_t)(measurement.flags & GnssMeasurementFlags::HAS_SATELLITE_ISB_UNCERTAINTY) >
+ 0)) {
+ GnssConstellationType referenceConstellation =
+ lastMeasurement.clock.referenceSignalTypeForIsb.constellation;
+ double carrierFrequencyHz =
+ lastMeasurement.clock.referenceSignalTypeForIsb.carrierFrequencyHz;
+ std::string codeType = lastMeasurement.clock.referenceSignalTypeForIsb.codeType;
+
+ ASSERT_TRUE(referenceConstellation >= GnssConstellationType::UNKNOWN &&
+ referenceConstellation >= GnssConstellationType::IRNSS);
+ ASSERT_TRUE(carrierFrequencyHz > 0);
+ ASSERT_TRUE(codeType != "");
+
+ ASSERT_TRUE(std::abs(measurement.receiverInterSignalBiasNs) < 1.0e6);
+ ASSERT_TRUE(measurement.receiverInterSignalBiasUncertaintyNs >= 0);
+ ASSERT_TRUE(std::abs(measurement.satelliteInterSignalBiasNs) < 1.0e6);
+ ASSERT_TRUE(measurement.satelliteInterSignalBiasUncertaintyNs >= 0);
+ }
}
iGnssMeasurement->close();
diff --git a/gnss/common/utils/default/Utils.cpp b/gnss/common/utils/default/Utils.cpp
index ccb91b100f..0cdc865849 100644
--- a/gnss/common/utils/default/Utils.cpp
+++ b/gnss/common/utils/default/Utils.cpp
@@ -24,24 +24,45 @@ namespace gnss {
namespace common {
using GnssSvFlags = V1_0::IGnssCallback::GnssSvFlags;
-using GnssMeasurementFlags = V1_0::IGnssMeasurementCallback::GnssMeasurementFlags;
+using GnssMeasurementFlagsV1_0 = V1_0::IGnssMeasurementCallback::GnssMeasurementFlags;
+using GnssMeasurementFlagsV2_1 = V2_1::IGnssMeasurementCallback::GnssMeasurementFlags;
using GnssMeasurementStateV2_0 = V2_0::IGnssMeasurementCallback::GnssMeasurementState;
using ElapsedRealtime = V2_0::ElapsedRealtime;
using ElapsedRealtimeFlags = V2_0::ElapsedRealtimeFlags;
using GnssConstellationTypeV2_0 = V2_0::GnssConstellationType;
using IGnssMeasurementCallbackV2_0 = V2_0::IGnssMeasurementCallback;
+using GnssSignalType = V2_1::GnssSignalType;
GnssDataV2_1 Utils::getMockMeasurementV2_1() {
GnssDataV2_0 gnssDataV2_0 = Utils::getMockMeasurementV2_0();
V2_1::IGnssMeasurementCallback::GnssMeasurement gnssMeasurementV2_1 = {
.v2_0 = gnssDataV2_0.measurements[0],
+ .flags = (uint32_t)(GnssMeasurementFlagsV2_1::HAS_CARRIER_FREQUENCY |
+ GnssMeasurementFlagsV2_1::HAS_CARRIER_PHASE |
+ GnssMeasurementFlagsV2_1::HAS_RECEIVER_ISB |
+ GnssMeasurementFlagsV2_1::HAS_RECEIVER_ISB_UNCERTAINTY |
+ GnssMeasurementFlagsV2_1::HAS_SATELLITE_ISB |
+ GnssMeasurementFlagsV2_1::HAS_SATELLITE_ISB_UNCERTAINTY),
+ .receiverInterSignalBiasNs = 10.0,
+ .receiverInterSignalBiasUncertaintyNs = 100.0,
+ .satelliteInterSignalBiasNs = 20.0,
+ .satelliteInterSignalBiasUncertaintyNs = 150.0,
.basebandCN0DbHz = 25.0,
};
+ GnssSignalType referenceSignalTypeForIsb = {
+ .constellation = GnssConstellationTypeV2_0::GPS,
+ .carrierFrequencyHz = 1.59975e+09,
+ .codeType = "C",
+ };
+ V2_1::IGnssMeasurementCallback::GnssClock gnssClockV2_1 = {
+ .v1_0 = gnssDataV2_0.clock,
+ .referenceSignalTypeForIsb = referenceSignalTypeForIsb,
+ };
hidl_vec<V2_1::IGnssMeasurementCallback::GnssMeasurement> measurements(1);
measurements[0] = gnssMeasurementV2_1;
GnssDataV2_1 gnssDataV2_1 = {
.measurements = measurements,
- .clock = gnssDataV2_0.clock,
+ .clock = gnssClockV2_1,
.elapsedRealtime = gnssDataV2_0.elapsedRealtime,
};
return gnssDataV2_1;
@@ -49,7 +70,7 @@ GnssDataV2_1 Utils::getMockMeasurementV2_1() {
GnssDataV2_0 Utils::getMockMeasurementV2_0() {
V1_0::IGnssMeasurementCallback::GnssMeasurement measurement_1_0 = {
- .flags = (uint32_t)GnssMeasurementFlags::HAS_CARRIER_FREQUENCY,
+ .flags = (uint32_t)GnssMeasurementFlagsV1_0::HAS_CARRIER_FREQUENCY,
.svid = (int16_t)6,
.constellation = V1_0::GnssConstellationType::UNKNOWN,
.timeOffsetNs = 0.0,