From 6a1c305329decda79aeeaa952911d3dd53613e02 Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Tue, 25 Jan 2022 12:16:45 -0800 Subject: uwb(uci-rust): Use {Packet} instead of {Packet}Builder The {Packet} struct should be used for parsed data. Also, made all EventManager method names consistent with "_received". Test: UwbManagerTest, adb shell cmd uwb start-fira-ranging-session Bug: 197341298 Change-Id: I9b08c43bb05254f01c495e53b630c96f323518ee --- src/rust/event_manager/mod.rs | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'src/rust/event_manager') diff --git a/src/rust/event_manager/mod.rs b/src/rust/event_manager/mod.rs index b8f6f46..cf93988 100644 --- a/src/rust/event_manager/mod.rs +++ b/src/rust/event_manager/mod.rs @@ -52,12 +52,15 @@ pub trait Manager { fn device_status_notification_received(&self, data: DeviceStatusNtfPacket) -> Result<()>; fn core_generic_error_notification_received(&self, data: GenericErrorPacket) -> Result<()>; fn session_status_notification_received(&self, data: SessionStatusNtfPacket) -> Result<()>; - fn short_range_data_notification(&self, data: ShortMacTwoWayRangeDataNtfPacket) -> Result<()>; - fn extended_range_data_notification( + fn short_range_data_notification_received( + &self, + data: ShortMacTwoWayRangeDataNtfPacket, + ) -> Result<()>; + fn extended_range_data_notification_received( &self, data: ExtendedMacTwoWayRangeDataNtfPacket, ) -> Result<()>; - fn session_update_controller_multicast_list_notification( + fn session_update_controller_multicast_list_notification_received( &self, data: SessionUpdateControllerMulticastListNtfPacket, ) -> Result<()>; @@ -93,29 +96,33 @@ impl Manager for EventManager { result } - fn short_range_data_notification(&self, data: ShortMacTwoWayRangeDataNtfPacket) -> Result<()> { + fn short_range_data_notification_received( + &self, + data: ShortMacTwoWayRangeDataNtfPacket, + ) -> Result<()> { let env = self.jvm.attach_current_thread()?; - let result = self.handle_short_range_data_notification(&env, data); + let result = self.handle_short_range_data_notification_received(&env, data); self.clear_exception(env); result } - fn extended_range_data_notification( + fn extended_range_data_notification_received( &self, data: ExtendedMacTwoWayRangeDataNtfPacket, ) -> Result<()> { let env = self.jvm.attach_current_thread()?; - let result = self.handle_extended_range_data_notification(&env, data); + let result = self.handle_extended_range_data_notification_received(&env, data); self.clear_exception(env); result } - fn session_update_controller_multicast_list_notification( + fn session_update_controller_multicast_list_notification_received( &self, data: SessionUpdateControllerMulticastListNtfPacket, ) -> Result<()> { let env = self.jvm.attach_current_thread()?; - let result = self.handle_session_update_controller_multicast_list_notification(&env, data); + let result = + self.handle_session_update_controller_multicast_list_notification_received(&env, data); self.clear_exception(env); result } @@ -454,7 +461,7 @@ impl EventManager { ) } - fn handle_short_range_data_notification( + fn handle_short_range_data_notification_received( &self, env: &JNIEnv, data: ShortMacTwoWayRangeDataNtfPacket, @@ -507,7 +514,7 @@ impl EventManager { .map(|_| ()) // drop void method return } - fn handle_extended_range_data_notification( + fn handle_extended_range_data_notification_received( &self, env: &JNIEnv, data: ExtendedMacTwoWayRangeDataNtfPacket, @@ -561,7 +568,7 @@ impl EventManager { .map(|_| ()) // drop void method return } - pub fn handle_session_update_controller_multicast_list_notification( + pub fn handle_session_update_controller_multicast_list_notification_received( &self, env: &JNIEnv, data: SessionUpdateControllerMulticastListNtfPacket, @@ -654,16 +661,19 @@ impl Manager for EventManagerTest { fn session_status_notification_received(&self, data: SessionStatusNtfPacket) -> Result<()> { Ok(()) } - fn short_range_data_notification(&self, data: ShortMacTwoWayRangeDataNtfPacket) -> Result<()> { + fn short_range_data_notification_received( + &self, + data: ShortMacTwoWayRangeDataNtfPacket, + ) -> Result<()> { Ok(()) } - fn extended_range_data_notification( + fn extended_range_data_notification_received( &self, data: ExtendedMacTwoWayRangeDataNtfPacket, ) -> Result<()> { Ok(()) } - fn session_update_controller_multicast_list_notification( + fn session_update_controller_multicast_list_notification_received( &self, data: SessionUpdateControllerMulticastListNtfPacket, ) -> Result<()> { -- cgit v1.2.3