1 /* 2 * Copyright (C) 2024 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 package com.android.sensor; 18 19 /** 20 * Estimate of range and bearing returned by Finder. This is in 1:1 correspondence with 21 * location.bluemoon.Estimate proto. This class is usually populated from the native side. 22 */ 23 public class Estimate { 24 25 private Status status; 26 27 private double rangeM; 28 29 private double rangeErrorStdDevM; 30 31 // The bearing is with respect to the device Y-axis, positive ccw. 32 private double bearingRad; 33 34 private double bearingErrorStdDevRad; 35 36 private double estimatedBeaconPositionErrorStdDevM; 37 38 private long timestampNanos; 39 40 /** Create an "empty" estimate. */ Estimate()41 public Estimate() { 42 status = Status.UNKNOWN_ERROR; 43 rangeM = 0.0; 44 rangeErrorStdDevM = 0.0; 45 bearingRad = 0.0; 46 bearingErrorStdDevRad = 0.0; 47 estimatedBeaconPositionErrorStdDevM = 0.0; 48 timestampNanos = 0; 49 } 50 setStatus(Status status)51 public void setStatus(Status status) { 52 this.status = status; 53 } 54 setRangeM(double rangeM)55 public void setRangeM(double rangeM) { 56 this.rangeM = rangeM; 57 } 58 setRangeErrorStdDevM(double rangeErrorStdDevM)59 public void setRangeErrorStdDevM(double rangeErrorStdDevM) { 60 this.rangeErrorStdDevM = rangeErrorStdDevM; 61 } 62 setBearingRad(double bearingRad)63 public void setBearingRad(double bearingRad) { 64 this.bearingRad = bearingRad; 65 } 66 setBearingErrorStdDevRad(double bearingErrorStdDevRad)67 public void setBearingErrorStdDevRad(double bearingErrorStdDevRad) { 68 this.bearingErrorStdDevRad = bearingErrorStdDevRad; 69 } 70 setEstimatedBeaconPositionErrorStdDevM(double estimatedBeaconPositionErrorStdDevM)71 public void setEstimatedBeaconPositionErrorStdDevM(double estimatedBeaconPositionErrorStdDevM) { 72 this.estimatedBeaconPositionErrorStdDevM = estimatedBeaconPositionErrorStdDevM; 73 } 74 setTimestampNanos(long timestampNanos)75 public void setTimestampNanos(long timestampNanos) { 76 this.timestampNanos = timestampNanos; 77 } 78 getStatus()79 public Status getStatus() { 80 return status; 81 } 82 getRangeM()83 public double getRangeM() { 84 return rangeM; 85 } 86 getRangeErrorStdDevM()87 public double getRangeErrorStdDevM() { 88 return rangeErrorStdDevM; 89 } 90 91 /** The bearing is with respect to the device Y-axis, positive ccw. */ getBearingRad()92 public double getBearingRad() { 93 return bearingRad; 94 } 95 getBearingErrorStdDevRad()96 public double getBearingErrorStdDevRad() { 97 return bearingErrorStdDevRad; 98 } 99 getEstimatedBeaconPositionErrorStdDevM()100 public double getEstimatedBeaconPositionErrorStdDevM() { 101 return estimatedBeaconPositionErrorStdDevM; 102 } 103 getTimestampNanos()104 public long getTimestampNanos() { 105 return timestampNanos; 106 } 107 }