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.NonNull;
20 
21 import com.google.common.collect.ImmutableList;
22 
23 import java.util.List;
24 
25 /** Ranging parameters that exposed through public API. */
26 public class RangingParameters {
27     @Utils.UwbConfigId
28     private final int mUwbConfigId;
29     private final int mSessionId;
30     private final int mSubSessionId;
31     private final byte[] mSessionKeyInfo;
32     private final byte[] mSubSessionKeyInfo;
33     private final UwbComplexChannel mComplexChannel;
34     private final ImmutableList<UwbAddress> mPeerAddresses;
35     @Utils.RangingUpdateRate
36     private final int mRangingUpdateRate;
37     @NonNull
38     private final UwbRangeDataNtfConfig mUwbRangeDataNtfConfig;
39     @Utils.SlotDuration
40     private final int mSlotDuration;
41     private final boolean mIsAoaDisabled;
42 
RangingParameters( @tils.UwbConfigId int uwbConfigId, int sessionId, int subSessionId, byte[] sessionKeyInfo, byte[] subSessionKeyInfo, UwbComplexChannel complexChannel, List<UwbAddress> peerAddresses, @Utils.RangingUpdateRate int rangingUpdateRate, @NonNull UwbRangeDataNtfConfig uwbRangeDataNtfConfig, @Utils.SlotDuration int slotDuration, boolean isAoaDisabled)43     public RangingParameters(
44             @Utils.UwbConfigId int uwbConfigId,
45             int sessionId,
46             int subSessionId,
47             byte[] sessionKeyInfo,
48             byte[] subSessionKeyInfo,
49             UwbComplexChannel complexChannel,
50             List<UwbAddress> peerAddresses,
51             @Utils.RangingUpdateRate int rangingUpdateRate,
52             @NonNull UwbRangeDataNtfConfig uwbRangeDataNtfConfig,
53             @Utils.SlotDuration int slotDuration,
54             boolean isAoaDisabled) {
55         mUwbConfigId = uwbConfigId;
56         mSessionId = sessionId;
57         mSubSessionId = subSessionId;
58         mSessionKeyInfo = sessionKeyInfo;
59         mSubSessionKeyInfo = subSessionKeyInfo;
60         mComplexChannel = complexChannel;
61         mPeerAddresses = ImmutableList.copyOf(peerAddresses);
62         mRangingUpdateRate = rangingUpdateRate;
63         mUwbRangeDataNtfConfig = uwbRangeDataNtfConfig;
64         mSlotDuration = slotDuration;
65         mIsAoaDisabled = isAoaDisabled;
66     }
67 
getSessionId()68     public int getSessionId() {
69         return mSessionId;
70     }
71 
getSubSessionId()72     public int getSubSessionId() {
73         return mSubSessionId;
74     }
75 
76     @Utils.UwbConfigId
getUwbConfigId()77     public int getUwbConfigId() {
78         return mUwbConfigId;
79     }
80 
getSessionKeyInfo()81     public byte[] getSessionKeyInfo() {
82         return mSessionKeyInfo;
83     }
84 
getSubSessionKeyInfo()85     public byte[] getSubSessionKeyInfo() {
86         return mSubSessionKeyInfo;
87     }
88 
getComplexChannel()89     public UwbComplexChannel getComplexChannel() {
90         return mComplexChannel;
91     }
92 
getPeerAddresses()93     public ImmutableList<UwbAddress> getPeerAddresses() {
94         return mPeerAddresses;
95     }
96 
getRangingUpdateRate()97     public int getRangingUpdateRate() {
98         return mRangingUpdateRate;
99     }
100 
getUwbRangeDataNtfConfig()101     public UwbRangeDataNtfConfig getUwbRangeDataNtfConfig() {
102         return mUwbRangeDataNtfConfig;
103     }
104 
105     @Utils.SlotDuration
getSlotDuration()106     public int getSlotDuration() {
107         return mSlotDuration;
108     }
109 
isAoaDisabled()110     public boolean isAoaDisabled() {
111         return mIsAoaDisabled;
112     }
113 }
114