From 049c587ca247ec731e6ab677cd3dade6f86f4634 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 27 Jul 2023 12:51:31 -0500 Subject: [PATCH] Add phoneapi plumbing. Need to regen protos on my other machine --- protobufs | 2 +- src/mesh/NodeDB.cpp | 4 ++++ src/mesh/PhoneAPI.cpp | 4 ++++ src/modules/AdminModule.cpp | 5 +++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/protobufs b/protobufs index 7bf13761b..0d5b0942f 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 7bf13761bbeebd6cfe0604d851cbce818655999d +Subproject commit 0d5b0942fe4a462e3c3c1b214fd4e41c588c9c44 diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index c5605a281..edd9e05f8 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -249,6 +249,9 @@ void NodeDB::installDefaultModuleConfig() strncpy(moduleConfig.mqtt.username, default_mqtt_username, sizeof(moduleConfig.mqtt.username)); strncpy(moduleConfig.mqtt.password, default_mqtt_password, sizeof(moduleConfig.mqtt.password)); + moduleConfig.has_neighbor_info = true; + moduleConfig.neighbor_info.enabled = false; + initModuleConfigIntervals(); } @@ -272,6 +275,7 @@ void NodeDB::initModuleConfigIntervals() moduleConfig.telemetry.device_update_interval = default_broadcast_interval_secs; moduleConfig.telemetry.environment_update_interval = default_broadcast_interval_secs; moduleConfig.telemetry.air_quality_interval = default_broadcast_interval_secs; + moduleConfig.neighbor_info.update_interval = default_broadcast_interval_secs; } void NodeDB::installDefaultChannels() diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index 6c6c70165..cd230cb1c 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -279,6 +279,10 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_remote_hardware_tag; fromRadioScratch.moduleConfig.payload_variant.remote_hardware = moduleConfig.remote_hardware; break; + case meshtastic_ModuleConfig_neighbor_info_tag: + fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_neighbor_info_tag; + fromRadioScratch.moduleConfig.payload_variant.neighbor_info = moduleConfig.neighbor_info; + break; default: LOG_ERROR("Unknown module config type %d\n", config_state); } diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index afe26f5a3..02e4fb416 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -508,6 +508,11 @@ void AdminModule::handleGetModuleConfig(const meshtastic_MeshPacket &req, const res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_remote_hardware_tag; res.get_module_config_response.payload_variant.remote_hardware = moduleConfig.remote_hardware; break; + case meshtastic_AdminMessage_ModuleConfigType_NEIGHBORINFO_CONFIG: + LOG_INFO("Getting module config: Remote Hardware\n"); + res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_neighbor_info_tag; + res.get_module_config_response.payload_variant.neighbor_info = moduleConfig.neighbor_info; + break; } // NOTE: The phone app needs to know the ls_secsvalue so it can properly expect sleep behavior.