diff --git a/src/modem.rs b/src/modem.rs index 9d1e46e..93ff631 100644 --- a/src/modem.rs +++ b/src/modem.rs @@ -155,9 +155,8 @@ impl Modem { pub fn gprs_connect(&mut self)-> Result<()> { println!("open gprs ..."); - let _ = self.send_command(Command::gprs_bearer_open())?; - - Ok(()) + self.send_command(Command::gprs_bearer_open()) + .map(|_| ()) } pub fn is_gprs_attached(&mut self)-> Result { @@ -171,33 +170,33 @@ impl Modem { } pub fn tcp_ssl_disable(&mut self) -> Result<()> { - let _ = self.send_command(Command::tcp_ssl_set(false))?; - Ok(()) + self.send_command(Command::tcp_ssl_set(false)) + .map(|_| ()) } pub fn tcp_ssl_enable(&mut self) -> Result<()> { - let _ = self.send_command(Command::tcp_ssl_set(true))?; - Ok(()) + self.send_command(Command::tcp_ssl_set(true)) + .map(|_| ()) } pub fn tcp_connect(&mut self, addr: &str, port: u16) -> Result<()> { - self.send_command(Command::tcp_connect(addr, port))?; - Ok(()) + self.send_command(Command::tcp_connect(addr, port)) + .map(|_| ()) } pub fn tcp_set_quick_mode(&mut self, mode: bool) -> Result<()> { - self.send_command(Command::tcp_set_quick_mode(mode))?; - Ok(()) + self.send_command(Command::tcp_set_quick_mode(mode)) + .map(|_| ()) } pub fn tcp_set_manual_receive(&mut self, is_manual: bool) -> Result<()> { - self.send_command(Command::tcp_set_manual_receive(is_manual))?; - Ok(()) + self.send_command(Command::tcp_set_manual_receive(is_manual)) + .map(|_| ()) } pub fn tcp_send(&mut self, buf: &[u8]) -> Result<()> { - self.tcp_send_data(buf)?; - Ok(()) + self.tcp_send_data(buf) + .map(|_| ()) } fn tcp_parse_response_size(&mut self, reply_line: &str) -> Result { @@ -271,8 +270,8 @@ impl Modem { } pub fn http_close(&mut self) -> Result<()> { - let _ = self.send_command(Command::http_close())?; - Ok(()) + self.send_command(Command::http_close()) + .map(|_| ()) } pub fn chip_info(&mut self) -> Result<()> { @@ -285,13 +284,13 @@ impl Modem { } pub fn location(&mut self) -> Result<()> { - let _ = self.send_command(Command::get_location())?; - Ok(()) + self.send_command(Command::get_location()) + .map(|_| ()) } pub fn ssl_opt(&mut self) -> Result<()> { - let _ = self.send_command(Command::ssl_opt())?; - Ok(()) + self.send_command(Command::ssl_opt()) + .map(|_| ()) } fn file_write(&mut self, buf: &[u8], path: &str, append: bool, input_time_sec: usize) -> Result<()> { @@ -322,23 +321,23 @@ impl Modem { } pub fn fs_list(&mut self, path: &str) -> Result<()> { - let _ = self.send_command(Command::fs_list(path))?; - Ok(()) + self.send_command(Command::fs_list(path)) + .map(|_| ()) } pub fn fs_free_space(&mut self) -> Result<()> { - let _ = self.send_command(Command::fs_free_size())?; - Ok(()) + self.send_command(Command::fs_free_size()) + .map(|_| ()) } pub fn ssl_set_client_cert(&mut self, path: &str, password: &str) -> Result<()> { - let _ = self.send_command(Command::ssl_set_client_cert(path, password))?; - Ok(()) + self.send_command(Command::ssl_set_client_cert(path, password)) + .map(|_| ()) } pub fn ssl_set_root_cert(&mut self, path: &str, filesize: usize) -> Result<()> { - let _ = self.send_command(Command::ssl_set_root_cert(path, filesize))?; - Ok(()) + self.send_command(Command::ssl_set_root_cert(path, filesize)) + .map(|_| ()) } fn mqtt_receive_reply(&mut self) -> std::result::Result<(), anyhow::Error> {