diff options
-rw-r--r-- | src/rust/event_manager/mod.rs | 3 | ||||
-rw-r--r-- | src/rust/uci/uci_hrcv.rs | 12 | ||||
-rw-r--r-- | src/rust/uci_packets.pdl | 22 |
3 files changed, 21 insertions, 16 deletions
diff --git a/src/rust/event_manager/mod.rs b/src/rust/event_manager/mod.rs index 4ffaa32..c83fb68 100644 --- a/src/rust/event_manager/mod.rs +++ b/src/rust/event_manager/mod.rs @@ -22,7 +22,8 @@ use log::error; use num_traits::ToPrimitive; use std::convert::TryInto; use uwb_uci_packets::{ - DeviceStatusNtfPacket, GenericErrorPacket, SessionStatusNtfPacket, ShortMacRangeDataNtfPacket, + DeviceStatusNtfPacket, GenericErrorPacket, SessionStatusNtfPacket, + ShortMacTwoWayRangeDataNtfPacket, }; // TODO: Reconsider the best way to cache the JNIEnv. We currently attach and detach for every diff --git a/src/rust/uci/uci_hrcv.rs b/src/rust/uci/uci_hrcv.rs index 38c7406..9161a86 100644 --- a/src/rust/uci/uci_hrcv.rs +++ b/src/rust/uci/uci_hrcv.rs @@ -45,8 +45,8 @@ pub enum UciNotification { DeviceStatusNtf(DeviceStatusNtfPacket), SessionStatusNtf(SessionStatusNtfPacket), SessionUpdateControllerMulticastListNtf(SessionUpdateControllerMulticastListNtfPacket), - ShortMacRangeDataNtf(ShortMacRangeDataNtfPacket), - ExtendedMacRangeDataNtf(ExtendedMacRangeDataNtfPacket), + ShortMacTwoWayRangeDataNtf(ShortMacTwoWayRangeDataNtfPacket), + ExtendedMacTwoWayRangeDataNtf(ExtendedMacTwoWayRangeDataNtfPacket), } pub fn uci_response(bytes: &[u8]) -> Result<UciResponse, UwbErr> { @@ -251,11 +251,11 @@ fn android_get_power_start_rsp(evt: AndroidGetPowerStatsRspPacket) -> UciRespons fn range_data_ntf(evt: RangeDataNtfPacket) -> Result<UciNotification, UwbErr> { match evt.specialize() { - RangeDataNtfChild::ShortMacRangeDataNtf(evt) => { - Ok(UciNotification::ShortMacRangeDataNtf(evt)) + RangeDataNtfChild::ShortMacTwoWayRangeDataNtf(evt) => { + Ok(UciNotification::ShortMacTwoWayRangeDataNtf(evt)) } - RangeDataNtfChild::ExtendedMacRangeDataNtf(evt) => { - Ok(UciNotification::ExtendedMacRangeDataNtf(evt)) + RangeDataNtfChild::ExtendedMacTwoWayRangeDataNtf(evt) => { + Ok(UciNotification::ExtendedMacTwoWayRangeDataNtf(evt)) } _ => Err(UwbErr::Specialize(evt.to_vec())), } diff --git a/src/rust/uci_packets.pdl b/src/rust/uci_packets.pdl index 5b6c7c1..ce51679 100644 --- a/src/rust/uci_packets.pdl +++ b/src/rust/uci_packets.pdl @@ -617,37 +617,41 @@ struct ExtendedAddressTwoWayRangingMeasurement { _reserved_: 48, } +enum RangingMeasurementType : 8 { + ONE_WAY = 0x0, + TWO_WAY = 0x1, +} + packet RangeDataNtf : RangingNotification (ranging_opcode = RANGE_START) { sequence_number: 32, session_id: 32, - _reserved_: 8, + rcr_indicator: 8, current_ranging_interval: 32, - ranging_measurement_type: 8, + ranging_measurement_type: RangingMeasurementType, _reserved_: 8, mac_address_indicator: MacAddressIndicator, _reserved_: 64, _payload_, } -packet ShortMacRangeDataNtf : RangeDataNtf (mac_address_indicator = SHORT_ADDRESS) { +packet ShortMacTwoWayRangeDataNtf : RangeDataNtf (ranging_measurement_type = TWO_WAY, mac_address_indicator = SHORT_ADDRESS) { _count_(two_way_ranging_measurements) : 8, two_way_ranging_measurements : ShortAddressTwoWayRangingMeasurement[], } -test ShortMacRangeDataNtf { - "\x62\x00\x00\x19\x00\x02\x03\x04\x05\x06\x07\x08\x00\x0a\x0b\x0c\x0d\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", +test ShortMacTwoWayRangeDataNtf { + "\x62\x00\x00\x19\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", } -packet ExtendedMacRangeDataNtf : RangeDataNtf (mac_address_indicator = EXTENDED_ADDRESS) { +packet ExtendedMacTwoWayRangeDataNtf : RangeDataNtf (ranging_measurement_type = TWO_WAY, mac_address_indicator = EXTENDED_ADDRESS) { _count_(two_way_ranging_measurements) : 8, two_way_ranging_measurements : ExtendedAddressTwoWayRangingMeasurement[], } -test ExtendedMacRangeDataNtf { - "\x62\x00\x00\x19\x00\x02\x03\x04\x05\x06\x07\x08\x00\x0a\x0b\x0c\x0d\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", +test ExtendedMacTwoWayRangeDataNtf { + "\x62\x00\x00\x19\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", } - packet RangeStopCmd : RangingCommand (ranging_opcode = RANGE_STOP) { session_id: 32, } |