encode_dprs

Function encode_dprs 

Source
pub fn encode_dprs(
    report: &DprsReport,
    out: &mut String,
) -> Result<(), DprsError>
Expand description

Encode a DprsReport into a DPRS sentence with a correct $$CRC<hex> checksum.

The output String is cleared first, then written in place. The CRC is computed over the sentence body (everything after the comma following $$CRC<hex>) using super::compute_crc — CRC-CCITT with reflected polynomial 0x8408, initial value 0xFFFF, final ~accumulator, matching the ircDDBGateway reference.

§Errors

Returns DprsError::MalformedCoordinates if the report’s lat/lon values can’t be formatted. This should not happen with validated super::coordinates::Latitude / super::coordinates::Longitude newtypes.

§See also

ircDDBGateway/Common/APRSCollector.cpp:371-394 for the reference CRC + sentence layout this encoder mirrors.