Skip to main content

Vendor-neutral telematics seam for mgf-common consumers — the TelematicsProvider device-session ABC, the codec-agnostic AVL frame types, the typed error hierarchy, and a scripted mock. Per-vendor codecs (mgf-tele-teltonika, …) build on this. Sibling of mgf-common under the mgf.* namespace.

Project description

mgf-tele-core

The vendor-neutral telematics seam for mgf-common consumers: the TelematicsProvider device-session ABC, the codec-agnostic AVL frame types, a typed error hierarchy, and a scripted mock. A sibling of mgf-common under the mgf.* namespace, and the foundation of the mgf-tele-* family — per-vendor codec packages (mgf-tele-teltonika, later mgf-tele-queclink, …) depend on this and never the other way.

Extracted from PlasmaMapper's ingest path (ADR-010's two-layer seam): the provider owns the device session; a per-vendor codec is a pure bytes → DecodedAvlRecord dependency injected into it.

Install

pip install mgf-tele-core

What's in it

Name What
TelematicsProvider the device-session ABC: open_session / receive_packet / send_command / close_session
SessionHandle / TrackerCommand / CommandAck the seam's command/session vocabulary
GeoPoint / DecodedAvlRecord / ReceivedPacket / ParseStatus codec-agnostic AVL frame types (every vendor normalises to these)
TelematicsError (+ MalformedPacketError, ChecksumError, UnsupportedCodecError, MalformedHandshakeError, UnknownTrackerError, SessionClosedError) typed errors, all subclass mgf.common.exceptions.AppError
mgf.tele.core.mock.MockTelematicsProvider scripted in-memory provider for consumers' tests

The two-layer shape

mgf-tele-core        TelematicsProvider (ABC)  +  AVL frame types  +  errors
      ▲
      │ depends on
mgf-tele-teltonika   Codec 8/8E/12 parser  +  TeltonikaProvider(codec)
mgf-tele-queclink    (future) …

A consumer wires a concrete provider into its ingest loop:

async def session_loop(provider: TelematicsProvider, reader, writer):
    handle = await provider.open_session(reader, writer)
    try:
        while True:
            packet = await provider.receive_packet(handle)   # ReceivedPacket
            persist_raw(packet)                               # always (forensic)
            if packet.parse_status == "ok":
                ingest(packet.records)                        # DecodedAvlRecord[]
    except SessionClosedError:
        pass
    finally:
        await provider.close_session(handle)

Tests use MockTelematicsProvider(batches=[…]) — no socket, no vendor codec — to drive the consumer's ingest logic deterministically.

Design notes

  • Frozen frame types (rule DP-03); UTC at the boundary (DP-12).
  • receive_packet always returns the raw bytes even on decode failure (parse_status"ok") so the consumer can persist a forensic record a future codec update may recover.
  • Read-only consumers may have their provider raise NotImplementedError from send_command until a control plane lands.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mgf_tele_core-0.1.0.tar.gz (82.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mgf_tele_core-0.1.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file mgf_tele_core-0.1.0.tar.gz.

File metadata

  • Download URL: mgf_tele_core-0.1.0.tar.gz
  • Upload date:
  • Size: 82.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mgf_tele_core-0.1.0.tar.gz
Algorithm Hash digest
SHA256 21051f742968f6df5d66881604aa43d0451dd111e57457f1a5e79a3a42e4fd87
MD5 a39ec3467e7f04d20eac40e978438720
BLAKE2b-256 d28709596d0cdd4ad923577c597171d440a0a7db479526459ab14c653424929d

See more details on using hashes here.

File details

Details for the file mgf_tele_core-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mgf_tele_core-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mgf_tele_core-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 936a7262839aaa8a8e79e6106fd86f0a048a35a9af8343b0c04383757a0e295e
MD5 acd55c360da9d42d7808f2242d033864
BLAKE2b-256 84d7a6954b5b4a6ad031744a727c8652b5d69ccb733b9b83b90d380091a06ffa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page