Skip to main content

CmuxSession

Struct CmuxSession 

Source
pub struct CmuxSession { /* private fields */ }
Expand description

Active GSM 07.10 multiplexer on a physical serial port.

Implementations§

Source§

impl CmuxSession

Source

pub fn new(physical_path: String, io: Arc<dyn CmuxPhysicalIo>) -> Arc<Self> ⓘ

Session with the basic-option default N1 (31, the 4.0.0 behaviour); Self::with_n1 for the N1 given to AT+CMUX.

Source

pub fn with_n1( physical_path: String, io: Arc<dyn CmuxPhysicalIo>, n1: usize, ) -> Arc<Self> ⓘ

n1: the negotiated maximum frame size (AT+CMUX N1, see cmux_n1). Frames up to max(n1, DEFAULT_MAX_RX_INFO) info bytes are accepted. One SABM per open (4.x).

Source

pub fn for_command( physical_path: String, io: Arc<dyn CmuxPhysicalIo>, command: &str, ) -> Arc<Self> ⓘ

Session for the AT+CMUX= command that started it: N1 (cmux_n1) and the T1/N2/T2 timers (CmuxTimers::from_command).

Source

pub fn physical_path(&self) -> &str

Source

pub fn register_dlci(&self, dlci: u8, virtual_path: String) -> Arc<DlciChannel> ⓘ

Source

pub fn unregister_dlci(&self, dlci: u8)

Source

pub fn has_dlci(&self, dlci: u8) -> bool

Source

pub fn open_dlci(&self, dlci: u8, timeout: Duration) -> Result<(), String>

Establish a DLC: send SABM and wait for the modem’s UA (DM = refused). SABM is resent every T1, at most N2 times; the last try waits out timeout (at least T1). A data DLC gets an MSC (V.24 signals ready) once established. DLCI 0 (the control channel) must be opened first.

Source

pub fn close_down(&self)

Ask the modem to leave multiplexer mode: CLD on the control channel, then wait up to T2 for its response. Channel writes fail from here on.

Source

pub fn tick(&self)

Batch-timeout flush for virtual-channel watches (called from the hub tick).

Source

pub fn emit_disconnect(&self, reason: &str)

Physical link lost: the session ends (writes waiting on flow control fail), an exchange in flight on a channel fails, and every channel watch gets its remainder, then Disconnect with the channel’s virtual path.

Source

pub fn set_watch_with( &self, dlci: u8, channel: EventSink, batch_timeout_ms: u64, framer: Option<Box<dyn Framer>>, )

Source

pub fn clear_watch(&self, dlci: u8)

Stop the channel watch; its batch and parser remainder are the last Data, before this returns (a sink that calls it does not wait for another thread’s delivery). The sink runs here, so call with no manager lock held.

Source

pub fn set_exchange_waiter(&self, dlci: u8, waiter: Arc<ExchangeWaiter>)

Source

pub fn clear_exchange_waiter(&self, dlci: u8)

Source

pub fn cancel_active_exchange(&self, dlci: u8)

Fail the in-flight exchange waiter on dlci (used by cancel_exchange).

Source

pub fn send_uih(&self, dlci: u8, payload: &[u8]) -> Result<usize, String>

Send payload on dlci as UIH frames. While the modem holds flow control off (FCoff, or MSC with FC=1 for this DLC) the write waits for it to end, at most the write timeout of the frames, then fails; nothing is queued to go out later.

Source

pub fn feed_physical_rx(&self, chunk: &[u8])

Feed raw bytes from the physical RX hub thread.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.