xref: /aosp_15_r20/external/uwb/src/rust/uwb_uci_packets/uci_packets.pdl (revision e0df40009cb5d71e642272d38ba1bb7ffccfce41)
1little_endian_packets
2
3enum PacketBoundaryFlag : 1 {
4    COMPLETE = 0x00,
5    NOT_COMPLETE = 0x01,
6}
7
8enum GroupId : 4 {
9    CORE = 0x00,
10    SESSION_CONFIG = 0x01,
11    SESSION_CONTROL = 0x02,
12    DATA_CONTROL = 0x03,
13    TEST = 0x0d,
14    VENDOR_RESERVED_9 = 0x09,
15    VENDOR_RESERVED_A = 0x0a,
16    VENDOR_RESERVED_B = 0x0b,
17    VENDOR_ANDROID    = 0x0c,
18    VENDOR_RESERVED_E = 0x0e,
19    VENDOR_RESERVED_F = 0x0f,
20}
21
22enum DataPacketFormat: 4 {
23    DATA_SND = 0x01,
24    DATA_RCV = 0x02,
25    RADAR_DATA_MESSAGE = 0x0f,
26}
27
28// Define a merged enum across GroupId & DataPacketFormat as they are at the same bits in
29// |UciPacketHal|.
30enum GroupIdOrDataPacketFormat : 4 {
31    CORE = 0x00,
32    SESSION_CONFIG_OR_DATA_SND = 0x01,
33    SESSION_CONTROL_OR_DATA_RCV = 0x02,
34    DATA_CONTROL = 0x03,
35    TEST = 0x0d,
36    VENDOR_RESERVED_9 = 0x09,
37    VENDOR_RESERVED_A = 0x0a,
38    VENDOR_RESERVED_B = 0x0b,
39    VENDOR_ANDROID    = 0x0c,
40    VENDOR_RESERVED_E = 0x0e,
41    VENDOR_RESERVED_F = 0x0f,
42}
43
44enum CoreOpCode : 6 {
45    CORE_DEVICE_RESET = 0x00,
46    CORE_DEVICE_STATUS_NTF = 0x01,
47    CORE_DEVICE_INFO = 0x02,
48    CORE_GET_CAPS_INFO = 0x03,
49    CORE_SET_CONFIG = 0x04,
50    CORE_GET_CONFIG = 0x05,
51    CORE_DEVICE_SUSPEND = 0x06,
52    CORE_GENERIC_ERROR_NTF = 0x07,
53    CORE_QUERY_UWBS_TIMESTAMP = 0x08,
54}
55
56enum SessionConfigOpCode : 6 {
57    SESSION_INIT = 0x00,
58    SESSION_DEINIT = 0x01,
59    SESSION_STATUS_NTF = 0x02,
60    SESSION_SET_APP_CONFIG = 0x03,
61    SESSION_GET_APP_CONFIG = 0x04,
62    SESSION_GET_COUNT = 0x05,
63    SESSION_GET_STATE = 0x06,
64    SESSION_UPDATE_CONTROLLER_MULTICAST_LIST = 0x07,
65    SESSION_UPDATE_ACTIVE_ROUNDS_ANCHOR = 0x08,
66    SESSION_UPDATE_ACTIVE_ROUNDS_DT_TAG = 0x09,
67    SESSION_SET_INITIATOR_DT_ANCHOR_RR_RDM_LIST = 0x0a,
68    SESSION_QUERY_DATA_SIZE_IN_RANGING = 0x0b,
69    SESSION_SET_HUS_CONTROLLER_CONFIG = 0x0c,
70    SESSION_SET_HUS_CONTROLEE_CONFIG = 0x0d,
71    SESSION_DATA_TRANSFER_PHASE_CONFIGURATION = 0x0e,
72}
73
74enum SessionControlOpCode : 6 {
75    SESSION_START = 0x00,
76    SESSION_STOP = 0x01,
77    SESSION_RESERVED = 0x02,
78    SESSION_GET_RANGING_COUNT = 0x03,
79    SESSION_DATA_CREDIT_NTF = 0x04,
80    SESSION_DATA_TRANSFER_STATUS_NTF = 0x05,
81}
82
83enum AppDataOpCode : 6 {
84    APP_DATA_TX = 0x00,
85    APP_DATA_RX = 0x01,
86}
87
88// Android vendor commands
89enum AndroidOpCode : 6 {
90    ANDROID_GET_POWER_STATS = 0x0,
91    ANDROID_SET_COUNTRY_CODE = 0x1,
92    ANDROID_FIRA_RANGE_DIAGNOSTICS = 0x2,
93    ANDROID_RADAR_SET_APP_CONFIG = 0x11,
94    ANDROID_RADAR_GET_APP_CONFIG = 0x12,
95}
96
97enum TestOpCode : 6 {
98    RF_TEST_CONFIG_SET_COMMAND  = 0x0,
99    RF_TEST_CONFIG_GET_COMMAND  = 0x1,
100    RF_TEST_PERIODIC_TX_CMD = 0x2,
101}
102
103enum StatusCode : 8 {
104    // Generic Status Codes
105    UCI_STATUS_OK = 0x00,
106    UCI_STATUS_REJECTED = 0x01,
107    UCI_STATUS_FAILED = 0x02,
108    UCI_STATUS_SYNTAX_ERROR = 0x03,
109    UCI_STATUS_INVALID_PARAM = 0x04,
110    UCI_STATUS_INVALID_RANGE = 0x05,
111    UCI_STATUS_INVALID_MSG_SIZE = 0x06,
112    UCI_STATUS_UNKNOWN_GID = 0x07,
113    UCI_STATUS_UNKNOWN_OID = 0x08,
114    UCI_STATUS_READ_ONLY = 0x09,
115    UCI_STATUS_COMMAND_RETRY = 0x0A,
116    UCI_STATUS_UNKNOWN = 0x0B,
117    UCI_STATUS_NOT_APPLICABLE = 0x0C,
118    RFU_STATUS_CODE_RANGE_1 = 0x0D..0x10,
119
120    // UWB Session Specific Status Codes
121    UCI_STATUS_SESSION_NOT_EXIST = 0x11,
122    UCI_STATUS_SESSION_DUPLICATE = 0x12,
123    UCI_STATUS_SESSION_ACTIVE = 0x13,
124    UCI_STATUS_MAX_SESSIONS_EXCEEDED = 0x14,
125    UCI_STATUS_SESSION_NOT_CONFIGURED = 0x15,
126    UCI_STATUS_ACTIVE_SESSIONS_ONGOING = 0x16,
127    UCI_STATUS_MULTICAST_LIST_FULL = 0x17,
128    UCI_STATUS_ADDRESS_NOT_FOUND = 0x18,
129    UCI_STATUS_ADDRESS_ALREADY_PRESENT = 0x19,
130    UCI_STATUS_ERROR_UWB_INITIATION_TIME_TOO_OLD = 0x1A,
131    UCI_STATUS_OK_NEGATIVE_DISTANCE_REPORT = 0x1B,
132    RFU_STATUS_CODE_RANGE_2 = 0x1C..0x1F,
133
134    // UWB Ranging Session Specific Status Codes
135    UCI_STATUS_RANGING_TX_FAILED = 0x20,
136    UCI_STATUS_RANGING_RX_TIMEOUT = 0x21,
137    UCI_STATUS_RANGING_RX_PHY_DEC_FAILED = 0x22,
138    UCI_STATUS_RANGING_RX_PHY_TOA_FAILED = 0x23,
139    UCI_STATUS_RANGING_RX_PHY_STS_FAILED = 0x24,
140    UCI_STATUS_RANGING_RX_MAC_DEC_FAILED = 0x25,
141    UCI_STATUS_RANGING_RX_MAC_IE_DEC_FAILED = 0x26,
142    UCI_STATUS_RANGING_RX_MAC_IE_MISSING = 0x27,
143    UCI_STATUS_ERROR_ROUND_INDEX_NOT_ACTIVATED = 0x28,
144    UCI_STATUS_ERROR_NUMBER_OF_ACTIVE_RANGING_ROUNDS_EXCEEDED = 0x29,
145    UCI_STATUS_ERROR_DL_TDOA_DEVICE_ADDRESS_NOT_MATCHING_IN_REPLY_TIME_LIST = 0x2A,
146    RFU_STATUS_CODE_RANGE_3 = 0x2B..0x2F,
147
148    // UWB Data Session Specific Status Codes
149    UCI_STATUS_DATA_MAX_TX_PSDU_SIZE_EXCEEDED = 0x30,
150    UCI_STATUS_DATA_RX_CRC_ERROR = 0x31,
151    RFU_STATUS_CODE_RANGE_4 = 0x32..0x4F,
152
153    // Vendor Specific Status Codes
154    VENDOR_SPECIFIC_STATUS_CODE_RANGE_1 = 0x50..0xFE {
155        UCI_STATUS_ERROR_CCC_SE_BUSY = 0x50,
156        UCI_STATUS_ERROR_CCC_LIFECYCLE = 0x51,
157        UCI_STATUS_ERROR_STOPPED_DUE_TO_OTHER_SESSION_CONFLICT = 0x52,
158        UCI_STATUS_REGULATION_UWB_OFF = 0x53,
159    },
160
161    // For internal usage, we will use 0xFF as default.
162    VENDOR_SPECIFIC_STATUS_CODE_2 = 0xFF,
163}
164
165// This needs a separate StatusCode as the Status code values in the DATA_RCV packet have
166// different values from the generic StatusCode above.
167enum DataRcvStatusCode : 8 {
168    UCI_STATUS_SUCCESS = 0x00,
169    UCI_STATUS_ERROR = 0x01,
170    UCI_STATUS_UNKNOWN = 0x02,
171}
172
173enum CreditAvailability : 8 {
174    CREDIT_NOT_AVAILABLE = 0,
175    CREDIT_AVAILABLE = 1,
176}
177
178// The UCI spec defines these status codes for a DATA_TRANSFER_STATUS_NTF packet.
179enum DataTransferNtfStatusCode : 8 {
180    UCI_DATA_TRANSFER_STATUS_REPETITION_OK = 0x00,
181    UCI_DATA_TRANSFER_STATUS_OK = 0x01,
182    UCI_DATA_TRANSFER_STATUS_ERROR_DATA_TRANSFER = 0x02,
183    UCI_DATA_TRANSFER_STATUS_ERROR_NO_CREDIT_AVAILABLE = 0x03,
184    UCI_DATA_TRANSFER_STATUS_ERROR_REJECTED = 0x04,
185    UCI_DATA_TRANSFER_STATUS_SESSION_TYPE_NOT_SUPPORTED = 0x05,
186    UCI_DATA_TRANSFER_STATUS_ERROR_DATA_TRANSFER_IS_ONGOING = 0x06,
187    UCI_DATA_TRANSFER_STATUS_INVALID_FORMAT = 0x07,
188}
189
190// The UCI spec defines these status codes for a SESSION_DATA_TRANSFER_PHASE_CONFIG_NTF packet.
191enum DataTransferPhaseConfigUpdateStatusCode : 8 {
192    UCI_DTPCM_CONFIG_SUCCESS_STATUS_OK = 0x00,
193    UCI_DTPCM_STATUS_ERROR_DUPLICATE_SLOT_ASSIGMENT = 0x01,
194}
195
196enum ResetConfig : 8 {
197    UWBS_RESET = 0x00,
198}
199
200enum DeviceConfigId : 8 {
201    DEVICE_STATE = 0x00,
202    LOW_POWER_MODE = 0x01,
203}
204
205enum AppConfigTlvType : 8 {
206    DEVICE_TYPE = 0x00,
207    RANGING_ROUND_USAGE = 0x01,
208    STS_CONFIG = 0x02,
209    MULTI_NODE_MODE = 0x03,
210    CHANNEL_NUMBER = 0x04,
211    NO_OF_CONTROLEE = 0x05,
212    DEVICE_MAC_ADDRESS = 0x06,
213    DST_MAC_ADDRESS = 0x07,
214    SLOT_DURATION = 0x08,
215    RANGING_DURATION = 0x09,
216    STS_INDEX = 0x0A,
217    MAC_FCS_TYPE = 0x0B,
218    RANGING_ROUND_CONTROL = 0x0C,
219    AOA_RESULT_REQ = 0x0D,
220    RNG_DATA_NTF = 0x0E,
221    RNG_DATA_NTF_PROXIMITY_NEAR = 0x0F,
222    RNG_DATA_NTF_PROXIMITY_FAR = 0x10,
223    DEVICE_ROLE = 0x11,
224    RFRAME_CONFIG = 0x12,
225    RSSI_REPORTING = 0x13,
226    PREAMBLE_CODE_INDEX = 0x14,
227    SFD_ID = 0x15,
228    PSDU_DATA_RATE = 0x16,
229    PREAMBLE_DURATION = 0x17,
230    LINK_LAYER_MODE = 0x18,
231    DATA_REPETITION_COUNT = 0x19,
232    RANGING_TIME_STRUCT = 0x1A,
233    SLOTS_PER_RR = 0x1B,
234    TX_ADAPTIVE_PAYLOAD_POWER = 0x1C,
235    // TODO: Ensure this value is correct in the final 2.0 specification.
236    RNG_DATA_NTF_AOA_BOUND = 0x1D,
237    RESPONDER_SLOT_INDEX = 0x1E,
238    PRF_MODE = 0x1F,
239    CAP_SIZE_RANGE = 0x20,
240    TX_JITTER_WINDOW_SIZE = 0x21,
241    SCHEDULED_MODE = 0x22,
242    KEY_ROTATION = 0x23,
243    KEY_ROTATION_RATE = 0x24,
244    SESSION_PRIORITY = 0x25,
245    MAC_ADDRESS_MODE = 0x26,
246    VENDOR_ID = 0x27,
247    STATIC_STS_IV = 0x28,
248    NUMBER_OF_STS_SEGMENTS = 0x29,
249    MAX_RR_RETRY = 0x2A,
250    UWB_INITIATION_TIME = 0x2B,
251    HOPPING_MODE = 0x2C,
252    BLOCK_STRIDE_LENGTH = 0x2D,
253    RESULT_REPORT_CONFIG = 0x2E,
254    IN_BAND_TERMINATION_ATTEMPT_COUNT = 0x2F,
255    SUB_SESSION_ID = 0x30,
256    BPRF_PHR_DATA_RATE = 0x31,
257    MAX_NUMBER_OF_MEASUREMENTS = 0x32,
258    UL_TDOA_TX_INTERVAL = 0x33,
259    UL_TDOA_RANDOM_WINDOW = 0x34,
260    STS_LENGTH = 0x35,
261    SUSPEND_RANGING_ROUNDS = 0x36,
262    UL_TDOA_NTF_REPORT_CONFIG = 0x37,
263    UL_TDOA_DEVICE_ID = 0x38,
264    UL_TDOA_TX_TIMESTAMP = 0x39,
265    MIN_FRAMES_PER_RR = 0x3A,
266    MTU_SIZE = 0x3B,
267    INTER_FRAME_INTERVAL = 0x3C,
268    DL_TDOA_RANGING_METHOD  = 0x3D,
269    DL_TDOA_TX_TIMESTAMP_CONF = 0x3E,
270    DL_TDOA_HOP_COUNT = 0x3F,
271    DL_TDOA_ANCHOR_CFO = 0x40,
272    DL_TDOA_ANCHOR_LOCATION = 0x41,
273    DL_TDOA_TX_ACTIVE_RANGING_ROUNDS = 0x42,
274    DL_TDOA_BLOCK_STRIDING = 0x43,
275    DL_TDOA_TIME_REFERENCE_ANCHOR = 0x44,
276    SESSION_KEY = 0x45,
277    SUBSESSION_KEY = 0x46,
278    SESSION_DATA_TRANSFER_STATUS_NTF_CONFIG = 0x47,
279    SESSION_TIME_BASE = 0x48,
280    DL_TDOA_RESPONDER_TOF = 0x49,
281    SECURE_RANGING_NEFA_LEVEL = 0x4A,
282    SECURE_RANGING_CSW_LENGTH = 0x4B,
283    APPLICATION_DATA_ENDPOINT = 0x4C,
284    OWR_AOA_MEASUREMENT_NTF_PERIOD = 0x4D,
285    RFU_APP_CFG_TLV_TYPE_RANGE = 0x4E..0x9F,
286
287    VENDOR_SPECIFIC_APP_CFG_TLV_TYPE_RANGE_1 = 0xA0..0xDF {
288        // CCC specific
289        CCC_HOP_MODE_KEY = 0xA0,
290        CCC_UWB_TIME0 = 0xA1,
291        CCC_RANGING_PROTOCOL_VER = 0xA3,
292        CCC_UWB_CONFIG_ID = 0xA4,
293        CCC_PULSESHAPE_COMBO = 0xA5,
294        CCC_URSK_TTL = 0xA6,
295        CCC_LAST_INDEX_USED  = 0xA8,
296        ALIRO_MAC_MODE = 0xA9,
297    },
298
299    // Reserved for extension IDs.
300    RFU_APP_CFG_TLV_TYPE_RANGE_4 = 0xE0..0xE2,
301
302    VENDOR_SPECIFIC_APP_CFG_TLV_TYPE_RANGE_2 = 0xE3..0xFF {
303        // Interleaving ratio if AOA_RESULT_REQ is set to 0xF0.
304        NB_OF_RANGE_MEASUREMENTS = 0xE3,
305        NB_OF_AZIMUTH_MEASUREMENTS = 0xE4,
306        NB_OF_ELEVATION_MEASUREMENTS = 0xE5,
307        ENABLE_DIAGNOSTICS = 0xE8,
308        DIAGRAMS_FRAME_REPORTS_FIELDS = 0xE9,
309        ANTENNA_MODE = 0xEA,
310    },
311}
312
313enum FrameReportTlvType : 8 {
314    RSSI = 0x0,
315    AOA = 0x1,
316    CIR = 0x2,
317    SEGMENT_METRICS = 0x6,
318}
319
320enum CapTlvType : 8 {
321    // Defining the parameters for both Fira v1.0 and v2.0 in one enum, as PDL
322    // does not allow to define two separate enum fields with the same value.
323    SUPPORTED_V1_FIRA_PHY_VERSION_RANGE_V2_MAX_MESSAGE_SIZE = 0x0,
324    SUPPORTED_V1_FIRA_MAC_VERSION_RANGE_V2_MAX_DATA_PAYLOAD_SIZE = 0x1,
325    SUPPORTED_V1_DEVICE_ROLES_V2_FIRA_PHY_VERSION_RANGE = 0x2,
326    SUPPORTED_V1_RANGING_METHOD_V2_FIRA_MAC_VERSION_RANGE = 0x3,
327    SUPPORTED_V1_STS_CONFIG_V2_DEVICE_TYPE = 0x4,
328    SUPPORTED_V1_MULTI_NODE_MODES_V2_DEVICE_ROLES = 0x5,
329    SUPPORTED_V1_RANGING_TIME_STRUCT_V2_RANGING_METHOD = 0x6,
330    SUPPORTED_V1_SCHEDULED_MODE_V2_STS_CONFIG = 0x7,
331    SUPPORTED_V1_HOPPING_MODE_V2_MULTI_NODE_MODE = 0x8,
332    SUPPORTED_V1_BLOCK_STRIDING_V2_RANGING_TIME_STRUCT = 0x9,
333    SUPPORTED_V1_UWB_INITIATION_TIME_V2_SCHEDULE_MODE = 0x0A,
334    SUPPORTED_V1_CHANNELS_V2_HOPPING_MODE = 0x0B,
335    SUPPORTED_V1_RFRAME_CONFIG_V2_BLOCK_STRIDING = 0x0C,
336    SUPPORTED_V1_CC_CONSTRAINT_LENGTH_V2_UWB_INITIATION_TIME = 0x0D,
337    SUPPORTED_V1_BPRF_PARAMETER_SETS_V2_CHANNELS = 0x0E,
338    SUPPORTED_V1_HPRF_PARAMETER_SETS_V2_RFRAME_CONFIG = 0x0F,
339    SUPPORTED_V1_AOA_V2_CC_CONSTRAINT_LENGTH = 0x10,
340    SUPPORTED_V1_EXTENDED_MAC_ADDRESS_V2_BPRF_PARAMETER_SETS = 0x11,
341    SUPPORTED_V1_MAX_MESSAGE_SIZE_V2_HPRF_PARAMETER_SETS = 0x12,
342    SUPPORTED_V1_MAX_DATA_PACKET_PAYLOAD_SIZE_V2_AOA_SUPPORT = 0x13,
343    SUPPORTED_V2_EXTENDED_MAC_ADDRESS = 0x14,
344    SUPPORTED_V2_ASSIGNED = 0x15,
345    SUPPORTED_V2_SESSION_KEY_LENGTH = 0x16,
346    SUPPORTED_V2_DT_ANCHOR_MAX_ACTIVE_RR = 0x17,
347    SUPPORTED_V2_DT_TAG_MAX_ACTIVE_RR = 0x18,
348    SUPPORTED_V2_DT_TAG_BLOCK_SHIPPING = 0x19,
349    SUPPORTED_V2_PSDU_LENGTH_SUPPORT = 0x1A,
350    RFU_CAP_TLV_TYPE_RANGE_1 = 0x1B..0x9F,
351
352    VENDOR_SPECIFIC_CAP_TLV_TYPE_RANGE_1 = 0xA0..0xBF {
353        // CCC specific
354        CCC_SUPPORTED_CHAPS_PER_SLOT = 0xA0,
355        CCC_SUPPORTED_SYNC_CODES = 0xA1,
356        CCC_SUPPORTED_HOPPING_CONFIG_MODES_AND_SEQUENCES = 0xA2,
357        CCC_SUPPORTED_CHANNELS = 0xA3,
358        CCC_SUPPORTED_VERSIONS = 0xA4,
359        CCC_SUPPORTED_UWB_CONFIGS = 0xA5,
360        CCC_SUPPORTED_PULSE_SHAPE_COMBOS = 0xA6,
361        CCC_SUPPORTED_RAN_MULTIPLIER = 0xA7,
362        CCC_SUPPORTED_MAX_RANGING_SESSION_NUMBER = 0xA8,
363        CCC_SUPPORTED_MIN_UWB_INITIATION_TIME_MS = 0xA9,
364        CCC_PRIORITIZED_CHANNEL_LIST = 0xAA,
365        CCC_SUPPORTED_UWBS_MAX_PPM = 0xAB,
366        ALIRO_SUPPORTED_MAC_MODES = 0xAC,
367
368        // RADAR specific
369        RADAR_SUPPORT = 0xB0
370    },
371
372    SUPPORTED_POWER_STATS = 0xC0,
373    VENDOR_SPECIFIC_CAP_TLV_TYPE_RANGE_2 = 0xC1..0xDF,
374    RFU_CAP_TLV_TYPE_RANGE_2 = 0xE0..0xE2,
375
376    VENDOR_SPECIFIC_CAP_TLV_TYPE_RANGE_3 = 0xE3..0xFF {
377        SUPPORTED_AOA_RESULT_REQ_ANTENNA_INTERLEAVING = 0xE3,
378        SUPPORTED_MIN_RANGING_INTERVAL_MS = 0xE4,
379        SUPPORTED_RANGE_DATA_NTF_CONFIG = 0xE5,
380        SUPPORTED_RSSI_REPORTING = 0xE6,
381        SUPPORTED_DIAGNOSTICS = 0xE7,
382        SUPPORTED_MIN_SLOT_DURATION_RSTU = 0xE8,
383        SUPPORTED_MAX_RANGING_SESSION_NUMBER = 0xE9,
384    },
385}
386
387
388// AOA result request type.
389// Values set for AOA_RESULT_REQ config ID.
390enum AoaResultReqType : 8 {
391    AOA_DISABLE = 0x0,
392    AOA_ENABLE = 0x01,
393    AOA_ENABLE_AZIMUTH = 0x02,
394    AOA_ENABLE_ELEVATION = 0x03,
395    AOA_ENABLE_INTERLEAVED = 0xF0,
396}
397
398enum DeviceState : 8 {
399    DEVICE_STATE_READY = 0x01,
400    DEVICE_STATE_ACTIVE = 0x02,
401    DEVICE_STATE_ERROR = 0xff,
402}
403
404enum SessionState : 8 {
405    SESSION_STATE_INIT = 0x00,
406    SESSION_STATE_DEINIT = 0x01,
407    SESSION_STATE_ACTIVE = 0x02,
408    SESSION_STATE_IDLE = 0x03,
409}
410
411enum ReasonCode : 8 {
412    STATE_CHANGE_WITH_SESSION_MANAGEMENT_COMMANDS = 0x00,
413    MAX_RANGING_ROUND_RETRY_COUNT_REACHED = 0x01,
414    MAX_NUMBER_OF_MEASUREMENTS_REACHED = 0x02,
415    SESSION_SUSPENDED_DUE_TO_INBAND_SIGNAL = 0x03,
416    SESSION_RESUMED_DUE_TO_INBAND_SIGNAL = 0x04,
417    SESSION_STOPPED_DUE_TO_INBAND_SIGNAL = 0x05,
418    RFU_REASON_CODE_RANGE_1 = 0x06..0x1C,
419    ERROR_INVALID_UL_TDOA_RANDOM_WINDOW = 0x1D,
420    ERROR_MIN_RFRAMES_PER_RR_NOT_SUPPORTED = 0x1E,
421    ERROR_INTER_FRAME_INTERVAL_NOT_SUPPORTED = 0x1F,
422    ERROR_SLOT_LENGTH_NOT_SUPPORTED = 0x20,
423    ERROR_INSUFFICIENT_SLOTS_PER_RR = 0x21,
424    ERROR_MAC_ADDRESS_MODE_NOT_SUPPORTED = 0x22,
425    ERROR_INVALID_RANGING_DURATION = 0x23,
426    ERROR_INVALID_STS_CONFIG = 0x24,
427    ERROR_INVALID_RFRAME_CONFIG = 0x25,
428    ERROR_HUS_NOT_ENOUGH_SLOTS = 0x26,
429    ERROR_HUS_CFP_PHASE_TOO_SHORT = 0x27,
430    ERROR_HUS_CAP_PHASE_TOO_SHORT = 0x28,
431    ERROR_HUS_OTHERS = 0x29,
432    ERROR_STATUS_SESSION_KEY_NOT_FOUND = 0x2A,
433    ERROR_STATUS_SUB_SESSION_KEY_NOT_FOUND = 0x2B,
434    ERROR_INVALID_PREAMBLE_CODE_INDEX = 0x2C,
435    ERROR_INVALID_SFD_ID = 0x2D,
436    ERROR_INVALID_PSDU_DATA_RATE = 0x2E,
437    ERROR_INVALID_PHR_DATA_RATE = 0x2F,
438    ERROR_INVALID_PREAMBLE_DURATION = 0x30,
439    ERROR_INVALID_STS_LENGTH = 0x31,
440    ERROR_INVALID_NUM_OF_STS_SEGMENTS = 0x32,
441    ERROR_INVALID_NUM_OF_CONTROLEES = 0x33,
442    ERROR_MAX_RANGING_REPLY_TIME_EXCEEDED = 0x34,
443    ERROR_INVALID_DST_ADDRESS_LIST = 0x35,
444    ERROR_INVALID_OR_NOT_FOUND_SUB_SESSION_ID = 0x36,
445    ERROR_INVALID_RESULT_REPORT_CONFIG = 0x37,
446    ERROR_INVALID_RANGING_ROUND_CONTROL_CONFIG = 0x38,
447    ERROR_INVALID_RANGING_ROUND_USAGE = 0x39,
448    ERROR_INVALID_MULTI_NODE_MODE = 0x3A,
449    ERROR_RDS_FETCH_FAILURE = 0x3B,
450    ERROR_REF_UWB_SESSION_DOES_NOT_EXIST = 0x3C,
451    ERROR_REF_UWB_SESSION_RANGING_DURATION_MISMATCH = 0x3D,
452    ERROR_REF_UWB_SESSION_INVALID_OFFSET_TIME = 0x3E,
453    ERROR_REF_UWB_SESSION_LOST = 0x3F,
454    RFU_REASON_CODE_RANGE_2 = 0x40..0x7F {
455        ERROR_DT_ANCHOR_RANGING_ROUNDS_NOT_CONFIGURED = 0x40,
456        ERROR_DT_TAG_RANGING_ROUNDS_NOT_CONFIGURED = 0x41,
457    },
458    VENDOR_SPECIFIC_REASON_CODE_RANGE_1 = 0x80..0xA1 {
459        ERROR_INVALID_CHANNEL_WITH_AOA = 0x80,
460        ERROR_STOPPED_DUE_TO_OTHER_SESSION_CONFLICT = 0x81,
461    },
462    SESSION_STOPPED_DUE_TO_MAX_STS_INDEX_VALUE = 0xA2,
463    VENDOR_SPECIFIC_REASON_CODE_RANGE_2 = 0xA3..0xFE,
464    // For internal usage, we will use 0xFF as default.
465    VENDOR_SPECIFIC_REASON_CODE_2 = 0xFF,
466}
467
468enum MulticastUpdateStatusCode : 8 {
469    STATUS_OK_MULTICAST_LIST_UPDATE = 0x00,
470    STATUS_ERROR_MULTICAST_LIST_FULL = 0x01,
471    STATUS_ERROR_KEY_FETCH_FAIL = 0x02,
472    STATUS_ERROR_SUB_SESSION_ID_NOT_FOUND = 0x03,
473    STATUS_ERROR_SUB_SESSION_KEY_NOT_FOUND = 0x04,
474    STATUS_ERROR_SUB_SESSION_KEY_NOT_APPLICABLE = 0x05,
475    STATUS_ERROR_SESSION_KEY_NOT_FOUND = 0x06,
476    STATUS_ERROR_ADDRESS_NOT_FOUND = 0x07,
477    STATUS_ERROR_ADDRESS_ALREADY_PRESENT = 0x08,
478    RFU_STATUS_CODE_RANGE_1 = 0x09..0xFF,
479}
480
481enum MacAddressIndicator : 8 {
482    SHORT_ADDRESS = 0x00,
483    EXTENDED_ADDRESS = 0x01,
484}
485
486enum SessionType: 8 {
487    FIRA_RANGING_SESSION = 0x00,
488    FIRA_RANGING_AND_IN_BAND_DATA_SESSION = 0x01,
489    FIRA_DATA_TRANSFER_SESSION = 0x02,
490    FIRA_RANGING_ONLY_PHASE = 0x03,
491    FIRA_IN_BAND_DATA_PHASE = 0x04,
492    FIRA_RANGING_WITH_DATA_PHASE = 0x05,
493    CCC = 0xA0,
494    RADAR_SESSION = 0xA1,
495    ALIRO = 0xA2,
496    DEVICE_TEST_MODE = 0xD0,
497}
498
499enum MessageType: 3 {
500    DATA = 0x00,
501    COMMAND = 0x01,
502    RESPONSE = 0x02,
503    NOTIFICATION = 0x03,
504    RESERVED_FOR_TESTING_1 = 0x04,
505    RESERVED_FOR_TESTING_2 = 0x05,
506}
507
508enum RfTestConfigTlvType : 8 {
509    NUM_PACKETS = 0x00,
510    T_GAP = 0x01,
511    T_START = 0x02,
512    T_WIN = 0x03,
513    RANDOMIZE_PSDU = 0x04,
514    PHR_RANGING_BIT = 0x05,
515    RMARKER_TX_START = 0x06,
516    RMARKER_RX_START = 0x07,
517    STS_INDEX_AUTO_INCR = 0x08,
518    STS_DETECT_BITMAP = 0x09,
519    RFU_TEST_APP_CFG_TLV_TYPE_RANGE = 0x0A..0xFF,
520}
521
522// UCI packet description in compliance with the FIRA UCI spec.
523// Only this packet should be sent/expected across the HAL interface.
524packet UciPacketHal {
525    group_id_or_data_packet_format: GroupIdOrDataPacketFormat,
526    packet_boundary_flag: PacketBoundaryFlag,
527    message_type: MessageType,
528    _body_
529}
530
531// The UciDataPacketHal must be declared before the UciControlPacketHal for correct parsing to
532// happen. This is required as the Data packet specifies a value for the 'message_type' constraint,
533// while the Control packet does not (as it encompasses multiple 'message_type' values).
534packet UciDataPacketHal: UciPacketHal (message_type = DATA) {
535    _reserved_: 8,
536    _size_(_payload_): 16,
537    _payload_,
538}
539
540packet UciControlPacketHal: UciPacketHal {
541    opcode: 6,
542    _reserved_: 2,
543    _reserved_: 8,
544    _size_(_payload_): 8,
545    _payload_,
546}
547
548// This control packet definition is used throughout the stack that holds a complete
549// (i.e unfragmented) UCI command/response/notification.
550//
551// UciControlPacket needs to be converted to one or more UciControlPacketHal fragments before
552// sending to the HAL. One or more UciControlPacketHal fragments needs to be converted to
553// UciControlPacket when receiving from the HAL.
554//
555// TODO(b/202760099): Handle fragmentation more cleanly in the PDL.
556packet UciControlPacket {
557    group_id: GroupId,
558    // This field is different from |UciControlPacketHal| to provide a placeholder for PBF flag.
559    _reserved_: 1,
560    message_type: MessageType,
561    opcode: 6,
562    _reserved_: 2,
563    _reserved_: 8,
564     // This field is different from |UciControlPacketHal| to allow holding a large unfragmented
565     // packet.
566    _size_(_payload_): 32,
567    _payload_,
568}
569
570// This data packet definition is used throughout the stack that holds a complete
571// (i.e unfragmented) UCI data packet.
572//
573// UciDataPacket needs to be converted to one or more UciDataPacketHal fragments before sending to
574// the HAL. One or more UciDataPacketHal fragments needs to be converted to UciDataPacket when
575// receiving from the HAL.
576//
577// TODO(b/202760099): Handle fragmentation more cleanly in the PDL.
578packet UciDataPacket {
579    data_packet_format: DataPacketFormat,
580    // This field is different from |UciDataPacketHal| to provide a placeholder for PBF flag.
581    _reserved_: 1,
582    message_type: MessageType,
583    _reserved_: 8,
584     // This field is different from |UciDataPacketHal| to allow holding large unfragmented packet.
585    _size_(_payload_): 32,
586    _payload_,
587}
588
589packet UciDataSnd : UciDataPacket (data_packet_format = DATA_SND, message_type = DATA) {
590    session_token: 32, // Session ID or Session Handle (based on UWBS version)
591    dest_mac_address: 64,
592    uci_sequence_number: 16,
593    _size_(data): 16,
594    data: 8[]
595}
596
597packet UciDataRcv : UciDataPacket (data_packet_format = DATA_RCV, message_type = DATA) {
598    session_token: 32, // Session ID or Session Handle (based on UWBS version)
599    status: StatusCode,
600    source_mac_address: 64,
601    uci_sequence_number: 16,
602    _size_(data): 16,
603    data: 8[]
604}
605
606packet UciCommand : UciControlPacket (message_type = COMMAND) {
607    _payload_,
608}
609
610packet UciResponse : UciControlPacket (message_type = RESPONSE) {
611    _payload_,
612}
613
614packet UciNotification : UciControlPacket (message_type = NOTIFICATION) {
615    _payload_,
616}
617
618packet CoreCommand : UciCommand (group_id = CORE) {
619    _body_,
620}
621
622packet CoreResponse : UciResponse (group_id = CORE) {
623    _body_,
624}
625
626packet CoreNotification : UciNotification (group_id = CORE) {
627    _body_,
628}
629
630packet SessionConfigCommand : UciCommand (group_id = SESSION_CONFIG) {
631    _body_,
632}
633
634packet SessionConfigResponse : UciResponse (group_id = SESSION_CONFIG) {
635    _body_,
636}
637
638packet SessionConfigNotification : UciNotification (group_id = SESSION_CONFIG) {
639    _body_,
640}
641
642packet SessionControlCommand : UciCommand (group_id = SESSION_CONTROL) {
643    _body_,
644}
645
646packet SessionControlResponse : UciResponse (group_id = SESSION_CONTROL) {
647    _body_,
648}
649
650packet SessionControlNotification : UciNotification (group_id = SESSION_CONTROL) {
651    _body_,
652}
653
654packet AndroidCommand : UciCommand (group_id = VENDOR_ANDROID) {
655    _body_,
656}
657
658packet AndroidResponse : UciResponse (group_id = VENDOR_ANDROID) {
659    _body_,
660}
661
662packet AndroidNotification : UciNotification (group_id = VENDOR_ANDROID) {
663    _body_,
664}
665
666packet TestCommand : UciCommand (group_id = TEST) {
667    _body_,
668}
669
670packet TestResponse : UciResponse (group_id = TEST) {
671    _body_,
672}
673
674packet TestNotification : UciNotification (group_id = TEST) {
675    _body_,
676}
677
678// TODO: b/202760099: Use the correspnding opcode enum instead of the raw value in the |opcode| field.
679packet DeviceResetCmd : CoreCommand (opcode = 0x0) { //CORE_DEVICE_RESET
680    reset_config: ResetConfig,
681}
682
683test DeviceResetCmd {
684    "\x20\x00\x00\x01\x00\x00\x00\x00",
685}
686
687packet DeviceResetRsp : CoreResponse (opcode = 0x0) { //CORE_DEVICE_RESET
688    status: StatusCode,
689}
690
691test DeviceResetRsp {
692    "\x40\x00\x00\x01\x00\x00\x00\x00",
693}
694
695packet DeviceStatusNtf : CoreNotification (opcode = 0x1) { //CORE_DEVICE_STATUS_NTF
696    device_state: DeviceState,
697}
698
699test DeviceStatusNtf {
700    "\x60\x01\x00\x01\x00\x00\x00\x01",
701}
702
703packet GetDeviceInfoCmd : CoreCommand (opcode = 0x2) { //CORE_DEVICE_INFO
704}
705
706test GetDeviceInfoCmd {
707    "\x20\x02\x00\x00\x00\x00\x00",
708}
709
710packet GetDeviceInfoRsp : CoreResponse (opcode = 0x2) { //CORE_DEVICE_INFO
711    status: StatusCode,
712    uci_version: 16,
713    mac_version: 16,
714    phy_version: 16,
715    uci_test_version: 16,
716    _count_(vendor_spec_info): 8,
717    vendor_spec_info: 8[],
718}
719
720test GetDeviceInfoRsp {
721    "\x40\x02\x00\x0b\x00\x00\x00\x01\x01\x00\x02\x00\x03\x00\x04\x00\x01\x0a",
722}
723
724packet GetCapsInfoCmd : CoreCommand (opcode = 0x3) { //CORE_GET_CAPS_INFO
725}
726
727test GetCapsInfoCmd {
728    "\x20\x03\x00\x00\x00\x00\x00",
729}
730
731struct CapTlv {
732    t: CapTlvType,
733    _count_(v): 8,
734    v: 8[],
735}
736
737
738packet GetCapsInfoRsp : CoreResponse (opcode = 0x3) { //CORE_GET_CAPS_INFO
739    status: StatusCode,
740    _count_(tlvs): 8,
741    tlvs: CapTlv[],
742}
743
744test GetCapsInfoRsp {
745    "\x40\x03\x00\x05\x00\x00\x00\x00\x01\x00\x01\x01",
746}
747
748struct DeviceConfigTlv {
749    cfg_id: DeviceConfigId,
750    _count_(v): 8,
751    v: 8[],
752}
753
754packet SetConfigCmd : CoreCommand (opcode = 0x4) { //CORE_SET_CONFIG
755    _count_(tlvs): 8,
756    tlvs: DeviceConfigTlv[],
757}
758
759test SetConfigCmd {
760    "\x20\x04\x00\x03\x00\x00\x00\x01\x01\x00",
761}
762
763struct DeviceConfigStatus {
764    cfg_id: DeviceConfigId,
765    status: StatusCode,
766}
767
768packet SetConfigRsp : CoreResponse (opcode = 0x4) { //CORE_SET_CONFIG
769    status: StatusCode,
770    _count_(cfg_status): 8,
771    cfg_status: DeviceConfigStatus[],
772}
773
774test SetConfigRsp {
775    "\x40\x04\x00\x04\x00\x00\x00\x01\x01\x01\x01",
776    "\x40\x04\x00\x04\x00\x00\x00\x01\x01\x01\x0B",
777}
778
779packet GetConfigCmd : CoreCommand (opcode = 0x5) { //CORE_GET_CONFIG
780    _count_(cfg_id): 8,
781    cfg_id: 8[], // DeviceConfigId (Infra does not allow array of enums)
782}
783
784test GetConfigCmd {
785    "\x20\x05\x00\x02\x00\x00\x00\x01\x01",
786}
787
788packet GetConfigRsp : CoreResponse (opcode = 0x5) { //CORE_GET_CONFIG
789    status: StatusCode,
790    _count_(tlvs): 8,
791    tlvs: DeviceConfigTlv[]
792}
793
794test GetConfigRsp {
795    "\x40\x05\x00\x05\x00\x00\x00\x01\x01\x00\x01\x01",
796}
797
798packet GenericError : CoreNotification (opcode = 0x7) { //CORE_GENERIC_ERROR_NTF
799    status: StatusCode,
800}
801
802test GenericError {
803    "\x60\x07\x00\x01\x00\x00\x00\x01",
804}
805
806
807packet CoreQueryTimeStampCmd : CoreCommand (opcode = 0x8) { //CORE_QUERY_UWBS_TIMESTAMP
808}
809
810test CoreQueryTimeStampCmd {
811    "\x20\x08\x00\\x00",
812}
813
814packet CoreQueryTimeStampRsp : CoreResponse (opcode = 0x8) { //CORE_QUERY_UWBS_TIMESTAMP
815    status: StatusCode,
816    timeStamp: 64,
817}
818
819test CoreQueryTimeStampRsp {
820    "\x40\x08\x00\x09\x00\x00\x00\x01\x01\x00\x01\x01\x01",
821}
822
823packet SessionInitCmd : SessionConfigCommand (opcode = 0x0) { //SESSION_INIT
824    session_id: 32,
825    session_type: SessionType,
826}
827
828test SessionInitCmd {
829    "\x21\x00\x00\x05\x00\x00\x00\x01\x02\x03\x04\x01",
830}
831
832// FIRA version 2 introduces a new version of SESSION_INIT_RSP which
833// includes UWBS generated session handle.
834packet SessionInitRsp_V2 : SessionConfigResponse (opcode = 0x0) { //SESSION_INIT
835    status: StatusCode,
836    session_handle: 32,
837}
838
839test SessionInitRsp_V2 {
840    "\x41\x00\x00\x01\x00\x00\x00\x11\x00\x00\x00\x01",
841}
842
843packet SessionInitRsp : SessionConfigResponse (opcode = 0x0) { //SESSION_INIT
844    status: StatusCode,
845}
846
847test SessionInitRsp {
848    "\x41\x00\x00\x01\x00\x00\x00\x11",
849}
850
851packet SessionDeinitCmd : SessionConfigCommand (opcode = 0x1) { //SESSION_DEINIT
852    session_token: 32, // Session ID or Session Handle (based on UWBS version)
853}
854
855test SessionDeinitCmd {
856    "\x21\x01\x00\x04\x00\x00\x00\x01\x02\x03\x04",
857}
858
859packet SessionDeinitRsp : SessionConfigResponse (opcode = 0x1) { //SESSION_DEINIT
860    status: StatusCode,
861}
862
863test SessionDeinitRsp {
864    "\x41\x01\x00\x01\x00\x00\x00\x00",
865}
866
867packet SessionStatusNtf : SessionConfigNotification (opcode = 0x2) { //SESSION_STATUS_NTF
868    session_token: 32, // Session ID or Session Handle (based on UWBS version)
869    session_state: SessionState,
870    // TODO(b/272775225): Switch back to the enum type ReasonCode, once PDL supports defining a
871    // range inside an enum (for the vendor-specific space), in b/267339120.
872    reason_code: 8,
873}
874
875test SessionStatusNtf {
876    "\x61\x02\x00\x06\x00\x00\x00\x01\x02\x03\x04\x02\x21",
877    "\x61\x02\x00\x06\x00\x00\x00\x01\x02\x03\x04\x01\x82", // Vendor Specific Reason Code
878}
879
880struct AppConfigTlv {
881    cfg_id: AppConfigTlvType,
882    _count_(v): 8,
883    v: 8[],
884}
885
886packet SessionSetAppConfigCmd : SessionConfigCommand (opcode = 0x3) { //SESSION_SET_APP_CONFIG
887    session_token: 32, // Session ID or Session Handle (based on UWBS version)
888    _count_(tlvs): 8,
889    tlvs: AppConfigTlv[]
890}
891
892test SessionSetAppConfigCmd {
893    "\x21\x03\x00\x05\x00\x00\x00\x01\x02\x03\x04\x00",
894}
895
896struct AppConfigStatus {
897    cfg_id: AppConfigTlvType,
898    status: StatusCode,
899}
900
901packet SessionSetAppConfigRsp : SessionConfigResponse (opcode = 0x3) { //SESSION_SET_APP_CONFIG
902    status: StatusCode,
903    _count_(cfg_status): 8,
904    cfg_status: AppConfigStatus[],
905}
906
907test SessionSetAppConfigRsp {
908    "\x41\x03\x00\x04\x00\x00\x00\x01\x01\x01\x00",
909}
910
911packet SessionGetAppConfigCmd : SessionConfigCommand (opcode = 0x4) { //SESSION_GET_APP_CONFIG
912    session_token: 32, // Session ID or Session Handle (based on UWBS version)
913    _count_(app_cfg): 8,
914    app_cfg: 8[], // AppConfigTlvType (Infra does not allow array of enums)
915}
916
917test SessionGetAppConfigCmd {
918    "\x21\x04\x00\x05\x00\x00\x00\x01\x02\x03\x04\x00",
919}
920
921packet SessionGetAppConfigRsp : SessionConfigResponse (opcode = 0x4) { //SESSION_GET_APP_CONFIG
922    status: StatusCode,
923    _count_(tlvs): 8,
924    tlvs: AppConfigTlv[],
925}
926
927test SessionGetAppConfigRsp {
928    "\x41\x04\x00\x02\x00\x00\x00\x01\x00",
929}
930
931packet SessionGetCountCmd : SessionConfigCommand (opcode = 0x5) { //SESSION_GET_COUNT
932}
933
934test SessionGetCountCmd {
935    "\x21\x05\x00\x00\x00\x00\x00",
936}
937
938packet SessionGetCountRsp : SessionConfigResponse (opcode = 0x5) { //SESSION_GET_COUNT
939    status: StatusCode,
940    session_count: 8,
941}
942
943test SessionGetCountRsp {
944    "\x41\x05\x00\x02\x00\x00\x00\x00\x01",
945}
946
947packet SessionGetStateCmd : SessionConfigCommand (opcode = 0x6) { //SESSION_GET_STATE
948    session_token: 32, // Session ID or Session Handle (based on UWBS version)
949}
950
951test SessionGetStateCmd {
952    "\x21\x06\x00\x04\x00\x00\x00\x00\x01\x02\x03",
953}
954
955packet SessionGetStateRsp : SessionConfigResponse (opcode = 0x6) { //SESSION_GET_STATE
956    status: StatusCode,
957    session_state: SessionState,
958}
959
960test SessionGetStateRsp {
961    "\x41\x06\x00\x02\x00\x00\x00\x00\x01",
962}
963
964packet SessionUpdateDtTagRangingRoundsCmd : SessionConfigCommand (opcode = 0x9) { //SESSION_UPDATE_ACTIVE_ROUNDS_DT_TAG
965    session_token: 32, // Session ID or Session Handle (based on UWBS version)
966    _count_(ranging_round_indexes): 8,
967    ranging_round_indexes: 8[],
968}
969
970test SessionUpdateDtTagRangingRoundsCmd {
971    "\x21\x09\x00\x0a\x00\x00\x00\x03\x03\x0f\x0c\x05\x08\x00\x00\x00\x00",
972}
973
974packet SessionUpdateDtTagRangingRoundsRsp : SessionConfigResponse (opcode = 0x9) { //SESSION_UPDATE_ACTIVE_ROUNDS_DT_TAG
975    status: StatusCode,
976    _count_(ranging_round_indexes): 8,
977    ranging_round_indexes: 8[],
978}
979
980test SessionUpdateDtTagRangingRoundsRsp {
981    "\x41\x09\x00\x03\x00\x00\x00\x01\x01\x01",
982}
983
984struct Controlee {
985    short_address: 8[2],
986    subsession_id: 32,
987}
988
989struct Controlee_V2_0_16_Byte_Version {
990    short_address: 8[2],
991    subsession_id: 32,
992    subsession_key: 8[16],
993}
994
995struct Controlee_V2_0_32_Byte_Version {
996    short_address: 8[2],
997    subsession_id: 32,
998    subsession_key: 8[32],
999}
1000
1001enum UpdateMulticastListAction: 8 {
1002    ADD_CONTROLEE = 0x00,
1003    REMOVE_CONTROLEE = 0x01,
1004    ADD_CONTROLEE_WITH_SHORT_SUB_SESSION_KEY = 0x02,
1005    ADD_CONTROLEE_WITH_LONG_SUB_SESSION_KEY = 0x03,
1006}
1007
1008packet SessionUpdateControllerMulticastListCmd : SessionConfigCommand (opcode = 0x7) { //SESSION_UPDATE_CONTROLLER_MULTICAST_LIST
1009    session_token: 32, // Session ID or Session Handle (based on UWBS version)
1010    action: UpdateMulticastListAction,
1011    _payload_,
1012}
1013
1014
1015struct SessionUpdateControllerMulticastListCmdPayload {
1016    _count_(controlees): 8,
1017    controlees: Controlee[],
1018}
1019
1020struct SessionUpdateControllerMulticastListCmd_2_0_16_Byte_Payload {
1021    _count_(controlees): 8,
1022    controlees: Controlee_V2_0_16_Byte_Version[],
1023}
1024
1025struct SessionUpdateControllerMulticastListCmd_2_0_32_Byte_Payload {
1026    _count_(controlees): 8,
1027    controlees: Controlee_V2_0_32_Byte_Version[],
1028}
1029
1030packet SessionUpdateControllerMulticastListRsp : SessionConfigResponse (opcode = 0x7) { //SESSION_UPDATE_CONTROLLER_MULTICAST_LIST
1031    _payload_,
1032}
1033
1034test SessionUpdateControllerMulticastListRsp {
1035    "\x41\x07\x00\x01\x00\x00\x00\x00",
1036}
1037
1038struct SessionUpdateControllerMulticastListRspV1Payload {
1039    status: StatusCode,
1040}
1041
1042struct SessionUpdateControllerMulticastListRspV2Payload {
1043    status: StatusCode,
1044    _count_(controlee_status): 8,
1045    controlee_status: ControleeStatusV2[],
1046}
1047
1048struct ControleeStatusV1 {
1049    mac_address: 8[2],
1050    subsession_id: 32,
1051    status: MulticastUpdateStatusCode,
1052}
1053
1054struct ControleeStatusV2 {
1055    mac_address: 8[2],
1056    status: MulticastUpdateStatusCode,
1057}
1058
1059packet SessionUpdateControllerMulticastListNtf : SessionConfigNotification (opcode = 0x7) { //SESSION_UPDATE_CONTROLLER_MULTICAST_LIST
1060    session_token: 32, // Session ID or Session Handle (based on UWBS version)
1061    _payload_,
1062}
1063
1064test SessionUpdateControllerMulticastListNtf {
1065    "\x61\x07\x00\x06\x00\x00\x00\x00\x01\x02\x03\x04\x00",
1066}
1067
1068struct SessionUpdateControllerMulticastListNtfV1Payload {
1069    remaining_multicast_list_size: 8,
1070    _count_(controlee_status): 8,
1071    controlee_status: ControleeStatusV1[],
1072}
1073
1074struct SessionUpdateControllerMulticastListNtfV2Payload {
1075    _count_(controlee_status): 8,
1076    controlee_status: ControleeStatusV2[],
1077}
1078
1079packet DataCreditNtf : SessionControlNotification (opcode = 0x04) { // SESSION_DATA_CREDIT_NTF
1080    session_token: 32, // Session ID or Session Handle (based on UWBS version)
1081    credit_availability: CreditAvailability,
1082}
1083
1084test DataCreditNtf {
1085    "\x62\x04\x00\x05\x00\x00\x00\x00\x00\x00\x01\x01",
1086}
1087
1088packet DataTransferStatusNtf : SessionControlNotification (opcode = 0x05) { // SESSION_DATA_TRANSFER_STATUS_NTF
1089    session_token: 32, // Session ID or Session Handle (based on UWBS version)
1090    uci_sequence_number: 16,
1091    status: DataTransferNtfStatusCode,
1092    tx_count: 8,
1093}
1094
1095test DataTransferStatusNtf {
1096    "\x62\x05\x00\x06\x00\x00\x00\x00\x00\x00\x01\x01\x00\x00",
1097}
1098
1099packet SessionQueryMaxDataSizeCmd : SessionConfigCommand (opcode = 0xB) { //QUERY_MAX_DATA_SIZE
1100    session_token: 32, // Session ID or Session Handle (based on UWBS version)
1101}
1102
1103test SessionQueryMaxDataSizeCmd {
1104 "\x21\x0B\x00\x04\x00\x00\x00\x00",
1105}
1106
1107packet SessionQueryMaxDataSizeRsp : SessionConfigResponse (opcode = 0xB) { //QUER_MAX_DATA_SIZE
1108    session_token: 32, // Session ID or Session Handle (based on UWBS version)
1109    status: StatusCode,
1110    max_data_size: 16,
1111}
1112
1113test SessionQueryMaxDataSizeRsp {
1114  "\x41\x0B\x00\x06\x00\x00\x00\x00\x00\x0E7\0x07",
1115}
1116
1117packet SessionDataTransferPhaseConfigCmd : SessionConfigCommand (opcode = 0x0e) { //SESSION_DATA_TRANSFER_PHASE_CONFIGURATION
1118    session_token: 32, // Session ID or Session Handle (based on UWBS version)
1119    dtpcm_repetition: 8,
1120    data_transfer_control: 8,
1121    dtpml_size: 8,
1122    _payload_,
1123}
1124
1125packet SessionDataTransferPhaseConfigRsp : SessionConfigResponse (opcode = 0x0e) { //SESSION_DATA_TRANSFER_PHASE_CONFIGURATION
1126    status: StatusCode,
1127}
1128
1129packet SessionDataTransferPhaseConfigNtf : SessionConfigNotification (opcode = 0x0e) { //SESSION_DATA_TRANSFER_PHASE_CONFIGURATION
1130    session_token: 32, // Session ID or Session Handle (based on UWBS version)
1131    status: DataTransferPhaseConfigUpdateStatusCode,
1132}
1133
1134test SessionDataTransferPhaseConfigNtf {
1135    "\x61\x0E\x00\x05\x00\x00\x00\x00\x00"
1136}
1137
1138struct PhaseListShortMacAddress {
1139    session_token: 32,
1140    start_slot_index: 16,
1141    end_slot_index: 16,
1142    phase_participation: 8,
1143    mac_address: 8[2],
1144}
1145
1146struct PhaseListExtendedMacAddress {
1147    session_token: 32,
1148    start_slot_index: 16,
1149    end_slot_index: 16,
1150    phase_participation: 8,
1151    mac_address: 8[8],
1152}
1153
1154packet SessionSetHybridControllerConfigCmd : SessionConfigCommand (opcode = 0x0C) { //SESSION_SET_HUS_CONTROLLER_CONFIG
1155    session_token: 32,
1156    message_control: 8,
1157    number_of_phases: 8,
1158    update_time: 8[8],
1159    _payload_,
1160}
1161
1162test SessionSetHybridControllerConfigCmd {
1163"\x21\x0C\x00\x23\x03\x00\x00\x01\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x05\x01\x00\x19\x00\x00\x30\x00\x02\x00\x00\x03\x1A\x00\x32\x00\x00\x30\x00",
1164}
1165
1166packet SessionSetHybridControllerConfigRsp : SessionConfigResponse (opcode = 0x0C) { //SESSION_SET_HUS_CONTROLLER_CONFIG
1167    status: StatusCode,
1168}
1169
1170test SessionSetHybridControllerConfigRsp {
1171     "\x41\x0C\x00\x01\x00"
1172}
1173
1174struct ControleePhaseList {
1175    session_token: 32,
1176    phase_participation: 8,
1177}
1178
1179packet SessionSetHybridControleeConfigCmd : SessionConfigCommand (opcode = 0x0D) { //SESSION_SET_HUS_CONTROLEE_CONFIG
1180    session_token: 32,
1181    _count_(controlee_phase_list): 8,
1182    controlee_phase_list: ControleePhaseList[],
1183}
1184
1185test SessionSetHybridControleeConfigCmd {
1186    "\x21\x0D\x00\x0F\x03\x00\x00\x01\x02\x01\x00\x00\x05\x02\x02\x00\x00\x03\x02",
1187}
1188
1189packet SessionSetHybridControleeConfigRsp : SessionConfigResponse (opcode = 0x0D) { //SESSION_SET_HUS_CONTROLEE_CONFIG
1190    status: StatusCode,
1191}
1192
1193test SessionSetHybridControleeConfigRsp {
1194     "\x41\x0D\x00\x01\x00"
1195}
1196
1197packet SessionStartCmd : SessionControlCommand (opcode = 0x0) { //RANGE_START
1198    session_token: 32, // Session ID or Session Handle (based on UWBS version)
1199}
1200
1201test SessionStartCmd {
1202    "\x22\x00\x00\x04\x00\x00\x00\x00\x01\x02\x03",
1203}
1204
1205packet SessionStartRsp : SessionControlResponse (opcode = 0x0) { //RANGE_START
1206    status: StatusCode,
1207}
1208
1209test SessionStartRsp {
1210    "\x42\x00\x00\x01\x00\x00\x00\x00",
1211}
1212
1213struct ShortAddressTwoWayRangingMeasurement {
1214    mac_address: 16,
1215    status: StatusCode,
1216    nlos: 8,
1217    distance: 16,
1218    aoa_azimuth: 16,
1219    aoa_azimuth_fom: 8,
1220    aoa_elevation: 16,
1221    aoa_elevation_fom: 8,
1222    aoa_destination_azimuth: 16,
1223    aoa_destination_azimuth_fom: 8,
1224    aoa_destination_elevation: 16,
1225    aoa_destination_elevation_fom: 8,
1226    slot_index: 8,
1227    rssi: 8,
1228    // b/272301550: The pdl compiler cannot handle individual fields
1229    // larger than 64 bit. The work around is to split the 88 bit
1230    // field into two.
1231    _reserved_: 64,
1232    _reserved_: 24,
1233}
1234
1235struct ExtendedAddressTwoWayRangingMeasurement {
1236    mac_address: 64,
1237    status: StatusCode,
1238    nlos: 8,
1239    distance: 16,
1240    aoa_azimuth: 16,
1241    aoa_azimuth_fom: 8,
1242    aoa_elevation: 16,
1243    aoa_elevation_fom: 8,
1244    aoa_destination_azimuth: 16,
1245    aoa_destination_azimuth_fom: 8,
1246    aoa_destination_elevation: 16,
1247    aoa_destination_elevation_fom: 8,
1248    slot_index: 8,
1249    rssi: 8,
1250    _reserved_: 40,
1251}
1252
1253struct ShortAddressOwrAoaRangingMeasurement {
1254    mac_address: 16,
1255    status: StatusCode,
1256    nlos: 8,
1257    frame_sequence_number: 8,
1258    block_index: 16,
1259    aoa_azimuth: 16,
1260    aoa_azimuth_fom: 8,
1261    aoa_elevation: 16,
1262    aoa_elevation_fom: 8,
1263}
1264
1265struct ExtendedAddressOwrAoaRangingMeasurement {
1266    mac_address: 64,
1267    status: StatusCode,
1268    nlos: 8,
1269    frame_sequence_number: 8,
1270    block_index: 16,
1271    aoa_azimuth: 16,
1272    aoa_azimuth_fom: 8,
1273    aoa_elevation: 16,
1274    aoa_elevation_fom: 8,
1275}
1276
1277enum RangingMeasurementType : 8 {
1278    ONE_WAY = 0x0,
1279    TWO_WAY = 0x1,
1280    DL_TDOA = 0x02,
1281    OWR_AOA = 0x03,
1282}
1283
1284packet SessionInfoNtf : SessionControlNotification (opcode = 0x0) { // SESSION_INFO
1285    sequence_number: 32,
1286    session_token: 32, // Session ID or Session Handle (based on UWBS version)
1287    rcr_indicator: 8,
1288    current_ranging_interval: 32,
1289    ranging_measurement_type: RangingMeasurementType,
1290    _reserved_: 8,
1291    mac_address_indicator: MacAddressIndicator,
1292    _reserved_: 64,
1293    _body_,
1294}
1295
1296packet ShortMacTwoWaySessionInfoNtf : SessionInfoNtf (ranging_measurement_type = TWO_WAY, mac_address_indicator = SHORT_ADDRESS) {
1297    _count_(two_way_ranging_measurements) : 8,
1298    two_way_ranging_measurements : ShortAddressTwoWayRangingMeasurement[],
1299    vendor_data: 8[],
1300}
1301
1302test ShortMacTwoWaySessionInfoNtf {
1303    "\x62\x00\x00\x19\x00\x00\x00\x00\x02\x03\x04\x05\x06\x07\x08\x00\x0a\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
1304}
1305
1306packet ExtendedMacTwoWaySessionInfoNtf : SessionInfoNtf (ranging_measurement_type = TWO_WAY, mac_address_indicator = EXTENDED_ADDRESS) {
1307    _count_(two_way_ranging_measurements) : 8,
1308    two_way_ranging_measurements : ExtendedAddressTwoWayRangingMeasurement[],
1309    vendor_data: 8[],
1310}
1311
1312test ExtendedMacTwoWaySessionInfoNtf {
1313    "\x62\x00\x00\x19\x00\x00\x00\x00\x02\x03\x04\x05\x06\x07\x08\x00\x0a\x01\x01\x01\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00",
1314}
1315
1316packet ShortMacDlTDoASessionInfoNtf : SessionInfoNtf (ranging_measurement_type = DL_TDOA, mac_address_indicator = SHORT_ADDRESS) {
1317    no_of_ranging_measurements : 8,
1318    dl_tdoa_measurements : 8[],
1319}
1320
1321test ShortMacDlTDoASessionInfoNtf {
1322     "\x62\x00\x00\x19\x00\x00\x00\x00\x02\x03\x04\x05\x06\x07\x08\x00\x0a\x02\x01\x01\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
1323}
1324
1325packet ExtendedMacDlTDoASessionInfoNtf : SessionInfoNtf (ranging_measurement_type = DL_TDOA, mac_address_indicator = EXTENDED_ADDRESS) {
1326    no_of_ranging_measurements : 8,
1327    dl_tdoa_measurements : 8[],
1328}
1329
1330test ExtendedMacDlTDoASessionInfoNtf {
1331     "\x62\x00\x00\x19\x00\x00\x00\x00\x02\x03\x04\x05\x06\x07\x08\x00\x0a\x01\x01\x01\x02\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00",
1332}
1333
1334packet ShortMacOwrAoaSessionInfoNtf : SessionInfoNtf (ranging_measurement_type = OWR_AOA, mac_address_indicator = SHORT_ADDRESS) {
1335    _count_(owr_aoa_ranging_measurements) : 8,
1336    owr_aoa_ranging_measurements : ShortAddressOwrAoaRangingMeasurement[],
1337    vendor_data: 8[],
1338}
1339
1340test ShortMacOwrAoaSessionInfoNtf {
1341    "\x62\x00\x00\x19\x00\x00\x00\x00\x02\x03\x04\x05\x06\x07\x08\x00\x0a\x01\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
1342    "\x62\x00\x00\x26\x00\x00\x00\x00\x02\x03\x04\x05\x06\x07\x08\x00\x0a\x01\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xaa\xbb\x00\x00\x01\x01\x00\x03\x04\x60\x05\x06\x50",
1343}
1344
1345packet ExtendedMacOwrAoaSessionInfoNtf : SessionInfoNtf (ranging_measurement_type = OWR_AOA, mac_address_indicator = EXTENDED_ADDRESS) {
1346    _count_(owr_aoa_ranging_measurements) : 8,
1347    owr_aoa_ranging_measurements : ExtendedAddressOwrAoaRangingMeasurement[],
1348    vendor_data: 8[],
1349}
1350
1351test ExtendedMacOwrAoaSessionInfoNtf {
1352    "\x62\x00\x00\x19\x00\x00\x00\x00\x02\x03\x04\x05\x06\x07\x08\x00\x0a\x01\x01\x01\x03\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00",
1353    "\x62\x00\x00\x2c\x00\x00\x00\x00\x02\x03\x04\x05\x06\x07\x08\x00\x0a\x01\x01\x01\x03\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\xaa\xbb\xcc\xdd\x01\x02\x03\x04\x00\x00\x01\x01\x00\x03\x04\x60\x05\x06\x50",
1354}
1355
1356packet SessionStopCmd : SessionControlCommand (opcode = 0x1) { // SESSION_STOP
1357    session_token: 32, // Session ID or Session Handle (based on UWBS version)
1358}
1359
1360test SessionStopCmd {
1361    "\x22\x01\x00\x04\x00\x00\x00\x00\x02\x03\x04",
1362}
1363
1364packet SessionStopRsp : SessionControlResponse (opcode = 0x1) { // SESSION_STOP
1365    status: StatusCode,
1366}
1367
1368test SessionStopRsp {
1369    "\x42\x01\x00\x01\x00\x00\x00\x00",
1370}
1371
1372packet SessionGetRangingCountCmd : SessionControlCommand (opcode = 0x3) { // SESSION_GET_RANGING_COUNT
1373    session_token: 32, // Session ID or Session Handle (based on UWBS version)
1374}
1375
1376test SessionGetRangingCountCmd {
1377    "\x22\x03\x00\x04\x00\x00\x00\x00\x02\x03\x04",
1378}
1379
1380packet SessionGetRangingCountRsp : SessionControlResponse (opcode = 0x3) { // SESSION_GET_RANGING_COUNT
1381    status: StatusCode,
1382    count: 32,
1383}
1384
1385test SessionGetRangingCountRsp {
1386    "\x42\x03\x00\x05\x00\x00\x00\x00\x02\x03\x04\x05",
1387}
1388
1389packet AndroidGetPowerStatsCmd: AndroidCommand (opcode = 0x0) { //ANDROID_GET_POWER_STATS
1390}
1391
1392test AndroidGetPowerStatsCmd {
1393    "\x2c\x00\x00\x00\x00\x00\x00",
1394}
1395
1396struct PowerStats {
1397    status: StatusCode,
1398    idle_time_ms: 32,
1399    tx_time_ms: 32,
1400    rx_time_ms: 32,
1401    total_wake_count:32,
1402}
1403
1404packet AndroidGetPowerStatsRsp : AndroidResponse (opcode = 0x0) { //ANDROID_GET_POWER_STATS
1405    stats: PowerStats,
1406}
1407
1408test AndroidGetPowerStatsRsp {
1409    "\x4c\x00\x00\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
1410}
1411
1412packet AndroidSetCountryCodeCmd: AndroidCommand (opcode = 0x1) { //ANDROID_SET_COUNTRY_CODE
1413    country_code : 8[2],
1414}
1415
1416// Set country code to US.
1417test AndroidSetCountryCodeCmd {
1418    "\x2c\x01\x00\x02\x00\x00\x00\x55\x53",
1419}
1420
1421packet AndroidSetCountryCodeRsp : AndroidResponse (opcode = 0x1) { //ANDROID_SET_COUNTRY_CODE
1422    status: StatusCode,
1423}
1424
1425test AndroidSetCountryCodeRsp {
1426    "\x4c\x01\x00\x01\x00\x00\x00\x00",
1427}
1428
1429struct FrameReportTlv {
1430    t: FrameReportTlvType,
1431    _size_(v): 16,
1432    v: 8[],
1433}
1434
1435packet FrameReportTlvPacket {
1436    t: FrameReportTlvType,
1437    _size_(_body_): 16,
1438    _body_,
1439}
1440
1441packet Rssi : FrameReportTlvPacket (t = RSSI) {
1442    rssi: 8[],
1443}
1444
1445struct AoaMeasurement {
1446    tdoa: 16,
1447    pdoa: 16,
1448    aoa: 16,
1449    fom: 8,
1450    t: 8,
1451}
1452
1453packet Aoa : FrameReportTlvPacket (t = AOA) {
1454    aoa: AoaMeasurement[],
1455}
1456
1457test Aoa {
1458    "\x01\x08\x00\x00\x01\x00\x01\x00\x01\x01\x01",
1459}
1460
1461struct CirValue {
1462    first_path_index : 16,
1463    first_path_snr: 16,
1464    first_path_ns: 16,
1465    peak_path_index: 16,
1466    peak_path_snr: 16,
1467    peak_path_ns: 16,
1468    first_path_sample_offset: 8,
1469    samples_number: 8,
1470    _size_(sample_window): 16,
1471    sample_window: 8[],
1472}
1473
1474packet Cir : FrameReportTlvPacket (t = CIR) {
1475    _count_(cir_value): 8,
1476    cir_value: CirValue[],
1477}
1478
1479test Cir {
1480    "\x02\x15\x00\x01\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x00\x02\x04\x00\x01\x02\x03\x04",
1481}
1482
1483packet SegmentMetrics : FrameReportTlvPacket (t = SEGMENT_METRICS) {
1484    segment_metrics: SegmentMetricsValue[],
1485}
1486
1487enum SegmentIdValue: 3 {
1488    Ipatov = 0,
1489    Sts0 = 1,
1490    Sts1 = 2,
1491    Sts2 = 3,
1492    Sts3 = 4,
1493}
1494
1495struct ReceiverAndSegmentValue {
1496    segment_id: SegmentIdValue,
1497    receiver_is_controller: 1,
1498    receiver_id: 4,
1499}
1500
1501struct PathSample {
1502    index: 16,
1503    rsl: 16, // Q8.8
1504    time_ns: 16, // Q6.9
1505}
1506
1507struct SegmentMetricsValue {
1508    receiver_and_segment: ReceiverAndSegmentValue,
1509    rf_noise_floor: 16, // Q8.8
1510    segment_rsl: 16, // Q8.8
1511    first_path: PathSample,
1512    peak_path: PathSample,
1513}
1514
1515test SegmentMetrics {
1516    "\x08\xB0\xFF\x04\x3C\xE1\x02\xA1\xFF\x52\xB8\xE3\x02\xC4\xFF\xC0\xB8",
1517}
1518
1519struct FrameReport {
1520    uwb_msg_id: 8,
1521    action: 8,
1522    antenna_set: 8,
1523    _count_(frame_report_tlvs): 8,
1524    frame_report_tlvs: FrameReportTlv[],
1525}
1526
1527packet AndroidRangeDiagnosticsNtf : AndroidNotification (opcode = 0x2) { //FIRA_RANGE_DIAGNOSTICS
1528    session_token: 32, // Session ID or Session Handle (based on UWBS version)
1529    sequence_number: 32,
1530    _count_(frame_reports): 8,
1531    frame_reports: FrameReport[],
1532}
1533
1534test AndroidRangeDiagnosticsNtf {
1535    "\x6c\x02\x00\x11\x00\x00\x00\x01\x01\x01\x01\x02\x02\x02\x02\x01\x00\x01\x02\x01\x00\x01\x00\x00",
1536    "\x6c\x02\x00\x34\x00\x00\x00\x01\x01\x01\x01\x02\x02\x02\x02\x01\x00\x01\x02\x03\x01\x08\x00\x01\x02\x01\x02\x01\x02\x01\x01\x02\x15\x00\x01\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x00\x02\x04\x00\x01\x02\x03\x04\x00\x01\x00\x00",
1537}
1538
1539packet UciVendor_9_Response : UciResponse (group_id = VENDOR_RESERVED_9) {
1540    _payload_,
1541}
1542
1543packet UciVendor_A_Response : UciResponse (group_id = VENDOR_RESERVED_A) {
1544    _payload_,
1545}
1546
1547packet UciVendor_B_Response : UciResponse (group_id = VENDOR_RESERVED_B) {
1548    _payload_,
1549}
1550
1551packet UciVendor_E_Response : UciResponse (group_id = VENDOR_RESERVED_E) {
1552    _payload_,
1553}
1554
1555packet UciVendor_F_Response : UciResponse (group_id = VENDOR_RESERVED_F) {
1556    _payload_,
1557}
1558
1559packet UciVendor_9_Notification : UciNotification (group_id = VENDOR_RESERVED_9) {
1560    _payload_,
1561}
1562
1563packet UciVendor_A_Notification : UciNotification (group_id = VENDOR_RESERVED_A) {
1564    _payload_,
1565}
1566
1567packet UciVendor_B_Notification : UciNotification (group_id = VENDOR_RESERVED_B) {
1568    _payload_,
1569}
1570
1571packet UciVendor_E_Notification : UciNotification (group_id = VENDOR_RESERVED_E) {
1572    _payload_,
1573}
1574
1575packet UciVendor_F_Notification : UciNotification (group_id = VENDOR_RESERVED_F) {
1576    _payload_,
1577}
1578
1579enum RadarDataType : 8 {
1580    RADAR_SWEEP_SAMPLES = 0x00,
1581}
1582
1583enum RadarConfigTlvType : 8 {
1584    RADAR_TIMING_PARAMS = 0x00,
1585    SAMPLES_PER_SWEEP = 0x01,
1586    CHANNEL_NUMBER = 0x02,
1587    SWEEP_OFFSET = 0x03,
1588    RFRAME_CONFIG = 0x04,
1589    PREAMBLE_DURATION = 0x05,
1590    PREAMBLE_CODE_INDEX = 0x06,
1591    SESSION_PRIORITY = 0x07,
1592    BITS_PER_SAMPLE = 0x08,
1593    PRF_MODE = 0x09,
1594    NUMBER_OF_BURSTS = 0x0A,
1595    RADAR_DATA_TYPE = 0x0B,
1596
1597    RFU_RADAR_APP_CFG_TLV_TYPE_RANGE = 0x0C..0x9F,
1598
1599    VENDOR_SPECIFIC_RADAR_APP_CFG_TLV_TYPE_RANGE = 0xA0..0xDF,
1600}
1601
1602struct RadarConfigTlv {
1603    cfg_id: RadarConfigTlvType,
1604    _count_(v): 8,
1605    v: 8[],
1606}
1607
1608struct RadarConfigStatus {
1609    cfg_id: RadarConfigTlvType,
1610    status: StatusCode,
1611}
1612
1613packet AndroidSetRadarConfigCmd: AndroidCommand (opcode = 0x11) {
1614    session_token: 32,
1615    _count_(tlvs): 8,
1616    tlvs: RadarConfigTlv[]
1617}
1618
1619packet AndroidSetRadarConfigRsp : AndroidResponse (opcode = 0x11) {
1620    status: StatusCode,
1621    _count_(cfg_status): 8,
1622    cfg_status: RadarConfigStatus[],
1623}
1624
1625packet AndroidGetRadarConfigCmd: AndroidCommand (opcode = 0x12) {
1626    session_token: 32,
1627    _count_(tlvs): 8,
1628    tlvs: 8[], // RadarConfigTlvType (Infra does not allow array of enums)
1629}
1630
1631packet AndroidGetRadarConfigRsp : AndroidResponse (opcode = 0x12) {
1632    status: StatusCode,
1633    _count_(tlvs): 8,
1634    tlvs: RadarConfigTlv[],
1635}
1636
1637enum BitsPerSample : 8 {
1638    VALUE_32 = 0x00,
1639    VALUE_48 = 0x01,
1640    VALUE_64 = 0x02
1641}
1642
1643struct RadarSweepDataRaw {
1644    sequence_number: 32,
1645    timestamp: 32,
1646    _count_(vendor_specific_data): 8,
1647    vendor_specific_data: 8[],
1648    sample_data: 8[],
1649}
1650
1651packet RadarDataRcv : UciDataPacket (data_packet_format = RADAR_DATA_MESSAGE, message_type = DATA) {
1652    session_handle: 32,
1653    status: DataRcvStatusCode,
1654    radar_data_type: RadarDataType,
1655    number_of_sweeps: 8,
1656    samples_per_sweep: 8,
1657    bits_per_sample: BitsPerSample,
1658    sweep_offset: 16,
1659    sweep_data_size: 16,
1660    sweep_data: 8[],
1661}
1662
1663struct RfTestConfigTlv {
1664    cfg_id: RfTestConfigTlvType,
1665    _count_(v): 8,
1666    v: 8[],
1667}
1668
1669packet SessionSetRfTestConfigCmd : TestCommand (opcode = 0x00) {
1670    session_token: 32, // Session ID or Session Handle (based on UWBS version)
1671    _count_(tlvs): 8,
1672    tlvs: RfTestConfigTlv[]
1673}
1674
1675test SessionSetRfTestConfigCmd {
1676    "\x2D\x00\x00\x08\x01\x00\x00\x0D\x01\x08\x01\x00",
1677}
1678
1679struct RfTestConfigStatus {
1680    cfg_id: RfTestConfigTlvType,
1681    status: StatusCode,
1682}
1683
1684packet SessionSetRfTestConfigRsp : TestResponse (opcode = 0x00) {
1685    status: StatusCode,
1686    _count_(cfg_status): 8,
1687    cfg_status: RfTestConfigStatus[],
1688}
1689
1690test SessionSetRfTestConfigRsp {
1691    "\x4D\x00\x00\x02\x00\x00",
1692}
1693
1694packet TestPeriodicTxCmd : TestCommand (opcode = 0x02) {
1695    psdu_data : 8[],
1696}
1697
1698test TestPeriodicTxCmd {
1699    "\x2D\x02\x00\x0a\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09",
1700}
1701
1702packet TestPeriodicTxRsp : TestResponse (opcode = 0x02) {
1703    status: StatusCode,
1704}
1705
1706test TestPeriodicTxRsp {
1707    "\x4D\x02\x00\x01\x00",
1708}
1709
1710packet TestPeriodicTxNtf : TestNotification (opcode = 0x02) {
1711    status: StatusCode,
1712    vendor_data: 8[],
1713}
1714
1715test TestPeriodicTxNtf {
1716    "\x6D\x02\x00\x01\x00",
1717}
1718
1719packet StopRfTestCmd : TestCommand (opcode = 0x07) { }
1720
1721test StopRfTestCmd { "\x2D\x07\x00\x00", }
1722
1723packet StopRfTestRsp : TestResponse (opcode = 0x07) {
1724    status: StatusCode,
1725}
1726
1727test StopRfTestRsp { "\x4D\x07\x00\x01\x00", }
1728