diff options
author | gomo <gomo@google.com> | 2018-12-02 02:49:10 -0800 |
---|---|---|
committer | gomo <gomo@google.com> | 2018-12-02 04:46:37 -0800 |
commit | 1da4b5c44c999438588b2c684de89bc46139e06b (patch) | |
tree | 9f5e28b7c62f62a45137967d9fa8bd3bd62ebf12 /gnss | |
parent | 351129427698ce9abeb99689488357e4fd7faef6 (diff) | |
download | android_hardware_interfaces-1da4b5c44c999438588b2c684de89bc46139e06b.tar.gz android_hardware_interfaces-1da4b5c44c999438588b2c684de89bc46139e06b.tar.bz2 android_hardware_interfaces-1da4b5c44c999438588b2c684de89bc46139e06b.zip |
Bluesky(go/bluesky) HAL and Default Implementation
- Create new sub-package of gnss with the name Bluesky
- Add bluesky/1/0/IBlueskyCorrections.hal
- Add bluesky/1.0/types.hal
- Modify IGnss.hal adding getExtensionBlueskyCorrections()
- Modify IGnssCallback.hal exteding capability enum for Bluesky
- Default Implementation
Bug: 111441283
Change-Id: I4ab2ecae7f0c43bb2b708741e3a55aba1b015db0
Test: Existing tests pass.
Diffstat (limited to 'gnss')
-rw-r--r-- | gnss/2.0/Android.bp | 3 | ||||
-rw-r--r-- | gnss/2.0/IGnss.hal | 20 | ||||
-rw-r--r-- | gnss/2.0/IGnssCallback.hal | 47 | ||||
-rw-r--r-- | gnss/2.0/default/Android.bp | 1 | ||||
-rw-r--r-- | gnss/2.0/default/Gnss.cpp | 48 | ||||
-rw-r--r-- | gnss/2.0/default/Gnss.h | 8 | ||||
-rw-r--r-- | gnss/2.0/vts/functional/Android.bp | 1 | ||||
-rw-r--r-- | gnss/measurement_corrections/1.0/Android.bp | 25 | ||||
-rw-r--r-- | gnss/measurement_corrections/1.0/IMeasurementCorrections.hal | 39 | ||||
-rw-r--r-- | gnss/measurement_corrections/1.0/types.hal | 125 |
10 files changed, 310 insertions, 7 deletions
diff --git a/gnss/2.0/Android.bp b/gnss/2.0/Android.bp index 39fe97d63..6a06bf4ce 100644 --- a/gnss/2.0/Android.bp +++ b/gnss/2.0/Android.bp @@ -8,14 +8,17 @@ hidl_interface { }, srcs: [ "IGnss.hal", + "IGnssCallback.hal", "IGnssMeasurement.hal", "IGnssMeasurementCallback.hal", ], interfaces: [ + "android.hardware.gnss.measurement_corrections@1.0", "android.hardware.gnss@1.0", "android.hardware.gnss@1.1", "android.hidl.base@1.0", ], gen_java: true, + gen_java_constants: true, } diff --git a/gnss/2.0/IGnss.hal b/gnss/2.0/IGnss.hal index a05f61a38..55621e555 100644 --- a/gnss/2.0/IGnss.hal +++ b/gnss/2.0/IGnss.hal @@ -16,12 +16,24 @@ package android.hardware.gnss@2.0; +import android.hardware.gnss.measurement_corrections@1.0::IMeasurementCorrections; import @1.1::IGnss; +import IGnssCallback; import IGnssMeasurement; /** Represents the standard GNSS (Global Navigation Satellite System) interface. */ interface IGnss extends @1.1::IGnss { + /** + * Opens the interface and provides the callback routines to the implementation of this + * interface. + * + * @param callback Callback interface for IGnss. + * + * @return success Returns true on success. + */ + setCallback_2_0(IGnssCallback callback) generates (bool success); + /** * This method returns the IGnssMeasurement interface. * @@ -31,4 +43,12 @@ interface IGnss extends @1.1::IGnss { * @return gnssMeasurementIface Handle to the IGnssMeasurement interface. */ getExtensionGnssMeasurement_2_0() generates (IGnssMeasurement gnssMeasurementIface); + + /** + * This method returns the IMeasurementCorrections interface. + * + * @return measurementCorrectionsIface Handle to the IMeasurementCorrections interface. + */ + getExtensionMeasurementCorrections() + generates (IMeasurementCorrections measurementCorrectionsIface); };
\ No newline at end of file diff --git a/gnss/2.0/IGnssCallback.hal b/gnss/2.0/IGnssCallback.hal new file mode 100644 index 000000000..1cdd2c02f --- /dev/null +++ b/gnss/2.0/IGnssCallback.hal @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2018 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::IGnssCallback; +import @1.1::IGnssCallback; + +/** + * The interface is required for the HAL to communicate certain information + * like status and location info back to the platform, the platform implements + * the interfaces and passes a handle to the HAL. + */ +interface IGnssCallback extends @1.1::IGnssCallback { + + /** Flags for the gnssSetCapabilities callback. */ + @export(name="", value_prefix="GPS_CAPABILITY_") + enum Capabilities : @1.0::IGnssCallback.Capabilities { + /** GNSS supports line-of-sight satellite identification measurement Corrections */ + MEASUREMENT_CORRECTIONS_LOS_SATS = 1 << 8, + /** GNSS supports per satellite excess-path-length measurement Corrections */ + MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH = 1 << 10, + /** GNSS supports reflecting planes measurement Corrections */ + MEASUREMENT_CORRECTIONS_REFLECTING_PLANE = 1 << 20 + }; + + /** + * Callback to inform framework of the GNSS engine's capabilities. + * + * @param capabilities Capability parameter is a bit field of the Capabilities enum. + */ + gnssSetCapabilitiesCb_2_0(bitfield<Capabilities> capabilities); + +};
\ No newline at end of file diff --git a/gnss/2.0/default/Android.bp b/gnss/2.0/default/Android.bp index 3c5557812..bec826072 100644 --- a/gnss/2.0/default/Android.bp +++ b/gnss/2.0/default/Android.bp @@ -30,6 +30,7 @@ cc_binary { "libutils", "liblog", "android.hardware.gnss@2.0", + "android.hardware.gnss.measurement_corrections@1.0", "android.hardware.gnss@1.0", "android.hardware.gnss@1.1", ], diff --git a/gnss/2.0/default/Gnss.cpp b/gnss/2.0/default/Gnss.cpp index 1170f73af..e21fb175a 100644 --- a/gnss/2.0/default/Gnss.cpp +++ b/gnss/2.0/default/Gnss.cpp @@ -25,7 +25,8 @@ namespace gnss { namespace V2_0 { namespace implementation { -sp<V1_1::IGnssCallback> Gnss::sGnssCallback = nullptr; +sp<V2_0::IGnssCallback> Gnss::sGnssCallback_2_0 = nullptr; +sp<V1_1::IGnssCallback> Gnss::sGnssCallback_1_1 = nullptr; // Methods from V1_0::IGnss follow. Return<bool> Gnss::setCallback(const sp<V1_0::IGnssCallback>&) { @@ -128,23 +129,23 @@ Return<bool> Gnss::setCallback_1_1(const sp<V1_1::IGnssCallback>& callback) { return false; } - sGnssCallback = callback; + sGnssCallback_1_1 = callback; uint32_t capabilities = 0x0; - auto ret = sGnssCallback->gnssSetCapabilitesCb(capabilities); + auto ret = sGnssCallback_1_1->gnssSetCapabilitesCb(capabilities); if (!ret.isOk()) { ALOGE("%s: Unable to invoke callback", __func__); } V1_1::IGnssCallback::GnssSystemInfo gnssInfo = {.yearOfHw = 2019}; - ret = sGnssCallback->gnssSetSystemInfoCb(gnssInfo); + ret = sGnssCallback_1_1->gnssSetSystemInfoCb(gnssInfo); if (!ret.isOk()) { ALOGE("%s: Unable to invoke callback", __func__); } auto gnssName = "Google Mock GNSS Implementation v2.0"; - ret = sGnssCallback->gnssNameCb(gnssName); + ret = sGnssCallback_1_1->gnssNameCb(gnssName); if (!ret.isOk()) { ALOGE("%s: Unable to invoke callback", __func__); } @@ -180,6 +181,43 @@ Return<sp<V2_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement_2_0() { return sp<V2_0::IGnssMeasurement>{}; } +Return<sp<measurement_corrections::V1_0::IMeasurementCorrections>> +Gnss::getExtensionMeasurementCorrections() { + // TODO implement + return sp<measurement_corrections::V1_0::IMeasurementCorrections>{}; +} + +Return<bool> Gnss::setCallback_2_0(const sp<V2_0::IGnssCallback>& callback) { + ALOGD("Gnss::setCallback_2_0"); + if (callback == nullptr) { + ALOGE("%s: Null callback ignored", __func__); + return false; + } + + sGnssCallback_2_0 = callback; + + uint32_t capabilities = 0x0; + auto ret = sGnssCallback_2_0->gnssSetCapabilitesCb(capabilities); + if (!ret.isOk()) { + ALOGE("%s: Unable to invoke callback", __func__); + } + + V1_1::IGnssCallback::GnssSystemInfo gnssInfo = {.yearOfHw = 2019}; + + ret = sGnssCallback_2_0->gnssSetSystemInfoCb(gnssInfo); + if (!ret.isOk()) { + ALOGE("%s: Unable to invoke callback", __func__); + } + + auto gnssName = "Google Mock GNSS Implementation v2.0"; + ret = sGnssCallback_2_0->gnssNameCb(gnssName); + if (!ret.isOk()) { + ALOGE("%s: Unable to invoke callback", __func__); + } + + return true; +} + } // namespace implementation } // namespace V2_0 } // namespace gnss diff --git a/gnss/2.0/default/Gnss.h b/gnss/2.0/default/Gnss.h index 17e439f6b..7f14513f6 100644 --- a/gnss/2.0/default/Gnss.h +++ b/gnss/2.0/default/Gnss.h @@ -73,9 +73,13 @@ struct Gnss : public IGnss { // Methods from V2_0::IGnss follow. Return<sp<V2_0::IGnssMeasurement>> getExtensionGnssMeasurement_2_0() override; + Return<bool> setCallback_2_0(const sp<V2_0::IGnssCallback>& callback) override; + Return<sp<measurement_corrections::V1_0::IMeasurementCorrections>> + getExtensionMeasurementCorrections() override; private: - static sp<V1_1::IGnssCallback> sGnssCallback; + static sp<V2_0::IGnssCallback> sGnssCallback_2_0; + static sp<V1_1::IGnssCallback> sGnssCallback_1_1; }; } // namespace implementation @@ -84,4 +88,4 @@ struct Gnss : public IGnss { } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_GNSS_V2_0_GNSS_H +#endif // ANDROID_HARDWARE_GNSS_V2_0_GNSS_H
\ No newline at end of file diff --git a/gnss/2.0/vts/functional/Android.bp b/gnss/2.0/vts/functional/Android.bp index 7db142f13..894716dc8 100644 --- a/gnss/2.0/vts/functional/Android.bp +++ b/gnss/2.0/vts/functional/Android.bp @@ -23,6 +23,7 @@ cc_test { "VtsHalGnssV2_0TargetTest.cpp", ], static_libs: [ + "android.hardware.gnss.measurement_corrections@1.0", "android.hardware.gnss@1.0", "android.hardware.gnss@1.1", "android.hardware.gnss@2.0", diff --git a/gnss/measurement_corrections/1.0/Android.bp b/gnss/measurement_corrections/1.0/Android.bp new file mode 100644 index 000000000..237b008bb --- /dev/null +++ b/gnss/measurement_corrections/1.0/Android.bp @@ -0,0 +1,25 @@ +// This file is autogenerated by hidl-gen -Landroidbp. + +hidl_interface { + name: "android.hardware.gnss.measurement_corrections@1.0", + root: "android.hardware", + vndk: { + enabled: true, + }, + srcs: [ + "types.hal", + "IMeasurementCorrections.hal", + ], + interfaces: [ + "android.hardware.gnss@1.0", + "android.hidl.base@1.0", + ], + types: [ + "GnssSingleSatCorrectionFlags", + "MeasurementCorrections", + "ReflectingPlane", + "SingleSatCorrection", + ], + gen_java: true, +} + diff --git a/gnss/measurement_corrections/1.0/IMeasurementCorrections.hal b/gnss/measurement_corrections/1.0/IMeasurementCorrections.hal new file mode 100644 index 000000000..934d10f64 --- /dev/null +++ b/gnss/measurement_corrections/1.0/IMeasurementCorrections.hal @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2018 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@1.0; + +/** + * Interface for measurement corrections support. + */ +interface IMeasurementCorrections { + + /** + * 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. + * + * @return success Whether the HAL can accept & use these corrections. + */ + setCorrections(MeasurementCorrections corrections) generates (bool success); +}; diff --git a/gnss/measurement_corrections/1.0/types.hal b/gnss/measurement_corrections/1.0/types.hal new file mode 100644 index 000000000..192bec9b4 --- /dev/null +++ b/gnss/measurement_corrections/1.0/types.hal @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2018 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@1.0; + +import android.hardware.gnss@1.0::GnssConstellationType; + +/** + * A struct with measurement corrections for a single visible satellites + * + * The bit mask singleSatCorrectionFlags indicates which correction values are valid in the struct + */ +struct SingleSatCorrection { + + /** Contains GnssSingleSatCorrectionFlags bits. */ + bitfield<GnssSingleSatCorrectionFlags> singleSatCorrectionFlags; + + /** + * Defines the constellation of the given satellite. + */ + GnssConstellationType constellation; + + /** + * Satellite vehicle ID number, as defined in GnssSvInfo::svid + */ + uint16_t 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. + */ + float carrierFrequencyHz; + + /** True if the satellite is in Line-of-Sight condition */ + bool satIsLos; + + /** + * 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 GnssMeasurementCallback outputs. + */ + float excessPathLengthMeters; + + /** Error estimate (1-sigma) for the Excess path length estimate */ + float excessPathLengthUncertaintyMeters; + + /** Defines the reflecting plane location and azimuth information */ + ReflectingPlane reflectingPlance; +}; + +/** + * 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 + */ +struct MeasurementCorrections { + /** Represents latitude in degrees. */ + double latitudeDegrees; + + /** Represents longitude in degrees. */ + double longitudeDegrees; + + /** + * Represents altitude in meters above the WGS 84 reference ellipsoid. + */ + double altitudeMeters; + + /** Time Of Applicability, GPS time of week */ + uint64_t toaGpsNanosecondsOfWeek; + + /** + * A set of SingleSatCorrection each containing measurement corrections for a satellite in view + */ + vec<SingleSatCorrection> satCorrections; +}; + +/** + * A struct containing the location and azimuth of the reflecting plane that the satellite signal + * has bounced from. + * + * This field is set only if the signal has bounced only once. + */ +struct 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 plane in meters above the WGS 84 reference ellipsoid. + */ + double altitudeMeters; + + /** Represents azimuth clockwise from north of the reflecting plane in degrees. */ + double azimuthDegrees; +}; + +/** Bit mask to indicate which values are valid in a SingleSatCorrection object. */ +enum GnssSingleSatCorrectionFlags : uint16_t { + /** GnssSingleSatCorrectionFlags has valid satellite-is-line-of-sight field. */ + HAS_SAT_IS_LOS = 0x0001, + /** GnssSingleSatCorrectionFlags has valid Excess Path Length field. */ + HAS_EXCESS_PATH_LENGTH = 0x0002, + /** GnssSingleSatCorrectionFlags has valid Excess Path Length Uncertainty field. */ + HAS_EXCESS_PATH_LENGTH_UNC = 0x0004, + /** GnssSingleSatCorrectionFlags has valid Reflecting Plane field. */ + HAS_REFLECTING_PLANE = 0x0008 +};
\ No newline at end of file |