From e7fbedd8ec8c32566714b02d799f1e35d46d4073 Mon Sep 17 00:00:00 2001 From: occheung Date: Wed, 4 Sep 2024 10:50:35 +0800 Subject: [PATCH] coremgr: current_payload -> config_payload --- src/satman/src/main.rs | 4 ++-- src/satman/src/mgmt.rs | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/satman/src/main.rs b/src/satman/src/main.rs index 275dc86..7ec3aa0 100644 --- a/src/satman/src/main.rs +++ b/src/satman/src/main.rs @@ -1189,12 +1189,12 @@ fn process_aux_packet( timer ); - core_manager.add_data(&data, length as usize); + core_manager.add_config_data(&data, length as usize); let mut succeeded = true; if last { succeeded = core_manager.write_config().is_ok(); - core_manager.clear_data(); + core_manager.clear_config_data(); } drtioaux::send(0, &drtioaux::Packet::CoreMgmtReply { succeeded }) diff --git a/src/satman/src/mgmt.rs b/src/satman/src/mgmt.rs index 169037e..d667483 100644 --- a/src/satman/src/mgmt.rs +++ b/src/satman/src/mgmt.rs @@ -46,7 +46,7 @@ pub fn clear_log() { pub struct Manager<'a> { cfg: &'a mut Config, last_log: Sliceable, - current_payload: Cursor>, + config_payload: Cursor>, last_value: Sliceable, } @@ -55,7 +55,7 @@ impl<'a> Manager<'_> { Manager { cfg: cfg, last_log: Sliceable::new(0, Vec::new()), - current_payload: Cursor::new(Vec::new()), + config_payload: Cursor::new(Vec::new()), last_value: Sliceable::new(0, Vec::new()), } } @@ -83,22 +83,22 @@ impl<'a> Manager<'_> { self.last_value.get_slice_satellite(data_slice) } - pub fn add_data(&mut self, data: &[u8], data_len: usize) { - self.current_payload.write_all(&data[..data_len]).unwrap(); + pub fn add_config_data(&mut self, data: &[u8], data_len: usize) { + self.config_payload.write_all(&data[..data_len]).unwrap(); } - pub fn clear_data(&mut self) { - self.current_payload.get_mut().clear(); - self.current_payload.set_position(0); + pub fn clear_config_data(&mut self) { + self.config_payload.get_mut().clear(); + self.config_payload.set_position(0); } pub fn write_config(&mut self) -> Result<()> { let key = self - .current_payload + .config_payload .read_string() .map_err(|_err| error!("error on reading key"))?; debug!("write key: {}", key); - let value = self.current_payload.read_bytes().unwrap(); + let value = self.config_payload.read_bytes().unwrap(); self.cfg .write(&key, value)