James Rich 36ca64af16 Add the BLE GATT mesh-peer transport: a phone connects to the node as a mesh peer
A phone can already reach a node's phone API over BLE, but it cannot be a
node on the mesh through that link: the phone API carries commands and
FromRadio state, not mesh frames. This adds a second GATT service, the
mesh-peer service, on which a client library (node-transport-ble-gatt)
exchanges whole encrypted MeshPackets with the node - the SIG Mesh "GATT
proxy" role. The node stays the GATT server; the phone is a central that
subscribes to the mesh characteristic and writes fragments to it.

BLEGattMeshHandler is the platform-neutral half and holds everything the
client library speaks, so the native suite covers it: the fragment framing
([version][id][index][total][payload], one ATT value per fragment), bounded
reassembly (per-peer in-flight limit, per-table peer limit, expiry, so a
hostile writer cannot fill memory), the ingress guards shared with the UDP
transport (no sender, our own node number, out-of-range hop counts,
local-only flags cleared), a relay exclusion so a packet is never written
back to the peer that delivered it unless that peer originated it (the
echo is its only implicit ack on a point-to-point bearer), the HELLO
link-control frame that names a node on its GATT links so a node reached
both ways can elect one link, and a liveness probe for a link this node
dialled. No platform here dials yet, so the probe and shed hooks keep their
base-class defaults; the dial-out half is a later change. It registers as
a PostEncode transport, gated on ProtocolFlags.BLE_GATT_PEER, and tags its
arrivals TRANSPORT_BLE_GATT.

NRF52BLEGattMesh is the Bluefruit half: the service and characteristic,
CCCD tracking (a link becomes a mesh peer when it subscribes), a write
queue from Bluefruit's callback task to the main-task pump, per-connection
MTU chunking, and re-arming the connectable advertisement while a
peripheral slot is free, which Bluefruit only does by itself once no link
is left. Bluefruit.begin(2, 0): two peripheral links, the phone and one
mesh peer, no central.

NRF52Bluetooth has to stop assuming one link. The phone is whichever link
uses the phone API, not the most recent connect, so notePhoneLink() learns
it from the first phone-API access and only that link's drop closes the
phone session; fromNum and logRadio notify that handle explicitly rather
than Bluefruit's default. The mesh-peer UUID rides in the scan response in
place of the TX power entry, since S140 has one advertising set.

The nanopb enums come from the protobufs branch this submodule now points
at; nothing under src/mesh/generated/ is committed, the regen workflow
supplies it once that PR merges (bin/regen-protos.sh locally until then).

Native tests in test_ble_gatt_mesh, built by the portduino env's new
HAS_BLE_GATT_MESH flag: framing and its bounds, reassembly, every ingress
guard, per-peer fragmentation, the relay exclusion and its originator
exception, the bounded TX ring and busy-stack retry, the greeting, the
election, and the probe timings.
2026-10-11 10:54:58 -05:00
2026-10-02 11:59:23 +00:00
2021-10-09 17:15:12 +11:00
2024-09-24 15:24:08 -05:00
2026-07-01 19:01:27 -05:00
2026-01-29 10:06:58 -06:00
2024-11-28 06:26:51 -06:00
2024-09-04 15:33:28 -07:00
2026-01-29 10:06:58 -06:00
2026-01-29 10:06:58 -06:00
2026-10-03 22:43:30 +00:00
2025-01-13 12:24:05 +08:00
2026-01-29 10:06:58 -06:00

Meshtastic Logo

Meshtastic Firmware

GitHub release downloads CI CLA assistant Fiscal Contributors Vercel MemBrowse

meshtastic%2Ffirmware | Trendshift

Overview

This repository contains the official device firmware for Meshtastic, an open-source LoRa mesh networking project designed for long-range, low-power communication without relying on internet or cellular infrastructure. The firmware supports various hardware platforms, including ESP32, nRF52, RP2040/RP2350, and Linux-based devices.

Meshtastic enables text messaging, location sharing, and telemetry over a decentralized mesh network, making it ideal for outdoor adventures, emergency preparedness, and remote operations.

Get Started

Join our community and help improve Meshtastic! 🚀

Stats

Alt

S
Description
No description provided
Readme GPL-3.0
317 MiB
0 Stars 1 Watchers 0 Forks
Languages
C++ 73.6%
C 21.7%
Python 2.6%
Shell 1.5%
Batchfile 0.2%
Other 0.2%