eufy-mega / core/contracts / RawDpCodec
Interface: RawDpCodec
Reader for the structured, base64-encoded values some device data points carry in place of a plain scalar. Such a value is a length-prefixed field-and-value tree; this walks the tree and reports the fields it finds, with no schema and no notion of which data point the value came from.
The split mirrors DpInboundFrame: decoding a container is a technical job, naming its contents is a semantic one. A capability receives a codec and asks for the field positions whose meaning it knows, so neither half has to carry the other's knowledge.
Methods
decode()
decode(value): readonly RawDpField[] | undefined;Decode a base64 payload to its top-level fields, or undefined when the value is not a well-formed payload — a length prefix disagreeing with the body, an encoding this does not recognise, or a string that is not base64 at all. The result is a whole field list or nothing, never a partial read.
Parameters
value
string
Returns
readonly RawDpField[] | undefined
nested()
nested(value): readonly RawDpField[] | undefined;Read a length-delimited field's bytes as a nested field list, on the same terms as decode.
Parameters
value
Buffer
Returns
readonly RawDpField[] | undefined