Merge "Add Inter-Signal Bias fields"

This commit is contained in:
Yu-Han Yang
2020-01-23 20:35:27 +00:00
committed by Android (Google) Code Review
6 changed files with 210 additions and 8 deletions

View File

@@ -636,11 +636,12 @@ f18695dd36ee205640b8326a17453858a7b4596653aaa6ef0016b0aef1bd4dac android.hardwar
994d08ab27d613022c258a9ec48cece7adf2a305e92df5d76ef923e2c6665f64 android.hardware.drm@1.3::IDrmFactory
881aa8720fb1d69aa9843bfab69d810ab7654a61d2f5ab5e2626cbf240f24eaf android.hardware.dumpstate@1.1::types
13b33f623521ded51a6c0f7ea5b77e97066d0aa1e38a83c2873f08ad67294f89 android.hardware.dumpstate@1.1::IDumpstateDevice
769d346927a94fd40ee80a5a976d8d15cf022ef99c5900738f4a82f26c0ed229 android.hardware.gnss@2.1::types
3dacec7801968e1e4479724dc0180442d9e915466bff051f80996266b1a51c2c android.hardware.gnss@2.1::IGnss
ba62e1e8993bfb9f27fa04816fa0f2241ae2d01edfa3d0c04182e2e5de80045c android.hardware.gnss@2.1::IGnssCallback
ccdf3c0fb2c02a6d4dc57afb276c3497ae8172b80b00ebc0bf8a0238dd38b01d android.hardware.gnss@2.1::IGnssConfiguration
5a125c49ca83629e22afc8c39e865509343bfa2c38f0baea9a186bbac103492d android.hardware.gnss@2.1::IGnssMeasurement
0bfb291708dd4a7c6ec6b9883e2b8592357edde8d7e962ef83918e4a2154ce69 android.hardware.gnss@2.1::IGnssMeasurementCallback
d7bf37660a0946de9599dcbae997b077ee3e604fc2044534d40d3da04297a5d3 android.hardware.gnss@2.1::IGnssMeasurementCallback
ce8dbe76eb9ee94b46ef98f725be992e760a5751073d4f4912484026541371f3 android.hardware.health@2.1::IHealth
26f04510a0b57aba5167c5c0a7c2f077c2acbb98b81902a072517829fd9fd67f android.hardware.health@2.1::IHealthInfoCallback
db47f4ceceb1f06c656f39caa70c557b0f8471ef59fd58611bea667ffca20101 android.hardware.health@2.1::types

View File

@@ -7,6 +7,7 @@ hidl_interface {
enabled: true,
},
srcs: [
"types.hal",
"IGnss.hal",
"IGnssCallback.hal",
"IGnssMeasurement.hal",

View File

@@ -17,23 +17,114 @@
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. */

46
gnss/2.1/types.hal Normal file
View File

@@ -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;
};

View File

@@ -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();

View File

@@ -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,