Add MeasurementCorrections AIDL HAL (hardware/interfaces)

Bug: 208728105
Test: atest VtsHalGnssTargetTest
Change-Id: I2192670951a517bd229535a083997cc9bab31287
This commit is contained in:
Edwin Tung
2021-12-27 12:13:02 +08:00
parent 96e2785b7e
commit bbf7fb9322
28 changed files with 863 additions and 2 deletions

View File

@@ -265,6 +265,14 @@
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.gnss.measurement_corrections</name>
<version>1</version>
<interface>
<name>IMeasurementCorrectionsInterface</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="false">
<name>android.hardware.graphics.allocator</name>
<!-- New, non-Go devices should use 4.0, tested in vts_treble_vintf_vendor_test -->

View File

@@ -36,6 +36,7 @@ cc_test {
"android.hardware.gnss@1.1",
"android.hardware.gnss@2.0",
"android.hardware.gnss@common-vts-lib",
"android.hardware.gnss-V2-cpp",
],
shared_libs: [
"android.hardware.gnss.measurement_corrections@1.0",

View File

@@ -39,6 +39,10 @@ cc_test {
"android.hardware.gnss@2.0",
"android.hardware.gnss@2.1",
"android.hardware.gnss@common-vts-lib",
"android.hardware.gnss-V2-cpp",
],
test_suites: [
"general-tests",
"vts",
],
test_suites: ["general-tests", "vts"],
}

View File

@@ -40,6 +40,7 @@ cc_test {
"android.hardware.gnss@2.0",
"android.hardware.gnss@2.1",
"android.hardware.gnss@common-vts-lib",
"android.hardware.gnss-V2-cpp",
],
shared_libs: [
"libvintf",

View File

@@ -28,6 +28,7 @@ aidl_interface {
vendor_available: true,
srcs: [
"android/hardware/gnss/*.aidl",
"android/hardware/gnss/measurement_corrections/*.aidl",
"android/hardware/gnss/visibility_control/*.aidl",
],
stability: "vintf",

View File

@@ -54,6 +54,7 @@ interface IGnss {
void deleteAidingData(in android.hardware.gnss.IGnss.GnssAidingData aidingDataFlags);
void setPositionMode(in android.hardware.gnss.IGnss.GnssPositionMode mode, in android.hardware.gnss.IGnss.GnssPositionRecurrence recurrence, in int minIntervalMs, in int preferredAccuracyMeters, in int preferredTimeMs, in boolean lowPowerMode);
android.hardware.gnss.IGnssAntennaInfo getExtensionGnssAntennaInfo();
@nullable android.hardware.gnss.measurement_corrections.IMeasurementCorrectionsInterface getExtensionMeasurementCorrections();
const int ERROR_INVALID_ARGUMENT = 1;
const int ERROR_ALREADY_INIT = 2;
const int ERROR_GENERIC = 3;

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2021 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.
*/
///////////////////////////////////////////////////////////////////////////////
// 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.measurement_corrections;
@VintfStability
interface IMeasurementCorrectionsCallback {
void setCapabilitiesCb(in int capabilities);
const int CAPABILITY_LOS_SATS = 1;
const int CAPABILITY_EXCESS_PATH_LENGTH = 2;
const int CAPABILITY_REFLECTING_PLANE = 4;
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright (C) 2021 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.
*/
///////////////////////////////////////////////////////////////////////////////
// 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.measurement_corrections;
@VintfStability
interface IMeasurementCorrectionsInterface {
void setCorrections(in android.hardware.gnss.measurement_corrections.MeasurementCorrections corrections);
void setCallback(in android.hardware.gnss.measurement_corrections.IMeasurementCorrectionsCallback callback);
}

View File

@@ -0,0 +1,47 @@
/*
* Copyright (C) 2021 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.
*/
///////////////////////////////////////////////////////////////////////////////
// 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.measurement_corrections;
@VintfStability
parcelable MeasurementCorrections {
double latitudeDegrees;
double longitudeDegrees;
double altitudeMeters;
double horizontalPositionUncertaintyMeters;
double verticalPositionUncertaintyMeters;
long toaGpsNanosecondsOfWeek;
android.hardware.gnss.measurement_corrections.SingleSatCorrection[] satCorrections;
boolean hasEnvironmentBearing;
float environmentBearingDegrees;
float environmentBearingUncertaintyDegrees;
}

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2021 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.
*/
///////////////////////////////////////////////////////////////////////////////
// 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.measurement_corrections;
@VintfStability
parcelable ReflectingPlane {
double latitudeDegrees;
double longitudeDegrees;
double altitudeMeters;
double azimuthDegrees;
}

View File

@@ -0,0 +1,49 @@
/*
* Copyright (C) 2021 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.
*/
///////////////////////////////////////////////////////////////////////////////
// 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.measurement_corrections;
@VintfStability
parcelable SingleSatCorrection {
int singleSatCorrectionFlags;
android.hardware.gnss.GnssConstellationType constellation;
int svid;
long carrierFrequencyHz;
float probSatIsLos;
float excessPathLengthMeters;
float excessPathLengthUncertaintyMeters;
android.hardware.gnss.measurement_corrections.ReflectingPlane reflectingPlane;
const int SINGLE_SAT_CORRECTION_HAS_SAT_IS_LOS_PROBABILITY = 1;
const int SINGLE_SAT_CORRECTION_HAS_EXCESS_PATH_LENGTH = 2;
const int SINGLE_SAT_CORRECTION_HAS_EXCESS_PATH_LENGTH_UNC = 4;
const int SINGLE_SAT_CORRECTION_HAS_REFLECTING_PLANE = 8;
}

View File

@@ -28,6 +28,7 @@ import android.hardware.gnss.IGnssMeasurementInterface;
import android.hardware.gnss.IGnssNavigationMessageInterface;
import android.hardware.gnss.IGnssPowerIndication;
import android.hardware.gnss.IGnssPsds;
import android.hardware.gnss.measurement_corrections.IMeasurementCorrectionsInterface;
import android.hardware.gnss.visibility_control.IGnssVisibilityControl;
/**
@@ -285,4 +286,11 @@ interface IGnss {
* @return Handle to the IGnssAntennaInfo.
*/
IGnssAntennaInfo getExtensionGnssAntennaInfo();
/**
* This method returns the IMeasurementCorrectionsInterface.
*
* @return Handle to the IMeasurementCorrectionsInterface.
*/
@nullable IMeasurementCorrectionsInterface getExtensionMeasurementCorrections();
}

View File

@@ -0,0 +1,57 @@
/*
* Copyright (C) 2021 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.measurement_corrections;
/**
* GNSS measurement corrections callback interface.
*/
@VintfStability
interface IMeasurementCorrectionsCallback {
/**
* Flags to indicate supported measurement corrections capabilities
*
* Either the LOS_SATS or the EXCESS_PATH_LENGTH capability must be supported.
*/
/**
* Capability bit flag indicating that GNSS supports line-of-sight satellite identification
* measurement corrections
*/
const int CAPABILITY_LOS_SATS = 1 << 0;
/**
* Capability bit flag indicating that GNSS supports per satellite excess-path-length
* measurement corrections
*/
const int CAPABILITY_EXCESS_PATH_LENGTH = 1 << 1;
/**
* Capability bit flag indicating that GNSS supports reflecting planes measurement
* corrections
*/
const int CAPABILITY_REFLECTING_PLANE = 1 << 2;
/**
* Callback to inform framework the measurement correction specific capabilities of the GNSS
* HAL implementation.
*
* The GNSS HAL must call this method immediately after the framework opens the measurement
* corrections interface.
*
* @param capabilities A bit field of flags indicating the capabilities of measurement
* corrections.
* It is mandatory to support either LOS_STATS or EXCESS_PATH_LENGTH capability.
*/
void setCapabilitiesCb(in int capabilities);
}

View File

@@ -0,0 +1,48 @@
/*
* Copyright (C) 2021 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.measurement_corrections;
import android.hardware.gnss.measurement_corrections.IMeasurementCorrectionsCallback;
import android.hardware.gnss.measurement_corrections.MeasurementCorrections;
/**
* Interface for measurement corrections support.
*/
@VintfStability
interface IMeasurementCorrectionsInterface {
/**
* Injects measurement corrections to be used by the HAL to improve the GNSS location output.
*
* These are NOT to be used to adjust the IGnssMeasurementCallback output values -
* those remain raw, uncorrected measurements.
*
* In general, these are injected when conditions defined by the platform are met, such as when
* GNSS Location is being requested at a sufficiently high accuracy, based on the capabilities
* of the GNSS chipset as reported in the IGnssCallback.
*
* @param corrections The computed corrections to be used by the HAL.
*/
void setCorrections(in MeasurementCorrections corrections);
/**
* Opens the interface and provides the callback routines to the implementation of this
* interface.
*
* @param callback Callback interface for IMeasurementCorrections.
*/
void setCallback(in IMeasurementCorrectionsCallback callback);
}

View File

@@ -0,0 +1,102 @@
/*
* Copyright (C) 2021 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.measurement_corrections;
import android.hardware.gnss.measurement_corrections.SingleSatCorrection;
/**
* A struct containing a set of measurement corrections for all used GNSS satellites at the location
* specified by latitudeDegrees, longitudeDegrees, altitudeMeters and at the time of week specified
* toaGpsNanosecondsOfWeek
*/
@VintfStability
parcelable MeasurementCorrections {
/** Represents latitude in degrees at which the corrections are computed.. */
double latitudeDegrees;
/** Represents longitude in degrees at which the corrections are computed.. */
double longitudeDegrees;
/**
* Represents altitude in meters above the WGS 84 reference ellipsoid at which the corrections
* are computed.
*/
double altitudeMeters;
/**
* Represents the horizontal uncertainty (63% to 68% confidence) in meters on the device
* position at which the corrections are provided.
*
* This value is useful for example to judge how accurate the provided corrections are.
*/
double horizontalPositionUncertaintyMeters;
/**
* Represents the vertical uncertainty (63% to 68% confidence) in meters on the device position
* at which the corrections are provided.
*
* This value is useful for example to judge how accurate the provided corrections are.
*/
double verticalPositionUncertaintyMeters;
/** Time Of Applicability, GPS time of week in nanoseconds. */
long toaGpsNanosecondsOfWeek;
/**
* A set of SingleSatCorrection each containing measurement corrections for a satellite in view
*/
SingleSatCorrection[] satCorrections;
/**
* Boolean indicating if environment bearing is available.
*/
boolean hasEnvironmentBearing;
/**
* Environment bearing in degrees clockwise from true North (0.0 to 360.0], in direction of
* user motion. Environment bearing is provided when it is known with high probability that
* velocity is aligned with an environment feature, such as a building or road.
*
* If user speed is zero, environmentBearingDegrees represents bearing of most recent speed
* that was > 0.
*
* As position approaches another road, environmentBearingUncertaintyDegrees will grow, and at
* some stage hasEnvironmentBearing = false.
*
* As position moves towards an open area, environmentBearingUncertaintyDegrees will grow, and
* at some stage hasEnvironmentBearing = false.
*
* If the road is curved in the vicinity of the user location, then
* environmentBearingUncertaintyDegrees will include the amount by which the road direction
* changes in the area of position uncertainty.
*
* hasEnvironmentBearing should be checked to verify the environment bearing is available
* before calling this method. The value is undefined if hasEnvironmentBearing is false.
*/
float environmentBearingDegrees;
/**
* Environment bearing uncertainty [0 to 180]. It represents the standard deviation of the
* physical structure in the circle of position uncertainty. hasEnvironmentBearing becomes false
* as the uncertainty value passes a predefined threshold depending on the physical structure
* around the user.
*
* hasEnvironmentBearing should be checked to verify the environment bearing is available
* before calling this method. The value is undefined if hasEnvironmentBearing is false.
*/
float environmentBearingUncertaintyDegrees;
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright (C) 2021 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.measurement_corrections;
/**
* A struct containing the characteristics of the reflecting plane that the satellite signal has
* bounced from.
*
* The value is only valid if HAS_REFLECTING_PLANE flag is set. An invalid reflecting plane
* means either reflection planes serving is not supported or the satellite signal has gone
* through multiple reflections.
*/
@VintfStability
parcelable ReflectingPlane {
/** Represents latitude of the reflecting plane in degrees. */
double latitudeDegrees;
/** Represents longitude of the reflecting plane in degrees. */
double longitudeDegrees;
/**
* Represents altitude of the reflecting point in the plane in meters above the WGS 84 reference
* ellipsoid.
*/
double altitudeMeters;
/** Represents azimuth clockwise from north of the reflecting plane in degrees. */
double azimuthDegrees;
}

View File

@@ -0,0 +1,85 @@
/*
* Copyright (C) 2021 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.measurement_corrections;
import android.hardware.gnss.GnssConstellationType;
import android.hardware.gnss.measurement_corrections.ReflectingPlane;
/**
* A struct with measurement corrections for a single visible satellites
*
* The bit mask singleSatCorrectionFlags indicates which correction values are valid in the struct
*/
@VintfStability
parcelable SingleSatCorrection {
/** Bit mask to indicate which values are valid in a SingleSatCorrection object. */
/** GnssSingleSatCorrectionFlags has valid satellite-is-line-of-sight-probability field. */
const int SINGLE_SAT_CORRECTION_HAS_SAT_IS_LOS_PROBABILITY = 0x0001;
/** GnssSingleSatCorrectionFlags has valid Excess Path Length field. */
const int SINGLE_SAT_CORRECTION_HAS_EXCESS_PATH_LENGTH = 0x0002;
/** GnssSingleSatCorrectionFlags has valid Excess Path Length Uncertainty field. */
const int SINGLE_SAT_CORRECTION_HAS_EXCESS_PATH_LENGTH_UNC = 0x0004;
/** GnssSingleSatCorrectionFlags has valid Reflecting Plane field. */
const int SINGLE_SAT_CORRECTION_HAS_REFLECTING_PLANE = 0x0008;
/** Contains GnssSingleSatCorrectionFlags bits. */
int singleSatCorrectionFlags;
/**
* Defines the constellation of the given satellite.
*/
GnssConstellationType constellation;
/**
* Satellite vehicle ID number, as defined in GnssSvInfo::svid
*/
int svid;
/**
* Carrier frequency of the signal to be corrected, for example it can be the
* GPS center frequency for L1 = 1,575,420,000 Hz, varying GLO channels, etc.
*
* For a receiver with capabilities to track multiple frequencies for the same satellite,
* multiple corrections for the same satellite may be provided.
*/
long carrierFrequencyHz;
/**
* The probability that the satellite is estimated to be in Line-of-Sight condition at the given
* location.
*/
float probSatIsLos;
/**
* Excess path length to be subtracted from pseudorange before using it in calculating location.
*
* Note this value is NOT to be used to adjust the GnsseasurementCallback outputs.
*/
float excessPathLengthMeters;
/** Error estimate (1-sigma) for the Excess path length estimate */
float excessPathLengthUncertaintyMeters;
/**
* Defines the reflecting plane characteristics such as location and azimuth
*
* The value is only valid if HAS_REFLECTING_PLANE flag is set. An invalid reflecting plane
* means either reflection planes serving is not supported or the satellite signal has gone
* through multiple reflections.
*/
ReflectingPlane reflectingPlane;
}

View File

@@ -68,6 +68,7 @@ cc_binary {
"GnssConfiguration.cpp",
"GnssMeasurementInterface.cpp",
"GnssVisibilityControl.cpp",
"MeasurementCorrectionsInterface.cpp",
"service.cpp",
],
static_libs: [

View File

@@ -30,6 +30,7 @@
#include "GnssNavigationMessageInterface.h"
#include "GnssPsds.h"
#include "GnssVisibilityControl.h"
#include "MeasurementCorrectionsInterface.h"
#include "NmeaFixInfo.h"
#include "Utils.h"
@@ -289,4 +290,14 @@ ndk::ScopedAStatus Gnss::getExtensionGnssAntennaInfo(
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

View File

@@ -25,6 +25,7 @@
#include <aidl/android/hardware/gnss/BnGnssMeasurementInterface.h>
#include <aidl/android/hardware/gnss/BnGnssPowerIndication.h>
#include <aidl/android/hardware/gnss/BnGnssPsds.h>
#include <aidl/android/hardware/gnss/measurement_corrections/BnMeasurementCorrectionsInterface.h>
#include <aidl/android/hardware/gnss/visibility_control/BnGnssVisibilityControl.h>
#include <atomic>
#include <mutex>
@@ -72,6 +73,10 @@ class Gnss : public BnGnss {
iGnssVisibilityControl) override;
ndk::ScopedAStatus getExtensionGnssAntennaInfo(
std::shared_ptr<IGnssAntennaInfo>* iGnssAntennaInfo) override;
ndk::ScopedAStatus getExtensionMeasurementCorrections(
std::shared_ptr<android::hardware::gnss::measurement_corrections::
IMeasurementCorrectionsInterface>* iMeasurementCorrections)
override;
std::shared_ptr<GnssConfiguration> mGnssConfiguration;
std::shared_ptr<GnssPowerIndication> mGnssPowerIndication;

View File

@@ -0,0 +1,68 @@
/*
* Copyright (C) 2021 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.
*/
#define LOG_TAG "MeasurementCorrectionsInterface"
#include "MeasurementCorrectionsInterface.h"
#include <inttypes.h>
#include <log/log.h>
namespace aidl::android::hardware::gnss::measurement_corrections {
std::shared_ptr<IMeasurementCorrectionsCallback> MeasurementCorrectionsInterface::sCallback =
nullptr;
ndk::ScopedAStatus MeasurementCorrectionsInterface::setCorrections(
const MeasurementCorrections& corrections) {
ALOGD("setCorrections");
ALOGD("corrections = lat: %f, lng: %f, alt: %f, hUnc: %f, vUnc: %f, toa: %llu, "
"satCorrections.size: %d",
corrections.latitudeDegrees, corrections.longitudeDegrees, corrections.altitudeMeters,
corrections.horizontalPositionUncertaintyMeters,
corrections.verticalPositionUncertaintyMeters,
static_cast<unsigned long long>(corrections.toaGpsNanosecondsOfWeek),
static_cast<int>(corrections.satCorrections.size()));
for (auto singleSatCorrection : corrections.satCorrections) {
ALOGD("singleSatCorrection = flags: %d, constellation: %d, svid: %d"
", cfHz: %" PRId64 ", probLos: %f, epl: %f, eplUnc: %f",
singleSatCorrection.singleSatCorrectionFlags, singleSatCorrection.constellation,
singleSatCorrection.svid, singleSatCorrection.carrierFrequencyHz,
singleSatCorrection.probSatIsLos, singleSatCorrection.excessPathLengthMeters,
singleSatCorrection.excessPathLengthUncertaintyMeters);
ALOGD("reflecting plane = lat: %f, lng: %f, alt: %f, azm: %f",
singleSatCorrection.reflectingPlane.latitudeDegrees,
singleSatCorrection.reflectingPlane.longitudeDegrees,
singleSatCorrection.reflectingPlane.altitudeMeters,
singleSatCorrection.reflectingPlane.azimuthDegrees);
}
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus MeasurementCorrectionsInterface::setCallback(
const std::shared_ptr<IMeasurementCorrectionsCallback>& callback) {
ALOGD("MeasurementCorrections::setCallback");
std::unique_lock<std::mutex> lock(mMutex);
sCallback = callback;
auto ret = sCallback->setCapabilitiesCb(
IMeasurementCorrectionsCallback::CAPABILITY_LOS_SATS |
IMeasurementCorrectionsCallback::CAPABILITY_EXCESS_PATH_LENGTH |
IMeasurementCorrectionsCallback::CAPABILITY_REFLECTING_PLANE);
if (!ret.isOk()) {
ALOGE("%s: Unable to invoke callback", __func__);
}
return ndk::ScopedAStatus::ok();
}
} // namespace aidl::android::hardware::gnss::measurement_corrections

View File

@@ -0,0 +1,36 @@
/*
* Copyright (C) 2021 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.
*/
#pragma once
#include <aidl/android/hardware/gnss/measurement_corrections/BnMeasurementCorrectionsInterface.h>
namespace aidl::android::hardware::gnss::measurement_corrections {
struct MeasurementCorrectionsInterface : public BnMeasurementCorrectionsInterface {
public:
ndk::ScopedAStatus setCorrections(const MeasurementCorrections& corrections) override;
ndk::ScopedAStatus setCallback(
const std::shared_ptr<IMeasurementCorrectionsCallback>& callback) override;
private:
// Synchronization lock for sCallback
mutable std::mutex mMutex;
// Guarded by mMutex
static std::shared_ptr<IMeasurementCorrectionsCallback> sCallback;
};
} // namespace aidl::android::hardware::gnss::measurement_corrections

View File

@@ -39,6 +39,7 @@ cc_test {
"GnssNavigationMessageCallback.cpp",
"GnssPowerIndicationCallback.cpp",
"GnssVisibilityControlCallback.cpp",
"MeasurementCorrectionsCallback.cpp",
"VtsHalGnssTargetTest.cpp",
],
shared_libs: [

View File

@@ -0,0 +1,26 @@
/*
* Copyright (C) 2021 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.
*/
#define LOG_TAG "MeasurementCorrectionsCallback"
#include "MeasurementCorrectionsCallback.h"
#include <log/log.h>
android::binder::Status MeasurementCorrectionsCallback::setCapabilitiesCb(const int capabilities) {
ALOGI("Capabilities received %d", capabilities);
capabilities_cbq_.store(capabilities);
return android::binder::Status::ok();
}

View File

@@ -0,0 +1,31 @@
/*
* Copyright (C) 2021 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.
*/
#pragma once
#include <android/hardware/gnss/measurement_corrections/BnMeasurementCorrectionsCallback.h>
#include "GnssCallbackEventQueue.h"
class MeasurementCorrectionsCallback
: public android::hardware::gnss::measurement_corrections::BnMeasurementCorrectionsCallback {
public:
MeasurementCorrectionsCallback() : capabilities_cbq_("capabilities"){};
~MeasurementCorrectionsCallback(){};
android::binder::Status setCapabilitiesCb(const int capabilities) override;
android::hardware::gnss::common::GnssCallbackEventQueue<int> capabilities_cbq_;
int last_capabilities_;
};

View File

@@ -25,6 +25,7 @@
#include <android/hardware/gnss/IGnssMeasurementInterface.h>
#include <android/hardware/gnss/IGnssPowerIndication.h>
#include <android/hardware/gnss/IGnssPsds.h>
#include <android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsInterface.h>
#include <android/hardware/gnss/visibility_control/IGnssVisibilityControl.h>
#include <cutils/properties.h>
#include "AGnssCallbackAidl.h"
@@ -35,6 +36,8 @@
#include "GnssNavigationMessageCallback.h"
#include "GnssPowerIndicationCallback.h"
#include "GnssVisibilityControlCallback.h"
#include "MeasurementCorrectionsCallback.h"
#include "Utils.h"
#include "gnss_hal_test.h"
using android::sp;
@@ -62,6 +65,8 @@ using android::hardware::gnss::IGnssPowerIndication;
using android::hardware::gnss::IGnssPsds;
using android::hardware::gnss::PsdsType;
using android::hardware::gnss::SatellitePvt;
using android::hardware::gnss::common::Utils;
using android::hardware::gnss::measurement_corrections::IMeasurementCorrectionsInterface;
using android::hardware::gnss::visibility_control::IGnssVisibilityControl;
using GnssConstellationTypeV2_0 = android::hardware::gnss::V2_0::GnssConstellationType;
@@ -909,7 +914,6 @@ TEST_P(GnssHalTest, GnssDebugValuesSanityTest) {
}
/*
* TestAGnssExtension:
* TestGnssVisibilityControlExtension:
* 1. Gets the IGnssVisibilityControl extension.
* 2. Sets GnssVisibilityControlCallback
@@ -1095,3 +1099,43 @@ TEST_P(GnssHalTest, TestGnssAntennaInfo) {
iGnssAntennaInfo->close();
}
/*
* TestGnssMeasurementCorrections:
* If measurement corrections capability is supported, verifies that the measurement corrections
* capabilities are reported and the mandatory LOS_SATS or the EXCESS_PATH_LENGTH
* capability flag is set.
*/
TEST_P(GnssHalTest, TestGnssMeasurementCorrections) {
if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
return;
}
if (!(aidl_gnss_cb_->last_capabilities_ &
(int)GnssCallbackAidl::CAPABILITY_MEASUREMENT_CORRECTIONS)) {
return;
}
sp<IMeasurementCorrectionsInterface> iMeasurementCorrectionsAidl;
auto status = aidl_gnss_hal_->getExtensionMeasurementCorrections(&iMeasurementCorrectionsAidl);
ASSERT_TRUE(status.isOk());
ASSERT_TRUE(iMeasurementCorrectionsAidl != nullptr);
// Setup measurement corrections callback.
auto gnssMeasurementCorrectionsCallback = sp<MeasurementCorrectionsCallback>::make();
status = iMeasurementCorrectionsAidl->setCallback(gnssMeasurementCorrectionsCallback);
ASSERT_TRUE(status.isOk());
const int kTimeoutSec = 5;
EXPECT_TRUE(gnssMeasurementCorrectionsCallback->capabilities_cbq_.retrieve(
gnssMeasurementCorrectionsCallback->last_capabilities_, kTimeoutSec));
ASSERT_TRUE(gnssMeasurementCorrectionsCallback->capabilities_cbq_.calledCount() > 0);
ASSERT_TRUE((gnssMeasurementCorrectionsCallback->last_capabilities_ &
(MeasurementCorrectionsCallback::CAPABILITY_LOS_SATS |
MeasurementCorrectionsCallback::CAPABILITY_EXCESS_PATH_LENGTH)) != 0);
// Set a mock MeasurementCorrections.
status = iMeasurementCorrectionsAidl->setCorrections(
Utils::getMockMeasurementCorrections_aidl());
ASSERT_TRUE(status.isOk());
}

View File

@@ -15,6 +15,7 @@
*/
#include <Utils.h>
#include <android/hardware/gnss/BnGnss.h>
#include <android/hardware/gnss/IGnss.h>
#include "gtest/gtest.h"
@@ -28,6 +29,12 @@ namespace common {
using namespace measurement_corrections::V1_0;
using V1_0::GnssLocationFlags;
using MeasurementCorrectionsAidl =
android::hardware::gnss::measurement_corrections::MeasurementCorrections;
using ReflectingPlaneAidl = android::hardware::gnss::measurement_corrections::ReflectingPlane;
using SingleSatCorrectionAidl =
android::hardware::gnss::measurement_corrections::SingleSatCorrection;
template <>
int64_t Utils::getLocationTimestampMillis(const android::hardware::gnss::GnssLocation& location) {
return location.timestampMillis;
@@ -63,6 +70,7 @@ const MeasurementCorrections Utils::getMockMeasurementCorrections() {
.singleSatCorrectionFlags = GnssSingleSatCorrectionFlags::HAS_SAT_IS_LOS_PROBABILITY |
GnssSingleSatCorrectionFlags::HAS_EXCESS_PATH_LENGTH |
GnssSingleSatCorrectionFlags::HAS_EXCESS_PATH_LENGTH_UNC,
.constellation = V1_0::GnssConstellationType::GPS,
.svid = 9,
.carrierFrequencyHz = 1.59975e+09,
@@ -114,6 +122,56 @@ Utils::getMockMeasurementCorrections_1_1() {
return mockCorrections_1_1;
}
const MeasurementCorrectionsAidl Utils::getMockMeasurementCorrections_aidl() {
ReflectingPlaneAidl reflectingPlane;
reflectingPlane.latitudeDegrees = 37.4220039;
reflectingPlane.longitudeDegrees = -122.0840991;
reflectingPlane.altitudeMeters = 250.35;
reflectingPlane.azimuthDegrees = 203.0;
SingleSatCorrectionAidl singleSatCorrection1;
singleSatCorrection1.singleSatCorrectionFlags =
SingleSatCorrectionAidl::SINGLE_SAT_CORRECTION_HAS_SAT_IS_LOS_PROBABILITY |
SingleSatCorrectionAidl::SINGLE_SAT_CORRECTION_HAS_EXCESS_PATH_LENGTH |
SingleSatCorrectionAidl::SINGLE_SAT_CORRECTION_HAS_EXCESS_PATH_LENGTH_UNC |
SingleSatCorrectionAidl::SINGLE_SAT_CORRECTION_HAS_REFLECTING_PLANE;
singleSatCorrection1.constellation = android::hardware::gnss::GnssConstellationType::GPS;
singleSatCorrection1.svid = 12;
singleSatCorrection1.carrierFrequencyHz = 1.59975e+09;
singleSatCorrection1.probSatIsLos = 0.50001;
singleSatCorrection1.excessPathLengthMeters = 137.4802;
singleSatCorrection1.excessPathLengthUncertaintyMeters = 25.5;
singleSatCorrection1.reflectingPlane = reflectingPlane;
SingleSatCorrectionAidl singleSatCorrection2;
singleSatCorrection2.singleSatCorrectionFlags =
SingleSatCorrectionAidl::SINGLE_SAT_CORRECTION_HAS_SAT_IS_LOS_PROBABILITY |
SingleSatCorrectionAidl::SINGLE_SAT_CORRECTION_HAS_EXCESS_PATH_LENGTH |
SingleSatCorrectionAidl::SINGLE_SAT_CORRECTION_HAS_EXCESS_PATH_LENGTH_UNC;
singleSatCorrection2.constellation = GnssConstellationType::GPS;
singleSatCorrection2.svid = 9;
singleSatCorrection2.carrierFrequencyHz = 1.59975e+09;
singleSatCorrection2.probSatIsLos = 0.873;
singleSatCorrection2.excessPathLengthMeters = 26.294;
singleSatCorrection2.excessPathLengthUncertaintyMeters = 10.0;
std::vector<SingleSatCorrectionAidl> singleSatCorrections = {singleSatCorrection1,
singleSatCorrection2};
MeasurementCorrectionsAidl mockCorrections;
mockCorrections.latitudeDegrees = 37.4219999;
mockCorrections.longitudeDegrees = -122.0840575;
mockCorrections.altitudeMeters = 30.60062531;
mockCorrections.horizontalPositionUncertaintyMeters = 9.23542;
mockCorrections.verticalPositionUncertaintyMeters = 15.02341;
mockCorrections.toaGpsNanosecondsOfWeek = 2935633453L;
mockCorrections.hasEnvironmentBearing = true;
mockCorrections.environmentBearingDegrees = 45.0;
mockCorrections.environmentBearingUncertaintyDegrees = 4.0;
mockCorrections.satCorrections = singleSatCorrections;
return mockCorrections;
}
/*
* MapConstellationType:
* Given a GnssConstellationType_2_0 type constellation, maps to its equivalent

View File

@@ -21,6 +21,8 @@
#include <android/hardware/gnss/2.0/IGnss.h>
#include <android/hardware/gnss/measurement_corrections/1.0/IMeasurementCorrections.h>
#include <android/hardware/gnss/measurement_corrections/1.1/IMeasurementCorrections.h>
#include <android/hardware/gnss/measurement_corrections/BnMeasurementCorrectionsInterface.h>
#include <gtest/gtest.h>
namespace android {
@@ -36,6 +38,8 @@ struct Utils {
getMockMeasurementCorrections();
static const measurement_corrections::V1_1::MeasurementCorrections
getMockMeasurementCorrections_1_1();
static const android::hardware::gnss::measurement_corrections::MeasurementCorrections
getMockMeasurementCorrections_aidl();
static V1_0::GnssConstellationType mapConstellationType(
V2_0::GnssConstellationType constellation);