Skip to main content

parse_status_response

Function parse_status_response 

Source
pub fn parse_status_response(bytes: &[u8]) -> Result<Option<u8>, ImError>
Expand description

Parse a bare StatusResponseMessage ({ 0: Status (u8), 0xFF: IMRev }) into its status code, or None if the message is not a bare status response.

This disambiguates a message-level StatusResponse from a WriteResponse (whose tag 0 is the WriteResponses array) and an InvokeResponse (whose tag 0 is the SuppressResponse bool): only a StatusResponse carries a scalar uint at context tag 0. The write/invoke verbs use this to detect a NEEDS_TIMED_INTERACTION (0xc6) rejection, which the device returns as a message-level StatusResponse rather than a per-path status.

ยงErrors

Returns ImError if bytes is not a valid IM message struct, or the status value exceeds a single octet (ImError::InvalidStatusCode).