CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-pynmea2

Python library for parsing and generating NMEA 0183 protocol messages used in GPS and marine navigation systems

77

1.11x
Overview
Eval results
Files

task.mdevals/scenario-2/

NMEA Message Validator

A utility for validating marine navigation data messages to ensure data integrity.

Capabilities

Message Validation

Validates navigation data messages by verifying their integrity checksums. Messages follow the format: $<data>*<checksum> where the checksum is a two-digit hexadecimal value computed from the message data.

  • When given a valid message with correct checksum, returns True @test
  • When given a message with incorrect checksum, returns False @test
  • When given a message without a checksum, raises an appropriate error @test
  • When given a malformed message (missing $ prefix), raises an appropriate error @test

Checksum Computation

Computes integrity checksums for navigation data messages using standard XOR algorithm.

  • When given message data, returns the correct two-digit hexadecimal checksum @test
  • When given an empty message, returns "00" as the checksum @test

Implementation

@generates

API

def validate_message(message: str) -> bool:
    """
    Validates a navigation data message by checking its integrity checksum.

    Args:
        message: A navigation data message string in the format "$<data>*<checksum>"

    Returns:
        True if the message has a valid checksum, False otherwise

    Raises:
        ValueError: If the message format is invalid
    """
    pass

def compute_checksum(data: str) -> str:
    """
    Computes the integrity checksum for navigation data.

    Args:
        data: The message data (without $ prefix or * and checksum suffix)

    Returns:
        A two-digit hexadecimal string representing the checksum
    """
    pass

Dependencies { .dependencies }

pynmea2 { .dependency }

Provides NMEA 0183 protocol parsing and validation support.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/pypi-pynmea2

tile.json