1 /* 2 * Copyright (C) 2022 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 androidx.core.uwb.backend.impl.internal; 18 19 import androidx.annotation.IntDef; 20 21 /** Measurement providing the value and confidence of the ranging. */ 22 public class RangingMeasurement { 23 24 @Confidence private final int mConfidence; 25 private final float mValue; 26 private final boolean mValid; 27 RangingMeasurement(@onfidence int confidence, float value, boolean valid)28 public RangingMeasurement(@Confidence int confidence, float value, boolean valid) { 29 this.mConfidence = confidence; 30 this.mValue = value; 31 mValid = valid; 32 } 33 34 /** Gets Confidence of this measurement. */ 35 @Confidence getConfidence()36 public int getConfidence() { 37 return mConfidence; 38 } 39 40 /** Gets value of this measurement. */ getValue()41 public float getValue() { 42 return mValue; 43 } 44 45 /** Gets validity of this measurement. */ isValid()46 public boolean isValid() { 47 return mValid; 48 } 49 50 /** Possible confidence values for a {@link RangingMeasurement}. */ 51 @IntDef({CONFIDENCE_LOW, CONFIDENCE_MEDIUM, CONFIDENCE_HIGH}) 52 public @interface Confidence {} 53 54 public static final int CONFIDENCE_LOW = 0; 55 public static final int CONFIDENCE_MEDIUM = 1; 56 public static final int CONFIDENCE_HIGH = 2; 57 } 58