chore: fix import ordering and formatting in core and client

This commit is contained in:
2026-06-14 04:12:37 +08:00
parent 4e4c9cee65
commit ee65e284c4
6 changed files with 44 additions and 42 deletions

View File

@@ -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};

View File

@@ -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};

View File

@@ -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;

View File

@@ -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(),
))
}
)),
}
}
}

View File

@@ -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);