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).

0 stars0 forks0 watchersApache License 2.0
embeddedhl7industrial-protocolsiotmavlinkmemory-safetymodbusno-stdprotocol-parserrust

Languages

Rust96.3%Shell1.4%Svelte1.0%Slint0.6%JavaScript0.4%Python0.3%TypeScript0.1%CSS0.0%
README

TPT Protocol

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)│
│  ...16 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)
out-protocol-mavlinkMAVLinkDronePrivate (alt. to mavlink crate)
tpt-protocol-bacnetBACnetBuildingPattern A (scratch)
tpt-protocol-opcuaOPC UAIndustry 4.0Pattern A (scratch)
tpt-protocol-dnp3DNP3Energy/SCADAPattern A (scratch)
out-protocol-ethercatEtherCATFactoryPrivate (alt. to ethercrab)
tpt-protocol-sparkplugbSparkplug BIIoTPattern A (scratch)
tpt-protocol-ocppOCPP 2.0.1EV 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>/    # 17 published protocol crates (Pattern A — scratch)
├── crates/out-protocol-<name>/    # 2 private from-scratch implementations (not published)
├── crates/tpt-protocol-daemon/    # Background service
├── 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 raw bytes from a file through a protocol's parser (hex or raw)
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 currently ships simulation only — every protocol produces synthetic TUP data points so the pipeline can be exercised end-to-end without hardware. Real transport (Serial/CAN/TCP/UDP) is future work.

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 only. 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. Critical state machines are formally verified with tpt-telos (tpt-protocol-telos).

License

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