Add IRNSS to GnssConstellationType (HAL)
Bug: 119270132 Test: atest VtsHalGnssV2_0TestTarget Change-Id: I3a5da40412a1e5dbe9410573ae2bc263643c585c
This commit is contained in:
parent
996b0b19d0
commit
6999a0f547
13 changed files with 232 additions and 59 deletions
|
@ -464,12 +464,13 @@ f27baaa587bc3dd9b740cb6928ab812b9b7d105b5187663938aee578105f3c39 android.hardwar
|
|||
7f460e795f5d1ed5e378935f98c6db4d39497de988aef1b4c2a4a07a6c400392 android.hardware.gnss@2.0::IAGnss
|
||||
2e5ad983734069e84a760004b32da0d09e4170c05380abe27e6eb80e4aa70d5a android.hardware.gnss@2.0::IAGnssCallback
|
||||
1f4ac068a88a72360280d94a7f6fd7c63813c1eea4891a0eb01394d3e7e775f2 android.hardware.gnss@2.0::IAGnssRil
|
||||
6e2f9a44375a0ae0b49ca7d711cb88945189d398535078408269e1e85889061d android.hardware.gnss@2.0::IGnss
|
||||
782dfc724272f279985de348c824197357941382f73c0083f0344d8ec594d2a8 android.hardware.gnss@2.0::IGnssCallback
|
||||
63216fcb23eaf4d6f12ea0e99b8bfdb8e4e57c02f215d433cd30943d850f61a7 android.hardware.gnss@2.0::IGnss
|
||||
b11a5e4a1602d3f408716b6fe2c578a79f060d571aad8e828f9a4426d161fbcf android.hardware.gnss@2.0::IGnssCallback
|
||||
ecc966c68bddbd95c8dae782b84204cf01c75734675e8769963f3b5106ec128b android.hardware.gnss@2.0::IGnssConfiguration
|
||||
b670bae2ab8517336290532e364502b4db9120340d75474ccc8442b1b15d6ab7 android.hardware.gnss@2.0::IGnssDebug
|
||||
c67759f5d6387d273b66729180d03690e827f0b6b8d4e13ce2ff42d31b224065 android.hardware.gnss@2.0::IGnssMeasurement
|
||||
3dd30a3ca77ef5ab109a55ba603ff816ae5019436886093dccf8fd6a068f85f1 android.hardware.gnss@2.0::IGnssMeasurementCallback
|
||||
4bcd767dd05304b4722c6521c7ed8d4a05faf6022f228f2c088379c647871f7c android.hardware.gnss@2.0::types
|
||||
15e09903748857f4beb5f485784606931fa5a6277cd070baa6d584df485b7948 android.hardware.gnss@2.0::IGnssMeasurementCallback
|
||||
a49c973f21ddf41bc402de55d7c8dffacf4dce06b0bbca4f5ffd3b09a471317e android.hardware.gnss@2.0::types
|
||||
d4cc8d91930d5a1a62deb0d97d398510a115ce3ede2d2978738651b9d01b11c3 android.hardware.gnss.measurement_corrections@1.0::IMeasurementCorrections
|
||||
3eec9763db9b101644f14175b77c9954047445a468e9c743fd402d472d4aa97e android.hardware.gnss.measurement_corrections@1.0::IMeasurementCorrectionsCallback
|
||||
6ef12cd95df73f8f80c25eb035d98ca4594f9cee571fdabea838a0b6016dd908 android.hardware.gnss.measurement_corrections@1.0::types
|
||||
|
|
|
@ -14,6 +14,7 @@ hidl_interface {
|
|||
"IGnss.hal",
|
||||
"IGnssCallback.hal",
|
||||
"IGnssConfiguration.hal",
|
||||
"IGnssDebug.hal",
|
||||
"IGnssMeasurement.hal",
|
||||
"IGnssMeasurementCallback.hal",
|
||||
],
|
||||
|
|
|
@ -23,6 +23,7 @@ import @1.1::IGnss;
|
|||
import GnssLocation;
|
||||
import IGnssCallback;
|
||||
import IGnssConfiguration;
|
||||
import IGnssDebug;
|
||||
import IGnssMeasurement;
|
||||
import IAGnss;
|
||||
import IAGnssRil;
|
||||
|
@ -54,6 +55,13 @@ interface IGnss extends @1.1::IGnss {
|
|||
*/
|
||||
getExtensionGnssConfiguration_2_0() generates (IGnssConfiguration gnssConfigurationIface);
|
||||
|
||||
/**
|
||||
* This method returns the IGnssDebug interface.
|
||||
*
|
||||
* @return gnssDebugIface Handle to the IGnssDebug interface.
|
||||
*/
|
||||
getExtensionGnssDebug_2_0() generates (IGnssDebug gnssDebugIface);
|
||||
|
||||
/**
|
||||
* This method returns the IAGnss Interface.
|
||||
*
|
||||
|
|
|
@ -19,6 +19,7 @@ package android.hardware.gnss@2.0;
|
|||
import @1.0::IGnssCallback;
|
||||
import @1.1::IGnssCallback;
|
||||
import GnssLocation;
|
||||
import GnssConstellationType;
|
||||
|
||||
/**
|
||||
* This interface is required for the HAL to communicate certain information
|
||||
|
@ -94,4 +95,26 @@ interface IGnssCallback extends @1.1::IGnssCallback {
|
|||
* during-call to E911, or up to 5 minutes after end-of-call or text to E911).
|
||||
*/
|
||||
gnssRequestLocationCb_2_0(bool independentFromGnss, bool isUserEmergency);
|
||||
|
||||
/** Extends a GnssSvInfo, replacing the GnssConstellationType. */
|
||||
struct GnssSvInfo {
|
||||
/**
|
||||
* GNSS satellite information for a single satellite and frequency.
|
||||
*
|
||||
* In this version of the HAL, the field 'constellation' in the v1_0 struct is deprecated,
|
||||
* and is no longer used by the framework. The constellation type is instead reported in
|
||||
* @2.0::IGnssCallback.GnssSvInfo.constellation.
|
||||
*/
|
||||
@1.0::IGnssCallback.GnssSvInfo v1_0;
|
||||
|
||||
/** Defines the constellation of the given SV. */
|
||||
GnssConstellationType constellation;
|
||||
};
|
||||
|
||||
/**
|
||||
* Callback for the HAL to pass a vector of GnssSvInfo back to the client.
|
||||
*
|
||||
* @param svInfo SV status information from HAL.
|
||||
*/
|
||||
gnssSvStatusCb_2_0(vec<GnssSvInfo> svInfoList);
|
||||
};
|
||||
|
|
66
gnss/2.0/IGnssDebug.hal
Normal file
66
gnss/2.0/IGnssDebug.hal
Normal file
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* 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.0;
|
||||
|
||||
import @1.0::IGnssDebug;
|
||||
|
||||
/** Extended interface for DEBUG support. */
|
||||
interface IGnssDebug extends @1.0::IGnssDebug {
|
||||
|
||||
/** Extending SatelliteData, replacing the GnssConstellationType. */
|
||||
struct SatelliteData {
|
||||
/**
|
||||
* GNSS Satellite info.
|
||||
*
|
||||
* In this version of the HAL, the field 'constellation' in the v1_0 struct is deprecated,
|
||||
* and is no longer used by the framework. The constellation type is instead reported in
|
||||
* @2.0::IGnssDebug.SatelliteData.constellation.
|
||||
*/
|
||||
@1.0::IGnssDebug.SatelliteData v1_0;
|
||||
|
||||
/** Defines the constellation type of the given SV. */
|
||||
GnssConstellationType constellation;
|
||||
};
|
||||
|
||||
/**
|
||||
* Provides a set of debug information that is filled by the GNSS chipset when the method
|
||||
* getDebugData() is invoked.
|
||||
*/
|
||||
struct DebugData {
|
||||
/** Current best known position. */
|
||||
@1.0::IGnssDebug.PositionDebug position;
|
||||
|
||||
/** Current best know time estimate. */
|
||||
@1.0::IGnssDebug.TimeDebug time;
|
||||
|
||||
/**
|
||||
* Provides a list of the available satellite data, for all
|
||||
* satellites and constellations the device can track,
|
||||
* including GnssConstellationType UNKNOWN.
|
||||
*/
|
||||
vec<SatelliteData> satelliteDataArray;
|
||||
};
|
||||
|
||||
/**
|
||||
* This methods requests position, time and satellite ephemeris debug information from the HAL.
|
||||
*
|
||||
* @return ret debugData information from GNSS Hal that contains the current best known
|
||||
* position, best known time estimate and a complete list of constellations that the device can
|
||||
* track.
|
||||
*/
|
||||
getDebugData_2_0() generates (DebugData debugData);
|
||||
};
|
|
@ -19,6 +19,7 @@ package android.hardware.gnss@2.0;
|
|||
import @1.0::IGnssMeasurementCallback;
|
||||
import @1.1::IGnssMeasurementCallback;
|
||||
import ElapsedRealtime;
|
||||
import GnssConstellationType;
|
||||
|
||||
/** The callback interface to report measurements from the HAL. */
|
||||
interface IGnssMeasurementCallback extends @1.1::IGnssMeasurementCallback {
|
||||
|
@ -365,7 +366,8 @@ interface IGnssMeasurementCallback extends @1.1::IGnssMeasurementCallback {
|
|||
};
|
||||
|
||||
/**
|
||||
* Extends a GNSS Measurement, adding a GnssMeasurementCodeType.
|
||||
* Extends a GNSS Measurement, adding a GnssMeasurementCodeType, a GnssMeasurementState, and
|
||||
* replacing the GnssConstellationType.
|
||||
*/
|
||||
struct GnssMeasurement {
|
||||
/**
|
||||
|
@ -380,6 +382,10 @@ interface IGnssMeasurementCallback extends @1.1::IGnssMeasurementCallback {
|
|||
* In this version of the HAL, the field 'state' in the v1_1.v1_0 struct is deprecated, and
|
||||
* is no longer used by the framework. The satellite sync state is instead reported in
|
||||
* @2.0::IGnssMeasurementCallback.GnssMeasurement.state.
|
||||
*
|
||||
* In this version of the HAL, the field 'constellation' in the v1_1.v1_0 struct is
|
||||
* deprecated, and is no longer used by the framework. The constellation type is instead
|
||||
* reported in @2.0::IGnssMeasurementCallback.GnssMeasurement.constellation.
|
||||
*/
|
||||
@1.1::IGnssMeasurementCallback.GnssMeasurement v1_1;
|
||||
|
||||
|
@ -442,6 +448,11 @@ interface IGnssMeasurementCallback extends @1.1::IGnssMeasurementCallback {
|
|||
* This value is mandatory.
|
||||
*/
|
||||
bitfield<GnssMeasurementState> state;
|
||||
|
||||
/**
|
||||
* The constellation type of the GNSS measurement.
|
||||
*/
|
||||
GnssConstellationType constellation;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -236,6 +236,11 @@ Return<sp<V2_0::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration_2_0() {
|
|||
return new GnssConfiguration{};
|
||||
}
|
||||
|
||||
Return<sp<V2_0::IGnssDebug>> Gnss::getExtensionGnssDebug_2_0() {
|
||||
// TODO(b/124012850): Implement function.
|
||||
return sp<V2_0::IGnssDebug>{};
|
||||
}
|
||||
|
||||
Return<sp<V2_0::IAGnss>> Gnss::getExtensionAGnss_2_0() {
|
||||
return new AGnss{};
|
||||
}
|
||||
|
|
|
@ -83,6 +83,7 @@ struct Gnss : public IGnss {
|
|||
|
||||
// Methods from V2_0::IGnss follow.
|
||||
Return<sp<V2_0::IGnssConfiguration>> getExtensionGnssConfiguration_2_0() override;
|
||||
Return<sp<V2_0::IGnssDebug>> getExtensionGnssDebug_2_0() override;
|
||||
Return<sp<V2_0::IAGnss>> getExtensionAGnss_2_0() override;
|
||||
Return<sp<V2_0::IAGnssRil>> getExtensionAGnssRil_2_0() override;
|
||||
Return<sp<V2_0::IGnssMeasurement>> getExtensionGnssMeasurement_2_0() override;
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace gnss {
|
|||
namespace V2_0 {
|
||||
namespace implementation {
|
||||
|
||||
using GnssConstellationType = V1_0::GnssConstellationType;
|
||||
using GnssConstellationType = V2_0::GnssConstellationType;
|
||||
using GnssMeasurementFlags = V1_0::IGnssMeasurementCallback::GnssMeasurementFlags;
|
||||
using GnssMeasurementState = V2_0::IGnssMeasurementCallback::GnssMeasurementState;
|
||||
|
||||
|
@ -46,6 +46,7 @@ Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallba
|
|||
}
|
||||
|
||||
Return<void> GnssMeasurement::close() {
|
||||
ALOGD("close");
|
||||
std::unique_lock<std::mutex> lock(mMutex);
|
||||
stop();
|
||||
sCallback = nullptr;
|
||||
|
@ -62,6 +63,7 @@ Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallba
|
|||
// Methods from V2_0::IGnssMeasurement follow.
|
||||
Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback_2_0(
|
||||
const sp<V2_0::IGnssMeasurementCallback>& callback, bool) {
|
||||
ALOGD("setCallback_2_0");
|
||||
std::unique_lock<std::mutex> lock(mMutex);
|
||||
sCallback = callback;
|
||||
|
||||
|
@ -75,6 +77,7 @@ Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallba
|
|||
}
|
||||
|
||||
void GnssMeasurement::start() {
|
||||
ALOGD("start");
|
||||
mIsActive = true;
|
||||
mThread = std::thread([this]() {
|
||||
while (mIsActive == true) {
|
||||
|
@ -87,6 +90,7 @@ void GnssMeasurement::start() {
|
|||
}
|
||||
|
||||
void GnssMeasurement::stop() {
|
||||
ALOGD("stop");
|
||||
mIsActive = false;
|
||||
if (mThread.joinable()) {
|
||||
mThread.join();
|
||||
|
@ -95,26 +99,27 @@ void GnssMeasurement::stop() {
|
|||
|
||||
GnssData GnssMeasurement::getMockMeasurement() {
|
||||
V1_0::IGnssMeasurementCallback::GnssMeasurement measurement_1_0 = {
|
||||
.flags = (uint32_t)GnssMeasurementFlags::HAS_CARRIER_FREQUENCY,
|
||||
.svid = (int16_t)6,
|
||||
.constellation = GnssConstellationType::GLONASS,
|
||||
.timeOffsetNs = 0.0,
|
||||
.receivedSvTimeInNs = 8195997131077,
|
||||
.receivedSvTimeUncertaintyInNs = 15,
|
||||
.cN0DbHz = 30.0,
|
||||
.pseudorangeRateMps = -484.13739013671875,
|
||||
.pseudorangeRateUncertaintyMps = 1.0379999876022339,
|
||||
.accumulatedDeltaRangeState = (uint32_t)
|
||||
V1_0::IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_UNKNOWN,
|
||||
.accumulatedDeltaRangeM = 0.0,
|
||||
.accumulatedDeltaRangeUncertaintyM = 0.0,
|
||||
.carrierFrequencyHz = 1.59975e+09,
|
||||
.multipathIndicator =
|
||||
V1_0::IGnssMeasurementCallback::GnssMultipathIndicator::INDICATOR_UNKNOWN};
|
||||
.flags = (uint32_t)GnssMeasurementFlags::HAS_CARRIER_FREQUENCY,
|
||||
.svid = (int16_t)6,
|
||||
.constellation = V1_0::GnssConstellationType::UNKNOWN,
|
||||
.timeOffsetNs = 0.0,
|
||||
.receivedSvTimeInNs = 8195997131077,
|
||||
.receivedSvTimeUncertaintyInNs = 15,
|
||||
.cN0DbHz = 30.0,
|
||||
.pseudorangeRateMps = -484.13739013671875,
|
||||
.pseudorangeRateUncertaintyMps = 1.0379999876022339,
|
||||
.accumulatedDeltaRangeState = (uint32_t)V1_0::IGnssMeasurementCallback::
|
||||
GnssAccumulatedDeltaRangeState::ADR_STATE_UNKNOWN,
|
||||
.accumulatedDeltaRangeM = 0.0,
|
||||
.accumulatedDeltaRangeUncertaintyM = 0.0,
|
||||
.carrierFrequencyHz = 1.59975e+09,
|
||||
.multipathIndicator =
|
||||
V1_0::IGnssMeasurementCallback::GnssMultipathIndicator::INDICATOR_UNKNOWN};
|
||||
V1_1::IGnssMeasurementCallback::GnssMeasurement measurement_1_1 = {.v1_0 = measurement_1_0};
|
||||
V2_0::IGnssMeasurementCallback::GnssMeasurement measurement_2_0 = {
|
||||
.v1_1 = measurement_1_1,
|
||||
.codeType = "C",
|
||||
.constellation = GnssConstellationType::GLONASS,
|
||||
.state = GnssMeasurementState::STATE_CODE_LOCK | GnssMeasurementState::STATE_BIT_SYNC |
|
||||
GnssMeasurementState::STATE_SUBFRAME_SYNC |
|
||||
GnssMeasurementState::STATE_TOW_DECODED |
|
||||
|
|
|
@ -72,4 +72,28 @@ struct GnssLocation {
|
|||
* needs to be estimated by syncing the notion of time via PTP or some other mechanism.
|
||||
*/
|
||||
ElapsedRealtime elapsedRealtime;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* GNSS constellation type
|
||||
*
|
||||
* This is to specify the navigation satellite system, for example, as listed in Section 3.5 in
|
||||
* RINEX Version 3.04.
|
||||
*/
|
||||
enum GnssConstellationType : uint8_t {
|
||||
UNKNOWN = 0,
|
||||
/** Global Positioning System. */
|
||||
GPS = 1,
|
||||
/** Satellite-Based Augmentation System. */
|
||||
SBAS = 2,
|
||||
/** Global Navigation Satellite System. */
|
||||
GLONASS = 3,
|
||||
/** Quasi-Zenith Satellite System. */
|
||||
QZSS = 4,
|
||||
/** BeiDou Navigation Satellite System. */
|
||||
BEIDOU = 5,
|
||||
/** Galileo Navigation Satellite System. */
|
||||
GALILEO = 6,
|
||||
/** Indian Regional Navigation Satellite System. */
|
||||
IRNSS = 7,
|
||||
};
|
||||
|
|
|
@ -33,7 +33,7 @@ GnssHalTest::GnssHalTest()
|
|||
void GnssHalTest::SetUp() {
|
||||
gnss_hal_ = ::testing::VtsHalHidlTargetTestBase::getService<IGnss>(
|
||||
GnssHidlEnvironment::Instance()->getServiceName<IGnss>());
|
||||
list_gnss_sv_status_.clear();
|
||||
list_vec_gnss_sv_info_.clear();
|
||||
ASSERT_NE(gnss_hal_, nullptr);
|
||||
|
||||
SetUpGnssCallback();
|
||||
|
@ -59,7 +59,7 @@ void GnssHalTest::SetUpGnssCallback() {
|
|||
gnss_cb_ = new GnssCallback(*this);
|
||||
ASSERT_NE(gnss_cb_, nullptr);
|
||||
|
||||
auto result = gnss_hal_->setCallback_1_1(gnss_cb_);
|
||||
auto result = gnss_hal_->setCallback_2_0(gnss_cb_);
|
||||
if (!result.isOk()) {
|
||||
ALOGE("result of failed setCallback %s", result.description().c_str());
|
||||
}
|
||||
|
@ -77,16 +77,6 @@ void GnssHalTest::SetUpGnssCallback() {
|
|||
EXPECT_EQ(capabilities_called_count_, 1);
|
||||
EXPECT_EQ(info_called_count_, 1);
|
||||
EXPECT_EQ(name_called_count_, 1);
|
||||
|
||||
// Setup measurement corrections callback.
|
||||
auto measurementCorrections = gnss_hal_->getExtensionMeasurementCorrections();
|
||||
ASSERT_TRUE(measurementCorrections.isOk());
|
||||
sp<IMeasurementCorrections> iMeasurementCorrections = measurementCorrections;
|
||||
if (iMeasurementCorrections != nullptr) {
|
||||
sp<IMeasurementCorrectionsCallback> iMeasurementCorrectionsCallback =
|
||||
new GnssMeasurementCorrectionsCallback(*this);
|
||||
iMeasurementCorrections->setCallback(iMeasurementCorrectionsCallback);
|
||||
}
|
||||
}
|
||||
|
||||
void GnssHalTest::StopAndClearLocations() {
|
||||
|
@ -193,11 +183,12 @@ std::cv_status GnssHalTest::waitForMeasurementCorrectionsCapabilities(int timeou
|
|||
status = cv_.wait_for(lock, std::chrono::seconds(timeout_seconds));
|
||||
if (status == std::cv_status::timeout) return status;
|
||||
}
|
||||
notify_count_--;
|
||||
return status;
|
||||
}
|
||||
|
||||
Return<void> GnssHalTest::GnssCallback::gnssSetSystemInfoCb(
|
||||
const IGnssCallback::GnssSystemInfo& info) {
|
||||
const IGnssCallback_1_0::GnssSystemInfo& info) {
|
||||
ALOGI("Info received, year %d", info.yearOfHw);
|
||||
parent_.info_called_count_++;
|
||||
parent_.last_info_ = info;
|
||||
|
@ -248,10 +239,9 @@ Return<void> GnssHalTest::GnssCallback::gnssLocationCbImpl(const GnssLocation_2_
|
|||
return Void();
|
||||
}
|
||||
|
||||
Return<void> GnssHalTest::GnssCallback::gnssSvStatusCb(
|
||||
const IGnssCallback::GnssSvStatus& svStatus) {
|
||||
ALOGI("GnssSvStatus received");
|
||||
parent_.list_gnss_sv_status_.emplace_back(svStatus);
|
||||
Return<void> GnssHalTest::GnssCallback::gnssSvStatusCb(const IGnssCallback_1_0::GnssSvStatus&) {
|
||||
ALOGI("gnssSvStatusCb");
|
||||
|
||||
return Void();
|
||||
}
|
||||
|
||||
|
@ -272,3 +262,11 @@ Return<void> GnssHalTest::GnssMeasurementCorrectionsCallback::setCapabilitiesCb(
|
|||
parent_.notify();
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> GnssHalTest::GnssCallback::gnssSvStatusCb_2_0(
|
||||
const hidl_vec<IGnssCallback_2_0::GnssSvInfo>& svInfoList) {
|
||||
ALOGI("gnssSvStatusCb_2_0. Size = %d", (int)svInfoList.size());
|
||||
parent_.list_vec_gnss_sv_info_.emplace_back(svInfoList);
|
||||
parent_.notify();
|
||||
return Void();
|
||||
}
|
||||
|
|
|
@ -25,17 +25,20 @@
|
|||
#include <list>
|
||||
#include <mutex>
|
||||
|
||||
using android::hardware::hidl_vec;
|
||||
using android::hardware::Return;
|
||||
using android::hardware::Void;
|
||||
|
||||
using android::hardware::gnss::measurement_corrections::V1_0::IMeasurementCorrectionsCallback;
|
||||
using android::hardware::gnss::V1_0::GnssLocationFlags;
|
||||
using android::hardware::gnss::V2_0::IGnss;
|
||||
using android::hardware::gnss::V2_0::IGnssCallback;
|
||||
|
||||
using GnssLocation_1_0 = android::hardware::gnss::V1_0::GnssLocation;
|
||||
using GnssLocation_2_0 = android::hardware::gnss::V2_0::GnssLocation;
|
||||
|
||||
using IGnssCallback_1_0 = android::hardware::gnss::V1_0::IGnssCallback;
|
||||
using IGnssCallback_2_0 = android::hardware::gnss::V2_0::IGnssCallback;
|
||||
|
||||
using IGnssMeasurementCallback_1_0 = android::hardware::gnss::V1_0::IGnssMeasurementCallback;
|
||||
using IGnssMeasurementCallback_1_1 = android::hardware::gnss::V1_1::IGnssMeasurementCallback;
|
||||
using IGnssMeasurementCallback_2_0 = android::hardware::gnss::V2_0::IGnssMeasurementCallback;
|
||||
|
@ -77,8 +80,8 @@ class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
std::cv_status waitForMeasurementCorrectionsCapabilities(int timeout_seconds);
|
||||
|
||||
/* Callback class for data & Event. */
|
||||
class GnssCallback : public IGnssCallback {
|
||||
public:
|
||||
class GnssCallback : public IGnssCallback_2_0 {
|
||||
public:
|
||||
GnssHalTest& parent_;
|
||||
|
||||
GnssCallback(GnssHalTest& parent) : parent_(parent){};
|
||||
|
@ -86,7 +89,7 @@ class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
virtual ~GnssCallback() = default;
|
||||
|
||||
// Dummy callback handlers
|
||||
Return<void> gnssStatusCb(const IGnssCallback::GnssStatusValue /* status */) override {
|
||||
Return<void> gnssStatusCb(const IGnssCallback_1_0::GnssStatusValue /* status */) override {
|
||||
return Void();
|
||||
}
|
||||
Return<void> gnssNmeaCb(int64_t /* timestamp */,
|
||||
|
@ -103,8 +106,8 @@ class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
Return<void> gnssNameCb(const android::hardware::hidl_string& name) override;
|
||||
Return<void> gnssLocationCb(const GnssLocation_1_0& location) override;
|
||||
Return<void> gnssSetCapabilitesCb(uint32_t capabilities) override;
|
||||
Return<void> gnssSetSystemInfoCb(const IGnssCallback::GnssSystemInfo& info) override;
|
||||
Return<void> gnssSvStatusCb(const IGnssCallback::GnssSvStatus& svStatus) override;
|
||||
Return<void> gnssSetSystemInfoCb(const IGnssCallback_1_0::GnssSystemInfo& info) override;
|
||||
Return<void> gnssSvStatusCb(const IGnssCallback_1_0::GnssSvStatus& svStatus) override;
|
||||
|
||||
// New in v2.0
|
||||
Return<void> gnssLocationCb_2_0(const GnssLocation_2_0& location) override;
|
||||
|
@ -113,6 +116,8 @@ class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
return Void();
|
||||
}
|
||||
Return<void> gnssSetCapabilitiesCb_2_0(uint32_t capabilities) override;
|
||||
Return<void> gnssSvStatusCb_2_0(
|
||||
const hidl_vec<IGnssCallback_2_0::GnssSvInfo>& svInfoList) override;
|
||||
|
||||
private:
|
||||
Return<void> gnssLocationCbImpl(const GnssLocation_2_0& location);
|
||||
|
@ -198,7 +203,7 @@ class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
void SetPositionMode(const int min_interval_msec, const bool low_power_mode);
|
||||
|
||||
sp<IGnss> gnss_hal_; // GNSS HAL to call into
|
||||
sp<IGnssCallback> gnss_cb_; // Primary callback interface
|
||||
sp<IGnssCallback_2_0> gnss_cb_; // Primary callback interface
|
||||
|
||||
// TODO: make these variables thread-safe.
|
||||
/* Count of calls to set the following items, and the latest item (used by
|
||||
|
@ -211,16 +216,16 @@ class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
int measurement_called_count_;
|
||||
int name_called_count_;
|
||||
|
||||
IGnssCallback::GnssSystemInfo last_info_;
|
||||
IGnssCallback_1_0::GnssSystemInfo last_info_;
|
||||
uint32_t last_capabilities_;
|
||||
uint32_t last_measurement_corrections_capabilities_;
|
||||
GnssLocation_2_0 last_location_;
|
||||
IGnssMeasurementCallback_2_0::GnssData last_measurement_;
|
||||
android::hardware::hidl_string last_name_;
|
||||
|
||||
list<IGnssCallback::GnssSvStatus> list_gnss_sv_status_;
|
||||
list<hidl_vec<IGnssCallback_2_0::GnssSvInfo>> list_vec_gnss_sv_info_;
|
||||
|
||||
private:
|
||||
private:
|
||||
std::mutex mtx_;
|
||||
std::condition_variable cv_;
|
||||
int notify_count_;
|
||||
|
|
|
@ -38,6 +38,7 @@ using android::hardware::gnss::measurement_corrections::V1_0::IMeasurementCorrec
|
|||
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::V2_0::GnssConstellationType;
|
||||
using android::hardware::gnss::V2_0::IGnssCallback;
|
||||
using android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControl;
|
||||
|
||||
|
@ -163,10 +164,13 @@ TEST_F(GnssHalTest, TestAGnssRil_UpdateNetworkState_2_0) {
|
|||
}
|
||||
|
||||
/*
|
||||
* TestGnssMeasurementCodeType:
|
||||
* Sets a GnssMeasurementCallback, waits for a measurement, and verifies the codeType is valid.
|
||||
* TestGnssMeasurementFields:
|
||||
* Sets a GnssMeasurementCallback, waits for a measurement, and verifies
|
||||
* 1. codeType is valid,
|
||||
* 2. constellation is valid.
|
||||
* 3. state is valid.
|
||||
*/
|
||||
TEST_F(GnssHalTest, TestGnssMeasurementCodeType) {
|
||||
TEST_F(GnssHalTest, TestGnssMeasurementFields) {
|
||||
const int kFirstGnssMeasurementTimeoutSeconds = 10;
|
||||
|
||||
auto gnssMeasurement = gnss_hal_->getExtensionGnssMeasurement_2_0();
|
||||
|
@ -189,7 +193,23 @@ TEST_F(GnssHalTest, TestGnssMeasurementCodeType) {
|
|||
EXPECT_EQ(measurement_called_count_, 1);
|
||||
ASSERT_TRUE(last_measurement_.measurements.size() > 0);
|
||||
for (auto measurement : last_measurement_.measurements) {
|
||||
// Verify CodeType is valid.
|
||||
ASSERT_NE(measurement.codeType, "");
|
||||
|
||||
// Verify ConstellationType is valid.
|
||||
ASSERT_TRUE(static_cast<uint8_t>(measurement.constellation) >=
|
||||
static_cast<uint8_t>(GnssConstellationType::UNKNOWN) &&
|
||||
static_cast<uint8_t>(measurement.constellation) <=
|
||||
static_cast<uint8_t>(GnssConstellationType::IRNSS));
|
||||
|
||||
// Verify State is valid.
|
||||
ASSERT_TRUE(
|
||||
static_cast<uint32_t>(measurement.state) >=
|
||||
static_cast<uint32_t>(IGnssMeasurementCallback_2_0::GnssMeasurementState::
|
||||
STATE_UNKNOWN) &&
|
||||
static_cast<uint32_t>(measurement.state) <=
|
||||
static_cast<uint32_t>(IGnssMeasurementCallback_2_0::GnssMeasurementState::
|
||||
STATE_2ND_CODE_LOCK));
|
||||
}
|
||||
|
||||
iGnssMeasurement->close();
|
||||
|
@ -272,6 +292,7 @@ TEST_F(GnssHalTest, TestGnssVisibilityControlExtension) {
|
|||
* capability flag is set.
|
||||
*/
|
||||
TEST_F(GnssHalTest, TestGnssMeasurementCorrectionsCapabilities) {
|
||||
// Setup measurement corrections callback.
|
||||
auto measurementCorrections = gnss_hal_->getExtensionMeasurementCorrections();
|
||||
ASSERT_TRUE(measurementCorrections.isOk());
|
||||
sp<IMeasurementCorrections> iMeasurementCorrections = measurementCorrections;
|
||||
|
@ -279,6 +300,10 @@ TEST_F(GnssHalTest, TestGnssMeasurementCorrectionsCapabilities) {
|
|||
return;
|
||||
}
|
||||
|
||||
sp<IMeasurementCorrectionsCallback> iMeasurementCorrectionsCallback =
|
||||
new GnssMeasurementCorrectionsCallback(*this);
|
||||
iMeasurementCorrections->setCallback(iMeasurementCorrectionsCallback);
|
||||
|
||||
const int kMeasurementCorrectionsCapabilitiesTimeoutSeconds = 5;
|
||||
waitForMeasurementCorrectionsCapabilities(kMeasurementCorrectionsCapabilitiesTimeoutSeconds);
|
||||
ASSERT_TRUE(measurement_corrections_capabilities_called_count_ > 0);
|
||||
|
@ -337,9 +362,9 @@ TEST_F(GnssHalTest, TestGnssDataElapsedRealtimeFlags) {
|
|||
wait(kFirstGnssMeasurementTimeoutSeconds);
|
||||
EXPECT_EQ(measurement_called_count_, 1);
|
||||
|
||||
ASSERT_TRUE((int)last_measurement_.elapsedRealtime.flags >= 0 &&
|
||||
(int)last_measurement_.elapsedRealtime.flags <=
|
||||
(int)ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS);
|
||||
ASSERT_TRUE((int)last_measurement_.elapsedRealtime.flags <=
|
||||
(int)(ElapsedRealtimeFlags::HAS_TIMESTAMP_NS |
|
||||
ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS));
|
||||
|
||||
// We expect a non-zero timestamp when set.
|
||||
if (last_measurement_.elapsedRealtime.flags & ElapsedRealtimeFlags::HAS_TIMESTAMP_NS) {
|
||||
|
@ -352,9 +377,9 @@ TEST_F(GnssHalTest, TestGnssDataElapsedRealtimeFlags) {
|
|||
TEST_F(GnssHalTest, TestGnssLocationElapsedRealtime) {
|
||||
StartAndCheckFirstLocation();
|
||||
|
||||
ASSERT_TRUE((int)last_location_.elapsedRealtime.flags >= 0 &&
|
||||
(int)last_location_.elapsedRealtime.flags <=
|
||||
(int)ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS);
|
||||
ASSERT_TRUE((int)last_location_.elapsedRealtime.flags <=
|
||||
(int)(ElapsedRealtimeFlags::HAS_TIMESTAMP_NS |
|
||||
ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS));
|
||||
|
||||
// We expect a non-zero timestamp when set.
|
||||
if (last_location_.elapsedRealtime.flags & ElapsedRealtimeFlags::HAS_TIMESTAMP_NS) {
|
||||
|
|
Loading…
Reference in a new issue