/// Poll the request/response interface.
///
/// # Args
/// * `f` - A function that will be called with the provided handler, command, and data. This
/// function is responsible for calling the handler with the necessary context.
///
/// # Note
/// Any incoming requests will be automatically handled using provided handlers.
Poll the request/response interface.
Poll the request / response interface .
pub fn poll<F>(&mut self, f: F) -> Result<(), Error<Stack::Error>>
    where
        F: FnMut(
            Handler<Context, Stack::Error, MESSAGE_SIZE>,
            &str,
            &[u8],
        ) -> Result<Response<MESSAGE_SIZE>, Error<Stack::Error>>,
    {
        if !self.machine.context_mut().mqtt.client.is_connected() {
            // Note(unwrap): It's always safe to unwrap the reset event. All states must handle it.
            self.machine.process_event(sm::Events::Reset).unwrap();
        }
        self.machine.process_event(sm::Events::Update).ok();
        self._handle_mqtt(f)
    }
pub fn poll < F > ( & mut self , f : F ) -> Result < ( ) , Error < Stack :: Error > > where F : FnMut ( Handler < Context , Stack :: Error , MESSAGE_SIZE > , & str , & [ u8 ] , ) -> Result < Response < MESSAGE_SIZE > , Error < Stack :: Error > > , { if ! self . machine . context_mut ( ) . mqtt . client . is_connected ( ) { // Note(unwrap): It's always safe to unwrap the reset event. All states must handle it. self . machine . process_event ( sm :: Events :: Reset ) . unwrap ( ) ; } self . machine . process_event ( sm :: Events :: Update ) . ok ( ) ; self . _handle_mqtt ( f ) }
Poll the request/response interface.
Poll the request / response interface .
&mut self
f
F
args
`f` - A function that will be called with the provided handler, command, and data. This
function is responsible for calling the handler with the necessary context.
` f ` - A function that will be called with the provided handler command and data . This function is responsible for calling the handler with the necessary context .
note
Any incoming requests will be automatically handled using provided handlers.
Any incoming requests will be automatically handled using provided handlers .