mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-20 01:32:40 +00:00
re-add namespacing in protobufs. Let's see what i missed. Portduino likely ...
Checking in generated on purpose.
This commit is contained in:
@@ -38,7 +38,7 @@ static void writeSecret(char *buf, size_t bufsz, const char *currentVal)
|
||||
* @param r Decoded AdminMessage
|
||||
* @return bool
|
||||
*/
|
||||
bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
|
||||
bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_AdminMessage *r)
|
||||
{
|
||||
// if handled == false, then let others look at this message also if they want
|
||||
bool handled = false;
|
||||
@@ -49,26 +49,26 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
|
||||
/**
|
||||
* Getters
|
||||
*/
|
||||
case AdminMessage_get_owner_request_tag:
|
||||
case meshtastic_AdminMessage_get_owner_request_tag:
|
||||
LOG_INFO("Client is getting owner\n");
|
||||
handleGetOwner(mp);
|
||||
break;
|
||||
|
||||
case AdminMessage_get_config_request_tag:
|
||||
case meshtastic_AdminMessage_get_config_request_tag:
|
||||
LOG_INFO("Client is getting config\n");
|
||||
handleGetConfig(mp, r->get_config_request);
|
||||
break;
|
||||
|
||||
case AdminMessage_get_module_config_request_tag:
|
||||
case meshtastic_AdminMessage_get_module_config_request_tag:
|
||||
LOG_INFO("Client is getting module config\n");
|
||||
handleGetModuleConfig(mp, r->get_module_config_request);
|
||||
break;
|
||||
|
||||
case AdminMessage_get_channel_request_tag: {
|
||||
case meshtastic_AdminMessage_get_channel_request_tag: {
|
||||
uint32_t i = r->get_channel_request - 1;
|
||||
LOG_INFO("Client is getting channel %u\n", i);
|
||||
if (i >= MAX_NUM_CHANNELS)
|
||||
myReply = allocErrorResponse(Routing_Error_BAD_REQUEST, &mp);
|
||||
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
|
||||
else
|
||||
handleGetChannel(mp, i);
|
||||
break;
|
||||
@@ -77,25 +77,25 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
|
||||
/**
|
||||
* Setters
|
||||
*/
|
||||
case AdminMessage_set_owner_tag:
|
||||
case meshtastic_AdminMessage_set_owner_tag:
|
||||
LOG_INFO("Client is setting owner\n");
|
||||
handleSetOwner(r->set_owner);
|
||||
break;
|
||||
|
||||
case AdminMessage_set_config_tag:
|
||||
case meshtastic_AdminMessage_set_config_tag:
|
||||
LOG_INFO("Client is setting the config\n");
|
||||
handleSetConfig(r->set_config);
|
||||
break;
|
||||
|
||||
case AdminMessage_set_module_config_tag:
|
||||
case meshtastic_AdminMessage_set_module_config_tag:
|
||||
LOG_INFO("Client is setting the module config\n");
|
||||
handleSetModuleConfig(r->set_module_config);
|
||||
break;
|
||||
|
||||
case AdminMessage_set_channel_tag:
|
||||
case meshtastic_AdminMessage_set_channel_tag:
|
||||
LOG_INFO("Client is setting channel %d\n", r->set_channel.index);
|
||||
if (r->set_channel.index < 0 || r->set_channel.index >= (int)MAX_NUM_CHANNELS)
|
||||
myReply = allocErrorResponse(Routing_Error_BAD_REQUEST, &mp);
|
||||
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
|
||||
else
|
||||
handleSetChannel(r->set_channel);
|
||||
break;
|
||||
@@ -103,11 +103,11 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
|
||||
/**
|
||||
* Other
|
||||
*/
|
||||
case AdminMessage_reboot_seconds_tag: {
|
||||
case meshtastic_AdminMessage_reboot_seconds_tag: {
|
||||
reboot(r->reboot_seconds);
|
||||
break;
|
||||
}
|
||||
case AdminMessage_reboot_ota_seconds_tag: {
|
||||
case meshtastic_AdminMessage_reboot_ota_seconds_tag: {
|
||||
int32_t s = r->reboot_ota_seconds;
|
||||
#ifdef ARCH_ESP32
|
||||
if (BleOta::getOtaAppVersion().isEmpty()) {
|
||||
@@ -125,35 +125,35 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
|
||||
rebootAtMsec = (s < 0) ? 0 : (millis() + s * 1000);
|
||||
break;
|
||||
}
|
||||
case AdminMessage_shutdown_seconds_tag: {
|
||||
case meshtastic_AdminMessage_shutdown_seconds_tag: {
|
||||
int32_t s = r->shutdown_seconds;
|
||||
LOG_INFO("Shutdown in %d seconds\n", s);
|
||||
shutdownAtMsec = (s < 0) ? 0 : (millis() + s * 1000);
|
||||
break;
|
||||
}
|
||||
case AdminMessage_get_device_metadata_request_tag: {
|
||||
case meshtastic_AdminMessage_get_device_metadata_request_tag: {
|
||||
LOG_INFO("Client is getting device metadata\n");
|
||||
handleGetDeviceMetadata(mp);
|
||||
break;
|
||||
}
|
||||
case AdminMessage_factory_reset_tag: {
|
||||
case meshtastic_AdminMessage_factory_reset_tag: {
|
||||
LOG_INFO("Initiating factory reset\n");
|
||||
nodeDB.factoryReset();
|
||||
reboot(DEFAULT_REBOOT_SECONDS);
|
||||
break;
|
||||
}
|
||||
case AdminMessage_nodedb_reset_tag: {
|
||||
case meshtastic_AdminMessage_nodedb_reset_tag: {
|
||||
LOG_INFO("Initiating node-db reset\n");
|
||||
nodeDB.resetNodes();
|
||||
reboot(DEFAULT_REBOOT_SECONDS);
|
||||
break;
|
||||
}
|
||||
case AdminMessage_begin_edit_settings_tag: {
|
||||
case meshtastic_AdminMessage_begin_edit_settings_tag: {
|
||||
LOG_INFO("Beginning transaction for editing settings\n");
|
||||
hasOpenEditTransaction = true;
|
||||
break;
|
||||
}
|
||||
case AdminMessage_commit_edit_settings_tag: {
|
||||
case meshtastic_AdminMessage_commit_edit_settings_tag: {
|
||||
LOG_INFO("Committing transaction for edited settings\n");
|
||||
hasOpenEditTransaction = false;
|
||||
saveChanges(SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS);
|
||||
@@ -167,7 +167,7 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
|
||||
#endif
|
||||
|
||||
default:
|
||||
AdminMessage res = AdminMessage_init_default;
|
||||
meshtastic_AdminMessage res = meshtastic_AdminMessage_init_default;
|
||||
AdminMessageHandleResult handleResult = MeshModule::handleAdminMessageForAllPlugins(mp, r, &res);
|
||||
|
||||
if (handleResult == AdminMessageHandleResult::HANDLED_WITH_RESPONSE) {
|
||||
@@ -183,7 +183,7 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
|
||||
|
||||
// If asked for a response and it is not yet set, generate an 'ACK' response
|
||||
if (mp.decoded.want_response && !myReply) {
|
||||
myReply = allocErrorResponse(Routing_Error_NONE, &mp);
|
||||
myReply = allocErrorResponse(meshtastic_Routing_Error_NONE, &mp);
|
||||
}
|
||||
|
||||
return handled;
|
||||
@@ -193,7 +193,7 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
|
||||
* Setter methods
|
||||
*/
|
||||
|
||||
void AdminModule::handleSetOwner(const User &o)
|
||||
void AdminModule::handleSetOwner(const meshtastic_User &o)
|
||||
{
|
||||
int changed = 0;
|
||||
bool licensed_changed = false;
|
||||
@@ -223,53 +223,53 @@ void AdminModule::handleSetOwner(const User &o)
|
||||
}
|
||||
}
|
||||
|
||||
void AdminModule::handleSetConfig(const Config &c)
|
||||
void AdminModule::handleSetConfig(const meshtastic_Config &c)
|
||||
{
|
||||
bool isRouter = (config.device.role == Config_DeviceConfig_Role_ROUTER);
|
||||
bool isRegionUnset = (config.lora.region == Config_LoRaConfig_RegionCode_UNSET);
|
||||
bool isRouter = (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER);
|
||||
bool isRegionUnset = (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET);
|
||||
|
||||
switch (c.which_payload_variant) {
|
||||
case Config_device_tag:
|
||||
case meshtastic_Config_device_tag:
|
||||
LOG_INFO("Setting config: Device\n");
|
||||
config.has_device = true;
|
||||
config.device = c.payload_variant.device;
|
||||
// If we're setting router role for the first time, install its intervals
|
||||
if (!isRouter && c.payload_variant.device.role == Config_DeviceConfig_Role_ROUTER) {
|
||||
if (!isRouter && c.payload_variant.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER) {
|
||||
nodeDB.initConfigIntervals();
|
||||
nodeDB.initModuleConfigIntervals();
|
||||
}
|
||||
break;
|
||||
case Config_position_tag:
|
||||
case meshtastic_Config_position_tag:
|
||||
LOG_INFO("Setting config: Position\n");
|
||||
config.has_position = true;
|
||||
config.position = c.payload_variant.position;
|
||||
// Save nodedb as well in case we got a fixed position packet
|
||||
saveChanges(SEGMENT_DEVICESTATE, false);
|
||||
break;
|
||||
case Config_power_tag:
|
||||
case meshtastic_Config_power_tag:
|
||||
LOG_INFO("Setting config: Power\n");
|
||||
config.has_power = true;
|
||||
config.power = c.payload_variant.power;
|
||||
break;
|
||||
case Config_network_tag:
|
||||
case meshtastic_Config_network_tag:
|
||||
LOG_INFO("Setting config: WiFi\n");
|
||||
config.has_network = true;
|
||||
config.network = c.payload_variant.network;
|
||||
break;
|
||||
case Config_display_tag:
|
||||
case meshtastic_Config_display_tag:
|
||||
LOG_INFO("Setting config: Display\n");
|
||||
config.has_display = true;
|
||||
config.display = c.payload_variant.display;
|
||||
break;
|
||||
case Config_lora_tag:
|
||||
case meshtastic_Config_lora_tag:
|
||||
LOG_INFO("Setting config: LoRa\n");
|
||||
config.has_lora = true;
|
||||
config.lora = c.payload_variant.lora;
|
||||
if (isRegionUnset && config.lora.region > Config_LoRaConfig_RegionCode_UNSET) {
|
||||
if (isRegionUnset && config.lora.region > meshtastic_Config_LoRaConfig_RegionCode_UNSET) {
|
||||
config.lora.tx_enabled = true;
|
||||
}
|
||||
break;
|
||||
case Config_bluetooth_tag:
|
||||
case meshtastic_Config_bluetooth_tag:
|
||||
LOG_INFO("Setting config: Bluetooth\n");
|
||||
config.has_bluetooth = true;
|
||||
config.bluetooth = c.payload_variant.bluetooth;
|
||||
@@ -279,50 +279,50 @@ void AdminModule::handleSetConfig(const Config &c)
|
||||
saveChanges(SEGMENT_CONFIG);
|
||||
}
|
||||
|
||||
void AdminModule::handleSetModuleConfig(const ModuleConfig &c)
|
||||
void AdminModule::handleSetModuleConfig(const meshtastic_ModuleConfig &c)
|
||||
{
|
||||
switch (c.which_payload_variant) {
|
||||
case ModuleConfig_mqtt_tag:
|
||||
case meshtastic_ModuleConfig_mqtt_tag:
|
||||
LOG_INFO("Setting module config: MQTT\n");
|
||||
moduleConfig.has_mqtt = true;
|
||||
moduleConfig.mqtt = c.payload_variant.mqtt;
|
||||
break;
|
||||
case ModuleConfig_serial_tag:
|
||||
case meshtastic_ModuleConfig_serial_tag:
|
||||
LOG_INFO("Setting module config: Serial\n");
|
||||
moduleConfig.has_serial = true;
|
||||
moduleConfig.serial = c.payload_variant.serial;
|
||||
break;
|
||||
case ModuleConfig_external_notification_tag:
|
||||
case meshtastic_ModuleConfig_external_notification_tag:
|
||||
LOG_INFO("Setting module config: External Notification\n");
|
||||
moduleConfig.has_external_notification = true;
|
||||
moduleConfig.external_notification = c.payload_variant.external_notification;
|
||||
break;
|
||||
case ModuleConfig_store_forward_tag:
|
||||
case meshtastic_ModuleConfig_store_forward_tag:
|
||||
LOG_INFO("Setting module config: Store & Forward\n");
|
||||
moduleConfig.has_store_forward = true;
|
||||
moduleConfig.store_forward = c.payload_variant.store_forward;
|
||||
break;
|
||||
case ModuleConfig_range_test_tag:
|
||||
case meshtastic_ModuleConfig_range_test_tag:
|
||||
LOG_INFO("Setting module config: Range Test\n");
|
||||
moduleConfig.has_range_test = true;
|
||||
moduleConfig.range_test = c.payload_variant.range_test;
|
||||
break;
|
||||
case ModuleConfig_telemetry_tag:
|
||||
case meshtastic_ModuleConfig_telemetry_tag:
|
||||
LOG_INFO("Setting module config: Telemetry\n");
|
||||
moduleConfig.has_telemetry = true;
|
||||
moduleConfig.telemetry = c.payload_variant.telemetry;
|
||||
break;
|
||||
case ModuleConfig_canned_message_tag:
|
||||
case meshtastic_ModuleConfig_canned_message_tag:
|
||||
LOG_INFO("Setting module config: Canned Message\n");
|
||||
moduleConfig.has_canned_message = true;
|
||||
moduleConfig.canned_message = c.payload_variant.canned_message;
|
||||
break;
|
||||
case ModuleConfig_audio_tag:
|
||||
case meshtastic_ModuleConfig_audio_tag:
|
||||
LOG_INFO("Setting module config: Audio\n");
|
||||
moduleConfig.has_audio = true;
|
||||
moduleConfig.audio = c.payload_variant.audio;
|
||||
break;
|
||||
case ModuleConfig_remote_hardware_tag:
|
||||
case meshtastic_ModuleConfig_remote_hardware_tag:
|
||||
LOG_INFO("Setting module config: Remote Hardware\n");
|
||||
moduleConfig.has_remote_hardware = true;
|
||||
moduleConfig.remote_hardware = c.payload_variant.remote_hardware;
|
||||
@@ -332,7 +332,7 @@ void AdminModule::handleSetModuleConfig(const ModuleConfig &c)
|
||||
saveChanges(SEGMENT_MODULECONFIG);
|
||||
}
|
||||
|
||||
void AdminModule::handleSetChannel(const Channel &cc)
|
||||
void AdminModule::handleSetChannel(const meshtastic_Channel &cc)
|
||||
{
|
||||
channels.setChannel(cc);
|
||||
channels.onConfigChanged(); // tell the radios about this change
|
||||
@@ -343,59 +343,59 @@ void AdminModule::handleSetChannel(const Channel &cc)
|
||||
* Getters
|
||||
*/
|
||||
|
||||
void AdminModule::handleGetOwner(const MeshPacket &req)
|
||||
void AdminModule::handleGetOwner(const meshtastic_MeshPacket &req)
|
||||
{
|
||||
if (req.decoded.want_response) {
|
||||
// We create the reply here
|
||||
AdminMessage res = AdminMessage_init_default;
|
||||
meshtastic_AdminMessage res = meshtastic_AdminMessage_init_default;
|
||||
res.get_owner_response = owner;
|
||||
|
||||
res.which_payload_variant = AdminMessage_get_owner_response_tag;
|
||||
res.which_payload_variant = meshtastic_AdminMessage_get_owner_response_tag;
|
||||
myReply = allocDataProtobuf(res);
|
||||
}
|
||||
}
|
||||
|
||||
void AdminModule::handleGetConfig(const MeshPacket &req, const uint32_t configType)
|
||||
void AdminModule::handleGetConfig(const meshtastic_MeshPacket &req, const uint32_t configType)
|
||||
{
|
||||
AdminMessage res = AdminMessage_init_default;
|
||||
meshtastic_AdminMessage res = meshtastic_AdminMessage_init_default;
|
||||
|
||||
if (req.decoded.want_response) {
|
||||
switch (configType) {
|
||||
case AdminMessage_ConfigType_DEVICE_CONFIG:
|
||||
case meshtastic_AdminMessage_ConfigType_DEVICE_CONFIG:
|
||||
LOG_INFO("Getting config: Device\n");
|
||||
res.get_config_response.which_payload_variant = Config_device_tag;
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_device_tag;
|
||||
res.get_config_response.payload_variant.device = config.device;
|
||||
break;
|
||||
case AdminMessage_ConfigType_POSITION_CONFIG:
|
||||
case meshtastic_AdminMessage_ConfigType_POSITION_CONFIG:
|
||||
LOG_INFO("Getting config: Position\n");
|
||||
res.get_config_response.which_payload_variant = Config_position_tag;
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_position_tag;
|
||||
res.get_config_response.payload_variant.position = config.position;
|
||||
break;
|
||||
case AdminMessage_ConfigType_POWER_CONFIG:
|
||||
case meshtastic_AdminMessage_ConfigType_POWER_CONFIG:
|
||||
LOG_INFO("Getting config: Power\n");
|
||||
res.get_config_response.which_payload_variant = Config_power_tag;
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_power_tag;
|
||||
res.get_config_response.payload_variant.power = config.power;
|
||||
break;
|
||||
case AdminMessage_ConfigType_NETWORK_CONFIG:
|
||||
case meshtastic_AdminMessage_ConfigType_NETWORK_CONFIG:
|
||||
LOG_INFO("Getting config: Network\n");
|
||||
res.get_config_response.which_payload_variant = Config_network_tag;
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_network_tag;
|
||||
res.get_config_response.payload_variant.network = config.network;
|
||||
writeSecret(res.get_config_response.payload_variant.network.wifi_psk,
|
||||
sizeof(res.get_config_response.payload_variant.network.wifi_psk), config.network.wifi_psk);
|
||||
break;
|
||||
case AdminMessage_ConfigType_DISPLAY_CONFIG:
|
||||
case meshtastic_AdminMessage_ConfigType_DISPLAY_CONFIG:
|
||||
LOG_INFO("Getting config: Display\n");
|
||||
res.get_config_response.which_payload_variant = Config_display_tag;
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_display_tag;
|
||||
res.get_config_response.payload_variant.display = config.display;
|
||||
break;
|
||||
case AdminMessage_ConfigType_LORA_CONFIG:
|
||||
case meshtastic_AdminMessage_ConfigType_LORA_CONFIG:
|
||||
LOG_INFO("Getting config: LoRa\n");
|
||||
res.get_config_response.which_payload_variant = Config_lora_tag;
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_lora_tag;
|
||||
res.get_config_response.payload_variant.lora = config.lora;
|
||||
break;
|
||||
case AdminMessage_ConfigType_BLUETOOTH_CONFIG:
|
||||
case meshtastic_AdminMessage_ConfigType_BLUETOOTH_CONFIG:
|
||||
LOG_INFO("Getting config: Bluetooth\n");
|
||||
res.get_config_response.which_payload_variant = Config_bluetooth_tag;
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_bluetooth_tag;
|
||||
res.get_config_response.payload_variant.bluetooth = config.bluetooth;
|
||||
break;
|
||||
}
|
||||
@@ -406,60 +406,60 @@ void AdminModule::handleGetConfig(const MeshPacket &req, const uint32_t configTy
|
||||
// hideSecret(r.get_radio_response.preferences.wifi_ssid); // hmm - leave public for now, because only minimally private
|
||||
// and useful for users to know current provisioning) hideSecret(r.get_radio_response.preferences.wifi_password);
|
||||
// r.get_config_response.which_payloadVariant = Config_ModuleConfig_telemetry_tag;
|
||||
res.which_payload_variant = AdminMessage_get_config_response_tag;
|
||||
res.which_payload_variant = meshtastic_AdminMessage_get_config_response_tag;
|
||||
myReply = allocDataProtobuf(res);
|
||||
}
|
||||
}
|
||||
|
||||
void AdminModule::handleGetModuleConfig(const MeshPacket &req, const uint32_t configType)
|
||||
void AdminModule::handleGetModuleConfig(const meshtastic_MeshPacket &req, const uint32_t configType)
|
||||
{
|
||||
AdminMessage res = AdminMessage_init_default;
|
||||
meshtastic_AdminMessage res = meshtastic_AdminMessage_init_default;
|
||||
|
||||
if (req.decoded.want_response) {
|
||||
switch (configType) {
|
||||
case AdminMessage_ModuleConfigType_MQTT_CONFIG:
|
||||
case meshtastic_AdminMessage_ModuleConfigType_MQTT_CONFIG:
|
||||
LOG_INFO("Getting module config: MQTT\n");
|
||||
res.get_module_config_response.which_payload_variant = ModuleConfig_mqtt_tag;
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_mqtt_tag;
|
||||
res.get_module_config_response.payload_variant.mqtt = moduleConfig.mqtt;
|
||||
break;
|
||||
case AdminMessage_ModuleConfigType_SERIAL_CONFIG:
|
||||
case meshtastic_AdminMessage_ModuleConfigType_SERIAL_CONFIG:
|
||||
LOG_INFO("Getting module config: Serial\n");
|
||||
res.get_module_config_response.which_payload_variant = ModuleConfig_serial_tag;
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_serial_tag;
|
||||
res.get_module_config_response.payload_variant.serial = moduleConfig.serial;
|
||||
break;
|
||||
case AdminMessage_ModuleConfigType_EXTNOTIF_CONFIG:
|
||||
case meshtastic_AdminMessage_ModuleConfigType_EXTNOTIF_CONFIG:
|
||||
LOG_INFO("Getting module config: External Notification\n");
|
||||
res.get_module_config_response.which_payload_variant = ModuleConfig_external_notification_tag;
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_external_notification_tag;
|
||||
res.get_module_config_response.payload_variant.external_notification = moduleConfig.external_notification;
|
||||
break;
|
||||
case AdminMessage_ModuleConfigType_STOREFORWARD_CONFIG:
|
||||
case meshtastic_AdminMessage_ModuleConfigType_STOREFORWARD_CONFIG:
|
||||
LOG_INFO("Getting module config: Store & Forward\n");
|
||||
res.get_module_config_response.which_payload_variant = ModuleConfig_store_forward_tag;
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_store_forward_tag;
|
||||
res.get_module_config_response.payload_variant.store_forward = moduleConfig.store_forward;
|
||||
break;
|
||||
case AdminMessage_ModuleConfigType_RANGETEST_CONFIG:
|
||||
case meshtastic_AdminMessage_ModuleConfigType_RANGETEST_CONFIG:
|
||||
LOG_INFO("Getting module config: Range Test\n");
|
||||
res.get_module_config_response.which_payload_variant = ModuleConfig_range_test_tag;
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_range_test_tag;
|
||||
res.get_module_config_response.payload_variant.range_test = moduleConfig.range_test;
|
||||
break;
|
||||
case AdminMessage_ModuleConfigType_TELEMETRY_CONFIG:
|
||||
case meshtastic_AdminMessage_ModuleConfigType_TELEMETRY_CONFIG:
|
||||
LOG_INFO("Getting module config: Telemetry\n");
|
||||
res.get_module_config_response.which_payload_variant = ModuleConfig_telemetry_tag;
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_telemetry_tag;
|
||||
res.get_module_config_response.payload_variant.telemetry = moduleConfig.telemetry;
|
||||
break;
|
||||
case AdminMessage_ModuleConfigType_CANNEDMSG_CONFIG:
|
||||
case meshtastic_AdminMessage_ModuleConfigType_CANNEDMSG_CONFIG:
|
||||
LOG_INFO("Getting module config: Canned Message\n");
|
||||
res.get_module_config_response.which_payload_variant = ModuleConfig_canned_message_tag;
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_canned_message_tag;
|
||||
res.get_module_config_response.payload_variant.canned_message = moduleConfig.canned_message;
|
||||
break;
|
||||
case AdminMessage_ModuleConfigType_AUDIO_CONFIG:
|
||||
case meshtastic_AdminMessage_ModuleConfigType_AUDIO_CONFIG:
|
||||
LOG_INFO("Getting module config: Audio\n");
|
||||
res.get_module_config_response.which_payload_variant = ModuleConfig_audio_tag;
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_audio_tag;
|
||||
res.get_module_config_response.payload_variant.audio = moduleConfig.audio;
|
||||
break;
|
||||
case AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG:
|
||||
case meshtastic_AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG:
|
||||
LOG_INFO("Getting module config: Remote Hardware\n");
|
||||
res.get_module_config_response.which_payload_variant = ModuleConfig_remote_hardware_tag;
|
||||
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;
|
||||
}
|
||||
@@ -471,16 +471,16 @@ void AdminModule::handleGetModuleConfig(const MeshPacket &req, const uint32_t co
|
||||
// hideSecret(r.get_radio_response.preferences.wifi_ssid); // hmm - leave public for now, because only minimally private
|
||||
// and useful for users to know current provisioning) hideSecret(r.get_radio_response.preferences.wifi_password);
|
||||
// r.get_config_response.which_payloadVariant = Config_ModuleConfig_telemetry_tag;
|
||||
res.which_payload_variant = AdminMessage_get_module_config_response_tag;
|
||||
res.which_payload_variant = meshtastic_AdminMessage_get_module_config_response_tag;
|
||||
myReply = allocDataProtobuf(res);
|
||||
}
|
||||
}
|
||||
|
||||
void AdminModule::handleGetDeviceMetadata(const MeshPacket &req)
|
||||
void AdminModule::handleGetDeviceMetadata(const meshtastic_MeshPacket &req)
|
||||
{
|
||||
AdminMessage r = AdminMessage_init_default;
|
||||
meshtastic_AdminMessage r = meshtastic_AdminMessage_init_default;
|
||||
|
||||
DeviceMetadata deviceMetadata;
|
||||
meshtastic_DeviceMetadata deviceMetadata;
|
||||
strncpy(deviceMetadata.firmware_version, myNodeInfo.firmware_version, 18);
|
||||
deviceMetadata.device_state_version = DEVICESTATE_CUR_VER;
|
||||
deviceMetadata.canShutdown = pmu_found || HAS_CPU_SHUTDOWN;
|
||||
@@ -491,17 +491,17 @@ void AdminModule::handleGetDeviceMetadata(const MeshPacket &req)
|
||||
deviceMetadata.position_flags = config.position.position_flags;
|
||||
|
||||
r.get_device_metadata_response = deviceMetadata;
|
||||
r.which_payload_variant = AdminMessage_get_device_metadata_response_tag;
|
||||
r.which_payload_variant = meshtastic_AdminMessage_get_device_metadata_response_tag;
|
||||
myReply = allocDataProtobuf(r);
|
||||
}
|
||||
|
||||
void AdminModule::handleGetChannel(const MeshPacket &req, uint32_t channelIndex)
|
||||
void AdminModule::handleGetChannel(const meshtastic_MeshPacket &req, uint32_t channelIndex)
|
||||
{
|
||||
if (req.decoded.want_response) {
|
||||
// We create the reply here
|
||||
AdminMessage r = AdminMessage_init_default;
|
||||
meshtastic_AdminMessage r = meshtastic_AdminMessage_init_default;
|
||||
r.get_channel_response = channels.getByIndex(channelIndex);
|
||||
r.which_payload_variant = AdminMessage_get_channel_response_tag;
|
||||
r.which_payload_variant = meshtastic_AdminMessage_get_channel_response_tag;
|
||||
myReply = allocDataProtobuf(r);
|
||||
}
|
||||
}
|
||||
@@ -526,7 +526,7 @@ void AdminModule::saveChanges(int saveWhat, bool shouldReboot)
|
||||
}
|
||||
}
|
||||
|
||||
AdminModule::AdminModule() : ProtobufModule("Admin", PortNum_ADMIN_APP, &AdminMessage_msg)
|
||||
AdminModule::AdminModule() : ProtobufModule("Admin", meshtastic_PortNum_ADMIN_APP, &meshtastic_AdminMessage_msg)
|
||||
{
|
||||
// restrict to the admin channel for rx
|
||||
boundChannel = Channels::adminChannel;
|
||||
|
||||
Reference in New Issue
Block a user