Lines Matching full:uci
1 use crate::packets::uci;
4 /// [UCI] 8.3 Application Configuration Parameters.
14 /// [UCI] 8.3 Application Configuration Parameters.
17 /// See [UCI] Table 45: APP Configuration Parameters IDs
24 pub device_type: Option<uci::DeviceType>,
25 pub ranging_round_usage: Option<uci::RangingRoundUsage>,
26 pub sts_config: uci::StsConfig,
27 pub multi_node_mode: Option<uci::MultiNodeMode>,
28 channel_number: uci::ChannelNumber,
45 mac_fcs_type: uci::MacFcsType,
47 aoa_result_req: uci::AoaResultReq,
48 pub session_info_ntf_config: uci::SessionInfoNtfConfig,
51 pub device_role: Option<uci::DeviceRole>,
52 rframe_config: uci::RframeConfig,
53 rssi_reporting: uci::RssiReporting,
56 psdu_data_rate: uci::PsduDataRate,
57 preamble_duration: uci::PreambleDuration,
58 link_layer_mode: uci::LinkLayerMode,
60 ranging_time_struct: uci::RangingTimeStruct,
63 prf_mode: uci::PrfMode,
66 pub schedule_mode: Option<uci::ScheduleMode>,
67 key_rotation: uci::KeyRotation,
70 pub mac_address_mode: uci::MacAddressMode,
76 hopping_mode: uci::HoppingMode,
81 bprf_phr_data_rate: uci::BprfPhrDataRate,
83 sts_length: uci::StsLength,
89 pub session_data_transfer_status_ntf_config: uci::SessionDataTransferStatusNtfConfig,
99 sts_config: uci::StsConfig::Static, in default()
101 channel_number: uci::ChannelNumber::ChannelNumber9, in default()
108 mac_fcs_type: uci::MacFcsType::Crc16, in default()
112 aoa_result_req: uci::AoaResultReq::AoaEnabled, in default()
113 session_info_ntf_config: uci::SessionInfoNtfConfig::Enable, in default()
117 rframe_config: uci::RframeConfig::Sp3, in default()
118 rssi_reporting: uci::RssiReporting::Disable, in default()
121 psdu_data_rate: uci::PsduDataRate::DataRate6m81, in default()
122 preamble_duration: uci::PreambleDuration::Duration64Symbols, in default()
123 link_layer_mode: uci::LinkLayerMode::BypassMode, in default()
125 ranging_time_struct: uci::RangingTimeStruct::BlockBasedScheduling, in default()
128 prf_mode: uci::PrfMode::BprfMode, in default()
133 key_rotation: uci::KeyRotation::Disable, in default()
136 mac_address_mode: uci::MacAddressMode::Mode0, in default()
142 hopping_mode: uci::HoppingMode::Disable, in default()
147 bprf_phr_data_rate: uci::BprfPhrDataRate::DataRate850k, in default()
149 sts_length: uci::StsLength::Length64Symbols, in default()
156 uci::SessionDataTransferStatusNtfConfig::Disable, in default()
167 pub fn set(&mut self, id: uci::AppConfigTlvType, value: &[u8]) -> anyhow::Result<()> { in set()
189 uci::AppConfigTlvType::DeviceType => self.device_type = Some(try_parse(value)?), in set()
190 uci::AppConfigTlvType::RangingRoundUsage => { in set()
193 uci::AppConfigTlvType::StsConfig => self.sts_config = try_parse(value)?, in set()
194 uci::AppConfigTlvType::MultiNodeMode => self.multi_node_mode = Some(try_parse(value)?), in set()
195 uci::AppConfigTlvType::ChannelNumber => self.channel_number = try_parse(value)?, in set()
196 uci::AppConfigTlvType::NumberOfControlees => { in set()
199 uci::AppConfigTlvType::DeviceMacAddress => { in set()
201 uci::MacAddressMode::Mode0 => MacAddress::Short(value.try_into()?), in set()
202 uci::MacAddressMode::Mode1 => unimplemented!(), in set()
203 uci::MacAddressMode::Mode2 => MacAddress::Extended(value.try_into()?), in set()
206 uci::AppConfigTlvType::DstMacAddress => { in set()
208 uci::MacAddressMode::Mode0 => 2, in set()
209 uci::MacAddressMode::Mode1 => unimplemented!(), in set()
210 uci::MacAddressMode::Mode2 => 8, in set()
224 uci::MacAddressMode::Mode0 => MacAddress::Short(value.try_into().unwrap()), in set()
225 uci::MacAddressMode::Mode1 => unimplemented!(), in set()
226 uci::MacAddressMode::Mode2 => { in set()
232 uci::AppConfigTlvType::SlotDuration => self.slot_duration = try_parse_u16(value)?, in set()
233 uci::AppConfigTlvType::RangingDuration => self.ranging_duration = try_parse_u32(value)?, in set()
234 uci::AppConfigTlvType::StsIndex => self.sts_index = try_parse_u32(value)?, in set()
235 uci::AppConfigTlvType::MacFcsType => self.mac_fcs_type = try_parse(value)?, in set()
236 uci::AppConfigTlvType::RangingRoundControl => { in set()
239 uci::AppConfigTlvType::AoaResultReq => self.aoa_result_req = try_parse(value)?, in set()
240 uci::AppConfigTlvType::SessionInfoNtfConfig => { in set()
243 uci::AppConfigTlvType::NearProximityConfig => { in set()
246 uci::AppConfigTlvType::FarProximityConfig => { in set()
249 uci::AppConfigTlvType::DeviceRole => self.device_role = Some(try_parse(value)?), in set()
250 uci::AppConfigTlvType::RframeConfig => self.rframe_config = try_parse(value)?, in set()
251 uci::AppConfigTlvType::RssiReporting => self.rssi_reporting = try_parse(value)?, in set()
252 uci::AppConfigTlvType::PreambleCodeIndex => { in set()
255 uci::AppConfigTlvType::SfdId => self.sfd_id = try_parse_u8(value)?, in set()
256 uci::AppConfigTlvType::PsduDataRate => self.psdu_data_rate = try_parse(value)?, in set()
257 uci::AppConfigTlvType::PreambleDuration => self.preamble_duration = try_parse(value)?, in set()
258 uci::AppConfigTlvType::LinkLayerMode => self.link_layer_mode = try_parse(value)?, in set()
259 uci::AppConfigTlvType::DataRepetitionCount => { in set()
262 uci::AppConfigTlvType::RangingTimeStruct => { in set()
265 uci::AppConfigTlvType::SlotsPerRr => self.slots_per_rr = try_parse_u8(value)?, in set()
266 uci::AppConfigTlvType::AoaBoundConfig => { in set()
281 uci::AppConfigTlvType::PrfMode => self.prf_mode = try_parse(value)?, in set()
282 uci::AppConfigTlvType::CapSizeRange => self.cap_size_range = value.try_into()?, in set()
283 uci::AppConfigTlvType::TxJitterWindowSize => { in set()
286 uci::AppConfigTlvType::ScheduleMode => self.schedule_mode = Some(try_parse(value)?), in set()
287 uci::AppConfigTlvType::KeyRotation => self.key_rotation = try_parse(value)?, in set()
288 uci::AppConfigTlvType::KeyRotationRate => self.key_rotation_rate = try_parse_u8(value)?, in set()
289 uci::AppConfigTlvType::SessionPriority => self.session_priority = try_parse_u8(value)?, in set()
290 uci::AppConfigTlvType::MacAddressMode => self.mac_address_mode = try_parse(value)?, in set()
291 uci::AppConfigTlvType::VendorId => self.vendor_id = try_parse_u16(value)?, in set()
292 uci::AppConfigTlvType::StaticStsIv => self.static_sts_iv = value.try_into()?, in set()
293 uci::AppConfigTlvType::NumberOfStsSegments => { in set()
296 uci::AppConfigTlvType::MaxRrRetry => self.max_rr_retry = try_parse_u16(value)?, in set()
297 uci::AppConfigTlvType::UwbInitiationTime => { in set()
298 // Implement backward compatiblity for UCI 1.0 in set()
305 uci::AppConfigTlvType::HoppingMode => self.hopping_mode = try_parse(value)?, in set()
306 uci::AppConfigTlvType::BlockStrideLength => { in set()
309 uci::AppConfigTlvType::ResultReportConfig => { in set()
312 uci::AppConfigTlvType::InBandTerminationAttemptCount => { in set()
315 uci::AppConfigTlvType::SubSessionId => self.sub_session_id = try_parse_u32(value)?, in set()
316 uci::AppConfigTlvType::BprfPhrDataRate => self.bprf_phr_data_rate = try_parse(value)?, in set()
317 uci::AppConfigTlvType::MaxNumberOfMeasurements => { in set()
320 uci::AppConfigTlvType::StsLength => self.sts_length = try_parse(value)?, in set()
321 uci::AppConfigTlvType::MinFramesPerRr => self.min_frames_per_rr = try_parse_u8(value)?, in set()
322 uci::AppConfigTlvType::MtuSize => self.mtu_size = try_parse_u16(value)?, in set()
323 uci::AppConfigTlvType::InterFrameInterval => { in set()
326 uci::AppConfigTlvType::SessionKey => self.session_key = value.to_vec(), in set()
327 uci::AppConfigTlvType::SubSessionKey => { in set()
334 uci::AppConfigTlvType::SessionDataTransferStatusNtfConfig => { in set()
337 uci::AppConfigTlvType::SessionTimeBase => self.session_time_base = value.try_into()?, in set()
338 uci::AppConfigTlvType::ApplicationDataEndpoint => { in set()
342 uci::AppConfigTlvType::CccHopModeKey in set()
343 | uci::AppConfigTlvType::CccUwbTime0 in set()
344 | uci::AppConfigTlvType::CccRangingProtocolVer in set()
345 | uci::AppConfigTlvType::CccUwbConfigId in set()
346 | uci::AppConfigTlvType::CccPulseshapeCombo in set()
347 | uci::AppConfigTlvType::CccUrskTtl in set()
348 | uci::AppConfigTlvType::CccLastIndexUsed in set()
349 | uci::AppConfigTlvType::NbOfRangeMeasurements in set()
350 | uci::AppConfigTlvType::NbOfAzimuthMeasurements in set()
351 | uci::AppConfigTlvType::NbOfElevationMeasurements in set()
352 | uci::AppConfigTlvType::EnableDiagnostics in set()
353 | uci::AppConfigTlvType::DiagramsFrameReportsFields => { in set()
367 pub fn get(&self, id: uci::AppConfigTlvType) -> anyhow::Result<Vec<u8>> { in get()
369 uci::AppConfigTlvType::DeviceType => Ok(vec![self in get()
373 uci::AppConfigTlvType::RangingRoundUsage => Ok(vec![self in get()
377 uci::AppConfigTlvType::StsConfig => Ok(vec![self.sts_config.into()]), in get()
378 uci::AppConfigTlvType::MultiNodeMode => Ok(vec![self in get()
382 uci::AppConfigTlvType::ChannelNumber => Ok(vec![self.channel_number.into()]), in get()
383 uci::AppConfigTlvType::NumberOfControlees => Ok(vec![self.number_of_controlees]), in get()
384 uci::AppConfigTlvType::DeviceMacAddress => Ok(self in get()
388 uci::AppConfigTlvType::DstMacAddress => Ok(self in get()
393 uci::AppConfigTlvType::SlotDuration => Ok(self.slot_duration.to_le_bytes().to_vec()), in get()
394 uci::AppConfigTlvType::RangingDuration => { in get()
397 uci::AppConfigTlvType::StsIndex => Ok(self.sts_index.to_le_bytes().to_vec()), in get()
398 uci::AppConfigTlvType::MacFcsType => Ok(vec![self.mac_fcs_type.into()]), in get()
399 uci::AppConfigTlvType::RangingRoundControl => Ok(vec![self.ranging_round_control]), in get()
400 uci::AppConfigTlvType::AoaResultReq => Ok(vec![self.aoa_result_req.into()]), in get()
401 uci::AppConfigTlvType::SessionInfoNtfConfig => { in get()
404 uci::AppConfigTlvType::NearProximityConfig => { in get()
407 uci::AppConfigTlvType::FarProximityConfig => { in get()
410 uci::AppConfigTlvType::DeviceRole => Ok(vec![self in get()
414 uci::AppConfigTlvType::RframeConfig => Ok(vec![self.rframe_config.into()]), in get()
415 uci::AppConfigTlvType::RssiReporting => Ok(vec![self.rssi_reporting.into()]), in get()
416 uci::AppConfigTlvType::PreambleCodeIndex => Ok(vec![self.preamble_code_index]), in get()
417 uci::AppConfigTlvType::SfdId => Ok(vec![self.sfd_id]), in get()
418 uci::AppConfigTlvType::PsduDataRate => Ok(vec![self.psdu_data_rate.into()]), in get()
419 uci::AppConfigTlvType::PreambleDuration => Ok(vec![self.preamble_duration.into()]), in get()
420 uci::AppConfigTlvType::LinkLayerMode => Ok(vec![self.link_layer_mode.into()]), in get()
421 uci::AppConfigTlvType::DataRepetitionCount => Ok(vec![self.data_repetition_count]), in get()
422 uci::AppConfigTlvType::RangingTimeStruct => Ok(vec![self.ranging_time_struct.into()]), in get()
423 uci::AppConfigTlvType::SlotsPerRr => Ok(vec![self.slots_per_rr]), in get()
424 uci::AppConfigTlvType::AoaBoundConfig => Ok(self in get()
430 uci::AppConfigTlvType::PrfMode => Ok(vec![self.prf_mode.into()]), in get()
431 uci::AppConfigTlvType::CapSizeRange => Ok(self.cap_size_range.to_vec()), in get()
432 uci::AppConfigTlvType::TxJitterWindowSize => Ok(vec![self.tx_jitter_window_size]), in get()
433 uci::AppConfigTlvType::ScheduleMode => Ok(vec![self in get()
437 uci::AppConfigTlvType::KeyRotation => Ok(vec![self.key_rotation.into()]), in get()
438 uci::AppConfigTlvType::KeyRotationRate => Ok(vec![self.key_rotation_rate]), in get()
439 uci::AppConfigTlvType::SessionPriority => Ok(vec![self.session_priority]), in get()
440 uci::AppConfigTlvType::MacAddressMode => Ok(vec![self.mac_address_mode.into()]), in get()
441 uci::AppConfigTlvType::VendorId => Ok(self.vendor_id.to_le_bytes().to_vec()), in get()
442 uci::AppConfigTlvType::StaticStsIv => Ok(self.static_sts_iv.to_vec()), in get()
443 uci::AppConfigTlvType::NumberOfStsSegments => Ok(vec![self.number_of_sts_segments]), in get()
444 uci::AppConfigTlvType::MaxRrRetry => Ok(self.max_rr_retry.to_le_bytes().to_vec()), in get()
445 uci::AppConfigTlvType::UwbInitiationTime => { in get()
448 uci::AppConfigTlvType::HoppingMode => Ok(vec![self.hopping_mode.into()]), in get()
449 uci::AppConfigTlvType::BlockStrideLength => Ok(vec![self.block_stride_length]), in get()
450 uci::AppConfigTlvType::ResultReportConfig => Ok(vec![self.result_report_config]), in get()
451 uci::AppConfigTlvType::InBandTerminationAttemptCount => { in get()
454 uci::AppConfigTlvType::SubSessionId => Ok(self.sub_session_id.to_le_bytes().to_vec()), in get()
455 uci::AppConfigTlvType::BprfPhrDataRate => Ok(vec![self.bprf_phr_data_rate.into()]), in get()
456 uci::AppConfigTlvType::MaxNumberOfMeasurements => { in get()
459 uci::AppConfigTlvType::StsLength => Ok(vec![self.sts_length.into()]), in get()
460 uci::AppConfigTlvType::MinFramesPerRr => Ok(vec![self.min_frames_per_rr]), in get()
461 uci::AppConfigTlvType::MtuSize => Ok(self.mtu_size.to_le_bytes().to_vec()), in get()
462 uci::AppConfigTlvType::InterFrameInterval => Ok(vec![self.inter_frame_interval]), in get()
463 uci::AppConfigTlvType::SessionKey => Ok(self.session_key.clone()), in get()
464 uci::AppConfigTlvType::SubSessionKey => Ok(match self.sub_session_key { in get()
469 uci::AppConfigTlvType::SessionDataTransferStatusNtfConfig => { in get()
472 uci::AppConfigTlvType::SessionTimeBase => Ok(self.session_time_base.to_vec()), in get()
473 uci::AppConfigTlvType::ApplicationDataEndpoint => { in get()
477 uci::AppConfigTlvType::CccHopModeKey in get()
478 | uci::AppConfigTlvType::CccUwbTime0 in get()
479 | uci::AppConfigTlvType::CccRangingProtocolVer in get()
480 | uci::AppConfigTlvType::CccUwbConfigId in get()
481 | uci::AppConfigTlvType::CccPulseshapeCombo in get()
482 | uci::AppConfigTlvType::CccUrskTtl in get()
483 | uci::AppConfigTlvType::CccLastIndexUsed in get()
484 | uci::AppConfigTlvType::NbOfRangeMeasurements in get()
485 | uci::AppConfigTlvType::NbOfAzimuthMeasurements in get()
486 | uci::AppConfigTlvType::NbOfElevationMeasurements in get()
487 | uci::AppConfigTlvType::EnableDiagnostics in get()
488 | uci::AppConfigTlvType::DiagramsFrameReportsFields => { in get()
511 self.device_role == Some(uci::DeviceRole::Initiator) in can_start_data_transfer()
515 self.device_role == Some(uci::DeviceRole::Responder) in can_receive_data_transfer()