chore: fix import ordering and formatting in core and client
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use pipeview_core::frame::{
|
||||
Endian, Framer,
|
||||
cobs::CobsFramer,
|
||||
@@ -15,6 +14,7 @@ use pipeview_core::protocol::{
|
||||
text::{TextDecoder, TextEncoding},
|
||||
};
|
||||
use pipeview_core::transport::TransportConfig;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::error::Result;
|
||||
use crate::lua::codec::{LuaDecoder, LuaFramer};
|
||||
|
||||
@@ -2,10 +2,10 @@ use std::fs;
|
||||
use std::sync::Mutex;
|
||||
|
||||
use mlua::{Function, Lua, RegistryKey, Table, Value};
|
||||
use tracing::warn;
|
||||
use pipeview_core::frame::Framer;
|
||||
use pipeview_core::protocol::plot::{PlotFormat, PlotFrame, SampleType};
|
||||
use pipeview_core::protocol::{DecodedData, ProtocolDecoder};
|
||||
use tracing::warn;
|
||||
|
||||
use crate::error::{Error, Result};
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ use std::sync::{
|
||||
use std::time::Duration;
|
||||
|
||||
use mlua::{Function, Lua, LuaSerdeExt, RegistryKey, UserData, UserDataMethods, Value, Variadic};
|
||||
use pipeview_core::protocol::DecodedData;
|
||||
use tokio::sync::mpsc;
|
||||
use tokio::task::JoinHandle;
|
||||
use pipeview_core::protocol::DecodedData;
|
||||
|
||||
use crate::config::SessionConfig;
|
||||
use crate::lua::LuaRuntime;
|
||||
|
||||
@@ -173,22 +173,18 @@ impl Connection {
|
||||
pub fn set_dtr(&mut self, state: bool) -> Result<()> {
|
||||
match self {
|
||||
Connection::Serial(t) => t.set_dtr(state),
|
||||
Connection::Tcp(_) | Connection::Udp(_) => {
|
||||
Err(crate::error::Error::ConnectionFailed(
|
||||
Connection::Tcp(_) | Connection::Udp(_) => Err(crate::error::Error::ConnectionFailed(
|
||||
"DTR only supported on Serial connections".into(),
|
||||
))
|
||||
}
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_rts(&mut self, state: bool) -> Result<()> {
|
||||
match self {
|
||||
Connection::Serial(t) => t.set_rts(state),
|
||||
Connection::Tcp(_) | Connection::Udp(_) => {
|
||||
Err(crate::error::Error::ConnectionFailed(
|
||||
Connection::Tcp(_) | Connection::Udp(_) => Err(crate::error::Error::ConnectionFailed(
|
||||
"RTS only supported on Serial connections".into(),
|
||||
))
|
||||
}
|
||||
)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use async_trait::async_trait;
|
||||
use serialport::SerialPort;
|
||||
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
|
||||
use tokio_serial::{DataBits, FlowControl, Parity, SerialPortBuilderExt, SerialStream, StopBits};
|
||||
use serialport::SerialPort;
|
||||
use tracing::{debug, info, warn};
|
||||
|
||||
use super::{Transport, TransportType};
|
||||
@@ -277,10 +277,16 @@ impl Transport for SerialTransport {
|
||||
// HC-15, HC-05, Bluetooth/UART bridges) need DTR asserted to stay in
|
||||
// transparent data mode and not fall into AT-command / reset state.
|
||||
if let Err(e) = port.write_data_terminal_ready(self.dtr) {
|
||||
warn!("Failed to set DTR({}) on {}: {}", self.dtr, self.port_name, e);
|
||||
warn!(
|
||||
"Failed to set DTR({}) on {}: {}",
|
||||
self.dtr, self.port_name, e
|
||||
);
|
||||
}
|
||||
if let Err(e) = port.write_request_to_send(self.rts) {
|
||||
warn!("Failed to set RTS({}) on {}: {}", self.rts, self.port_name, e);
|
||||
warn!(
|
||||
"Failed to set RTS({}) on {}: {}",
|
||||
self.rts, self.port_name, e
|
||||
);
|
||||
}
|
||||
|
||||
debug!("Serial port {} opened successfully", self.port_name);
|
||||
|
||||
Reference in New Issue
Block a user