diff --git a/protobufs b/protobufs index 9a120bb5a..ba16bfc73 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 9a120bb5a4c7f7dd87efa7a25eefaa75bc6db659 +Subproject commit ba16bfc731ab7e23f6be5a8e73358b1973e73822 diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index a39775cd6..cf58c23b4 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -897,6 +897,23 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_tak_tag; fromRadioScratch.moduleConfig.payload_variant.tak = moduleConfig.tak; break; +#if !MESHTASTIC_EXCLUDE_BEACON + case meshtastic_ModuleConfig_mesh_beacon_tag: + LOG_DEBUG("Send module config: mesh beacon"); + fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_mesh_beacon_tag; +#ifdef MESHTASTIC_PHONEAPI_ACCESS_CONTROL + if (!getAdminAuthorized()) { + // Unauthenticated: emit an empty MeshBeaconConfig (zero-init from + // the top-of-loop memset). The embedded ChannelSettings + // (broadcast_offer_channel / broadcast_on_channel) carry PSKs that + // must not be visible to an unauth client. + } else +#endif + { + fromRadioScratch.moduleConfig.payload_variant.mesh_beacon = moduleConfig.mesh_beacon; + } + break; +#endif default: LOG_DEBUG("Unhandled module config type %d", config_state); } diff --git a/src/mesh/generated/meshtastic/admin.pb.h b/src/mesh/generated/meshtastic/admin.pb.h index 42d8879ce..4c00a568c 100644 --- a/src/mesh/generated/meshtastic/admin.pb.h +++ b/src/mesh/generated/meshtastic/admin.pb.h @@ -83,7 +83,9 @@ typedef enum _meshtastic_AdminMessage_ModuleConfigType { /* Traffic management module config */ meshtastic_AdminMessage_ModuleConfigType_TRAFFICMANAGEMENT_CONFIG = 14, /* TAK module config */ - meshtastic_AdminMessage_ModuleConfigType_TAK_CONFIG = 15 + meshtastic_AdminMessage_ModuleConfigType_TAK_CONFIG = 15, + /* Mesh Beacon module config */ + meshtastic_AdminMessage_ModuleConfigType_MESHBEACON_CONFIG = 16 } meshtastic_AdminMessage_ModuleConfigType; typedef enum _meshtastic_AdminMessage_BackupLocation { @@ -510,8 +512,8 @@ extern "C" { #define _meshtastic_AdminMessage_ConfigType_ARRAYSIZE ((meshtastic_AdminMessage_ConfigType)(meshtastic_AdminMessage_ConfigType_DEVICEUI_CONFIG+1)) #define _meshtastic_AdminMessage_ModuleConfigType_MIN meshtastic_AdminMessage_ModuleConfigType_MQTT_CONFIG -#define _meshtastic_AdminMessage_ModuleConfigType_MAX meshtastic_AdminMessage_ModuleConfigType_TAK_CONFIG -#define _meshtastic_AdminMessage_ModuleConfigType_ARRAYSIZE ((meshtastic_AdminMessage_ModuleConfigType)(meshtastic_AdminMessage_ModuleConfigType_TAK_CONFIG+1)) +#define _meshtastic_AdminMessage_ModuleConfigType_MAX meshtastic_AdminMessage_ModuleConfigType_MESHBEACON_CONFIG +#define _meshtastic_AdminMessage_ModuleConfigType_ARRAYSIZE ((meshtastic_AdminMessage_ModuleConfigType)(meshtastic_AdminMessage_ModuleConfigType_MESHBEACON_CONFIG+1)) #define _meshtastic_AdminMessage_BackupLocation_MIN meshtastic_AdminMessage_BackupLocation_FLASH #define _meshtastic_AdminMessage_BackupLocation_MAX meshtastic_AdminMessage_BackupLocation_SD diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 27d769b06..261944845 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -1487,6 +1487,13 @@ void AdminModule::handleGetModuleConfig(const meshtastic_MeshPacket &req, const res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_traffic_management_tag; res.get_module_config_response.payload_variant.traffic_management = moduleConfig.traffic_management; break; +#if !MESHTASTIC_EXCLUDE_BEACON + case meshtastic_AdminMessage_ModuleConfigType_MESHBEACON_CONFIG: + configName = "MeshBeacon"; + res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_mesh_beacon_tag; + res.get_module_config_response.payload_variant.mesh_beacon = moduleConfig.mesh_beacon; + break; +#endif } LOG_INFO("Get module config: %s", configName);