Config rework - Init GetConfigResponse

raytac-diy
Sacha Weatherstone 2022-05-01 16:12:48 +10:00
rodzic 50326fbb6b
commit c0d40895f8
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7AB2D7E206124B31
5 zmienionych plików z 446 dodań i 61 usunięć

2
proto

@ -1 +1 @@
Subproject commit de602f29b743b5c46cd0205e50719ec7fd817543
Subproject commit 6c790cef4c500f02773986726e48d45d4a218b5d

Wyświetl plik

@ -7,30 +7,31 @@
#include "channel.pb.h"
#include "mesh.pb.h"
#include "radioconfig.pb.h"
#include "config.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
/* Enum definitions */
typedef enum _AdminMessage_RadioConfigType {
AdminMessage_RadioConfigType_ALL = 0,
AdminMessage_RadioConfigType_CORE_ONLY = 1,
AdminMessage_RadioConfigType_MODULE_ONLY = 2,
AdminMessage_RadioConfigType_DEVICE_CONFIG = 3,
AdminMessage_RadioConfigType_GPS_CONFIG = 4,
AdminMessage_RadioConfigType_POWER_CONFIG = 5,
AdminMessage_RadioConfigType_WIFI_CONFIG = 6,
AdminMessage_RadioConfigType_DISPLAY_CONFIG = 7,
AdminMessage_RadioConfigType_LORA_CONFIG = 8,
AdminMessage_RadioConfigType_MODULE_MQTT_CONFIG = 9,
AdminMessage_RadioConfigType_MODULE_SERIAL_CONFIG = 10,
AdminMessage_RadioConfigType_MODULE_EXTNOTIF_CONFIG = 11,
AdminMessage_RadioConfigType_MODULE_STOREFORWARD_CONFIG = 12,
AdminMessage_RadioConfigType_MODULE_RANGETEST_CONFIG = 13,
AdminMessage_RadioConfigType_MODULE_ENVIRONMENTAL_CONFIG = 14,
AdminMessage_RadioConfigType_MODULE_CANNEDMSG_CONFIG = 15
} AdminMessage_RadioConfigType;
typedef enum _AdminMessage_ConfigType {
AdminMessage_ConfigType_ALL = 0,
AdminMessage_ConfigType_CORE_ONLY = 1,
AdminMessage_ConfigType_MODULE_ONLY = 2,
AdminMessage_ConfigType_DEVICE_CONFIG = 3,
AdminMessage_ConfigType_GPS_CONFIG = 4,
AdminMessage_ConfigType_POWER_CONFIG = 5,
AdminMessage_ConfigType_WIFI_CONFIG = 6,
AdminMessage_ConfigType_DISPLAY_CONFIG = 7,
AdminMessage_ConfigType_LORA_CONFIG = 8,
AdminMessage_ConfigType_MODULE_MQTT_CONFIG = 9,
AdminMessage_ConfigType_MODULE_SERIAL_CONFIG = 10,
AdminMessage_ConfigType_MODULE_EXTNOTIF_CONFIG = 11,
AdminMessage_ConfigType_MODULE_STOREFORWARD_CONFIG = 12,
AdminMessage_ConfigType_MODULE_RANGETEST_CONFIG = 13,
AdminMessage_ConfigType_MODULE_ENVIRONMENTAL_CONFIG = 14,
AdminMessage_ConfigType_MODULE_CANNEDMSG_CONFIG = 15
} AdminMessage_ConfigType;
/* Struct definitions */
/* This message is handled by the Admin module and is responsible for all settings/channel read/write operations.
@ -49,7 +50,8 @@ typedef struct _AdminMessage {
Channel get_channel_response;
bool get_owner_request;
User get_owner_response;
AdminMessage_RadioConfigType get_config_request;
AdminMessage_ConfigType get_config_request;
Config get_config_response;
bool confirm_set_channel;
bool confirm_set_radio;
bool exit_simulator;
@ -72,9 +74,9 @@ typedef struct _AdminMessage {
/* Helper constants for enums */
#define _AdminMessage_RadioConfigType_MIN AdminMessage_RadioConfigType_ALL
#define _AdminMessage_RadioConfigType_MAX AdminMessage_RadioConfigType_MODULE_CANNEDMSG_CONFIG
#define _AdminMessage_RadioConfigType_ARRAYSIZE ((AdminMessage_RadioConfigType)(AdminMessage_RadioConfigType_MODULE_CANNEDMSG_CONFIG+1))
#define _AdminMessage_ConfigType_MIN AdminMessage_ConfigType_ALL
#define _AdminMessage_ConfigType_MAX AdminMessage_ConfigType_MODULE_CANNEDMSG_CONFIG
#define _AdminMessage_ConfigType_ARRAYSIZE ((AdminMessage_ConfigType)(AdminMessage_ConfigType_MODULE_CANNEDMSG_CONFIG+1))
#ifdef __cplusplus
@ -96,6 +98,7 @@ extern "C" {
#define AdminMessage_get_owner_request_tag 8
#define AdminMessage_get_owner_response_tag 9
#define AdminMessage_get_config_request_tag 10
#define AdminMessage_get_config_response_tag 11
#define AdminMessage_confirm_set_channel_tag 32
#define AdminMessage_confirm_set_radio_tag 33
#define AdminMessage_exit_simulator_tag 34
@ -126,6 +129,7 @@ X(a, STATIC, ONEOF, MESSAGE, (variant,get_channel_response,get_channel_res
X(a, STATIC, ONEOF, BOOL, (variant,get_owner_request,get_owner_request), 8) \
X(a, STATIC, ONEOF, MESSAGE, (variant,get_owner_response,get_owner_response), 9) \
X(a, STATIC, ONEOF, UENUM, (variant,get_config_request,get_config_request), 10) \
X(a, STATIC, ONEOF, MESSAGE, (variant,get_config_response,get_config_response), 11) \
X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_channel,confirm_set_channel), 32) \
X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_radio,confirm_set_radio), 33) \
X(a, STATIC, ONEOF, BOOL, (variant,exit_simulator,exit_simulator), 34) \
@ -151,6 +155,7 @@ X(a, STATIC, ONEOF, INT32, (variant,shutdown_seconds,shutdown_seconds),
#define AdminMessage_variant_get_radio_response_MSGTYPE RadioConfig
#define AdminMessage_variant_get_channel_response_MSGTYPE Channel
#define AdminMessage_variant_get_owner_response_MSGTYPE User
#define AdminMessage_variant_get_config_response_MSGTYPE Config
extern const pb_msgdesc_t AdminMessage_msg;
@ -158,7 +163,10 @@ extern const pb_msgdesc_t AdminMessage_msg;
#define AdminMessage_fields &AdminMessage_msg
/* Maximum encoded size of messages (where known) */
#define AdminMessage_size 598
#if defined(Config_size)
#define AdminMessage_size (0 + sizeof(union AdminMessage_variant_size_union))
union AdminMessage_variant_size_union {char f0[598]; char f11[(6 + Config_size)];};
#endif
#ifdef __cplusplus
} /* extern "C" */

Wyświetl plik

@ -0,0 +1,54 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.5 */
#include "config.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
PB_BIND(Config, Config, AUTO)
PB_BIND(Config_DeviceConfig, Config_DeviceConfig, AUTO)
PB_BIND(Config_GpsConfig, Config_GpsConfig, AUTO)
PB_BIND(Config_PowerConfig, Config_PowerConfig, AUTO)
PB_BIND(Config_WiFiConfig, Config_WiFiConfig, AUTO)
PB_BIND(Config_DisplayConfig, Config_DisplayConfig, AUTO)
PB_BIND(Config_LoRaConfig, Config_LoRaConfig, AUTO)
PB_BIND(Config_ModuleConfig, Config_ModuleConfig, AUTO)
PB_BIND(Config_ModuleConfig_MQTTConfig, Config_ModuleConfig_MQTTConfig, AUTO)
PB_BIND(Config_ModuleConfig_SerialConfig, Config_ModuleConfig_SerialConfig, AUTO)
PB_BIND(Config_ModuleConfig_ExternalNotificationConfig, Config_ModuleConfig_ExternalNotificationConfig, AUTO)
PB_BIND(Config_ModuleConfig_StoreForwardConfig, Config_ModuleConfig_StoreForwardConfig, AUTO)
PB_BIND(Config_ModuleConfig_RangeTestConfig, Config_ModuleConfig_RangeTestConfig, AUTO)
PB_BIND(Config_ModuleConfig_TelemetryConfig, Config_ModuleConfig_TelemetryConfig, AUTO)
PB_BIND(Config_ModuleConfig_CannedMessageConfig, Config_ModuleConfig_CannedMessageConfig, AUTO)

Wyświetl plik

@ -0,0 +1,308 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.5 */
#ifndef PB_CONFIG_PB_H_INCLUDED
#define PB_CONFIG_PB_H_INCLUDED
#include <pb.h>
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
/* Struct definitions */
typedef struct _Config_DeviceConfig {
char dummy_field;
} Config_DeviceConfig;
typedef struct _Config_DisplayConfig {
char dummy_field;
} Config_DisplayConfig;
typedef struct _Config_GpsConfig {
char dummy_field;
} Config_GpsConfig;
typedef struct _Config_LoRaConfig {
char dummy_field;
} Config_LoRaConfig;
typedef struct _Config_ModuleConfig_CannedMessageConfig {
char dummy_field;
} Config_ModuleConfig_CannedMessageConfig;
typedef struct _Config_ModuleConfig_ExternalNotificationConfig {
char dummy_field;
} Config_ModuleConfig_ExternalNotificationConfig;
typedef struct _Config_ModuleConfig_MQTTConfig {
char dummy_field;
} Config_ModuleConfig_MQTTConfig;
typedef struct _Config_ModuleConfig_RangeTestConfig {
char dummy_field;
} Config_ModuleConfig_RangeTestConfig;
typedef struct _Config_ModuleConfig_SerialConfig {
char dummy_field;
} Config_ModuleConfig_SerialConfig;
typedef struct _Config_ModuleConfig_StoreForwardConfig {
char dummy_field;
} Config_ModuleConfig_StoreForwardConfig;
typedef struct _Config_ModuleConfig_TelemetryConfig {
char dummy_field;
} Config_ModuleConfig_TelemetryConfig;
typedef struct _Config_PowerConfig {
char dummy_field;
} Config_PowerConfig;
typedef struct _Config_ModuleConfig {
pb_size_t which_payloadVariant;
union {
Config_ModuleConfig_MQTTConfig mqtt_config;
Config_ModuleConfig_SerialConfig serial_config;
Config_ModuleConfig_ExternalNotificationConfig external_notification_config;
Config_ModuleConfig_StoreForwardConfig store_forward_config;
Config_ModuleConfig_RangeTestConfig range_test_config;
Config_ModuleConfig_TelemetryConfig telemetry_config;
Config_ModuleConfig_CannedMessageConfig canned_message_config;
} payloadVariant;
} Config_ModuleConfig;
typedef struct _Config_WiFiConfig {
pb_callback_t wifi_ssid;
pb_callback_t wifi_password;
bool wifi_ap_mode;
} Config_WiFiConfig;
typedef struct _Config {
/* TODO: REPLACE */
pb_size_t which_payloadVariant;
union {
Config_DeviceConfig device_config;
Config_GpsConfig gps_config;
Config_PowerConfig power_config;
Config_WiFiConfig wifi_config;
Config_DisplayConfig display_config;
Config_LoRaConfig lora_config;
Config_ModuleConfig module_config;
} payloadVariant;
} Config;
#ifdef __cplusplus
extern "C" {
#endif
/* Initializer values for message structs */
#define Config_init_default {0, {Config_DeviceConfig_init_default}}
#define Config_DeviceConfig_init_default {0}
#define Config_GpsConfig_init_default {0}
#define Config_PowerConfig_init_default {0}
#define Config_WiFiConfig_init_default {{{NULL}, NULL}, {{NULL}, NULL}, 0}
#define Config_DisplayConfig_init_default {0}
#define Config_LoRaConfig_init_default {0}
#define Config_ModuleConfig_init_default {0, {Config_ModuleConfig_MQTTConfig_init_default}}
#define Config_ModuleConfig_MQTTConfig_init_default {0}
#define Config_ModuleConfig_SerialConfig_init_default {0}
#define Config_ModuleConfig_ExternalNotificationConfig_init_default {0}
#define Config_ModuleConfig_StoreForwardConfig_init_default {0}
#define Config_ModuleConfig_RangeTestConfig_init_default {0}
#define Config_ModuleConfig_TelemetryConfig_init_default {0}
#define Config_ModuleConfig_CannedMessageConfig_init_default {0}
#define Config_init_zero {0, {Config_DeviceConfig_init_zero}}
#define Config_DeviceConfig_init_zero {0}
#define Config_GpsConfig_init_zero {0}
#define Config_PowerConfig_init_zero {0}
#define Config_WiFiConfig_init_zero {{{NULL}, NULL}, {{NULL}, NULL}, 0}
#define Config_DisplayConfig_init_zero {0}
#define Config_LoRaConfig_init_zero {0}
#define Config_ModuleConfig_init_zero {0, {Config_ModuleConfig_MQTTConfig_init_zero}}
#define Config_ModuleConfig_MQTTConfig_init_zero {0}
#define Config_ModuleConfig_SerialConfig_init_zero {0}
#define Config_ModuleConfig_ExternalNotificationConfig_init_zero {0}
#define Config_ModuleConfig_StoreForwardConfig_init_zero {0}
#define Config_ModuleConfig_RangeTestConfig_init_zero {0}
#define Config_ModuleConfig_TelemetryConfig_init_zero {0}
#define Config_ModuleConfig_CannedMessageConfig_init_zero {0}
/* Field tags (for use in manual encoding/decoding) */
#define Config_ModuleConfig_mqtt_config_tag 1
#define Config_ModuleConfig_serial_config_tag 2
#define Config_ModuleConfig_external_notification_config_tag 3
#define Config_ModuleConfig_store_forward_config_tag 4
#define Config_ModuleConfig_range_test_config_tag 5
#define Config_ModuleConfig_telemetry_config_tag 6
#define Config_ModuleConfig_canned_message_config_tag 7
#define Config_WiFiConfig_wifi_ssid_tag 1
#define Config_WiFiConfig_wifi_password_tag 2
#define Config_WiFiConfig_wifi_ap_mode_tag 3
#define Config_device_config_tag 1
#define Config_gps_config_tag 2
#define Config_power_config_tag 3
#define Config_wifi_config_tag 4
#define Config_display_config_tag 5
#define Config_lora_config_tag 6
#define Config_module_config_tag 7
/* Struct field encoding specification for nanopb */
#define Config_FIELDLIST(X, a) \
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,device_config,payloadVariant.device_config), 1) \
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,gps_config,payloadVariant.gps_config), 2) \
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,power_config,payloadVariant.power_config), 3) \
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,wifi_config,payloadVariant.wifi_config), 4) \
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,display_config,payloadVariant.display_config), 5) \
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,lora_config,payloadVariant.lora_config), 6) \
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,module_config,payloadVariant.module_config), 7)
#define Config_CALLBACK NULL
#define Config_DEFAULT NULL
#define Config_payloadVariant_device_config_MSGTYPE Config_DeviceConfig
#define Config_payloadVariant_gps_config_MSGTYPE Config_GpsConfig
#define Config_payloadVariant_power_config_MSGTYPE Config_PowerConfig
#define Config_payloadVariant_wifi_config_MSGTYPE Config_WiFiConfig
#define Config_payloadVariant_display_config_MSGTYPE Config_DisplayConfig
#define Config_payloadVariant_lora_config_MSGTYPE Config_LoRaConfig
#define Config_payloadVariant_module_config_MSGTYPE Config_ModuleConfig
#define Config_DeviceConfig_FIELDLIST(X, a) \
#define Config_DeviceConfig_CALLBACK NULL
#define Config_DeviceConfig_DEFAULT NULL
#define Config_GpsConfig_FIELDLIST(X, a) \
#define Config_GpsConfig_CALLBACK NULL
#define Config_GpsConfig_DEFAULT NULL
#define Config_PowerConfig_FIELDLIST(X, a) \
#define Config_PowerConfig_CALLBACK NULL
#define Config_PowerConfig_DEFAULT NULL
#define Config_WiFiConfig_FIELDLIST(X, a) \
X(a, CALLBACK, SINGULAR, STRING, wifi_ssid, 1) \
X(a, CALLBACK, SINGULAR, STRING, wifi_password, 2) \
X(a, STATIC, SINGULAR, BOOL, wifi_ap_mode, 3)
#define Config_WiFiConfig_CALLBACK pb_default_field_callback
#define Config_WiFiConfig_DEFAULT NULL
#define Config_DisplayConfig_FIELDLIST(X, a) \
#define Config_DisplayConfig_CALLBACK NULL
#define Config_DisplayConfig_DEFAULT NULL
#define Config_LoRaConfig_FIELDLIST(X, a) \
#define Config_LoRaConfig_CALLBACK NULL
#define Config_LoRaConfig_DEFAULT NULL
#define Config_ModuleConfig_FIELDLIST(X, a) \
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,mqtt_config,payloadVariant.mqtt_config), 1) \
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,serial_config,payloadVariant.serial_config), 2) \
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,external_notification_config,payloadVariant.external_notification_config), 3) \
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,store_forward_config,payloadVariant.store_forward_config), 4) \
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,range_test_config,payloadVariant.range_test_config), 5) \
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,telemetry_config,payloadVariant.telemetry_config), 6) \
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,canned_message_config,payloadVariant.canned_message_config), 7)
#define Config_ModuleConfig_CALLBACK NULL
#define Config_ModuleConfig_DEFAULT NULL
#define Config_ModuleConfig_payloadVariant_mqtt_config_MSGTYPE Config_ModuleConfig_MQTTConfig
#define Config_ModuleConfig_payloadVariant_serial_config_MSGTYPE Config_ModuleConfig_SerialConfig
#define Config_ModuleConfig_payloadVariant_external_notification_config_MSGTYPE Config_ModuleConfig_ExternalNotificationConfig
#define Config_ModuleConfig_payloadVariant_store_forward_config_MSGTYPE Config_ModuleConfig_StoreForwardConfig
#define Config_ModuleConfig_payloadVariant_range_test_config_MSGTYPE Config_ModuleConfig_RangeTestConfig
#define Config_ModuleConfig_payloadVariant_telemetry_config_MSGTYPE Config_ModuleConfig_TelemetryConfig
#define Config_ModuleConfig_payloadVariant_canned_message_config_MSGTYPE Config_ModuleConfig_CannedMessageConfig
#define Config_ModuleConfig_MQTTConfig_FIELDLIST(X, a) \
#define Config_ModuleConfig_MQTTConfig_CALLBACK NULL
#define Config_ModuleConfig_MQTTConfig_DEFAULT NULL
#define Config_ModuleConfig_SerialConfig_FIELDLIST(X, a) \
#define Config_ModuleConfig_SerialConfig_CALLBACK NULL
#define Config_ModuleConfig_SerialConfig_DEFAULT NULL
#define Config_ModuleConfig_ExternalNotificationConfig_FIELDLIST(X, a) \
#define Config_ModuleConfig_ExternalNotificationConfig_CALLBACK NULL
#define Config_ModuleConfig_ExternalNotificationConfig_DEFAULT NULL
#define Config_ModuleConfig_StoreForwardConfig_FIELDLIST(X, a) \
#define Config_ModuleConfig_StoreForwardConfig_CALLBACK NULL
#define Config_ModuleConfig_StoreForwardConfig_DEFAULT NULL
#define Config_ModuleConfig_RangeTestConfig_FIELDLIST(X, a) \
#define Config_ModuleConfig_RangeTestConfig_CALLBACK NULL
#define Config_ModuleConfig_RangeTestConfig_DEFAULT NULL
#define Config_ModuleConfig_TelemetryConfig_FIELDLIST(X, a) \
#define Config_ModuleConfig_TelemetryConfig_CALLBACK NULL
#define Config_ModuleConfig_TelemetryConfig_DEFAULT NULL
#define Config_ModuleConfig_CannedMessageConfig_FIELDLIST(X, a) \
#define Config_ModuleConfig_CannedMessageConfig_CALLBACK NULL
#define Config_ModuleConfig_CannedMessageConfig_DEFAULT NULL
extern const pb_msgdesc_t Config_msg;
extern const pb_msgdesc_t Config_DeviceConfig_msg;
extern const pb_msgdesc_t Config_GpsConfig_msg;
extern const pb_msgdesc_t Config_PowerConfig_msg;
extern const pb_msgdesc_t Config_WiFiConfig_msg;
extern const pb_msgdesc_t Config_DisplayConfig_msg;
extern const pb_msgdesc_t Config_LoRaConfig_msg;
extern const pb_msgdesc_t Config_ModuleConfig_msg;
extern const pb_msgdesc_t Config_ModuleConfig_MQTTConfig_msg;
extern const pb_msgdesc_t Config_ModuleConfig_SerialConfig_msg;
extern const pb_msgdesc_t Config_ModuleConfig_ExternalNotificationConfig_msg;
extern const pb_msgdesc_t Config_ModuleConfig_StoreForwardConfig_msg;
extern const pb_msgdesc_t Config_ModuleConfig_RangeTestConfig_msg;
extern const pb_msgdesc_t Config_ModuleConfig_TelemetryConfig_msg;
extern const pb_msgdesc_t Config_ModuleConfig_CannedMessageConfig_msg;
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
#define Config_fields &Config_msg
#define Config_DeviceConfig_fields &Config_DeviceConfig_msg
#define Config_GpsConfig_fields &Config_GpsConfig_msg
#define Config_PowerConfig_fields &Config_PowerConfig_msg
#define Config_WiFiConfig_fields &Config_WiFiConfig_msg
#define Config_DisplayConfig_fields &Config_DisplayConfig_msg
#define Config_LoRaConfig_fields &Config_LoRaConfig_msg
#define Config_ModuleConfig_fields &Config_ModuleConfig_msg
#define Config_ModuleConfig_MQTTConfig_fields &Config_ModuleConfig_MQTTConfig_msg
#define Config_ModuleConfig_SerialConfig_fields &Config_ModuleConfig_SerialConfig_msg
#define Config_ModuleConfig_ExternalNotificationConfig_fields &Config_ModuleConfig_ExternalNotificationConfig_msg
#define Config_ModuleConfig_StoreForwardConfig_fields &Config_ModuleConfig_StoreForwardConfig_msg
#define Config_ModuleConfig_RangeTestConfig_fields &Config_ModuleConfig_RangeTestConfig_msg
#define Config_ModuleConfig_TelemetryConfig_fields &Config_ModuleConfig_TelemetryConfig_msg
#define Config_ModuleConfig_CannedMessageConfig_fields &Config_ModuleConfig_CannedMessageConfig_msg
/* Maximum encoded size of messages (where known) */
/* Config_size depends on runtime parameters */
/* Config_WiFiConfig_size depends on runtime parameters */
#define Config_DeviceConfig_size 0
#define Config_DisplayConfig_size 0
#define Config_GpsConfig_size 0
#define Config_LoRaConfig_size 0
#define Config_ModuleConfig_CannedMessageConfig_size 0
#define Config_ModuleConfig_ExternalNotificationConfig_size 0
#define Config_ModuleConfig_MQTTConfig_size 0
#define Config_ModuleConfig_RangeTestConfig_size 0
#define Config_ModuleConfig_SerialConfig_size 0
#define Config_ModuleConfig_StoreForwardConfig_size 0
#define Config_ModuleConfig_TelemetryConfig_size 0
#define Config_ModuleConfig_size 2
#define Config_PowerConfig_size 0
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

Wyświetl plik

@ -65,57 +65,72 @@ void AdminModule::handleGetConfig(const MeshPacket &req)
{
// We create the reply here
AdminMessage r = AdminMessage_init_default;
r.get_radio_response = radioConfig;
if (req.decoded.want_response) {
switch(r.get_config_request) {
case AdminMessage_RadioConfigType_ALL:
DEBUG_MSG("Requesting AdminMessage_RadioConfigType_ALL\n");
case AdminMessage_ConfigType_ALL:
DEBUG_MSG("Requesting AdminMessage_ConfigType_ALL\n");
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_ALL;
break;
case AdminMessage_RadioConfigType_CORE_ONLY:
DEBUG_MSG("Requesting AdminMessage_RadioConfigType_CORE_ONLY\n");
case AdminMessage_ConfigType_CORE_ONLY:
DEBUG_MSG("Requesting AdminMessage_ConfigType_CORE_ONLY\n");
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_CORE_ONLY;
break;
case AdminMessage_RadioConfigType_MODULE_ONLY:
DEBUG_MSG("Requesting AdminMessage_RadioConfigType_MODULE_ONLY\n");
case AdminMessage_ConfigType_MODULE_ONLY:
DEBUG_MSG("Requesting AdminMessage_ConfigType_MODULE_ONLY\n");
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_MODULE_ONLY;
break;
case AdminMessage_RadioConfigType_DEVICE_CONFIG:
DEBUG_MSG("Requesting AdminMessage_RadioConfigType_DEVICE_CONFIG\n");
case AdminMessage_ConfigType_DEVICE_CONFIG:
DEBUG_MSG("Requesting AdminMessage_ConfigType_DEVICE_CONFIG\n");
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_DEVICE_CONFIG;
break;
case AdminMessage_RadioConfigType_GPS_CONFIG:
DEBUG_MSG("Requesting AdminMessage_RadioConfigType_GPS_CONFIG\n");
case AdminMessage_ConfigType_GPS_CONFIG:
DEBUG_MSG("Requesting AdminMessage_ConfigType_GPS_CONFIG\n");
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_GPS_CONFIG;
break;
case AdminMessage_RadioConfigType_POWER_CONFIG:
DEBUG_MSG("Requesting AdminMessage_RadioConfigType_POWER_CONFIG\n");
case AdminMessage_ConfigType_POWER_CONFIG:
DEBUG_MSG("Requesting AdminMessage_ConfigType_POWER_CONFIG\n");
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_POWER_CONFIG;
break;
case AdminMessage_RadioConfigType_WIFI_CONFIG:
DEBUG_MSG("Requesting AdminMessage_RadioConfigType_WIFI_CONFIG\n");
case AdminMessage_ConfigType_WIFI_CONFIG:
DEBUG_MSG("Requesting AdminMessage_ConfigType_WIFI_CONFIG\n");
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_POWER_CONFIG;
break;
case AdminMessage_RadioConfigType_DISPLAY_CONFIG:
DEBUG_MSG("Requesting AdminMessage_RadioConfigType_DISPLAY_CONFIG\n");
case AdminMessage_ConfigType_DISPLAY_CONFIG:
DEBUG_MSG("Requesting AdminMessage_ConfigType_DISPLAY_CONFIG\n");
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_DISPLAY_CONFIG;
break;
case AdminMessage_RadioConfigType_LORA_CONFIG:
DEBUG_MSG("Requesting AdminMessage_RadioConfigType_LORA_CONFIG\n");
case AdminMessage_ConfigType_LORA_CONFIG:
DEBUG_MSG("Requesting AdminMessage_ConfigType_LORA_CONFIG\n");
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_LORA_CONFIG;
break;
case AdminMessage_RadioConfigType_MODULE_MQTT_CONFIG:
DEBUG_MSG("Requesting AdminMessage_RadioConfigType_MODULE_MQTT_CONFIG\n");
case AdminMessage_ConfigType_MODULE_MQTT_CONFIG:
DEBUG_MSG("Requesting AdminMessage_ConfigType_MODULE_MQTT_CONFIG\n");
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_MODULE_MQTT_CONFIG;
break;
case AdminMessage_RadioConfigType_MODULE_SERIAL_CONFIG:
DEBUG_MSG("Requesting AdminMessage_RadioConfigType_MODULE_SERIAL_CONFIG\n");
case AdminMessage_ConfigType_MODULE_SERIAL_CONFIG:
DEBUG_MSG("Requesting AdminMessage_ConfigType_MODULE_SERIAL_CONFIG\n");
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_MODULE_SERIAL_CONFIG;
break;
case AdminMessage_RadioConfigType_MODULE_EXTNOTIF_CONFIG:
DEBUG_MSG("Requesting AdminMessage_RadioConfigType_MODULE_EXTNOTIF_CONFIG\n");
case AdminMessage_ConfigType_MODULE_EXTNOTIF_CONFIG:
DEBUG_MSG("Requesting AdminMessage_ConfigType_MODULE_EXTNOTIF_CONFIG\n");
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_MODULE_EXTNOTIF_CONFIG;
break;
case AdminMessage_RadioConfigType_MODULE_STOREFORWARD_CONFIG:
DEBUG_MSG("Requesting AdminMessage_RadioConfigType_MODULE_STOREFORWARD_CONFIG\n");
case AdminMessage_ConfigType_MODULE_STOREFORWARD_CONFIG:
DEBUG_MSG("Requesting AdminMessage_ConfigType_MODULE_STOREFORWARD_CONFIG\n");
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_MODULE_STOREFORWARD_CONFIG;
break;
case AdminMessage_RadioConfigType_MODULE_RANGETEST_CONFIG:
DEBUG_MSG("Requesting AdminMessage_RadioConfigType_MODULE_RANGETEST_CONFIG\n");
case AdminMessage_ConfigType_MODULE_RANGETEST_CONFIG:
DEBUG_MSG("Requesting AdminMessage_ConfigType_MODULE_RANGETEST_CONFIG\n");
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_MODULE_RANGETEST_CONFIG;
break;
case AdminMessage_RadioConfigType_MODULE_ENVIRONMENTAL_CONFIG:
DEBUG_MSG("Requesting AdminMessage_RadioConfigType_MODULE_ENVIRONMENTAL_CONFIG\n");
case AdminMessage_ConfigType_MODULE_ENVIRONMENTAL_CONFIG:
DEBUG_MSG("Requesting AdminMessage_ConfigType_MODULE_ENVIRONMENTAL_CONFIG\n");
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_MODULE_ENVIRONMENTAL_CONFIG;
break;
case AdminMessage_RadioConfigType_MODULE_CANNEDMSG_CONFIG:
DEBUG_MSG("Requesting AdminMessage_RadioConfigType_MODULE_CANNEDMSG_CONFIG\n");
case AdminMessage_ConfigType_MODULE_CANNEDMSG_CONFIG:
DEBUG_MSG("Requesting AdminMessage_ConfigType_MODULE_CANNEDMSG_CONFIG\n");
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_MODULE_CANNEDMSG_CONFIG;
break;
default:
break;
@ -124,12 +139,12 @@ void AdminModule::handleGetConfig(const MeshPacket &req)
// NOTE: The phone app needs to know the ls_secs & phone_timeout value so it can properly expect sleep behavior.
// So even if we internally use 0 to represent 'use default' we still need to send the value we are
// using to the app (so that even old phone apps work with new device loads).
r.get_radio_response.preferences.ls_secs = getPref_ls_secs();
r.get_radio_response.preferences.phone_timeout_secs = getPref_phone_timeout_secs();
// r.get_radio_response.preferences.ls_secs = getPref_ls_secs();
// r.get_radio_response.preferences.phone_timeout_secs = getPref_phone_timeout_secs();
// 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);
// hideSecret(r.get_radio_response.preferences.wifi_password);
r.which_variant = AdminMessage_get_radio_response_tag;
r.which_variant = AdminMessage_get_config_response_tag;
myReply = allocDataProtobuf(r);
}
}