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.ranging.generic.ranging; 18 19 import com.android.ranging.generic.RangingTechnology; 20 21 import com.google.auto.value.AutoValue; 22 23 /** Ranging Data class contains data received from a ranging technology such as UWB or CS. */ 24 @AutoValue 25 public abstract class RangingData { 26 27 /** Returns the ranging technology this data is for. */ getRangingTechnology()28 public abstract RangingTechnology getRangingTechnology(); 29 30 /** Returns range distance in meters. */ getRangeDistance()31 public abstract double getRangeDistance(); 32 33 /** Returns rssi. */ getRssi()34 public abstract int getRssi(); 35 36 /** Returns timestamp in nanons. */ getTimestamp()37 public abstract long getTimestamp(); 38 39 /** Returns a builder for {@link RangingData}. */ builder()40 public static Builder builder() { 41 return new AutoValue_RangingData.Builder(); 42 } 43 44 /** Builder for {@link RangingData}. */ 45 @AutoValue.Builder 46 public abstract static class Builder { setRangingTechnology(RangingTechnology rangingTechnology)47 public abstract Builder setRangingTechnology(RangingTechnology rangingTechnology); 48 setRangeDistance(double rangeDistance)49 public abstract Builder setRangeDistance(double rangeDistance); 50 setRssi(int rssi)51 public abstract Builder setRssi(int rssi); 52 setTimestamp(long timestamp)53 public abstract Builder setTimestamp(long timestamp); 54 build()55 public abstract RangingData build(); 56 } 57 } 58