pub struct CiStack { /* private fields */ }Expand description
The composed EN 50221 protocol core.
Implementations§
Source§impl CiStack
impl CiStack
Sourcepub fn new() -> Self
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}Sourcepub fn register(&mut self, resource: Box<dyn Resource>) -> &mut Self
pub fn register(&mut self, resource: Box<dyn Resource>) -> &mut Self
Register an additional resource handler.
Sourcepub fn handle(&mut self, event: Event<'_>) -> Vec<Action>
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§
Auto Trait Implementations§
impl !RefUnwindSafe for CiStack
impl !Send for CiStack
impl !Sync for CiStack
impl !UnwindSafe for CiStack
impl Freeze for CiStack
impl Unpin for CiStack
impl UnsafeUnpin for CiStack
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