use &[u8] instead of &str
This commit is contained in:
parent
a0a80a4d3e
commit
bc495a7592
1 changed files with 4 additions and 4 deletions
|
@ -185,7 +185,7 @@ impl<UART: serial::Uart> Modem<UART> {
|
||||||
self.read_response(cmd.contains, cmd.timeout)
|
self.read_response(cmd.contains, cmd.timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn send_data(&mut self, payload: &str) -> Result<String> {
|
fn send_data(&mut self, buf: &[u8]) -> Result<String> {
|
||||||
self.rx.clear();
|
self.rx.clear();
|
||||||
let _ = self.send_bytes("AT+CIPSEND".as_bytes(), '\r')?;
|
let _ = self.send_bytes("AT+CIPSEND".as_bytes(), '\r')?;
|
||||||
let send_request: String = self.rx.reset(Duration::from_millis(3000))
|
let send_request: String = self.rx.reset(Duration::from_millis(3000))
|
||||||
|
@ -196,7 +196,7 @@ impl<UART: serial::Uart> Modem<UART> {
|
||||||
return Err(ModemError::SendDataError);
|
return Err(ModemError::SendDataError);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.send_bytes(payload.as_bytes(), 26 as char)?; // 26_u8 = Ctrl+z - to end sending data
|
self.send_bytes(buf, 26 as char)?; // 26_u8 = Ctrl+z - to end sending data
|
||||||
let _ = self.read_response(Some("DATA ACCEPT".to_string()), Duration::from_millis(3000));
|
let _ = self.read_response(Some("DATA ACCEPT".to_string()), Duration::from_millis(3000));
|
||||||
|
|
||||||
self.rx.clear();
|
self.rx.clear();
|
||||||
|
@ -263,8 +263,8 @@ impl<UART: serial::Uart> Modem<UART> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tcp_send(&mut self, payload: &str) -> Result<()> {
|
pub fn tcp_send(&mut self, buf: &[u8]) -> Result<()> {
|
||||||
self.send_data(payload)?;
|
self.send_data(buf)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue