mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Add VTS test for gnss.measurement_corrections@1.0
- also implemented default implementation Bug: 120529158 Fixes: 120529158 Test: tested on cuttlefish Change-Id: I9e63dc35284effff351eabedade05ed147d1ef17
This commit is contained in:
@@ -27,5 +27,8 @@ cc_test {
|
||||
"android.hardware.gnss@1.1",
|
||||
"android.hardware.gnss@common-vts-lib",
|
||||
],
|
||||
shared_libs: [
|
||||
"android.hardware.gnss.measurement_corrections@1.0",
|
||||
],
|
||||
test_suites: ["general-tests"],
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ cc_binary {
|
||||
"AGnssRil.cpp",
|
||||
"Gnss.cpp",
|
||||
"GnssMeasurement.cpp",
|
||||
"GnssMeasurementCorrections.cpp",
|
||||
"GnssVisibilityControl.cpp",
|
||||
"service.cpp"
|
||||
],
|
||||
|
||||
@@ -25,11 +25,14 @@
|
||||
#include "AGnssRil.h"
|
||||
#include "GnssConfiguration.h"
|
||||
#include "GnssMeasurement.h"
|
||||
#include "GnssMeasurementCorrections.h"
|
||||
#include "GnssVisibilityControl.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using ::android::hardware::Status;
|
||||
using ::android::hardware::gnss::common::Utils;
|
||||
using ::android::hardware::gnss::measurement_corrections::V1_0::implementation::
|
||||
GnssMeasurementCorrections;
|
||||
using ::android::hardware::gnss::visibility_control::V1_0::implementation::GnssVisibilityControl;
|
||||
|
||||
namespace android {
|
||||
@@ -248,8 +251,8 @@ Return<sp<V2_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement_2_0() {
|
||||
|
||||
Return<sp<measurement_corrections::V1_0::IMeasurementCorrections>>
|
||||
Gnss::getExtensionMeasurementCorrections() {
|
||||
// TODO(b/124012850): Implement function.
|
||||
return sp<measurement_corrections::V1_0::IMeasurementCorrections>{};
|
||||
ALOGD("Gnss::getExtensionMeasurementCorrections");
|
||||
return new GnssMeasurementCorrections();
|
||||
}
|
||||
|
||||
Return<sp<visibility_control::V1_0::IGnssVisibilityControl>> Gnss::getExtensionVisibilityControl() {
|
||||
|
||||
62
gnss/2.0/default/GnssMeasurementCorrections.cpp
Normal file
62
gnss/2.0/default/GnssMeasurementCorrections.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "GnssMeasurementCorrections"
|
||||
|
||||
#include "GnssMeasurementCorrections.h"
|
||||
#include <log/log.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace gnss {
|
||||
namespace measurement_corrections {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
// Methods from V1_0::IMeasurementCorrections follow.
|
||||
Return<bool> GnssMeasurementCorrections::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: %f, probLos: %f,"
|
||||
" epl: %f, eplUnc: %f",
|
||||
static_cast<int>(singleSatCorrection.singleSatCorrectionFlags),
|
||||
static_cast<int>(singleSatCorrection.constellation),
|
||||
static_cast<int>(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 true;
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace measurement_corrections
|
||||
} // namespace gnss
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
48
gnss/2.0/default/GnssMeasurementCorrections.h
Normal file
48
gnss/2.0/default/GnssMeasurementCorrections.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <android/hardware/gnss/measurement_corrections/1.0/IMeasurementCorrections.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <hidl/Status.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace gnss {
|
||||
namespace measurement_corrections {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::sp;
|
||||
using ::android::hardware::hidl_array;
|
||||
using ::android::hardware::hidl_memory;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
|
||||
struct GnssMeasurementCorrections : public IMeasurementCorrections {
|
||||
// Methods from V1_0::IMeasurementCorrections follow.
|
||||
Return<bool> setCorrections(const MeasurementCorrections& corrections) override;
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace measurement_corrections
|
||||
} // namespace gnss
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <gnss_hal_test.h>
|
||||
#include "Utils.h"
|
||||
|
||||
using android::hardware::hidl_string;
|
||||
using android::hardware::hidl_vec;
|
||||
@@ -32,6 +33,9 @@ using IAGnss_2_0 = android::hardware::gnss::V2_0::IAGnss;
|
||||
using IAGnss_1_0 = android::hardware::gnss::V1_0::IAGnss;
|
||||
using IAGnssCallback_2_0 = android::hardware::gnss::V2_0::IAGnssCallback;
|
||||
|
||||
using android::hardware::gnss::common::Utils;
|
||||
using android::hardware::gnss::measurement_corrections::V1_0::IMeasurementCorrections;
|
||||
using android::hardware::gnss::measurement_corrections::V1_0::MeasurementCorrections;
|
||||
using android::hardware::gnss::V1_0::IGnssNi;
|
||||
using android::hardware::gnss::V2_0::ElapsedRealtimeFlags;
|
||||
using android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControl;
|
||||
@@ -272,6 +276,24 @@ TEST_F(GnssHalTest, TestGnssVisibilityControlExtension) {
|
||||
EXPECT_TRUE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* TestGnssMeasurementCorrections:
|
||||
* Gets the GnssMeasurementCorrectionsExtension and verifies that it supports the
|
||||
* gnss.measurement_corrections@1.0::IMeasurementCorrections interface by invoking a method.
|
||||
*/
|
||||
TEST_F(GnssHalTest, TestGnssMeasurementCorrections) {
|
||||
// Verify IMeasurementCorrections is supported.
|
||||
auto measurementCorrections = gnss_hal_->getExtensionMeasurementCorrections();
|
||||
ASSERT_TRUE(measurementCorrections.isOk());
|
||||
sp<IMeasurementCorrections> iMeasurementCorrections = measurementCorrections;
|
||||
ASSERT_NE(iMeasurementCorrections, nullptr);
|
||||
|
||||
// Set a mock MeasurementCorrections.
|
||||
auto result = iMeasurementCorrections->setCorrections(Utils::getMockMeasurementCorrections());
|
||||
ASSERT_TRUE(result.isOk());
|
||||
EXPECT_TRUE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* TestGnssDataElapsedRealtimeFlags:
|
||||
* Sets a GnssMeasurementCallback, waits for a GnssData object, and verifies the flags in member
|
||||
|
||||
@@ -29,6 +29,7 @@ cc_library_static {
|
||||
export_include_dirs: ["include"],
|
||||
shared_libs: [
|
||||
"android.hardware.gnss@1.0",
|
||||
"android.hardware.gnss.measurement_corrections@1.0",
|
||||
],
|
||||
static_libs: [
|
||||
"libgtest",
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace hardware {
|
||||
namespace gnss {
|
||||
namespace common {
|
||||
|
||||
using V1_0::GnssConstellationType;
|
||||
using V1_0::GnssLocationFlags;
|
||||
|
||||
void Utils::checkLocation(const GnssLocation& location, bool check_speed,
|
||||
@@ -91,6 +92,53 @@ void Utils::checkLocation(const GnssLocation& location, bool check_speed,
|
||||
EXPECT_GT(location.timestamp, 1.48e12);
|
||||
}
|
||||
|
||||
const MeasurementCorrections Utils::getMockMeasurementCorrections() {
|
||||
ReflectingPlane reflectingPlane = {
|
||||
.latitudeDegrees = 37.4220039,
|
||||
.longitudeDegrees = -122.0840991,
|
||||
.altitudeMeters = 250.35,
|
||||
.azimuthDegrees = 203.0,
|
||||
};
|
||||
|
||||
SingleSatCorrection singleSatCorrection1 = {
|
||||
.singleSatCorrectionFlags = GnssSingleSatCorrectionFlags::HAS_SAT_IS_LOS_PROBABILITY |
|
||||
GnssSingleSatCorrectionFlags::HAS_EXCESS_PATH_LENGTH |
|
||||
GnssSingleSatCorrectionFlags::HAS_EXCESS_PATH_LENGTH_UNC |
|
||||
GnssSingleSatCorrectionFlags::HAS_REFLECTING_PLANE,
|
||||
.constellation = GnssConstellationType::GPS,
|
||||
.svid = 12,
|
||||
.carrierFrequencyHz = 1.59975e+09,
|
||||
.probSatIsLos = 0.50001,
|
||||
.excessPathLengthMeters = 137.4802,
|
||||
.excessPathLengthUncertaintyMeters = 25.5,
|
||||
.reflectingPlane = reflectingPlane,
|
||||
};
|
||||
SingleSatCorrection singleSatCorrection2 = {
|
||||
.singleSatCorrectionFlags = GnssSingleSatCorrectionFlags::HAS_SAT_IS_LOS_PROBABILITY |
|
||||
GnssSingleSatCorrectionFlags::HAS_EXCESS_PATH_LENGTH |
|
||||
GnssSingleSatCorrectionFlags::HAS_EXCESS_PATH_LENGTH_UNC,
|
||||
.constellation = GnssConstellationType::GPS,
|
||||
.svid = 9,
|
||||
.carrierFrequencyHz = 1.59975e+09,
|
||||
.probSatIsLos = 0.873,
|
||||
.excessPathLengthMeters = 26.294,
|
||||
.excessPathLengthUncertaintyMeters = 10.0,
|
||||
};
|
||||
|
||||
hidl_vec<SingleSatCorrection> singleSatCorrections = {singleSatCorrection1,
|
||||
singleSatCorrection2};
|
||||
MeasurementCorrections mockCorrections = {
|
||||
.latitudeDegrees = 37.4219999,
|
||||
.longitudeDegrees = -122.0840575,
|
||||
.altitudeMeters = 30.60062531,
|
||||
.horizontalPositionUncertaintyMeters = 9.23542,
|
||||
.verticalPositionUncertaintyMeters = 15.02341,
|
||||
.toaGpsNanosecondsOfWeek = 2935633453L,
|
||||
.satCorrections = singleSatCorrections,
|
||||
};
|
||||
return mockCorrections;
|
||||
}
|
||||
|
||||
} // namespace common
|
||||
} // namespace gnss
|
||||
} // namespace hardware
|
||||
|
||||
@@ -18,8 +18,10 @@
|
||||
#define android_hardware_gnss_common_vts_Utils_H_
|
||||
|
||||
#include <android/hardware/gnss/1.0/IGnss.h>
|
||||
#include <android/hardware/gnss/measurement_corrections/1.0/IMeasurementCorrections.h>
|
||||
|
||||
using GnssLocation = ::android::hardware::gnss::V1_0::GnssLocation;
|
||||
using namespace android::hardware::gnss::measurement_corrections::V1_0;
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
@@ -29,6 +31,7 @@ namespace common {
|
||||
struct Utils {
|
||||
static void checkLocation(const GnssLocation& location, bool check_speed,
|
||||
bool check_more_accuracies);
|
||||
static const MeasurementCorrections getMockMeasurementCorrections();
|
||||
};
|
||||
|
||||
} // namespace common
|
||||
|
||||
Reference in New Issue
Block a user