Yu-Han Yang | a509861 | 2019-02-08 16:22:07 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2019 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include <Utils.h> |
Edwin Tung | bbf7fb9 | 2021-12-27 12:13:02 +0800 | [diff] [blame] | 18 | #include <android/hardware/gnss/BnGnss.h> |
Yu-Han Yang | 1afbd5f | 2021-11-24 16:39:13 -0800 | [diff] [blame] | 19 | #include <android/hardware/gnss/IGnss.h> |
Yu-Han Yang | a509861 | 2019-02-08 16:22:07 -0800 | [diff] [blame] | 20 | #include "gtest/gtest.h" |
| 21 | |
Tyler Trephan | 0d9206a | 2020-09-28 22:03:18 -0700 | [diff] [blame] | 22 | #include <cutils/properties.h> |
Yu-Han Yang | 4165ed1 | 2022-02-09 14:47:50 -0800 | [diff] [blame] | 23 | #include <utils/SystemClock.h> |
Tyler Trephan | 0d9206a | 2020-09-28 22:03:18 -0700 | [diff] [blame] | 24 | |
Yu-Han Yang | a509861 | 2019-02-08 16:22:07 -0800 | [diff] [blame] | 25 | namespace android { |
| 26 | namespace hardware { |
| 27 | namespace gnss { |
| 28 | namespace common { |
| 29 | |
Yu-Han Yang | 4165ed1 | 2022-02-09 14:47:50 -0800 | [diff] [blame] | 30 | using android::hardware::gnss::ElapsedRealtime; |
| 31 | using android::hardware::gnss::GnssLocation; |
| 32 | |
Yu-Han Yang | 3a75dc0 | 2021-09-27 01:01:06 -0700 | [diff] [blame] | 33 | using namespace measurement_corrections::V1_0; |
Yu-Han Yang | a509861 | 2019-02-08 16:22:07 -0800 | [diff] [blame] | 34 | using V1_0::GnssLocationFlags; |
| 35 | |
Edwin Tung | bbf7fb9 | 2021-12-27 12:13:02 +0800 | [diff] [blame] | 36 | using MeasurementCorrectionsAidl = |
| 37 | android::hardware::gnss::measurement_corrections::MeasurementCorrections; |
| 38 | using ReflectingPlaneAidl = android::hardware::gnss::measurement_corrections::ReflectingPlane; |
| 39 | using SingleSatCorrectionAidl = |
| 40 | android::hardware::gnss::measurement_corrections::SingleSatCorrection; |
Yu-Han Yang | f5bd7c0 | 2022-03-04 13:46:52 -0800 | [diff] [blame^] | 41 | using ExcessPathInfo = SingleSatCorrectionAidl::ExcessPathInfo; |
Edwin Tung | bbf7fb9 | 2021-12-27 12:13:02 +0800 | [diff] [blame] | 42 | |
Yu-Han Yang | 1afbd5f | 2021-11-24 16:39:13 -0800 | [diff] [blame] | 43 | template <> |
| 44 | int64_t Utils::getLocationTimestampMillis(const android::hardware::gnss::GnssLocation& location) { |
| 45 | return location.timestampMillis; |
| 46 | } |
Yu-Han Yang | a509861 | 2019-02-08 16:22:07 -0800 | [diff] [blame] | 47 | |
Yu-Han Yang | 1afbd5f | 2021-11-24 16:39:13 -0800 | [diff] [blame] | 48 | template <> |
| 49 | int64_t Utils::getLocationTimestampMillis(const V1_0::GnssLocation& location) { |
| 50 | return location.timestamp; |
Yu-Han Yang | a509861 | 2019-02-08 16:22:07 -0800 | [diff] [blame] | 51 | } |
| 52 | |
Yu-Han Yang | 4165ed1 | 2022-02-09 14:47:50 -0800 | [diff] [blame] | 53 | template <> |
| 54 | void Utils::checkLocationElapsedRealtime(const V1_0::GnssLocation&) {} |
| 55 | |
| 56 | template <> |
| 57 | void Utils::checkLocationElapsedRealtime(const android::hardware::gnss::GnssLocation& location) { |
| 58 | checkElapsedRealtime(location.elapsedRealtime); |
| 59 | } |
| 60 | |
| 61 | void Utils::checkElapsedRealtime(const ElapsedRealtime& elapsedRealtime) { |
| 62 | ASSERT_TRUE(elapsedRealtime.flags >= 0 && |
| 63 | elapsedRealtime.flags <= (ElapsedRealtime::HAS_TIMESTAMP_NS | |
| 64 | ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS)); |
| 65 | if (elapsedRealtime.flags & ElapsedRealtime::HAS_TIMESTAMP_NS) { |
| 66 | ASSERT_TRUE(elapsedRealtime.timestampNs > 0); |
| 67 | } |
| 68 | if (elapsedRealtime.flags & ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS) { |
| 69 | ASSERT_TRUE(elapsedRealtime.timeUncertaintyNs > 0); |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | const GnssLocation Utils::getMockLocation(double latitudeDegrees, double longitudeDegrees, |
| 74 | double horizontalAccuracyMeters) { |
| 75 | ElapsedRealtime elapsedRealtime; |
| 76 | elapsedRealtime.flags = |
| 77 | ElapsedRealtime::HAS_TIMESTAMP_NS | ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS; |
| 78 | elapsedRealtime.timestampNs = ::android::elapsedRealtimeNano(); |
| 79 | elapsedRealtime.timeUncertaintyNs = 1000; |
| 80 | GnssLocation location; |
| 81 | location.gnssLocationFlags = 0xFF; |
| 82 | location.latitudeDegrees = latitudeDegrees; |
| 83 | location.longitudeDegrees = longitudeDegrees; |
| 84 | location.altitudeMeters = 500.0; |
| 85 | location.speedMetersPerSec = 0.0; |
| 86 | location.bearingDegrees = 0.0; |
| 87 | location.horizontalAccuracyMeters = horizontalAccuracyMeters; |
| 88 | location.verticalAccuracyMeters = 1000.0; |
| 89 | location.speedAccuracyMetersPerSecond = 1000.0; |
| 90 | location.bearingAccuracyDegrees = 90.0; |
| 91 | location.timestampMillis = |
| 92 | static_cast<int64_t>(kMockTimestamp + ::android::elapsedRealtimeNano() * 1e-6); |
| 93 | location.elapsedRealtime = elapsedRealtime; |
| 94 | return location; |
| 95 | } |
| 96 | |
Yu-Han Yang | 3a75dc0 | 2021-09-27 01:01:06 -0700 | [diff] [blame] | 97 | const MeasurementCorrections Utils::getMockMeasurementCorrections() { |
Yu-Han Yang | 08642f9 | 2019-03-02 14:22:14 -0800 | [diff] [blame] | 98 | ReflectingPlane reflectingPlane = { |
| 99 | .latitudeDegrees = 37.4220039, |
| 100 | .longitudeDegrees = -122.0840991, |
| 101 | .altitudeMeters = 250.35, |
| 102 | .azimuthDegrees = 203.0, |
| 103 | }; |
| 104 | |
Yu-Han Yang | 3a75dc0 | 2021-09-27 01:01:06 -0700 | [diff] [blame] | 105 | SingleSatCorrection singleSatCorrection1 = { |
Yu-Han Yang | 08642f9 | 2019-03-02 14:22:14 -0800 | [diff] [blame] | 106 | .singleSatCorrectionFlags = GnssSingleSatCorrectionFlags::HAS_SAT_IS_LOS_PROBABILITY | |
| 107 | GnssSingleSatCorrectionFlags::HAS_EXCESS_PATH_LENGTH | |
| 108 | GnssSingleSatCorrectionFlags::HAS_EXCESS_PATH_LENGTH_UNC | |
| 109 | GnssSingleSatCorrectionFlags::HAS_REFLECTING_PLANE, |
Yu-Han Yang | 3a75dc0 | 2021-09-27 01:01:06 -0700 | [diff] [blame] | 110 | .constellation = V1_0::GnssConstellationType::GPS, |
Yu-Han Yang | 08642f9 | 2019-03-02 14:22:14 -0800 | [diff] [blame] | 111 | .svid = 12, |
| 112 | .carrierFrequencyHz = 1.59975e+09, |
| 113 | .probSatIsLos = 0.50001, |
| 114 | .excessPathLengthMeters = 137.4802, |
| 115 | .excessPathLengthUncertaintyMeters = 25.5, |
| 116 | .reflectingPlane = reflectingPlane, |
| 117 | }; |
Yu-Han Yang | 3a75dc0 | 2021-09-27 01:01:06 -0700 | [diff] [blame] | 118 | SingleSatCorrection singleSatCorrection2 = { |
Yu-Han Yang | 08642f9 | 2019-03-02 14:22:14 -0800 | [diff] [blame] | 119 | .singleSatCorrectionFlags = GnssSingleSatCorrectionFlags::HAS_SAT_IS_LOS_PROBABILITY | |
| 120 | GnssSingleSatCorrectionFlags::HAS_EXCESS_PATH_LENGTH | |
| 121 | GnssSingleSatCorrectionFlags::HAS_EXCESS_PATH_LENGTH_UNC, |
Edwin Tung | bbf7fb9 | 2021-12-27 12:13:02 +0800 | [diff] [blame] | 122 | |
Yu-Han Yang | 3a75dc0 | 2021-09-27 01:01:06 -0700 | [diff] [blame] | 123 | .constellation = V1_0::GnssConstellationType::GPS, |
Yu-Han Yang | 08642f9 | 2019-03-02 14:22:14 -0800 | [diff] [blame] | 124 | .svid = 9, |
| 125 | .carrierFrequencyHz = 1.59975e+09, |
| 126 | .probSatIsLos = 0.873, |
| 127 | .excessPathLengthMeters = 26.294, |
| 128 | .excessPathLengthUncertaintyMeters = 10.0, |
| 129 | }; |
| 130 | |
Yu-Han Yang | 3a75dc0 | 2021-09-27 01:01:06 -0700 | [diff] [blame] | 131 | hidl_vec<SingleSatCorrection> singleSatCorrections = {singleSatCorrection1, |
| 132 | singleSatCorrection2}; |
| 133 | MeasurementCorrections mockCorrections = { |
Yu-Han Yang | 08642f9 | 2019-03-02 14:22:14 -0800 | [diff] [blame] | 134 | .latitudeDegrees = 37.4219999, |
| 135 | .longitudeDegrees = -122.0840575, |
| 136 | .altitudeMeters = 30.60062531, |
| 137 | .horizontalPositionUncertaintyMeters = 9.23542, |
| 138 | .verticalPositionUncertaintyMeters = 15.02341, |
| 139 | .toaGpsNanosecondsOfWeek = 2935633453L, |
| 140 | .satCorrections = singleSatCorrections, |
| 141 | }; |
| 142 | return mockCorrections; |
| 143 | } |
| 144 | |
Yu-Han Yang | 3a75dc0 | 2021-09-27 01:01:06 -0700 | [diff] [blame] | 145 | const measurement_corrections::V1_1::MeasurementCorrections |
| 146 | Utils::getMockMeasurementCorrections_1_1() { |
| 147 | MeasurementCorrections mockCorrections_1_0 = getMockMeasurementCorrections(); |
Sasha Kuznetsov | 31eea85 | 2020-01-03 13:06:38 -0800 | [diff] [blame] | 148 | |
Yu-Han Yang | 3a75dc0 | 2021-09-27 01:01:06 -0700 | [diff] [blame] | 149 | measurement_corrections::V1_1::SingleSatCorrection singleSatCorrection1 = { |
Sasha Kuznetsov | 6678ffd | 2020-02-19 11:55:26 -0800 | [diff] [blame] | 150 | .v1_0 = mockCorrections_1_0.satCorrections[0], |
Yu-Han Yang | 3a75dc0 | 2021-09-27 01:01:06 -0700 | [diff] [blame] | 151 | .constellation = V2_0::GnssConstellationType::IRNSS, |
Sasha Kuznetsov | 6678ffd | 2020-02-19 11:55:26 -0800 | [diff] [blame] | 152 | }; |
Yu-Han Yang | 3a75dc0 | 2021-09-27 01:01:06 -0700 | [diff] [blame] | 153 | measurement_corrections::V1_1::SingleSatCorrection singleSatCorrection2 = { |
Sasha Kuznetsov | 6678ffd | 2020-02-19 11:55:26 -0800 | [diff] [blame] | 154 | .v1_0 = mockCorrections_1_0.satCorrections[1], |
Yu-Han Yang | 3a75dc0 | 2021-09-27 01:01:06 -0700 | [diff] [blame] | 155 | .constellation = V2_0::GnssConstellationType::IRNSS, |
Sasha Kuznetsov | 6678ffd | 2020-02-19 11:55:26 -0800 | [diff] [blame] | 156 | }; |
| 157 | |
Yu-Han Yang | 3a75dc0 | 2021-09-27 01:01:06 -0700 | [diff] [blame] | 158 | mockCorrections_1_0.satCorrections[0].constellation = V1_0::GnssConstellationType::UNKNOWN; |
| 159 | mockCorrections_1_0.satCorrections[1].constellation = V1_0::GnssConstellationType::UNKNOWN; |
Sasha Kuznetsov | 6678ffd | 2020-02-19 11:55:26 -0800 | [diff] [blame] | 160 | |
Yu-Han Yang | 3a75dc0 | 2021-09-27 01:01:06 -0700 | [diff] [blame] | 161 | hidl_vec<measurement_corrections::V1_1::SingleSatCorrection> singleSatCorrections = { |
| 162 | singleSatCorrection1, singleSatCorrection2}; |
Sasha Kuznetsov | 6678ffd | 2020-02-19 11:55:26 -0800 | [diff] [blame] | 163 | |
Yu-Han Yang | 3a75dc0 | 2021-09-27 01:01:06 -0700 | [diff] [blame] | 164 | measurement_corrections::V1_1::MeasurementCorrections mockCorrections_1_1 = { |
Sasha Kuznetsov | 31eea85 | 2020-01-03 13:06:38 -0800 | [diff] [blame] | 165 | .v1_0 = mockCorrections_1_0, |
| 166 | .hasEnvironmentBearing = true, |
| 167 | .environmentBearingDegrees = 45.0, |
| 168 | .environmentBearingUncertaintyDegrees = 4.0, |
Sasha Kuznetsov | 6678ffd | 2020-02-19 11:55:26 -0800 | [diff] [blame] | 169 | .satCorrections = singleSatCorrections, |
Sasha Kuznetsov | 31eea85 | 2020-01-03 13:06:38 -0800 | [diff] [blame] | 170 | }; |
| 171 | return mockCorrections_1_1; |
| 172 | } |
| 173 | |
Yu-Han Yang | f5bd7c0 | 2022-03-04 13:46:52 -0800 | [diff] [blame^] | 174 | namespace { |
| 175 | const ExcessPathInfo createExcessPathInfo(float excessPathLengthMeters, |
| 176 | float excessPathLengthUncertaintyMeters, |
| 177 | const ReflectingPlaneAidl* reflectingPlane, |
| 178 | float attenuationDb) { |
| 179 | ExcessPathInfo excessPathInfo; |
| 180 | excessPathInfo.excessPathInfoFlags = |
| 181 | ExcessPathInfo::EXCESS_PATH_INFO_HAS_EXCESS_PATH_LENGTH | |
| 182 | ExcessPathInfo::EXCESS_PATH_INFO_HAS_EXCESS_PATH_LENGTH_UNC | |
| 183 | ExcessPathInfo::EXCESS_PATH_INFO_HAS_ATTENUATION | |
| 184 | (reflectingPlane == nullptr ? 0 |
| 185 | : ExcessPathInfo::EXCESS_PATH_INFO_HAS_REFLECTING_PLANE); |
| 186 | excessPathInfo.excessPathLengthMeters = excessPathLengthMeters; |
| 187 | excessPathInfo.excessPathLengthUncertaintyMeters = excessPathLengthUncertaintyMeters; |
| 188 | if (reflectingPlane != nullptr) { |
| 189 | excessPathInfo.reflectingPlane = *reflectingPlane; |
| 190 | } |
| 191 | excessPathInfo.attenuationDb = attenuationDb; |
| 192 | return excessPathInfo; |
| 193 | } |
| 194 | } // anonymous namespace |
| 195 | |
Edwin Tung | bbf7fb9 | 2021-12-27 12:13:02 +0800 | [diff] [blame] | 196 | const MeasurementCorrectionsAidl Utils::getMockMeasurementCorrections_aidl() { |
| 197 | ReflectingPlaneAidl reflectingPlane; |
| 198 | reflectingPlane.latitudeDegrees = 37.4220039; |
| 199 | reflectingPlane.longitudeDegrees = -122.0840991; |
| 200 | reflectingPlane.altitudeMeters = 250.35; |
Yu-Han Yang | f5bd7c0 | 2022-03-04 13:46:52 -0800 | [diff] [blame^] | 201 | reflectingPlane.reflectingPlaneAzimuthDegrees = 203.0; |
Edwin Tung | bbf7fb9 | 2021-12-27 12:13:02 +0800 | [diff] [blame] | 202 | |
| 203 | SingleSatCorrectionAidl singleSatCorrection1; |
| 204 | singleSatCorrection1.singleSatCorrectionFlags = |
| 205 | SingleSatCorrectionAidl::SINGLE_SAT_CORRECTION_HAS_SAT_IS_LOS_PROBABILITY | |
Yu-Han Yang | f5bd7c0 | 2022-03-04 13:46:52 -0800 | [diff] [blame^] | 206 | SingleSatCorrectionAidl::SINGLE_SAT_CORRECTION_HAS_COMBINED_EXCESS_PATH_LENGTH | |
| 207 | SingleSatCorrectionAidl::SINGLE_SAT_CORRECTION_HAS_COMBINED_EXCESS_PATH_LENGTH_UNC | |
| 208 | SingleSatCorrectionAidl::SINGLE_SAT_CORRECTION_HAS_COMBINED_ATTENUATION; |
Edwin Tung | bbf7fb9 | 2021-12-27 12:13:02 +0800 | [diff] [blame] | 209 | singleSatCorrection1.constellation = android::hardware::gnss::GnssConstellationType::GPS; |
| 210 | singleSatCorrection1.svid = 12; |
| 211 | singleSatCorrection1.carrierFrequencyHz = 1.59975e+09; |
| 212 | singleSatCorrection1.probSatIsLos = 0.50001; |
Yu-Han Yang | f5bd7c0 | 2022-03-04 13:46:52 -0800 | [diff] [blame^] | 213 | singleSatCorrection1.combinedExcessPathLengthMeters = 203.5; |
| 214 | singleSatCorrection1.combinedExcessPathLengthUncertaintyMeters = 59.1; |
| 215 | singleSatCorrection1.combinedAttenuationDb = -4.3; |
| 216 | singleSatCorrection1.excessPathInfos.push_back( |
| 217 | createExcessPathInfo(137.4, 25.5, &reflectingPlane, -3.5)); |
| 218 | singleSatCorrection1.excessPathInfos.push_back( |
| 219 | createExcessPathInfo(296.3, 87.2, &reflectingPlane, -5.1)); |
Edwin Tung | bbf7fb9 | 2021-12-27 12:13:02 +0800 | [diff] [blame] | 220 | |
| 221 | SingleSatCorrectionAidl singleSatCorrection2; |
| 222 | singleSatCorrection2.singleSatCorrectionFlags = |
| 223 | SingleSatCorrectionAidl::SINGLE_SAT_CORRECTION_HAS_SAT_IS_LOS_PROBABILITY | |
Yu-Han Yang | f5bd7c0 | 2022-03-04 13:46:52 -0800 | [diff] [blame^] | 224 | SingleSatCorrectionAidl::SINGLE_SAT_CORRECTION_HAS_COMBINED_EXCESS_PATH_LENGTH | |
| 225 | SingleSatCorrectionAidl::SINGLE_SAT_CORRECTION_HAS_COMBINED_EXCESS_PATH_LENGTH_UNC | |
| 226 | SingleSatCorrectionAidl::SINGLE_SAT_CORRECTION_HAS_COMBINED_ATTENUATION; |
Edwin Tung | bbf7fb9 | 2021-12-27 12:13:02 +0800 | [diff] [blame] | 227 | singleSatCorrection2.constellation = GnssConstellationType::GPS; |
| 228 | singleSatCorrection2.svid = 9; |
| 229 | singleSatCorrection2.carrierFrequencyHz = 1.59975e+09; |
| 230 | singleSatCorrection2.probSatIsLos = 0.873; |
Yu-Han Yang | f5bd7c0 | 2022-03-04 13:46:52 -0800 | [diff] [blame^] | 231 | singleSatCorrection2.combinedExcessPathLengthMeters = 26.294; |
| 232 | singleSatCorrection2.combinedExcessPathLengthUncertaintyMeters = 10.0; |
| 233 | singleSatCorrection2.combinedAttenuationDb = -0.5; |
| 234 | singleSatCorrection2.excessPathInfos.push_back( |
| 235 | createExcessPathInfo(26.294, 10.0, nullptr, -0.5)); |
Edwin Tung | bbf7fb9 | 2021-12-27 12:13:02 +0800 | [diff] [blame] | 236 | |
| 237 | std::vector<SingleSatCorrectionAidl> singleSatCorrections = {singleSatCorrection1, |
| 238 | singleSatCorrection2}; |
| 239 | MeasurementCorrectionsAidl mockCorrections; |
| 240 | mockCorrections.latitudeDegrees = 37.4219999; |
| 241 | mockCorrections.longitudeDegrees = -122.0840575; |
| 242 | mockCorrections.altitudeMeters = 30.60062531; |
| 243 | mockCorrections.horizontalPositionUncertaintyMeters = 9.23542; |
| 244 | mockCorrections.verticalPositionUncertaintyMeters = 15.02341; |
| 245 | mockCorrections.toaGpsNanosecondsOfWeek = 2935633453L; |
| 246 | mockCorrections.hasEnvironmentBearing = true; |
| 247 | mockCorrections.environmentBearingDegrees = 45.0; |
| 248 | mockCorrections.environmentBearingUncertaintyDegrees = 4.0; |
| 249 | mockCorrections.satCorrections = singleSatCorrections; |
| 250 | |
| 251 | return mockCorrections; |
| 252 | } |
| 253 | |
Yu-Han Yang | 4e5ffc2 | 2020-04-17 15:44:59 -0700 | [diff] [blame] | 254 | /* |
| 255 | * MapConstellationType: |
| 256 | * Given a GnssConstellationType_2_0 type constellation, maps to its equivalent |
| 257 | * GnssConstellationType_1_0 type constellation. For constellations that do not have |
| 258 | * an equivalent value, maps to GnssConstellationType_1_0::UNKNOWN |
| 259 | */ |
Yu-Han Yang | 3a75dc0 | 2021-09-27 01:01:06 -0700 | [diff] [blame] | 260 | V1_0::GnssConstellationType Utils::mapConstellationType(V2_0::GnssConstellationType constellation) { |
Yu-Han Yang | 4e5ffc2 | 2020-04-17 15:44:59 -0700 | [diff] [blame] | 261 | switch (constellation) { |
Yu-Han Yang | 3a75dc0 | 2021-09-27 01:01:06 -0700 | [diff] [blame] | 262 | case V2_0::GnssConstellationType::GPS: |
| 263 | return V1_0::GnssConstellationType::GPS; |
| 264 | case V2_0::GnssConstellationType::SBAS: |
| 265 | return V1_0::GnssConstellationType::SBAS; |
| 266 | case V2_0::GnssConstellationType::GLONASS: |
| 267 | return V1_0::GnssConstellationType::GLONASS; |
| 268 | case V2_0::GnssConstellationType::QZSS: |
| 269 | return V1_0::GnssConstellationType::QZSS; |
| 270 | case V2_0::GnssConstellationType::BEIDOU: |
| 271 | return V1_0::GnssConstellationType::BEIDOU; |
| 272 | case V2_0::GnssConstellationType::GALILEO: |
| 273 | return V1_0::GnssConstellationType::GALILEO; |
Yu-Han Yang | 4e5ffc2 | 2020-04-17 15:44:59 -0700 | [diff] [blame] | 274 | default: |
Yu-Han Yang | 3a75dc0 | 2021-09-27 01:01:06 -0700 | [diff] [blame] | 275 | return V1_0::GnssConstellationType::UNKNOWN; |
Yu-Han Yang | 4e5ffc2 | 2020-04-17 15:44:59 -0700 | [diff] [blame] | 276 | } |
| 277 | } |
| 278 | |
Tyler Trephan | 0d9206a | 2020-09-28 22:03:18 -0700 | [diff] [blame] | 279 | bool Utils::isAutomotiveDevice() { |
| 280 | char buffer[PROPERTY_VALUE_MAX] = {0}; |
| 281 | property_get("ro.hardware.type", buffer, ""); |
| 282 | return strncmp(buffer, "automotive", PROPERTY_VALUE_MAX) == 0; |
| 283 | } |
| 284 | |
Yu-Han Yang | a509861 | 2019-02-08 16:22:07 -0800 | [diff] [blame] | 285 | } // namespace common |
| 286 | } // namespace gnss |
| 287 | } // namespace hardware |
| 288 | } // namespace android |