tpt-protocol

Rust

Open-source, memory-safe Rust suite that unifies 19 industrial, medical, and hardware protocols (Modbus, CAN, BACnet, HL7, MAVLink, and more) into a single open envelope (TUP).

1 stars0 forks1 watchers3 open issuesApache License 2.0
embeddedhl7industrial-protocolsiotmavlinkmemory-safetymodbusno-stdprotocol-parserrust

Languages

Rust93.9%Python4.4%Svelte0.4%Shell0.4%HTML0.3%Slint0.2%JavaScript0.2%C0.1%Dockerfile0.1%TypeScript0.0%CSS0.0%
README

TPT Protocol

CI License: MIT OR Apache-2.0 crates.io docs.rs

The universal translation layer for the physical world.

TPT Protocol is an open-source, memory-safe Rust suite that decodes, normalizes, and unifies 19 heavily gatekept industrial, medical, and hardware communication protocols into a single, openly-specified message envelope (TUP).

                    ┌──────────────────────────────────────┐
                    │            TPT Protocol              │
                    ├──────────────────────────────────────┤
                    │   ┌──────────────────────────────┐   │
                    │   │     tpt-protocol-daemon       │   │
                    │   │   ┌────────────────────────┐  │   │
                    │   │   │  Transport (Serial/CAN/ │  │   │
                    │   │   │  TCP/UDP)               │  │   │
                    │   │   └───────────┬────────────┘  │   │
                    │   │   ┌───────────▼────────────┐  │   │
┌───────────────┐   │   │   │  19 Protocol Parsers   │  │   │
│  Modbus RTU/  │───┼───┼──▶│  (FrameParser,         │  │   │  ┌────────────────┐
│  TCP Device   │   │   │   │   StateValidator,      │  │   │  │  TUI (ratatui) │
├───────────────┤   │   │   │   DataNormalizer)      │  │   │  │  (CLI)         │
│  J1939/ISOBUS │───┼───┼──▶│   ──────────────────▶  │  │──┼──▶├────────────────┤
│  ECU          │   │   │   │   TUP (CBOR/JSON)      │  │   │  │  Embedded UI   │
├───────────────┤   │   │   └────────────────────────┘  │   │  │  (Slint)       │
│  BACnet       │───┼───┼──▶│  ┌────────────────────┐   │   │  ├────────────────┤
│  Building     │   │   │   │  │ Local WebSocket/   │   │   │  │  Web UI        │
├───────────────┤   │   │   │  │ REST API (127.0.0.1)│   │   │  │  (Tauri/Svelte)│
│  ...15 more   │───┼───┼──▶│  └────────────────────┘   │   │  └────────────────┘
└───────────────┘   │   └──────────────────────────────┘   │
                    └──────────────────────────────────────┘

Protocol Crates

CrateProtocolCategoryStrategy
tpt-protocol-modbusModbus RTU/TCPIndustrial IoTPattern A (scratch, no_std alt. to tokio-modbus)
tpt-protocol-j1939SAE J1939Heavy MachineryPattern A (scratch)
tpt-protocol-isobusISO 11783 (ISOBUS)AgriculturePattern A (scratch)
tpt-protocol-udsISO 14229 (UDS)AutomotivePattern A (scratch — no existing crate)
tpt-protocol-canopenCANopenAutomationPattern A (scratch, no_std alt. to canopen crate)
tpt-protocol-doip-someipDoIP / SOME/IPAutomotivePattern A (scratch)
tpt-protocol-nmeaNMEA 2000/0183MarinePattern A (scratch, MIT-compatible alt. to nmea crate)
tpt-protocol-mavlinkMAVLinkDronePublished (wraps mavlink crate)
tpt-protocol-bacnetBACnetBuildingPattern A (scratch)
tpt-protocol-opcuaOPC UAIndustry 4.0Pattern A (scratch)
tpt-protocol-dnp3DNP3Energy/SCADAPattern A (scratch)
tpt-protocol-ethercatEtherCATFactoryPublished (alt. to ethercrab)
tpt-protocol-sparkplugbSparkplug BIIoTPattern A (scratch)
tpt-protocol-ocppOCPP-J (1.6, 2.0.1)EV ChargingPattern A (scratch — ocpp crate unmaintained)
tpt-protocol-ieee11073-sdcIEEE 11073 SDCMedicalPattern A (scratch)
tpt-protocol-hl7v2HL7 v2.xHealthcarePattern A (scratch)
tpt-protocol-knxKNXSmart BuildingPattern A (scratch)
tpt-protocol-matter-threadMatter/ThreadSmart HomePattern A (scratch, MIT-compatible alt. to rs-matter)
tpt-protocol-coapCoAPIoTPattern A (scratch, no_std alt. to coap crate)

Repository Structure

tpt-protocol/
├── crates/tpt-protocol-tup/       # TUP schema (CBOR + JSON), no_std
├── crates/tpt-protocol-core/      # Core traits (FrameParser, StateValidator, DataNormalizer)
├── crates/tpt-protocol-<name>/    # 19 published protocol crates (Pattern A — scratch, or a wrapper: MAVLink)
├── crates/tpt-protocol-daemon/    # Background service
├── crates/tpt-protocol-bindings/  # C ABI, WebAssembly and Python bindings (not published)
├── crates/tpt-protocol-cli/       # TUI (ratatui dashboard)
├── crates/tpt-protocol-ui-embedded/ # Native embedded UI (Slint)
├── crates/tpt-protocol-ui-web/    # Web fleet dashboard (Tauri v2 + SvelteKit)
├── crates/tpt-protocol-telos/     # Formal-verification specs (tpt-telos)
├── SPEC-TUP.md                    # TUP schema specification
└── Cargo.toml                     # Workspace root

Quick Start

# Build all crates
cargo build --workspace

# Test all crates
cargo test --workspace

# List the 19 protocols the daemon can simulate
cargo run --bin tpt-protocol-daemon -- --list-protocols

# Run the daemon with simulated data for any supported protocol
cargo run --bin tpt-protocol-daemon -- --simulate modbus

# Replay a capture through a protocol's parser (hex, raw, candump or pcap)
cargo run --bin tpt-protocol-daemon -- --simulate bacnet --replay frame.hex

# In another terminal, launch the TUI
cargo run --bin tpt-protocol-cli

The daemon has two data sources. By default every protocol produces synthetic TUP data points, so the pipeline runs end-to-end without hardware. Pass a transport flag to decode real bytes instead: --tcp-connect, --tcp-listen, --udp-bind, --stdin, --modbus-poll (a Modbus TCP poller), and (with the serial or socketcan feature) --serial and --can. Serial and SocketCAN are tested only against a pseudo-terminal pair and a vcan0 interface, not real hardware. The daemon can also send its points to MQTT, InfluxDB, OpenTelemetry, Prometheus or an OPC UA server, and record them to NDJSON, MCAP or Parquet. See the daemon README.

Architecture

  • no_std by default: All protocol crates compile to bare-metal targets (thumbv6m-none-eabi).
  • Local-first: The daemon binds its API to 127.0.0.1 by default, and logs a warning for any other address. Zero telemetry, zero cloud dependency.
  • TUP envelope: Every protocol normalizes into the TPT Unified Protocol — CBOR on the wire, JSON for the UI, openly specified in SPEC-TUP.md.
  • Memory-safe: Written in Rust. tpt-protocol-telos formally checks three Modbus specifications (in this repository; not published). Other state machines are not yet covered.

License

Licensed under either of MIT or Apache 2.0 at your option.