Skip to main content

RxHubShared

Struct RxHubShared 

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

Shared hub state between the RX thread and API handlers.

Implementations§

Source§

impl RxHubShared

Source

pub fn new() -> Self

Source

pub fn for_path(path: String) -> Self

Source

pub fn attach_watch_with( &self, channel: EventSink, batch_timeout_ms: u64, read_size: usize, route_urc: bool, framer: Option<Box<dyn Framer>>, )

Source

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.

Source

pub fn detach_watch_queued(&self)

Self::detach_watch without running the sink: the remainder is queued.

Source

pub fn has_core_watches(&self) -> bool

Source

pub fn deliver_queued(&self)

Deliver events queued by *_queued calls. Call with no lock held.

Source

pub fn emit(&self, event: SerialEvent)

Queue event for the current watch (if any) and deliver.

Source

pub fn attach_cmux(&self, session: Arc<CmuxSession>)

Source

pub fn detach_cmux(&self)

Source

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.

Source

pub fn clear_exchange_waiter(&self)

Source

pub fn cancel_active_exchange(&self)

Wake an in-flight exchange waiter when SerialManager::cancel_exchange is invoked.

Source

pub fn feed_bytes(&self, chunk: &[u8], state: &mut HubRoutingState)

Push-model entry: route incoming bytes (Android JNI / tests).

Source

pub fn tick(&self, path: &str, state: &mut HubRoutingState)

Idle timers for push model: drain completion + watch batch flush + read deadlines.

Source

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

Immediately fail exchange waiters, active drain, and pending read (USB error teardown).

Source

pub fn buffered_len(&self) -> usize

Source

pub fn purge_buffers(&self)

Drop bytes the hub holds for no one yet (idle RX, a pending read’s partial fill).

Source

pub fn take_idle_bytes(&self) -> Vec<u8> ⓘ

Take any bytes buffered without an active consumer (e.g. early RX before exchange waiter).

Source

pub fn cancel_pending_read(&self)

Source

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).

Source

pub fn pending_watch_bytes(&self, state: &HubRoutingState) -> usize

Source

pub fn flush_watch_now(&self, state: &mut HubRoutingState)

Source

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). Once per hub: a second call (Android reports a USB failure from the hub loop and from fail_port) does nothing.

Source

pub fn finish_watch_stream(&self, state: &mut HubRoutingState)

Port going away: flush the batch and the parser remainder into pending_events.

Source

pub fn has_watch(&self) -> bool

Source

pub fn dispatch_queued_events(&self, events: Vec<QueuedEvent>)

Source

pub fn drain( &self, idle_ms: u64, max_ms: u64, cancel: Arc<AtomicBool>, solicited_prefixes: Vec<String>, ) -> Result<Vec<u8>, String>

Soft-drain via the hub thread (single reader); URC lines are emitted on the watch channel.

Trait Implementations§

Source§

impl Default for RxHubShared

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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.