pub fn decode_color_command(
data: &[u8],
offset: usize,
) -> Result<(BACnetColorCommand, usize), Error>Expand description
Decode one unframed BACnetColorCommand SEQUENCE at offset.
Returns the command and the offset just past its last field. Decoding
stops at the first tag that isn’t the next optional field, so a caller
that expects exactly one command must check that the returned offset
reaches the end of its data, or the closing tag of its frame. A caller
whose whole input must be one command uses decode_color_command_value
instead, which checks that before it reports a field too wide for its
type.
Field values aren’t range-checked here; the receiver does that. Failures come in three kinds:
- contents that run past the end of
data:Error::BufferTooShort; - any other malformed field (a missing operation, an Unsigned with no
contents octets, or one of more than four that opens with a zero octet,
or a target colour that isn’t two four-octet application REALs closed
by tag 1, a frame cut off at a tag boundary included):
Error::Decoding; - a well-formed command whose operation or an Unsigned field needs more
than 32 bits:
Error::OutOfRange, naming the first such field. A malformed field anywhere takes precedence.
Up to four contents octets, an Unsigned or ENUMERATED may open with zero
octets; encode_color_command always writes the shortest form.