From ad4f75a5b14c62e945d166089d8e4e10b83b53fd Mon Sep 17 00:00:00 2001 From: Sacha Weatherstone Date: Wed, 7 Sep 2022 11:43:54 +0930 Subject: [PATCH] re-index & reorder --- admin.proto | 177 +++++++++++++++++++++++--------------------- channel.proto | 12 +-- config.proto | 43 +++++------ mesh.proto | 147 ++++++++++++++++-------------------- module_config.proto | 4 +- 5 files changed, 183 insertions(+), 200 deletions(-) diff --git a/admin.proto b/admin.proto index 0c7deda..89d6e5b 100644 --- a/admin.proto +++ b/admin.proto @@ -106,85 +106,110 @@ message AdminMessage { */ oneof payload_variant { - /* - * Set the owner for this node - */ - User set_owner = 2; - - /* - * Set channels (using the new API). - * A special channel is the "primary channel". - * The other records are secondary channels. - * Note: only one channel can be marked as primary. - * If the client sets a particular channel to be primary, the previous channel will be set to SECONDARY automatically. - */ - Channel set_channel = 3; - /* * Send the specified channel in the response to this message * NOTE: This field is sent with the channel index + 1 (to ensure we never try to send 'zero' - which protobufs treats as not present) */ - uint32 get_channel_request = 6; + uint32 get_channel_request = 1; /* - * TODO: REPLACE - */ - Channel get_channel_response = 7; - + * TODO: REPLACE + */ + Channel get_channel_response = 2; + /* - * Send the current owner data in the response to this message. - */ - bool get_owner_request = 8; - + * Send the current owner data in the response to this message. + */ + bool get_owner_request = 3; + /* - * TODO: REPLACE - */ - User get_owner_response = 9; + * TODO: REPLACE + */ + User get_owner_response = 4; + + /* + * Ask for the following config data to be sent + */ + ConfigType get_config_request = 5; + + /* + * Send the current Config in the response to this message. + */ + Config get_config_response = 6; /* * Ask for the following config data to be sent */ - ConfigType get_config_request = 10; + ModuleConfigType get_module_config_request = 7; /* * Send the current Config in the response to this message. */ - Config get_config_response = 11; - - /* - * Set the current Config - */ - Config set_config = 12; - - /* - * Sent immediatly after a config change has been sent to ensure comms, if this is not recieved, the config will be reverted after 10 mins - */ - bool confirm_set_config = 13; - - /* - * Ask for the following config data to be sent - */ - ModuleConfigType get_module_config_request = 14; - - /* - * Send the current Config in the response to this message. - */ - ModuleConfig get_module_config_response = 15; - - /* - * Set the current Config - */ - ModuleConfig set_module_config = 16; - - /* - * Sent immediatly after a config change has been sent to ensure comms, if this is not recieved, the config will be reverted after 10 mins - */ - bool confirm_set_module_config = 17; + ModuleConfig get_module_config_response = 8; /* * Send all channels in the response to this message */ - bool get_all_channel_request = 18; + bool get_all_channel_request = 9; + + /* + * Get the Canned Message Module messages in the response to this message. + */ + bool get_canned_message_module_messages_request = 10; + + /* + * Get the Canned Message Module messages in the response to this message. + */ + string get_canned_message_module_messages_response = 11; + + /* + * Request the node to send device metadata (firmware, protobuf version, etc) + */ + uint32 get_device_metadata_request = 12; + + /* + * Device metadata response + */ + DeviceMetadata get_device_metadata_response = 13; + + /* + * Set the owner for this node + */ + User set_owner = 32; + + /* + * Set channels (using the new API). + * A special channel is the "primary channel". + * The other records are secondary channels. + * Note: only one channel can be marked as primary. + * If the client sets a particular channel to be primary, the previous channel will be set to SECONDARY automatically. + */ + Channel set_channel = 33; + + /* + * Set the current Config + */ + Config set_config = 34; + + /* + * Set the current Config + */ + ModuleConfig set_module_config = 35; + + /* + * Set the Canned Message Module messages text. + */ + string set_canned_message_module_messages = 36; + + /* + * Sent immediatly after a config change has been sent to ensure comms, if this is not recieved, the config will be reverted after 10 mins + */ + bool confirm_set_config = 64; + + /* + * Sent immediatly after a config change has been sent to ensure comms, if this is not recieved, the config will be reverted after 10 mins + */ + bool confirm_set_module_config = 65; /* * Setting channels/radio config remotely carries the risk that you might send an invalid config and the radio never talks to your mesh again. @@ -192,52 +217,32 @@ message AdminMessage { * If you fail to do so, the radio will assume loss of comms and revert your changes. * These messages are optional when changing the local node. */ - bool confirm_set_channel = 32; + bool confirm_set_channel = 66; /* * TODO: REPLACE */ - bool confirm_set_radio = 33; + bool confirm_set_radio = 67; /* * This message is only supported for the simulator porduino build. * If received the simulator will exit successfully. */ - bool exit_simulator = 34; + bool exit_simulator = 96; /* * Tell the node to reboot in this many seconds (or <0 to cancel reboot) */ - int32 reboot_seconds = 35; - - /* - * Get the Canned Message Module messages in the response to this message. - */ - bool get_canned_message_module_messages_request = 36; - - /* - * Get the Canned Message Module messages in the response to this message. - */ - string get_canned_message_module_messages_response = 37; - - /* - * Set the Canned Message Module messages text. - */ - string set_canned_message_module_messages = 44; + int32 reboot_seconds = 97; /* * Tell the node to shutdown in this many seconds (or <0 to cancel shutdown) */ - int32 shutdown_seconds = 51; + int32 shutdown_seconds = 98; /* - * Request the node to send device metadata (firmware, protobuf version, etc) + * Tell the node to factory reset, all device settings will be returned to factory defaults. */ - uint32 get_device_metadata_request = 52; - - /* - * Device metadata response - */ - DeviceMetadata get_device_metadata_response = 53; + int32 factory_reset = 99; } } diff --git a/channel.proto b/channel.proto index 94c91de..19afc19 100644 --- a/channel.proto +++ b/channel.proto @@ -50,7 +50,7 @@ message ChannelSettings { * return hash; * } */ - uint32 channel_num = 9; + uint32 channel_num = 1; /* * A simple pre-shared key for now for crypto. @@ -64,7 +64,7 @@ message ChannelSettings { * `2` through 10 = The default channel key, except with 1 through 9 added to the last byte. * Shown to user as simple1 through 10 */ - bytes psk = 4; + bytes psk = 2; /* * A SHORT name that will be packed into the URL. @@ -76,7 +76,7 @@ message ChannelSettings { * For channel_num hashing empty string will be treated as "X". * Where "X" is selected based on the English words listed above for ModemPreset */ - string name = 5; + string name = 3; /* * Used to construct a globally unique channel ID. @@ -91,17 +91,17 @@ message ChannelSettings { * a table of well known IDs. * (see Well Known Channels FIXME) */ - fixed32 id = 10; + fixed32 id = 4; /* * If true, messages on the mesh will be sent to the *public* internet by any gateway ndoe */ - bool uplink_enabled = 16; + bool uplink_enabled = 5; /* * If true, messages seen on the internet will be forwarded to the local mesh. */ - bool downlink_enabled = 17; + bool downlink_enabled = 6; } /* diff --git a/config.proto b/config.proto index de3f357..01ca397 100644 --- a/config.proto +++ b/config.proto @@ -51,21 +51,11 @@ message Config { */ bool serial_disabled = 2; - /* - * This setting is never saved to disk, but if set, all device settings will be returned to factory defaults. - */ - bool factory_reset = 3; - /* * By default we turn off logging as soon as an API client connects (to keep shared serial link quiet). * Set this to true to leave the debug log outputting even when API is active. */ - bool debug_log_enabled = 4; - - /* - * NTP server to use if WiFi is conneced, defaults to `0.pool.ntp.org` - */ - string ntp_server = 5; + bool debug_log_enabled = 3; } @@ -162,14 +152,14 @@ message Config { /* * Should the GPS be disabled for this node? */ - bool gps_disabled = 5; + bool gps_disabled = 4; /* * How often should we try to get GPS position (in seconds) * or zero for the default of once every 30 seconds * or a very large value (maxint) to update only once at boot. */ - uint32 gps_update_interval = 6; + uint32 gps_update_interval = 5; /* * How long should we try to get our position during each gps_update_interval attempt? (in seconds) @@ -177,13 +167,13 @@ message Config { * If we don't get a new gps fix in that time, the gps will be put into sleep until the next gps_update_rate * window. */ - uint32 gps_attempt_time = 7; + uint32 gps_attempt_time = 6; /* * Bit field of boolean configuration options for POSITION messages * (bitwise OR of PositionFlags) */ - uint32 position_flags = 10; + uint32 position_flags = 7; } @@ -199,12 +189,12 @@ message Config { * YOU DO NOT NEED TO SET THIS IF YOU'VE set is_router (it is implied in that case). * Advanced Option */ - bool is_power_saving = 2; + bool is_power_saving = 1; /* * If non-zero, the device will fully power off this many seconds after external power is removed. */ - uint32 on_battery_shutdown_after_secs = 4; + uint32 on_battery_shutdown_after_secs = 2; /* * Ratio of voltage divider for battery pin eg. 3.20 (R1=100k, R2=220k) @@ -212,14 +202,14 @@ message Config { * Should be set to floating point value between 2 and 4 * Fixes issues on Heltec v2 */ - float adc_multiplier_override = 6; + float adc_multiplier_override = 3; /* * Wait Bluetooth Seconds * The number of seconds for to wait before turning off BLE in No Bluetooth states * 0 for default of 1 minute */ - uint32 wait_bluetooth_secs = 7; + uint32 wait_bluetooth_secs = 4; /* * Mesh Super Deep Sleep Timeout Seconds @@ -227,7 +217,7 @@ message Config { * for sds_secs (default 1 year) or a button press * 0 for default of two hours, MAXUINT for disabled */ - uint32 mesh_sds_timeout_secs = 9; + uint32 mesh_sds_timeout_secs = 5; /* * Super Deep Sleep Seconds @@ -235,7 +225,7 @@ message Config { * for this value (default 1 year) or a button press * 0 for default of one year */ - uint32 sds_secs = 10; + uint32 sds_secs = 6; /* * Light Sleep Seconds @@ -243,14 +233,14 @@ message Config { * ESP32 Only * 0 for default of 300 */ - uint32 ls_secs = 11; + uint32 ls_secs = 7; /* * Minimum Wake Seconds * While in light sleep when we receive packets on the LoRa radio we will wake and handle them and stay awake in no BLE mode for this value * 0 for default of 10 seconds */ - uint32 min_wake_secs = 12; + uint32 min_wake_secs = 8; } @@ -297,6 +287,11 @@ message Config { * If set, will be use to authenticate to the named wifi */ string wifi_psk = 4; + + /* + * NTP server to use if WiFi is conneced, defaults to `0.pool.ntp.org` + */ + string ntp_server = 5; } /* @@ -598,7 +593,7 @@ message Config { DeviceConfig device = 1; PositionConfig position = 2; PowerConfig power = 3; - WiFiConfig wifi = 4; + NetworkConfig network = 4; DisplayConfig display = 5; LoRaConfig lora = 6; BluetoothConfig bluetooth = 7; diff --git a/mesh.proto b/mesh.proto index e3c9b11..e8116e3 100644 --- a/mesh.proto +++ b/mesh.proto @@ -38,13 +38,7 @@ message Position { * be sent by devices which has a hardware GPS clock. * seconds since 1970 */ - fixed32 time = 9; - - /* - * Precision positioning elements - optional and usually not included - * ------------------------------------------------------------------ - * TODO: REMOVE/INTEGRATE - */ + fixed32 time = 4; /* * How the location was acquired: manual, onboard GPS, external (EUD) GPS @@ -75,7 +69,7 @@ message Position { /* * TODO: REPLACE */ - LocSource location_source = 10; + LocSource location_source = 5; /* * How the altitude was acquired: manual, GPS int/ext, etc @@ -112,27 +106,27 @@ message Position { /* * TODO: REPLACE */ - AltSource altitude_source = 11; + AltSource altitude_source = 6; /* * Positional timestamp (actual timestamp of GPS solution) in integer epoch seconds */ - fixed32 pos_timestamp = 12; + fixed32 timestamp = 7; /* * Pos. timestamp milliseconds adjustment (rarely available or required) */ - int32 pos_time_millis = 13; + int32 timestamp_millis_adjust = 8; /* * HAE altitude in meters - can be used instead of MSL altitude */ - sint32 altitude_hae = 14; + sint32 altitude_hae = 9; /* * Geoidal separation in meters */ - sint32 alt_geoid_sep = 15; + sint32 altitude_geoidal_seperation = 10; /* * Horizontal, Vertical and Position Dilution of Precision, in 1/100 units @@ -141,24 +135,24 @@ message Position { * in which case PDOP becomes redundant (PDOP=sqrt(HDOP^2 + VDOP^2)) * TODO: REMOVE/INTEGRATE */ - uint32 PDOP = 16; + uint32 PDOP = 11; /* * TODO: REPLACE */ - uint32 HDOP = 17; + uint32 HDOP = 12; /* * TODO: REPLACE */ - uint32 VDOP = 18; + uint32 VDOP = 13; /* * GPS accuracy (a hardware specific constant) in mm * multiplied with DOP to calculate positional accuracy * Default: "'bout three meters-ish" :) */ - uint32 gps_accuracy = 19; + uint32 gps_accuracy = 14; /* * Ground speed in m/s and True North TRACK in 1/100 degrees @@ -168,32 +162,32 @@ message Position { * - "yaw" indicates a relative rotation about the vertical axis * TODO: REMOVE/INTEGRATE */ - uint32 ground_speed = 20; + uint32 ground_speed = 15; /* * TODO: REPLACE */ - uint32 ground_track = 21; + uint32 ground_track = 16; /* * GPS fix quality (from NMEA GxGGA statement or similar) */ - uint32 fix_quality = 22; + uint32 fix_quality = 17; /* * GPS fix type 2D/3D (from NMEA GxGSA statement) */ - uint32 fix_type = 23; + uint32 fix_type = 18; /* * GPS "Satellites in View" number */ - uint32 sats_in_view = 24; + uint32 sats_in_view = 19; /* * Sensor ID - in case multiple positioning sensors are being used */ - uint32 sensor_id = 25; + uint32 sensor_id = 20; /* * Estimated/expected time (in seconds) until next update: @@ -201,13 +195,13 @@ message Position { * - if we update at dynamic intervals (based on relative movement etc), * but "AT LEAST every Y seconds", use Y */ - uint32 pos_next_update = 40; + uint32 next_update = 21; /* * A sequence number, incremented with each Position message to help * detect lost updates if needed */ - uint32 pos_seq_number = 41; + uint32 seq_number = 22; } /* @@ -288,72 +282,72 @@ enum HardwareModel { /* * Less common/prototype boards listed here (needs one more byte over the air) */ - LORA_RELAY_V1 = 32; + LORA_RELAY_V1 = 12; /* * TODO: REPLACE */ - NRF52840DK = 33; + NRF52840DK = 13; /* * TODO: REPLACE */ - PPR = 34; + PPR = 14; /* * TODO: REPLACE */ - GENIEBLOCKS = 35; + GENIEBLOCKS = 15; /* * TODO: REPLACE */ - NRF52_UNKNOWN = 36; + NRF52_UNKNOWN = 16; /* * TODO: REPLACE */ - PORTDUINO = 37; + PORTDUINO = 17; /* * The simulator built into the android app */ - ANDROID_SIM = 38; + ANDROID_SIM = 18; /* * Custom DIY device based on @NanoVHF schematics: https://github.com/NanoVHF/Meshtastic-DIY/tree/main/Schematics */ - DIY_V1 = 39; + DIY_V1 = 19; /* * RAK WisBlock ESP32 core: https://docs.rakwireless.com/Product-Categories/WisBlock/RAK11200/Overview/ */ - RAK11200 = 40; + RAK11200 = 20; /* * B&Q Consulting Nano Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:nano */ - NANO_G1 = 41; + NANO_G1 = 21; /* * nRF52840 Dongle : https://www.nordicsemi.com/Products/Development-hardware/nrf52840-dongle/ */ - NRF52840_PCA10059 = 42; + NRF52840_PCA10059 = 22; /* * Custom Disaster Radio esp32 v3 device https://github.com/sudomesh/disaster-radio/tree/master/hardware/board_esp32_v3 */ - DR_DEV = 43; + DR_DEV = 23; /* * M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, Paper) https://m5stack.com/ */ - M5STACK = 44; + M5STACK = 24; /* * B&Q Consulting Station Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:station */ - STATION_G1 = 45; + STATION_G1 = 25; /* * Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits. @@ -416,14 +410,14 @@ message User { * Apps will still need the string here for older builds * (so OTA update can find the right image), but if the enum is available it will be used instead. */ - HardwareModel hw_model = 6; + HardwareModel hw_model = 5; /* * In some regions Ham radio operators have different bandwidth limitations than others. * If this user is a licensed operator, set this flag. * Also, "long_name" should be their licence number. */ - bool is_licensed = 7; + bool is_licensed = 6; } /* @@ -434,7 +428,7 @@ message RouteDiscovery { /* * The list of nodenums this packet has visited so far */ - repeated fixed32 route = 2; + repeated fixed32 route = 1; } /* @@ -799,7 +793,7 @@ message MeshPacket { * For our usecase real world topologies probably have a max of about 3. * This field is normally placed into a few of bits in the header. */ - uint32 hop_limit = 10; + uint32 hop_limit = 9; /* * This packet is being sent as a reliable message, we would prefer it to arrive at the destination. @@ -812,23 +806,23 @@ message MeshPacket { * If after some time we don't hear anyone rebroadcast our packet, we will timeout and retransmit, using the regular resend logic. * Note: This flag is normally sent in a flag bit in the header when sent over the wire */ - bool want_ack = 11; + bool want_ack = 10; /* * The priority of this message for sending. * See MeshPacket.Priority description for more details. */ - Priority priority = 12; + Priority priority = 11; /* * rssi of received packet. Only sent to phone for dispay purposes. */ - int32 rx_rssi = 13; + int32 rx_rssi = 12; /* * Describe if this message is delayed */ - Delayed delayed = 15; + Delayed delayed = 13; } @@ -1022,12 +1016,12 @@ message MyNodeInfo { /* * The maximum number of 'software' channels that can be set on this node. */ - uint32 max_channels = 15; + uint32 max_channels = 3; /* * 0.0.5 etc... */ - string firmware_version = 6; + string firmware_version = 4; /* * An error message we'd like to report back to the mothership through analytics. @@ -1037,29 +1031,29 @@ message MyNodeInfo { * (i.e. it will only be reported once) * a numeric error code to go with error message, zero means no error */ - CriticalErrorCode error_code = 7; + CriticalErrorCode error_code = 5; /* * A numeric error address (nonzero if available) */ - uint32 error_address = 8; + uint32 error_address = 6; /* * The total number of errors this node has ever encountered * (well - since the last time we discarded preferences) */ - uint32 error_count = 9; + uint32 error_count = 7; /* * The total number of reboots this node has ever encountered * (well - since the last time we discarded preferences) */ - uint32 reboot_count = 10; + uint32 reboot_count = 8; /* * Calculated bitrate of the current channel (in Bytes Per Second) */ - float bitrate = 11; + float bitrate = 9; /* * How long before we consider a message abandoned and we can clear our @@ -1067,38 +1061,38 @@ message MyNodeInfo { * message delivery time, 5 minutes. * Formerly called FLOOD_EXPIRE_TIME in the device code */ - uint32 message_timeout_msec = 13; + uint32 message_timeout_msec = 10; /* * The minimum app version that can talk to this device. * Phone/PC apps should compare this to their build number and if too low tell the user they must update their app */ - uint32 min_app_version = 14; + uint32 min_app_version = 11; /* * 24 time windows of 1hr each with the airtime transmitted out of the device per hour. */ - repeated uint32 air_period_tx = 16; + repeated uint32 air_period_tx = 12; /* * 24 time windows of 1hr each with the airtime of valid packets for your mesh. */ - repeated uint32 air_period_rx = 17; + repeated uint32 air_period_rx = 13; /* * Is the device wifi capable? */ - bool has_wifi = 18; + bool has_wifi = 14; /* * Utilization for the current channel, including well formed TX, RX and malformed RX (aka noise). */ - float channel_utilization = 19; + float channel_utilization = 15; /* * Percent of airtime for transmission used within the last hour. */ - float air_util_tx = 20; + float air_util_tx = 16; } /* @@ -1179,11 +1173,6 @@ message LogRecord { */ message FromRadio { - /* - * In the <1.2 versions packet had ID 2, to prevent confusing old apps with our new packets, we've changed - */ - reserved 2; - /* * The packet id, used to allow the phone to request missing read packets from the FIFO, * see our bluetooth docs @@ -1198,7 +1187,7 @@ message FromRadio { /* * Log levels, chosen to match python logging conventions. */ - MeshPacket packet = 11; + MeshPacket packet = 2; /* * Tells the phone what our node number is, can be -1 if we've not yet joined a mesh. @@ -1215,12 +1204,12 @@ message FromRadio { /* * Include a part of the config (was: RadioConfig radio) */ - Config config = 6; + Config config = 5; /* * Set to send debug console output over our protobuf stream */ - LogRecord log_record = 7; + LogRecord log_record = 6; /* * Sent as true once the device has finished sending all of the responses to want_config @@ -1228,7 +1217,7 @@ message FromRadio { * not, it means your config responses haven't started yet. * NOTE: This ID must not change - to keep (minimal) compatibility with <1.2 version of android apps. */ - uint32 config_complete_id = 8; + uint32 config_complete_id = 7; /* * Sent to tell clients the radio has just rebooted. @@ -1236,13 +1225,13 @@ message FromRadio { * Not used on all transports, currently just used for the serial console. * NOTE: This ID must not change - to keep (minimal) compatibility with <1.2 version of android apps. */ - bool rebooted = 9; + bool rebooted = 8; /* * Include module config */ - ModuleConfig moduleConfig = 10; + ModuleConfig moduleConfig = 9; } } @@ -1273,12 +1262,6 @@ message ToRadio { bool mqtt_gateway = 2; } - /* - * In the <1.2 versions packet had ID 2, to prevent confusing old apps with our new packets, we've changed. - * 101-103 were used for set_radio, set_owner, set_channel - */ - reserved 1, 101, 102, 103; - /* * Log levels, chosen to match python logging conventions. */ @@ -1287,13 +1270,13 @@ message ToRadio { /* * Send this packet on the mesh */ - MeshPacket packet = 2; + MeshPacket packet = 1; /* * Information about the peer, sent after the phone sneds want_config_id. * Old clients do not send this, which is fine. */ - PeerInfo peer_info = 3; + PeerInfo peer_info = 2; /* * Phone wants radio to send full node db to the phone, This is @@ -1305,14 +1288,14 @@ message ToRadio { * config_complete_id response this allows clients to never be confused by * a stale old partially sent config. */ - uint32 want_config_id = 100; + uint32 want_config_id = 3; /* * Tell API server we are disconnecting now. * This is useful for serial links where there is no hardware/protocol based notification that the client has dropped the link. * (Sending this message is optional for clients) */ - bool disconnect = 104; + bool disconnect = 4; } } diff --git a/module_config.proto b/module_config.proto index ad7b645..ce98780 100644 --- a/module_config.proto +++ b/module_config.proto @@ -65,7 +65,7 @@ message ModuleConfig { * TODO: REPLACE */ enum Serial_Baud { - Default = 0; + DEFAULT = 0; BAUD_110 = 1; BAUD_300 = 2; BAUD_600 = 3; @@ -254,7 +254,7 @@ message ModuleConfig { * We'll always read the sensor in Celsius, but sometimes we might want to * display the results in Fahrenheit as a "user preference". */ - bool environment_display_fahrenheit = 7; + bool environment_display_fahrenheit = 5; } /*