pub struct Connection { /* private fields */ }Expand description
One end of an ASH link.
Implementations§
Source§impl Connection
impl Connection
Sourcepub fn new(role: Role, config: Config) -> Self
pub fn new(role: Role, config: Config) -> Self
A link in the down state. A host starts it with Connection::reset;
an NCP waits for the host’s RST.
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
True once RST/RSTACK has completed.
Sourcepub fn ack_period(&self) -> Duration
pub fn ack_period(&self) -> Duration
The current adaptive ACK timeout.
Sourcepub fn reset(&mut self, now: Instant)
pub fn reset(&mut self, now: Instant)
Host: drop everything and send RST. The link reports
Event::Connected when the NCP answers.
Sourcepub fn send(&mut self, payload: Vec<u8>, now: Instant) -> Result<(), SendError>
pub fn send(&mut self, payload: Vec<u8>, now: Instant) -> Result<(), SendError>
Queue an EZSP frame for sending.
Sourcepub fn handle_bad_frame(&mut self, _error: FrameError, now: Instant)
pub fn handle_bad_frame(&mut self, _error: FrameError, now: Instant)
A frame the decoder rejected (bad CRC, length, UART error).
Sourcepub fn handle_frame(&mut self, frame: Frame, now: Instant)
pub fn handle_frame(&mut self, frame: Frame, now: Instant)
A well-formed frame from the peer.
Sourcepub fn poll_timeout(&self) -> Option<Instant>
pub fn poll_timeout(&self) -> Option<Instant>
The earliest time Connection::handle_timeout must be called.
Sourcepub fn handle_timeout(&mut self, now: Instant)
pub fn handle_timeout(&mut self, now: Instant)
Run the timers.
Sourcepub fn poll_transmit(&mut self) -> Option<Vec<u8>>
pub fn poll_transmit(&mut self) -> Option<Vec<u8>>
Bytes to write to the serial port, if any.
Sourcepub fn poll_event(&mut self) -> Option<Event>
pub fn poll_event(&mut self) -> Option<Event>
The next event for the layer above, if any.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Connection
impl RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl UnsafeUnpin for Connection
impl UnwindSafe for Connection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more