Skip to main content

CiStack

Struct CiStack 

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

The composed EN 50221 protocol core.

Implementations§

Source§

impl CiStack

Source

pub fn new() -> Self

New stack on transport connection t_c_id = 1. The host advertises the Resource Manager and registers the RM + application_information + conditional_access handlers.

Examples found in repository?
examples/sans_io_core.rs (line 27)
26fn main() {
27    let mut stack = CiStack::new();
28
29    // Host brings the interface up: reset + query slot + open transport.
30    show("Init", &stack.handle(Event::Host(HostRequest::Init)));
31
32    // Module accepts the transport connection.
33    let reply = [tags::C_T_C_REPLY, 0x01, 0x01];
34    show(
35        "Readable(C_T_C_Reply)",
36        &stack.handle(Event::Readable(&reply)),
37    );
38
39    // A timer tick with no inbound data drives the poll cadence
40    // (an empty T_Data_Last down to the module).
41    show(
42        "Tick(100ms)",
43        &stack.handle(Event::Tick {
44            elapsed: Duration::from_millis(100),
45        }),
46    );
47}
Source

pub fn register(&mut self, resource: Box<dyn Resource>) -> &mut Self

Register an additional resource handler.

Source

pub fn handle(&mut self, event: Event<'_>) -> Vec<Action>

The pure sans-IO entry point.

Examples found in repository?
examples/sans_io_core.rs (line 30)
26fn main() {
27    let mut stack = CiStack::new();
28
29    // Host brings the interface up: reset + query slot + open transport.
30    show("Init", &stack.handle(Event::Host(HostRequest::Init)));
31
32    // Module accepts the transport connection.
33    let reply = [tags::C_T_C_REPLY, 0x01, 0x01];
34    show(
35        "Readable(C_T_C_Reply)",
36        &stack.handle(Event::Readable(&reply)),
37    );
38
39    // A timer tick with no inbound data drives the poll cadence
40    // (an empty T_Data_Last down to the module).
41    show(
42        "Tick(100ms)",
43        &stack.handle(Event::Tick {
44            elapsed: Duration::from_millis(100),
45        }),
46    );
47}

Trait Implementations§

Source§

impl Default for CiStack

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.