pub enum IncomingEvent<'a> {
Nothing,
Request(bool, EncodedMessage<'a>),
DuplicatedRequest,
SendAck,
SendCon,
Success,
SendRst,
Timeout,
RecvRst,
}Expand description
What has happened in the IncomingCommunication path when calling
CoapEndpoint::process
This type is annotated with must_use because some events require user interaction to avoid
getting stuck in specific states. See the documentation for the specific events for more
information.
Variants§
Nothing
No real event happened. This pseudo-event is included as a variant here to allow concise event handling on the user side.
Request(bool, EncodedMessage<'a>)
A new request was received. The user must respond to this event. The event contains the
bool flag if the request is confirmable (true) or non-confirmable (false) and the
request message itself.
In any case, the response may be sent with IncomingCommunication::schedule_response
immediately. For CON requests, this will result in a piggybacked response. For NON
requests, a NON response will be sent. For other options, see the
IncomingState::Received state.
The contained EncodedMessage keeps the borrow of the Endpoint
alive which might be undesirable in some situations. To resolve this, it may safely be dropped, it can be accessed later via IncomingCommunication::request.
DuplicatedRequest
We have received the same request again. Depending on how we have already handled the request, appropriate action is taken automatically. For example, if the request has already been ACKed but a separate response is still missing, we send the ACK again. If we have sent a NON response before which may not have reached the other endpoint, we send it again.
SendAck
We have sent an ACK. With this event, a state transition into
IncomingState::AwaitingResponse takes place in which more user interaction is
required.
SendCon
A separate CON response has been (re-)sent. NON and piggybacked responses directly result
in a IncomingEvent::Success event.
Success
We have successfully finished the communication (from our perspective). If our response was piggybacked or a separate NON message, we have no guarantee that the other endpoint has already received our response. If our response was a separate CON message, the corresponding ACK has been received and we know that the other endpoint has received our response.
SendRst
We have sent a RST message. With this event, a state transition into
IncomingState::Idle takes place.
Timeout
Sending the separate CON response has timed out. Piggybacked or separate NON responses will not be ACKed so they can not time out.
RecvRst
We have received a RST when sending a separate CON response
Trait Implementations§
Source§impl<'a> Clone for IncomingEvent<'a>
impl<'a> Clone for IncomingEvent<'a>
Source§fn clone(&self) -> IncomingEvent<'a>
fn clone(&self) -> IncomingEvent<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more