diff --git a/meshtastic/localonly.proto b/meshtastic/localonly.proto index 2a6c7cac..4f846e53 100644 --- a/meshtastic/localonly.proto +++ b/meshtastic/localonly.proto @@ -146,6 +146,11 @@ message LocalModuleConfig { */ ModuleConfig.TAKConfig tak = 17; + /* + * MeshBeacon Config + */ + ModuleConfig.MeshBeaconConfig mesh_beacon = 18; + /* * A version integer used to invalidate old save files when we make * incompatible changes This integer is set at build time and is private to diff --git a/meshtastic/mesh_beacon.options b/meshtastic/mesh_beacon.options new file mode 100644 index 00000000..cd4099cd --- /dev/null +++ b/meshtastic/mesh_beacon.options @@ -0,0 +1,3 @@ +*MeshBeacon.message max_size:101 +*MeshBeacon.offer_channel.name max_size:12 +*MeshBeacon.offer_channel.psk max_size:32 diff --git a/meshtastic/mesh_beacon.proto b/meshtastic/mesh_beacon.proto new file mode 100644 index 00000000..c6005ab7 --- /dev/null +++ b/meshtastic/mesh_beacon.proto @@ -0,0 +1,42 @@ +syntax = "proto3"; + +package meshtastic; + +import "meshtastic/channel.proto"; +import "meshtastic/config.proto"; + +option csharp_namespace = "Meshtastic.Protobufs"; +option go_package = "github.com/meshtastic/go/generated"; +option java_outer_classname = "MeshBeaconProtos"; +option java_package = "org.meshtastic.proto"; +option swift_prefix = ""; + +/* + * Payload for MESH_BEACON_APP packets. + * Periodically broadcast by nodes in beacon mode. + * Listeners deliver the text message to the local inbox and cache any offered + * channel/preset for the client app to act on — the firmware never auto-applies them. + */ +message MeshBeacon { + /* + * Human-readable beacon message. Max 100 bytes enforced by firmware on send. + */ + string message = 1; + + /* + * Optional channel (name + PSK) being advertised to listening clients. + * A client app may offer to switch the user to this channel; firmware never applies it automatically. + */ + ChannelSettings offer_channel = 2; + + /* + * Optional region being advertised alongside offer_preset. + */ + Config.LoRaConfig.RegionCode offer_region = 3; + + /* + * Optional modem preset being advertised. + * Combined with offer_region, tells a client "there is a mesh on this preset/region". + */ + optional Config.LoRaConfig.ModemPreset offer_preset = 4; +} diff --git a/meshtastic/module_config.options b/meshtastic/module_config.options index c6158bef..1a4efaa9 100644 --- a/meshtastic/module_config.options +++ b/meshtastic/module_config.options @@ -29,3 +29,9 @@ *DetectionSensorConfig.detection_trigger_type max_size:8 *StatusMessageConfig.node_status max_size:80 + +*MeshBeaconConfig.broadcast_message max_size:101 +*MeshBeaconConfig.broadcast_offer_channel.name max_size:12 +*MeshBeaconConfig.broadcast_offer_channel.psk max_size:32 +*MeshBeaconConfig.broadcast_on_channel.name max_size:12 +*MeshBeaconConfig.broadcast_on_channel.psk max_size:32 diff --git a/meshtastic/module_config.proto b/meshtastic/module_config.proto index a134f74c..bcc89fcf 100644 --- a/meshtastic/module_config.proto +++ b/meshtastic/module_config.proto @@ -3,6 +3,8 @@ syntax = "proto3"; package meshtastic; import "meshtastic/atak.proto"; +import "meshtastic/channel.proto"; +import "meshtastic/config.proto"; option csharp_namespace = "Meshtastic.Protobufs"; option go_package = "github.com/meshtastic/go/generated"; @@ -857,6 +859,83 @@ message ModuleConfig { string node_status = 1; } + /* + * MeshBeacon module config + */ + message MeshBeaconConfig { + /* + * Enable receiving MESH_BEACON_APP packets from other nodes. + * The text portion is delivered to the local message inbox. + * Offered channel/preset are stored for the client app to act on. + */ + bool listen_enabled = 1; + + /* + * Enable periodically broadcasting MESH_BEACON_APP packets from this node. + */ + bool broadcast_enabled = 2; + + /* + * Optional: node ID to send beacon messages AS. + * When set, the `from` field of outgoing beacon packets is set to this node ID, + * making beacons appear to originate from that node. + * When unset (0), beacons are sent as the local node. + * A remote admin can only set this field to their own node ID. + */ + uint32 broadcast_send_as_node = 3; + + /* + * Message to include in each beacon broadcast. Max 100 bytes enforced by firmware. + */ + string broadcast_message = 4; + + /* + * Optional channel (name + PSK) to advertise in the MeshBeacon offer_channel field. + */ + ChannelSettings broadcast_offer_channel = 5; + + /* + * Optional region to advertise in the MeshBeacon offer_region field. + */ + Config.LoRaConfig.RegionCode broadcast_offer_region = 6; + + /* + * Optional modem preset to advertise in the MeshBeacon offer_preset field. + */ + optional Config.LoRaConfig.ModemPreset broadcast_offer_preset = 7; + + /* + * Channel settings (name + PSK) to use when sending beacons. + * If unset, beacons go out on the primary channel. + */ + ChannelSettings broadcast_on_channel = 8; + + /* + * Region to use when sending beacons on broadcast_on_preset. + */ + Config.LoRaConfig.RegionCode broadcast_on_region = 9; + + /* + * Modem preset to use when sending beacons. + * If different from current config, the radio is temporarily switched for TX. + */ + optional Config.LoRaConfig.ModemPreset broadcast_on_preset = 10; + + /* + * How often to broadcast, in seconds. Min 3600 (1 h), default 3600. + */ + uint32 broadcast_interval_secs = 11; + + /* + * When true and both broadcast_message and offer content (preset/channel/region) are present, + * the broadcaster splits them into two separate packets instead of one combined MESH_BEACON_APP: + * - Packet A: MESH_BEACON_APP carrying only the offer fields (no text) on the beacon radio config. + * - Packet B: TEXT_MESSAGE_APP carrying only the broadcast_message on the normal radio config. + * This ensures nodes that only decode TEXT_MESSAGE_APP can still receive the human-readable text. + */ + bool broadcast_legacy_split = 12; + } + /* * TODO: REPLACE */ @@ -940,6 +1019,11 @@ message ModuleConfig { * TAK team/role configuration for TAK_TRACKER */ TAKConfig tak = 16; + + /* + * MeshBeacon module config + */ + MeshBeaconConfig mesh_beacon = 17; } /* diff --git a/meshtastic/portnums.proto b/meshtastic/portnums.proto index 61412cfe..5ebe26fb 100644 --- a/meshtastic/portnums.proto +++ b/meshtastic/portnums.proto @@ -155,6 +155,14 @@ enum PortNum { */ NODE_STATUS_APP = 36; + /* + * Beacon module broadcast packets. + * ENCODING: protobuf (MeshBeacon) + * Periodically broadcast by nodes in beacon mode; received by nodes with listen_enabled. + * Carries a text message plus optional channel/preset offers for client apps. + */ + MESH_BEACON_APP = 37; + /* * Provides a hardware serial interface to send and receive from the Meshtastic network. * Connect to the RX/TX pins of a device with 38400 8N1. Packets received from the Meshtastic