Add CorrelationVector AIDL HAL

Adds CorrelationVector into GnssMeasurement report.

Bug: 171516016
Test: on cuttlefish
Change-Id: Ibe47f4839012d34272fd2d0b079e1edda6282fd2
This commit is contained in:
Shinru Han
2020-12-09 15:07:18 +08:00
parent 2cac3d31d5
commit 4abab50603
30 changed files with 281 additions and 119 deletions

View File

@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
// edit this file. It looks like you are doing that because you have modified
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
// from an interface or a field from a parcelable and it broke the build. That
// breakage is intended.
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible changes to the AIDL files built
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped

View File

@@ -0,0 +1,26 @@
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.gnss;
@VintfStability
parcelable CorrelationVector {
int frequencyOffsetMps;
double samplingWidthM;
double samplingStartM;
int[] magnitude;
}

View File

@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
// edit this file. It looks like you are doing that because you have modified
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
// from an interface or a field from a parcelable and it broke the build. That
// breakage is intended.
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible changes to the AIDL files built
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped

View File

@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
// edit this file. It looks like you are doing that because you have modified
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
// from an interface or a field from a parcelable and it broke the build. That
// breakage is intended.
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible changes to the AIDL files built
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped

View File

@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
// edit this file. It looks like you are doing that because you have modified
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
// from an interface or a field from a parcelable and it broke the build. That
// breakage is intended.
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible changes to the AIDL files built
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped

View File

@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
// edit this file. It looks like you are doing that because you have modified
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
// from an interface or a field from a parcelable and it broke the build. That
// breakage is intended.
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible changes to the AIDL files built
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped

View File

@@ -44,6 +44,7 @@ parcelable GnssMeasurement {
double satelliteInterSignalBiasNs;
double satelliteInterSignalBiasUncertaintyNs;
android.hardware.gnss.SatellitePvt satellitePvt;
android.hardware.gnss.CorrelationVector[] correlationVectors;
const int HAS_SNR = 1;
const int HAS_CARRIER_FREQUENCY = 512;
const int HAS_CARRIER_CYCLES = 1024;
@@ -55,6 +56,7 @@ parcelable GnssMeasurement {
const int HAS_SATELLITE_ISB = 262144;
const int HAS_SATELLITE_ISB_UNCERTAINTY = 524288;
const int HAS_SATELLITE_PVT = 1048576;
const int HAS_CORRELATION_VECTOR = 2097152;
const int STATE_UNKNOWN = 0;
const int STATE_CODE_LOCK = 1;
const int STATE_BIT_SYNC = 2;

View File

@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
// edit this file. It looks like you are doing that because you have modified
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
// from an interface or a field from a parcelable and it broke the build. That
// breakage is intended.
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible changes to the AIDL files built
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped

View File

@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
// edit this file. It looks like you are doing that because you have modified
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
// from an interface or a field from a parcelable and it broke the build. That
// breakage is intended.
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible changes to the AIDL files built
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped

View File

@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
// edit this file. It looks like you are doing that because you have modified
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
// from an interface or a field from a parcelable and it broke the build. That
// breakage is intended.
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible changes to the AIDL files built
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped

View File

@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
// edit this file. It looks like you are doing that because you have modified
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
// from an interface or a field from a parcelable and it broke the build. That
// breakage is intended.
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible changes to the AIDL files built
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped

View File

@@ -21,5 +21,6 @@ package android.hardware.gnss;
interface IGnssCallback {
void gnssSetCapabilitiesCb(in int capabilities);
const int CAPABILITY_SATELLITE_BLOCKLIST = 1;
const int CAPABILITY_CORRELATION_VECTOR = 4096;
const int CAPABILITY_SATELLITE_PVT = 8192;
}

View File

@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
// edit this file. It looks like you are doing that because you have modified
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
// from an interface or a field from a parcelable and it broke the build. That
// breakage is intended.
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible changes to the AIDL files built
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped

View File

@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
// edit this file. It looks like you are doing that because you have modified
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
// from an interface or a field from a parcelable and it broke the build. That
// breakage is intended.
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible changes to the AIDL files built
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped

View File

@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
// edit this file. It looks like you are doing that because you have modified
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
// from an interface or a field from a parcelable and it broke the build. That
// breakage is intended.
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible changes to the AIDL files built
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
@@ -18,6 +19,6 @@
package android.hardware.gnss;
@VintfStability
interface IGnssMeasurementInterface {
void setCallback(in android.hardware.gnss.IGnssMeasurementCallback callback, in boolean enableFullTracking);
void setCallback(in android.hardware.gnss.IGnssMeasurementCallback callback, in boolean enableFullTracking, in boolean enableCorrVecOutputs);
void close();
}

View File

@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
// edit this file. It looks like you are doing that because you have modified
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
// from an interface or a field from a parcelable and it broke the build. That
// breakage is intended.
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible changes to the AIDL files built
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped

View File

@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
// edit this file. It looks like you are doing that because you have modified
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
// from an interface or a field from a parcelable and it broke the build. That
// breakage is intended.
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible changes to the AIDL files built
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped

View File

@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
// edit this file. It looks like you are doing that because you have modified
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
// from an interface or a field from a parcelable and it broke the build. That
// breakage is intended.
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible changes to the AIDL files built
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped

View File

@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
// edit this file. It looks like you are doing that because you have modified
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
// from an interface or a field from a parcelable and it broke the build. That
// breakage is intended.
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible changes to the AIDL files built
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped

View File

@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
// edit this file. It looks like you are doing that because you have modified
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
// from an interface or a field from a parcelable and it broke the build. That
// breakage is intended.
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible changes to the AIDL files built
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped

View File

@@ -0,0 +1,51 @@
/*
* Copyright (C) 2020 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;
/**
* Contains info about the correlation output of incoming GNSS signal and a local copy of
* its corresponding spreading code at a given frequency offset.
*/
@VintfStability
parcelable CorrelationVector {
/**
* Frequency offset from reported pseudorange rate for this Correlation Vector.
*/
int frequencyOffsetMps;
/**
* Space between correlation samples in meters.
*/
double samplingWidthM;
/**
* Offset of the first sampling bin in meters.
* The following sampling bins are located at positive offsets from this value as follows:
* samplingStartM, samplingStartM + samplingWidthM, ... , samplingStartM +
* (magnitude.size-1) * samplingWidthM.
*/
double samplingStartM;
/**
* Normalized correlation magnitude values from -1 to 1, the reported value must be encoded as
* signed 16 bit integer where 1 is represented by 32767 and -1 is represented by -32768.
*
* The length of the array is defined by the GNSS chipset.
*/
int[] magnitude;
}

View File

@@ -16,6 +16,7 @@
package android.hardware.gnss;
import android.hardware.gnss.CorrelationVector;
import android.hardware.gnss.GnssSignalType;
import android.hardware.gnss.GnssMultipathIndicator;
import android.hardware.gnss.SatellitePvt;
@@ -62,6 +63,10 @@ parcelable GnssMeasurement {
* Bit mask indicating a valid satellite PVT is stored in the GnssMeasurement.
*/
const int HAS_SATELLITE_PVT = 1 << 20;
/**
* Bit mask indicating valid correlation vectors are stored in the GnssMeasurement.
*/
const int HAS_CORRELATION_VECTOR = 1 << 21;
/**
* A bitfield of flags indicating the validity of the fields in this GnssMeasurement. The bit
@@ -625,4 +630,13 @@ parcelable GnssMeasurement {
* If the data is available, gnssMeasurementFlags must contain HAS_SATELLITE_PVT.
*/
SatellitePvt satellitePvt;
/**
* A list of Correlation Vectors with each vector corresponding to a frequency offset.
*
* To represent correlation values over a 2D spaces (delay and frequency), a CorrelationVector
* is required per frequency offset, and each CorrelationVector contains correlation values
* at equally spaced spatial offsets.
*/
CorrelationVector[] correlationVectors;
}

View File

@@ -27,9 +27,12 @@ import android.hardware.gnss.IGnssConfiguration;
@VintfStability
interface IGnssCallback {
/** Capability bit mask indicating GNSS supports blocklisting satellites */
/** Capability bit mask indicating that GNSS supports blocklisting satellites */
const int CAPABILITY_SATELLITE_BLOCKLIST = 1 << 0;
/** Capability bit mask indicating that GNSS supports correlation vector */
const int CAPABILITY_CORRELATION_VECTOR = 1 << 12;
/** Capability bit mask indicating that GNSS supports satellite PVT */
const int CAPABILITY_SATELLITE_PVT = 1 << 13;

View File

@@ -37,12 +37,16 @@ interface IGnssMeasurementInterface {
* The GNSS chipset is allowed to consume more power in this mode. If false, API must
* optimize power via duty cycling, constellations and frequency limits, etc.
*
* @param enableCorrVecOutputs If true, enable correlation vectors as part of the raw GNSS
* measurements outputs. If false, disable correlation vectors.
*
* @return initRet Returns SUCCESS if successful. Returns ERROR_ALREADY_INIT if a callback has
* already been registered without a corresponding call to 'close'. Returns ERROR_GENERIC
* for any other error. The HAL must not generate any other updates upon returning this
* error code.
*/
void setCallback(in IGnssMeasurementCallback callback, in boolean enableFullTracking);
void setCallback(in IGnssMeasurementCallback callback, in boolean enableFullTracking,
in boolean enableCorrVecOutputs);
/**
* Stops updates from the HAL, and unregisters the callback routines. After a call to close(),

View File

@@ -37,7 +37,9 @@ ndk::ScopedAStatus Gnss::setCallback(const std::shared_ptr<IGnssCallback>& callb
sGnssCallback = callback;
int capabilities = (int)(IGnssCallback::CAPABILITY_SATELLITE_BLOCKLIST |
IGnssCallback::CAPABILITY_SATELLITE_PVT);
IGnssCallback::CAPABILITY_SATELLITE_PVT |
IGnssCallback::CAPABILITY_CORRELATION_VECTOR);
auto status = sGnssCallback->gnssSetCapabilitiesCb(capabilities);
if (!status.isOk()) {
ALOGE("%s: Unable to invoke callback.gnssSetCapabilities", __func__);

View File

@@ -34,8 +34,10 @@ GnssMeasurementInterface::~GnssMeasurementInterface() {
}
ndk::ScopedAStatus GnssMeasurementInterface::setCallback(
const std::shared_ptr<IGnssMeasurementCallback>& callback, const bool enableFullTracking) {
ALOGD("setCallback: enableFullTracking: %d", (int)enableFullTracking);
const std::shared_ptr<IGnssMeasurementCallback>& callback, const bool enableFullTracking,
const bool enableCorrVecOutputs) {
ALOGD("setCallback: enableFullTracking: %d enableCorrVecOutputs: %d", (int)enableFullTracking,
(int)enableCorrVecOutputs);
std::unique_lock<std::mutex> lock(mMutex);
sCallback = callback;
@@ -43,7 +45,7 @@ ndk::ScopedAStatus GnssMeasurementInterface::setCallback(
ALOGW("GnssMeasurement callback already set. Resetting the callback...");
stop();
}
start();
start(enableCorrVecOutputs);
return ndk::ScopedAStatus::ok();
}
@@ -56,12 +58,12 @@ ndk::ScopedAStatus GnssMeasurementInterface::close() {
return ndk::ScopedAStatus::ok();
}
void GnssMeasurementInterface::start() {
void GnssMeasurementInterface::start(const bool enableCorrVecOutputs) {
ALOGD("start");
mIsActive = true;
mThread = std::thread([this]() {
mThread = std::thread([this, enableCorrVecOutputs]() {
while (mIsActive == true) {
auto measurement = Utils::getMockMeasurement();
auto measurement = Utils::getMockMeasurement(enableCorrVecOutputs);
this->reportMeasurement(measurement);
std::this_thread::sleep_for(std::chrono::milliseconds(mMinIntervalMillis));

View File

@@ -29,11 +29,12 @@ struct GnssMeasurementInterface : public BnGnssMeasurementInterface {
GnssMeasurementInterface();
~GnssMeasurementInterface();
ndk::ScopedAStatus setCallback(const std::shared_ptr<IGnssMeasurementCallback>& callback,
const bool enableFullTracking) override;
const bool enableFullTracking,
const bool enableCorrVecOutputs) override;
ndk::ScopedAStatus close() override;
private:
void start();
void start(const bool enableCorrVecOutputs);
void stop();
void reportMeasurement(const GnssData&);

View File

@@ -69,15 +69,21 @@ TEST_P(GnssHalTest, TestPsdsExtension) {
* 2. Sets a GnssMeasurementCallback, waits for a measurement, and verifies fields are valid.
*/
TEST_P(GnssHalTest, TestGnssMeasurementExtension) {
const bool kIsCorrelationVectorSupported = aidl_gnss_cb_->last_capabilities_ &
(int)GnssCallbackAidl::CAPABILITY_CORRELATION_VECTOR;
const int kFirstGnssMeasurementTimeoutSeconds = 10;
bool has_capability_satpvt = false;
sp<IGnssMeasurementInterface> iGnssMeasurement;
auto status = aidl_gnss_hal_->getExtensionGnssMeasurement(&iGnssMeasurement);
ASSERT_TRUE(status.isOk());
ASSERT_TRUE(iGnssMeasurement != nullptr);
auto callback = sp<GnssMeasurementCallbackAidl>::make();
status = iGnssMeasurement->setCallback(callback, /* enableFullTracking= */ true);
status =
iGnssMeasurement->setCallback(callback, /* enableFullTracking= */ true,
/* enableCorrVecOutputs */ kIsCorrelationVectorSupported);
ASSERT_TRUE(status.isOk());
android::hardware::gnss::GnssData lastMeasurement;
@@ -118,7 +124,9 @@ TEST_P(GnssHalTest, TestGnssMeasurementExtension) {
GnssMeasurement::HAS_FULL_ISB | GnssMeasurement::HAS_FULL_ISB_UNCERTAINTY |
GnssMeasurement::HAS_SATELLITE_ISB |
GnssMeasurement::HAS_SATELLITE_ISB_UNCERTAINTY |
GnssMeasurement::HAS_SATELLITE_PVT));
GnssMeasurement::HAS_SATELLITE_PVT |
GnssMeasurement::HAS_CORRELATION_VECTOR));
if ((measurement.flags & GnssMeasurement::HAS_SATELLITE_PVT) &&
(has_capability_satpvt == true)) {
ASSERT_TRUE(measurement.satellitePvt.satPosEcef.posXMeters >= -43000000 &&
@@ -136,6 +144,20 @@ TEST_P(GnssHalTest, TestGnssMeasurementExtension) {
measurement.satellitePvt.satVelEcef.velZMps <= 4000);
ASSERT_TRUE(measurement.satellitePvt.satVelEcef.ureRateMps > 0);
}
if (kIsCorrelationVectorSupported &&
measurement.flags & GnssMeasurement::HAS_CORRELATION_VECTOR) {
ASSERT_TRUE(measurement.correlationVectors.size() > 0);
for (const auto& correlationVector : measurement.correlationVectors) {
ASSERT_GE(correlationVector.frequencyOffsetMps, 0);
ASSERT_GT(correlationVector.samplingWidthM, 0);
ASSERT_GE(correlationVector.samplingStartM, 0);
ASSERT_TRUE(correlationVector.magnitude.size() > 0);
for (const auto& magnitude : correlationVector.magnitude) {
ASSERT_TRUE(magnitude >= -32768 && magnitude <= 32767);
}
}
}
}
status = iGnssMeasurement->close();

View File

@@ -140,7 +140,7 @@ GnssDataV2_0 Utils::getMockMeasurementV2_0() {
return gnssData;
}
GnssData Utils::getMockMeasurement() {
GnssData Utils::getMockMeasurement(const bool enableCorrVecOutputs) {
aidl::android::hardware::gnss::GnssSignalType signalType = {
.constellation = aidl::android::hardware::gnss::GnssConstellationType::GLONASS,
.carrierFrequencyHz = 1.59975e+09,
@@ -187,7 +187,8 @@ GnssData Utils::getMockMeasurement() {
.satTimeCorrectionMeters = -7113.08964331,
.satClkDriftMps = 0},
.ionoDelayMeters = 3.069949602639317e-08,
.tropoDelayMeters = 3.882265204404031}};
.tropoDelayMeters = 3.882265204404031},
.correlationVectors = {}};
GnssClock clock = {.gnssClockFlags = GnssClock::HAS_FULL_BIAS | GnssClock::HAS_FULL_BIAS |
GnssClock::HAS_BIAS_UNCERTAINTY | GnssClock::HAS_DRIFT |
@@ -208,6 +209,21 @@ GnssData Utils::getMockMeasurement() {
// or don't set the field.
.timeUncertaintyNs = 1020400};
if (enableCorrVecOutputs) {
aidl::android::hardware::gnss::CorrelationVector correlationVector1 = {
.frequencyOffsetMps = 10,
.samplingWidthM = 30,
.samplingStartM = 0,
.magnitude = {0, 5000, 10000, 5000, 0, 0, 3000, 0}};
aidl::android::hardware::gnss::CorrelationVector correlationVector2 = {
.frequencyOffsetMps = 20,
.samplingWidthM = 30,
.samplingStartM = 0,
.magnitude = {0, 3000, 5000, 3000, 0, 0, 1000, 0}};
measurement.correlationVectors = {correlationVector1, correlationVector2};
measurement.flags |= GnssMeasurement::HAS_CORRELATION_VECTOR;
}
GnssData gnssData = {
.measurements = {measurement}, .clock = clock, .elapsedRealtime = timestamp};
return gnssData;

View File

@@ -30,7 +30,8 @@ namespace gnss {
namespace common {
struct Utils {
static aidl::android::hardware::gnss::GnssData getMockMeasurement();
static aidl::android::hardware::gnss::GnssData getMockMeasurement(
const bool enableCorrVecOutputs);
static V2_0::IGnssMeasurementCallback::GnssData getMockMeasurementV2_0();
static V2_1::IGnssMeasurementCallback::GnssData getMockMeasurementV2_1();
static V2_0::GnssLocation getMockLocationV2_0();