lattice-protocol

module
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2026 License: GPL-3.0

README

lattice-protocol

CI

Shared protocol definitions for the Lattice mesh network. Defines the opcode and adapter-type constants consumed by all Lattice services and firmware.

Used by:

  • motionSensorServer (Go) — imports as a Go module
  • Lattice-nodes (ESP32/C++) — includes via git submodule

Packages

Package Description
opcodes/ Serial command opcode constants (Go)
adapter/ Adapter type identifiers and helpers (Go)
c/ Generated C headers for firmware — do not edit directly
cmd/gen-headers/ Generator that writes c/ from the Go constants

Usage

Go (motionSensorServer)
import (
    "github.com/superbrobenji/lattice-protocol/opcodes"
    "github.com/superbrobenji/lattice-protocol/adapter"
)

payload[0] = opcodes.OpLEDSolid
if adapter.IsOutput(node.AdapterType) { ... }
C (Lattice-nodes — via git submodule at main/lib/lattice-protocol)
#include "lib/lattice-protocol/c/opcodes.h"
#include "lib/lattice-protocol/c/adapter_types.h"

payload[0] = OP_LED_SOLID;

Set up the submodule:

git submodule update --init

Contributing

See CONTRIBUTING.md for the full protocol contribution workflow — adding opcodes or adapter types, regenerating C headers, and opening a PR.

Versioning

This module follows semver. Consumers pin to a tag.

Tag Notes
v0.6.0 Wire shrink 250→200B: dropped top-level Secondary{MasterMac,PublicKey} (moved to JOIN_ACK data payload); RoutePath[60→48] (MAX_HOPS 10→8). Flag-day, no v5 backcompat.
v0.5.0 Protocol v4 wire: AuthPath[8] — chained HMAC-SHA256-64 authenticating relay-accumulated route_path (issue lattice-nodes#44). Flag-day, no backcompat. WireSize=250.
v0.4.2 gen-headers emit textual include guards (LATTICE_<FILE>_H) on all c/*.h; wire format unchanged
v0.4.1 nanopb max_size options for proto v3 fields (routePath, authTag, secondary master)
v0.4.0 Protocol v3 wire format: source-routed downlink (RoutePath[60] + RouteLen), E2E AEAD auth tag (AuthTag[16]), dual-master JOIN_ACK fields (SecondaryMasterMac, SecondaryPublicKey[32]); WireSize = 242
v0.3.0 Add health opcodes 0xB0/0xB1/0xB2
v0.2.1 Lower go directive to 1.21.0
v0.2.0 Generated C headers; submodule support
v0.1.0 Initial release

License

Copyright (C) 2026 Lattice Contributors

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

See LICENSE for the full terms.

Directories

Path Synopsis
Package adapter defines the input/output adapter type constants for the Lattice mesh.
Package adapter defines the input/output adapter type constants for the Lattice mesh.
cmd
gen-headers command
gen-headers generates c/opcodes.h, c/adapter_types.h, c/message_types.h, and c/mesh_message.h from the Go constants.
gen-headers generates c/opcodes.h, c/adapter_types.h, c/message_types.h, and c/mesh_message.h from the Go constants.
Package message defines the Lattice mesh wire-format message struct.
Package message defines the Lattice mesh wire-format message struct.
Package opcodes defines the shared opcode constants for the Lattice mesh protocol.
Package opcodes defines the shared opcode constants for the Lattice mesh protocol.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL