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 #define LOG_TAG "GnssMeasurementCorrections" 18 19 #include "GnssMeasurementCorrections.h" 20 #include <log/log.h> 21 22 namespace android { 23 namespace hardware { 24 namespace gnss { 25 namespace measurement_corrections { 26 namespace V1_0 { 27 namespace implementation { 28 29 // Methods from V1_0::IMeasurementCorrections follow. 30 Return<bool> GnssMeasurementCorrections::setCorrections(const MeasurementCorrections& corrections) { 31 ALOGD("setCorrections"); 32 ALOGD("corrections = lat: %f, lng: %f, alt: %f, hUnc: %f, vUnc: %f, toa: %llu, " 33 "satCorrections.size: %d", 34 corrections.latitudeDegrees, corrections.longitudeDegrees, corrections.altitudeMeters, 35 corrections.horizontalPositionUncertaintyMeters, 36 corrections.verticalPositionUncertaintyMeters, 37 static_cast<unsigned long long>(corrections.toaGpsNanosecondsOfWeek), 38 static_cast<int>(corrections.satCorrections.size())); 39 for (auto singleSatCorrection : corrections.satCorrections) { 40 ALOGD("singleSatCorrection = flags: %d, constellation: %d, svid: %d, cfHz: %f, probLos: %f," 41 " epl: %f, eplUnc: %f", 42 static_cast<int>(singleSatCorrection.singleSatCorrectionFlags), 43 static_cast<int>(singleSatCorrection.constellation), 44 static_cast<int>(singleSatCorrection.svid), singleSatCorrection.carrierFrequencyHz, 45 singleSatCorrection.probSatIsLos, singleSatCorrection.excessPathLengthMeters, 46 singleSatCorrection.excessPathLengthUncertaintyMeters); 47 ALOGD("reflecting plane = lat: %f, lng: %f, alt: %f, azm: %f", 48 singleSatCorrection.reflectingPlane.latitudeDegrees, 49 singleSatCorrection.reflectingPlane.longitudeDegrees, 50 singleSatCorrection.reflectingPlane.altitudeMeters, 51 singleSatCorrection.reflectingPlane.azimuthDegrees); 52 } 53 54 return true; 55 } 56 57 Return<bool> GnssMeasurementCorrections::setCallback( 58 const sp<V1_0::IMeasurementCorrectionsCallback>& callback) { 59 using Capabilities = V1_0::IMeasurementCorrectionsCallback::Capabilities; 60 auto ret = 61 callback->setCapabilitiesCb(Capabilities::LOS_SATS | Capabilities::EXCESS_PATH_LENGTH | 62 Capabilities::REFLECTING_PLANE); 63 if (!ret.isOk()) { 64 ALOGE("%s: Unable to invoke callback", __func__); 65 return false; 66 } 67 return true; 68 } 69 70 } // namespace implementation 71 } // namespace V1_0 72 } // namespace measurement_corrections 73 } // namespace gnss 74 } // namespace hardware 75 } // namespace android 76