1 /*
2  * Copyright (C) 2021 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.server.uwb.config;
18 
19 import android.hardware.uwb.fira_android.UwbVendorCapabilityTlvTypes;
20 import android.hardware.uwb.fira_android.UwbVendorCapabilityTlvValues;
21 
22 public class CapabilityParam {
23     /**
24      * CR 287 params Fira Version 1.0
25      */
26     public static final int SUPPORTED_FIRA_PHY_VERSION_RANGE_VER_1_0 = 0x0;
27     public static final int SUPPORTED_FIRA_MAC_VERSION_RANGE_VER_1_0 = 0x1;
28     public static final int SUPPORTED_DEVICE_ROLES_VER_1_0 = 0x2;
29     public static final int SUPPORTED_RANGING_METHOD_VER_1_0 = 0x3;
30     public static final int SUPPORTED_STS_CONFIG_VER_1_0 = 0x4;
31     public static final int SUPPORTED_MULTI_NODE_MODES_VER_1_0 = 0x5;
32     public static final int SUPPORTED_RANGING_TIME_STRUCT_VER_1_0 = 0x6;
33     public static final int SUPPORTED_SCHEDULED_MODE_VER_1_0 = 0x7;
34     public static final int SUPPORTED_HOPPING_MODE_VER_1_0 = 0x8;
35     public static final int SUPPORTED_BLOCK_STRIDING_VER_1_0 = 0x9;
36     public static final int SUPPORTED_UWB_INITIATION_TIME_VER_1_0 = 0x0A;
37     public static final int SUPPORTED_CHANNELS_VER_1_0 = 0x0B;
38     public static final int SUPPORTED_RFRAME_CONFIG_VER_1_0 = 0x0C;
39     public static final int SUPPORTED_CC_CONSTRAINT_LENGTH_VER_1_0 = 0x0D;
40     public static final int SUPPORTED_BPRF_PARAMETER_SETS_VER_1_0 = 0x0E;
41     public static final int SUPPORTED_HPRF_PARAMETER_SETS_VER_1_0 = 0x0F;
42     public static final int SUPPORTED_AOA_VER_1_0 = 0x10;
43     public static final int SUPPORTED_EXTENDED_MAC_ADDRESS_VER_1_0 = 0x11;
44     public static final int SUPPORTED_MAX_MESSAGE_SIZE_VER_1_0 = 0x12;
45     public static final int SUPPORTED_MAX_DATA_PACKET_PAYLOAD_SIZE_VER_1_0 = 0x13;
46 
47     /**
48      * CR 287 params Fira Version 2.0
49      */
50     public static final int SUPPORTED_MAX_MESSAGE_SIZE_VER_2_0 = 0x0;
51     public static final int SUPPORTED_MAX_DATA_PACKET_PAYLOAD_SIZE_VER_2_0  = 0x1;
52     public static final int SUPPORTED_FIRA_PHY_VERSION_RANGE_VER_2_0  = 0x2;
53     public static final int SUPPORTED_FIRA_MAC_VERSION_RANGE_VER_2_0  = 0x3;
54     public static final int SUPPORTED_DEVICE_TYPE_VER_2_0  = 0x4;
55     public static final int SUPPORTED_DEVICE_ROLES_VER_2_0  = 0x5;
56     public static final int SUPPORTED_RANGING_METHOD_VER_2_0  = 0x6;
57     public static final int SUPPORTED_STS_CONFIG_VER_2_0  = 0x7;
58     public static final int SUPPORTED_MULTI_NODE_MODES_VER_2_0  = 0x8;
59     public static final int SUPPORTED_RANGING_TIME_STRUCT_VER_2_0  = 0x9;
60     public static final int SUPPORTED_SCHEDULED_MODE_VER_2_0  = 0x0A;
61     public static final int SUPPORTED_HOPPING_MODE_VER_2_0  = 0x0B;
62     public static final int SUPPORTED_BLOCK_STRIDING_VER_2_0  = 0x0C;
63     public static final int SUPPORTED_UWB_INITIATION_TIME_VER_2_0  = 0x0D;
64     public static final int SUPPORTED_CHANNELS_VER_2_0  = 0x0E;
65     public static final int SUPPORTED_RFRAME_CONFIG_VER_2_0  = 0x0F;
66     public static final int SUPPORTED_CC_CONSTRAINT_LENGTH_VER_2_0  = 0x10;
67     public static final int SUPPORTED_BPRF_PARAMETER_SETS_VER_2_0  = 0x11;
68     public static final int SUPPORTED_HPRF_PARAMETER_SETS_VER_2_0  = 0x12;
69     public static final int SUPPORTED_AOA_VER_2_0  = 0x13;
70     public static final int SUPPORTED_EXTENDED_MAC_ADDRESS_VER_2_0  = 0x14;
71     public static final int SUPPORTED_SUSPEND_RANGING_VER_2_0  = 0x15;
72     public static final int SUPPORTED_SESSION_KEY_LENGTH_VER_2_0  = 0x16;
73     public static final int SUPPORTED_DT_TAG_MAX_ACTIVE_RR_2_0 = 0x18;
74     public static final int SUPPORTED_DT_TAG_BLOCK_SKIPPING_2_0 = 0x19;
75     public static final int SUPPORTED_PSDU_LENGTH_2_0 = 0x1A;
76 
77     /**
78      * CR 287 params common across versions
79      */
80     public static final int SUPPORTED_AOA_RESULT_REQ_INTERLEAVING =
81             UwbVendorCapabilityTlvTypes.SUPPORTED_AOA_RESULT_REQ_ANTENNA_INTERLEAVING;
82     public static final int SUPPORTED_MIN_RANGING_INTERVAL_MS =
83             UwbVendorCapabilityTlvTypes.SUPPORTED_MIN_RANGING_INTERVAL_MS;
84     public static final int SUPPORTED_RANGE_DATA_NTF_CONFIG =
85             UwbVendorCapabilityTlvTypes.SUPPORTED_RANGE_DATA_NTF_CONFIG;
86     public static final int SUPPORTED_RSSI_REPORTING =
87             UwbVendorCapabilityTlvTypes.SUPPORTED_RSSI_REPORTING;
88     public static final int SUPPORTED_DIAGNOSTICS =
89             UwbVendorCapabilityTlvTypes.SUPPORTED_DIAGNOSTICS;
90     public static final int SUPPORTED_MIN_SLOT_DURATION_RSTU =
91             UwbVendorCapabilityTlvTypes.SUPPORTED_MIN_SLOT_DURATION_RSTU;
92     public static final int SUPPORTED_MAX_RANGING_SESSION_NUMBER =
93             UwbVendorCapabilityTlvTypes.SUPPORTED_MAX_RANGING_SESSION_NUMBER;
94 
95     // CCC specific
96     public static final int CCC_SUPPORTED_VERSIONS =
97             UwbVendorCapabilityTlvTypes.CCC_SUPPORTED_VERSIONS;
98     public static final int CCC_SUPPORTED_UWB_CONFIGS =
99             UwbVendorCapabilityTlvTypes.CCC_SUPPORTED_UWB_CONFIGS;
100     public static final int CCC_SUPPORTED_PULSE_SHAPE_COMBOS =
101             UwbVendorCapabilityTlvTypes.CCC_SUPPORTED_PULSE_SHAPE_COMBOS;
102     public static final int CCC_SUPPORTED_RAN_MULTIPLIER =
103             UwbVendorCapabilityTlvTypes.CCC_SUPPORTED_RAN_MULTIPLIER;
104     public static final int CCC_SUPPORTED_MAX_RANGING_SESSION_NUMBER =
105             UwbVendorCapabilityTlvTypes.CCC_SUPPORTED_MAX_RANGING_SESSION_NUMBER;
106     public static final int CCC_SUPPORTED_CHAPS_PER_SLOT =
107             UwbVendorCapabilityTlvTypes.CCC_SUPPORTED_CHAPS_PER_SLOT;
108     public static final int CCC_SUPPORTED_SYNC_CODES =
109             UwbVendorCapabilityTlvTypes.CCC_SUPPORTED_SYNC_CODES;
110     public static final int CCC_SUPPORTED_CHANNELS =
111             UwbVendorCapabilityTlvTypes.CCC_SUPPORTED_CHANNELS;
112     public static final int CCC_SUPPORTED_HOPPING_CONFIG_MODES_AND_SEQUENCES =
113             UwbVendorCapabilityTlvTypes.CCC_SUPPORTED_HOPPING_CONFIG_MODES_AND_SEQUENCES;
114     public static final int CCC_SUPPORTED_MIN_UWB_INITIATION_TIME_MS =
115             UwbVendorCapabilityTlvTypes.CCC_SUPPORTED_MIN_UWB_INITIATION_TIME_MS;
116     public static final int CCC_PRIORITIZED_CHANNEL_LIST =
117             UwbVendorCapabilityTlvTypes.CCC_PRIORITIZED_CHANNEL_LIST;
118     public static final int CCC_SUPPORTED_UWBS_MAX_PPM =
119             UwbVendorCapabilityTlvTypes.CCC_SUPPORTED_UWBS_MAX_PPM;
120 
121     public static final int RESPONDER = 0x01;
122     public static final int INITIATOR = 0x02;
123     public static final int UT_SYNCHRONIZATION_ANCHOR = 0X04;
124     public static final int UT_ANCHOR = 0X08;
125     public static final int UT_TAG = 0X10;
126     public static final int ADVERTISER = 0X20;
127     public static final int OBSERVER = 0X40;
128     public static final int DT_ANCHOR = 0X80;
129     public static final int DT_TAG = 0X01; // First bit of 2nd byte of Device Role
130 
131     public static final int OWR_UL_TDOA = 0x01;
132     public static final int SS_TWR_DEFERRED = 0x02;
133     public static final int DS_TWR_DEFERRED = 0x04;
134     public static final int SS_TWR_NON_DEFERRED = 0x08;
135     public static final int DS_TWR_NON_DEFERRED = 0x10;
136     public static final int OWR_DL_TDOA = 0x20;
137     public static final int OWR_AOA = 0x40;
138     public static final int ESS_TWR_NON_DEFERRED = 0x80;
139     public static final int ADS_TWR = 0x01; // First bit of 2nd byte of Ranging Method
140 
141     public static final int STATIC_STS = 0x1;
142     public static final int DYNAMIC_STS = 0x2;
143     public static final int DYNAMIC_STS_RESPONDER_SPECIFIC_SUBSESSION_KEY = 0x4;
144     public static final int PROVISIONED_STS = 0x8;
145     public static final int PROVISIONED_STS_RESPONDER_SPECIFIC_SUBSESSION_KEY = 0x10;
146 
147     public static final int UNICAST = 0x1;
148     public static final int ONE_TO_MANY = 0x2;
149     public static final int MANY_TO_MANY = 0x4;
150 
151     public static final int INTERVAL_BASED_SCHEDULING = 0x1;
152     public static final int BLOCK_BASED_SCHEDULING = 0x2;
153 
154     public static final int CONTENTION_BASED_RANGING = 0x1;
155     public static final int TIME_SCHEDULED_RANGING = 0x2;
156 
157     public static final int CONSTRAINT_LENGTH_3 = 0x1;
158     public static final int CONSTRAINT_LENGTH_7 = 0x2;
159 
160     public static final int NO_BLOCK_STRIDING = 0x0;
161     public static final int BLOCK_STRIDING = 0x1;
162 
163     public static final int NO_HOPPING_MODE = 0x0;
164     public static final int HOPPING_MODE = 0x1;
165 
166     public static final int NO_EXTENDED_MAC_ADDRESS = 0x0;
167     public static final int EXTENDED_MAC_ADDRESS = 0x1;
168 
169     public static final int NO_UWB_INITIATION_TIME = 0x0;
170     public static final int UWB_INITIATION_TIME = 0x1;
171 
172     public static final int CHANNEL_5 = 0x1;
173     public static final int CHANNEL_6 = 0x2;
174     public static final int CHANNEL_8 = 0x4;
175     public static final int CHANNEL_9 = 0x8;
176     public static final int CHANNEL_10 = 0x10;
177     public static final int CHANNEL_12 = 0x20;
178     public static final int CHANNEL_13 = 0x40;
179     public static final int CHANNEL_14 = 0x80;
180 
181     public static final int SP0 = 0x1;
182     public static final int SP1 = 0x2;
183     public static final int SP2 = 0x4;
184     public static final int SP3 = 0x8;
185 
186     public static final int CC_CONSTRAINT_LENGTH_K3 = 0x1;
187     public static final int CC_CONSTRAINT_LENGTH_K7 = 0x2;
188 
189     public static final int AOA_AZIMUTH_90 = 0x1;
190     public static final int AOA_AZIMUTH_180 = 0x2;
191     public static final int AOA_ELEVATION = 0x4;
192     public static final int AOA_FOM = 0x8;
193 
194     public static final int NO_EXTENDED_MAC = 0x0;
195     public static final int EXTENDED_MAC = 0x1;
196 
197     public static final int NO_AOA_RESULT_REQ_INTERLEAVING = 0x0;
198     public static final int AOA_RESULT_REQ_INTERLEAVING = 0x1;
199 
200     public static final int NO_RSSI_REPORTING = 0x0;
201     public static final int RSSI_REPORTING = 0x1;
202 
203     public static final int NO_DIAGNOSTICS = 0x0;
204     public static final int DIAGNOSTICS = 0x1;
205 
206     public static final int NO_DT_TAG_BLOCK_SKIPPING = 0x0;
207     public static final int DT_TAG_BLOCK_SKIPPING = 0x1;
208 
209     public static final int NO_PSDU_LENGTH_SUPPORT = 0x0;
210     public static final int PSDU_LENGTH_SUPPORT = 0x1;
211 
212     public static final int CCC_CHANNEL_5 = (int) UwbVendorCapabilityTlvValues.CCC_CHANNEL_5;
213     public static final int CCC_CHANNEL_9 = (int) UwbVendorCapabilityTlvValues.CCC_CHANNEL_9;
214 
215     public static final int CCC_CHAPS_PER_SLOT_3 =
216             (int) UwbVendorCapabilityTlvValues.CHAPS_PER_SLOT_3;
217     public static final int CCC_CHAPS_PER_SLOT_4 =
218             (int) UwbVendorCapabilityTlvValues.CHAPS_PER_SLOT_4;
219     public static final int CCC_CHAPS_PER_SLOT_6 =
220             (int) UwbVendorCapabilityTlvValues.CHAPS_PER_SLOT_6;
221     public static final int CCC_CHAPS_PER_SLOT_8 =
222             (int) UwbVendorCapabilityTlvValues.CHAPS_PER_SLOT_8;
223     public static final int CCC_CHAPS_PER_SLOT_9 =
224             (int) UwbVendorCapabilityTlvValues.CHAPS_PER_SLOT_9;
225     public static final int CCC_CHAPS_PER_SLOT_12 =
226             (int) UwbVendorCapabilityTlvValues.CHAPS_PER_SLOT_12;
227     public static final int CCC_CHAPS_PER_SLOT_24 =
228             (int) UwbVendorCapabilityTlvValues.CHAPS_PER_SLOT_24;
229 
230     public static final int CCC_HOPPING_CONFIG_MODE_NONE =
231             (int) UwbVendorCapabilityTlvValues.HOPPING_CONFIG_MODE_NONE;
232     public static final int CCC_HOPPING_CONFIG_MODE_CONTINUOUS =
233             (int) UwbVendorCapabilityTlvValues.HOPPING_CONFIG_MODE_CONTINUOUS;
234     public static final int CCC_HOPPING_CONFIG_MODE_ADAPTIVE =
235             (int) UwbVendorCapabilityTlvValues.HOPPING_CONFIG_MODE_ADAPTIVE;
236 
237     public static final int CCC_HOPPING_SEQUENCE_AES =
238             (int) UwbVendorCapabilityTlvValues.HOPPING_SEQUENCE_AES;
239     public static final int CCC_HOPPING_SEQUENCE_DEFAULT =
240             (int) UwbVendorCapabilityTlvValues.HOPPING_SEQUENCE_DEFAULT;
241 
242     public static final int SUPPORTED_POWER_STATS_QUERY =
243             UwbVendorCapabilityTlvTypes.SUPPORTED_POWER_STATS_QUERY;
244 
245     public static final int RANGE_DATA_NTF_CONFIG_ENABLE = 1 << 0;
246     public static final int RANGE_DATA_NTF_CONFIG_DISABLE = 1 << 1;
247     public static final int RANGE_DATA_NTF_CONFIG_ENABLE_PROXIMITY_LEVEL_TRIG = 1 << 2;
248     public static final int RANGE_DATA_NTF_CONFIG_ENABLE_AOA_LEVEL_TRIG = 1 << 3;
249     public static final int RANGE_DATA_NTF_CONFIG_ENABLE_PROXIMITY_AOA_LEVEL_TRIG = 1 << 4;
250     public static final int RANGE_DATA_NTF_CONFIG_ENABLE_PROXIMITY_EDGE_TRIG = 1 << 5;
251     public static final int RANGE_DATA_NTF_CONFIG_ENABLE_AOA_EDGE_TRIG = 1 << 6;
252     public static final int RANGE_DATA_NTF_CONFIG_ENABLE_PROXIMITY_AOA_EDGE_TRIG = 1 << 7;
253 
254     // Radar specific
255     public static final int RADAR_SUPPORT = (int) UwbVendorCapabilityTlvTypes.RADAR_SUPPORT;
256     public static final int RADAR_SWEEP_SAMPLES_SUPPORTED =
257             (int) UwbVendorCapabilityTlvValues.RADAR_SWEEP_SAMPLES_SUPPORTED;
258 }
259