map to () instead of ? ... Ok(())
This commit is contained in:
parent
78df516fba
commit
41e89028e9
1 changed files with 28 additions and 29 deletions
57
src/modem.rs
57
src/modem.rs
|
@ -155,9 +155,8 @@ impl<UART: serial::Uart> Modem<UART> {
|
||||||
|
|
||||||
pub fn gprs_connect(&mut self)-> Result<()> {
|
pub fn gprs_connect(&mut self)-> Result<()> {
|
||||||
println!("open gprs ...");
|
println!("open gprs ...");
|
||||||
let _ = self.send_command(Command::gprs_bearer_open())?;
|
self.send_command(Command::gprs_bearer_open())
|
||||||
|
.map(|_| ())
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_gprs_attached(&mut self)-> Result<bool> {
|
pub fn is_gprs_attached(&mut self)-> Result<bool> {
|
||||||
|
@ -171,33 +170,33 @@ impl<UART: serial::Uart> Modem<UART> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tcp_ssl_disable(&mut self) -> Result<()> {
|
pub fn tcp_ssl_disable(&mut self) -> Result<()> {
|
||||||
let _ = self.send_command(Command::tcp_ssl_set(false))?;
|
self.send_command(Command::tcp_ssl_set(false))
|
||||||
Ok(())
|
.map(|_| ())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tcp_ssl_enable(&mut self) -> Result<()> {
|
pub fn tcp_ssl_enable(&mut self) -> Result<()> {
|
||||||
let _ = self.send_command(Command::tcp_ssl_set(true))?;
|
self.send_command(Command::tcp_ssl_set(true))
|
||||||
Ok(())
|
.map(|_| ())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tcp_connect(&mut self, addr: &str, port: u16) -> Result<()> {
|
pub fn tcp_connect(&mut self, addr: &str, port: u16) -> Result<()> {
|
||||||
self.send_command(Command::tcp_connect(addr, port))?;
|
self.send_command(Command::tcp_connect(addr, port))
|
||||||
Ok(())
|
.map(|_| ())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tcp_set_quick_mode(&mut self, mode: bool) -> Result<()> {
|
pub fn tcp_set_quick_mode(&mut self, mode: bool) -> Result<()> {
|
||||||
self.send_command(Command::tcp_set_quick_mode(mode))?;
|
self.send_command(Command::tcp_set_quick_mode(mode))
|
||||||
Ok(())
|
.map(|_| ())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tcp_set_manual_receive(&mut self, is_manual: bool) -> Result<()> {
|
pub fn tcp_set_manual_receive(&mut self, is_manual: bool) -> Result<()> {
|
||||||
self.send_command(Command::tcp_set_manual_receive(is_manual))?;
|
self.send_command(Command::tcp_set_manual_receive(is_manual))
|
||||||
Ok(())
|
.map(|_| ())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tcp_send(&mut self, buf: &[u8]) -> Result<()> {
|
pub fn tcp_send(&mut self, buf: &[u8]) -> Result<()> {
|
||||||
self.tcp_send_data(buf)?;
|
self.tcp_send_data(buf)
|
||||||
Ok(())
|
.map(|_| ())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn tcp_parse_response_size(&mut self, reply_line: &str) -> Result<usize> {
|
fn tcp_parse_response_size(&mut self, reply_line: &str) -> Result<usize> {
|
||||||
|
@ -271,8 +270,8 @@ impl<UART: serial::Uart> Modem<UART> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn http_close(&mut self) -> Result<()> {
|
pub fn http_close(&mut self) -> Result<()> {
|
||||||
let _ = self.send_command(Command::http_close())?;
|
self.send_command(Command::http_close())
|
||||||
Ok(())
|
.map(|_| ())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn chip_info(&mut self) -> Result<()> {
|
pub fn chip_info(&mut self) -> Result<()> {
|
||||||
|
@ -285,13 +284,13 @@ impl<UART: serial::Uart> Modem<UART> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn location(&mut self) -> Result<()> {
|
pub fn location(&mut self) -> Result<()> {
|
||||||
let _ = self.send_command(Command::get_location())?;
|
self.send_command(Command::get_location())
|
||||||
Ok(())
|
.map(|_| ())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ssl_opt(&mut self) -> Result<()> {
|
pub fn ssl_opt(&mut self) -> Result<()> {
|
||||||
let _ = self.send_command(Command::ssl_opt())?;
|
self.send_command(Command::ssl_opt())
|
||||||
Ok(())
|
.map(|_| ())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn file_write(&mut self, buf: &[u8], path: &str, append: bool, input_time_sec: usize) -> Result<()> {
|
fn file_write(&mut self, buf: &[u8], path: &str, append: bool, input_time_sec: usize) -> Result<()> {
|
||||||
|
@ -322,23 +321,23 @@ impl<UART: serial::Uart> Modem<UART> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn fs_list(&mut self, path: &str) -> Result<()> {
|
pub fn fs_list(&mut self, path: &str) -> Result<()> {
|
||||||
let _ = self.send_command(Command::fs_list(path))?;
|
self.send_command(Command::fs_list(path))
|
||||||
Ok(())
|
.map(|_| ())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn fs_free_space(&mut self) -> Result<()> {
|
pub fn fs_free_space(&mut self) -> Result<()> {
|
||||||
let _ = self.send_command(Command::fs_free_size())?;
|
self.send_command(Command::fs_free_size())
|
||||||
Ok(())
|
.map(|_| ())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ssl_set_client_cert(&mut self, path: &str, password: &str) -> Result<()> {
|
pub fn ssl_set_client_cert(&mut self, path: &str, password: &str) -> Result<()> {
|
||||||
let _ = self.send_command(Command::ssl_set_client_cert(path, password))?;
|
self.send_command(Command::ssl_set_client_cert(path, password))
|
||||||
Ok(())
|
.map(|_| ())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ssl_set_root_cert(&mut self, path: &str, filesize: usize) -> Result<()> {
|
pub fn ssl_set_root_cert(&mut self, path: &str, filesize: usize) -> Result<()> {
|
||||||
let _ = self.send_command(Command::ssl_set_root_cert(path, filesize))?;
|
self.send_command(Command::ssl_set_root_cert(path, filesize))
|
||||||
Ok(())
|
.map(|_| ())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mqtt_receive_reply(&mut self) -> std::result::Result<(), anyhow::Error> {
|
fn mqtt_receive_reply(&mut self) -> std::result::Result<(), anyhow::Error> {
|
||||||
|
|
Loading…
Reference in a new issue