serialplugin_core/api/lines.rs
1//! Which ports have real modem control lines.
2
3use crate::api::SerialManager;
4use crate::cmux::parse_mux_path;
5use crate::port::tcp::TCP_SCHEME;
6
7impl SerialManager {
8 /// `false` when `path` has no real RTS/DTR/CTS/DSR/RI/DCD: `tcp://` bridges and
9 /// `ble://` UARTs, where the modem-line setters still succeed (the value is stored
10 /// locally) and the getters return fixed values, and CMUX channels
11 /// (`path#dlci=N`), where line calls fail (the lines belong to the physical
12 /// port). Check this before relying on hardware flow control or line signalling.
13 /// Local serial ports return `true`. Needs no open port.
14 pub fn supports_modem_lines(&self, path: &str) -> bool {
15 !(path.starts_with(TCP_SCHEME)
16 || path.starts_with("ble://")
17 || parse_mux_path(path).is_some())
18 }
19}