From 4905dde4c3e08f878db7fe6551c09a4036756743 Mon Sep 17 00:00:00 2001 From: Rokas Puzonas Date: Sun, 26 Mar 2023 15:51:25 +0300 Subject: [PATCH] add todo for 'subscribe' --- src/ubus.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/ubus.rs b/src/ubus.rs index b15d6d0..1e74524 100644 --- a/src/ubus.rs +++ b/src/ubus.rs @@ -243,6 +243,7 @@ impl Ubus { let cmd = format!("ubus listen {}", paths.join(" ")); let mut channel = self.session.channel_session().await?; channel.exec(&cmd).await?; + // TODO: Handle error? 'channel.exit_status()', idk if neededdi let mut line_buffer = vec![0u8; 1024]; let mut buffer_size = 0usize; @@ -273,4 +274,16 @@ impl Ubus { } } } + + pub async fn subscribe(self, paths: &[&str]) -> Result<()> { + if paths.len() < 1 { + bail!("At least 1 object is required") + } + let cmd = format!("ubus subscribe {}", paths.join(" ")); + let mut channel = self.session.channel_session().await?; + channel.exec(&cmd).await?; + + // TODO: Haven't figured out how to test subscribe event using default objects on ubus. + todo!(); + } }