pub struct RxHubShared { /* private fields */ }Expand description
Shared hub state between the RX thread and API handlers.
Implementations§
pub fn new() -> Self
pub fn for_path(path: String) -> Self
pub fn attach_watch_with( &self, channel: EventSink, batch_timeout_ms: u64, read_size: usize, route_urc: bool, framer: Option<Box<dyn Framer>>, )
Sourcepub fn detach_watch(&self)
pub fn detach_watch(&self)
Stop the watch; a parser’s buffered remainder goes out as a last Data event,
after every frame the hub already decoded. Call with no lock held (the sink runs
here); under locks use Self::detach_watch_queued + Self::deliver_queued.
Sourcepub fn detach_watch_queued(&self)
pub fn detach_watch_queued(&self)
Self::detach_watch without running the sink: the remainder is queued.
Sourcepub fn deliver_queued(&self)
pub fn deliver_queued(&self)
Deliver events queued by *_queued calls. Call with no lock held.
Sourcepub fn emit(&self, event: SerialEvent)
pub fn emit(&self, event: SerialEvent)
Queue event for the current watch (if any) and deliver.
pub fn attach_cmux(&self, session: Arc<CmuxSession>)
pub fn detach_cmux(&self)
Sourcepub fn set_exchange_waiter(&self, waiter: Arc<ExchangeWaiter>)
pub fn set_exchange_waiter(&self, waiter: Arc<ExchangeWaiter>)
Install the waiter. Bytes that arrived with no consumer (idle) are handed to it
first, under the idle lock, so they keep their order ahead of the reply.
pub fn clear_exchange_waiter(&self)
Sourcepub fn cancel_active_exchange(&self)
pub fn cancel_active_exchange(&self)
Wake an in-flight exchange waiter when SerialManager::cancel_exchange is invoked.
Sourcepub fn feed_bytes(&self, chunk: &[u8], state: &mut HubRoutingState)
pub fn feed_bytes(&self, chunk: &[u8], state: &mut HubRoutingState)
Push-model entry: route incoming bytes (Android JNI / tests).
Sourcepub fn tick(&self, path: &str, state: &mut HubRoutingState)
pub fn tick(&self, path: &str, state: &mut HubRoutingState)
Idle timers for push model: drain completion + watch batch flush + read deadlines.
Sourcepub fn fail_all_waiters(&self, reason: &str)
pub fn fail_all_waiters(&self, reason: &str)
Immediately fail exchange waiters, active drain, and pending read (USB error teardown).
pub fn buffered_len(&self) -> usize
pub fn purge_buffers(&self)
Sourcepub fn take_idle_bytes(&self) -> Vec<u8> ⓘ
pub fn take_idle_bytes(&self) -> Vec<u8> ⓘ
Take any bytes buffered without an active consumer (e.g. early RX before exchange waiter).
pub fn cancel_pending_read(&self)
Sourcepub fn read_request(
&self,
max_bytes: usize,
timeout_ms: u64,
fill: bool,
) -> Result<Vec<u8>, String>
pub fn read_request( &self, max_bytes: usize, timeout_ms: u64, fill: bool, ) -> Result<Vec<u8>, String>
Blocking poll-read via the hub (raw bytes, bypasses LineRouter).
pub fn pending_watch_bytes(&self, state: &HubRoutingState) -> usize
pub fn flush_watch_now(&self, state: &mut HubRoutingState)
Sourcepub fn emit_disconnect(&self, path: &str, reason: &str)
pub fn emit_disconnect(&self, path: &str, reason: &str)
Send Disconnect on the watch, after the parser’s remainder as a last Data.
CMUX channel watches get the same (remainder, then Disconnect on their path).
Sourcepub fn finish_watch_stream(&self, state: &mut HubRoutingState)
pub fn finish_watch_stream(&self, state: &mut HubRoutingState)
Port going away: flush the batch and the parser remainder into pending_events.