inspect()
Function¶
-
metlinkpid.
inspect
(bytes_in: bytes) → metlinkpid.Message¶ The
inspect()
function is used to determine how the display would interpret an arbitrary sequence of bytes.It de-frames & CRC-checks the data (if a DLE/STX/ETX packet is provided), then compares the header against the headers of all known
Message
types, then constructs an object of the matching type.The
inspect()
function is used internally byPID.send()
to ensure that a validResponseMessage
is received after each transmission.- Returns
a
DisplayMessage
object, aPingMessage
object, or aResponseMessage
object.- Raises
ValueError – if a DLE/STX/ETX packet is provided with a bad CRC checksum, or if the bytes can’t be understood.