mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-22 10:42:49 +00:00
[create-pull-request] automated change
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/* Automatically generated nanopb header */
|
||||
/* Generated by nanopb-0.4.6 */
|
||||
/* Generated by nanopb-0.4.7 */
|
||||
|
||||
#ifndef PB_MESH_PB_H_INCLUDED
|
||||
#define PB_MESH_PB_H_INCLUDED
|
||||
@@ -19,350 +19,245 @@
|
||||
bin/build-all.sh script.
|
||||
Because they will be used to find firmware filenames in the android app for OTA updates.
|
||||
To match the old style filenames, _ is converted to -, p is converted to . */
|
||||
typedef enum _HardwareModel {
|
||||
typedef enum _HardwareModel {
|
||||
/* TODO: REPLACE */
|
||||
HardwareModel_UNSET = 0,
|
||||
HardwareModel_UNSET = 0,
|
||||
/* TODO: REPLACE */
|
||||
HardwareModel_TLORA_V2 = 1,
|
||||
HardwareModel_TLORA_V2 = 1,
|
||||
/* TODO: REPLACE */
|
||||
HardwareModel_TLORA_V1 = 2,
|
||||
HardwareModel_TLORA_V1 = 2,
|
||||
/* TODO: REPLACE */
|
||||
HardwareModel_TLORA_V2_1_1P6 = 3,
|
||||
HardwareModel_TLORA_V2_1_1P6 = 3,
|
||||
/* TODO: REPLACE */
|
||||
HardwareModel_TBEAM = 4,
|
||||
HardwareModel_TBEAM = 4,
|
||||
/* The original heltec WiFi_Lora_32_V2, which had battery voltage sensing hooked to GPIO 13
|
||||
(see HELTEC_V2 for the new version). */
|
||||
HardwareModel_HELTEC_V2_0 = 5,
|
||||
HardwareModel_HELTEC_V2_0 = 5,
|
||||
/* TODO: REPLACE */
|
||||
HardwareModel_TBEAM_V0P7 = 6,
|
||||
HardwareModel_TBEAM_V0P7 = 6,
|
||||
/* TODO: REPLACE */
|
||||
HardwareModel_T_ECHO = 7,
|
||||
HardwareModel_T_ECHO = 7,
|
||||
/* TODO: REPLACE */
|
||||
HardwareModel_TLORA_V1_1P3 = 8,
|
||||
HardwareModel_TLORA_V1_1P3 = 8,
|
||||
/* TODO: REPLACE */
|
||||
HardwareModel_RAK4631 = 9,
|
||||
HardwareModel_RAK4631 = 9,
|
||||
/* The new version of the heltec WiFi_Lora_32_V2 board that has battery sensing hooked to GPIO 37.
|
||||
Sadly they did not update anything on the silkscreen to identify this board */
|
||||
HardwareModel_HELTEC_V2_1 = 10,
|
||||
HardwareModel_HELTEC_V2_1 = 10,
|
||||
/* Ancient heltec WiFi_Lora_32 board */
|
||||
HardwareModel_HELTEC_V1 = 11,
|
||||
HardwareModel_HELTEC_V1 = 11,
|
||||
/* New T-BEAM with ESP32-S3 CPU */
|
||||
HardwareModel_LILYGO_TBEAM_S3_CORE = 12,
|
||||
HardwareModel_LILYGO_TBEAM_S3_CORE = 12,
|
||||
/* RAK WisBlock ESP32 core: https://docs.rakwireless.com/Product-Categories/WisBlock/RAK11200/Overview/ */
|
||||
HardwareModel_RAK11200 = 13,
|
||||
HardwareModel_RAK11200 = 13,
|
||||
/* B&Q Consulting Nano Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:nano */
|
||||
HardwareModel_NANO_G1 = 14,
|
||||
HardwareModel_NANO_G1 = 14,
|
||||
/* TODO: REPLACE */
|
||||
HardwareModel_TLORA_V2_1_1P8 = 15,
|
||||
HardwareModel_TLORA_V2_1_1P8 = 15,
|
||||
/* B&Q Consulting Station Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:station */
|
||||
HardwareModel_STATION_G1 = 25,
|
||||
HardwareModel_STATION_G1 = 25,
|
||||
/* Less common/prototype boards listed here (needs one more byte over the air) */
|
||||
HardwareModel_LORA_RELAY_V1 = 32,
|
||||
HardwareModel_LORA_RELAY_V1 = 32,
|
||||
/* TODO: REPLACE */
|
||||
HardwareModel_NRF52840DK = 33,
|
||||
HardwareModel_NRF52840DK = 33,
|
||||
/* TODO: REPLACE */
|
||||
HardwareModel_PPR = 34,
|
||||
HardwareModel_PPR = 34,
|
||||
/* TODO: REPLACE */
|
||||
HardwareModel_GENIEBLOCKS = 35,
|
||||
HardwareModel_GENIEBLOCKS = 35,
|
||||
/* TODO: REPLACE */
|
||||
HardwareModel_NRF52_UNKNOWN = 36,
|
||||
HardwareModel_NRF52_UNKNOWN = 36,
|
||||
/* TODO: REPLACE */
|
||||
HardwareModel_PORTDUINO = 37,
|
||||
HardwareModel_PORTDUINO = 37,
|
||||
/* The simulator built into the android app */
|
||||
HardwareModel_ANDROID_SIM = 38,
|
||||
HardwareModel_ANDROID_SIM = 38,
|
||||
/* Custom DIY device based on @NanoVHF schematics: https://github.com/NanoVHF/Meshtastic-DIY/tree/main/Schematics */
|
||||
HardwareModel_DIY_V1 = 39,
|
||||
HardwareModel_DIY_V1 = 39,
|
||||
/* nRF52840 Dongle : https://www.nordicsemi.com/Products/Development-hardware/nrf52840-dongle/ */
|
||||
HardwareModel_NRF52840_PCA10059 = 40,
|
||||
HardwareModel_NRF52840_PCA10059 = 40,
|
||||
/* Custom Disaster Radio esp32 v3 device https://github.com/sudomesh/disaster-radio/tree/master/hardware/board_esp32_v3 */
|
||||
HardwareModel_DR_DEV = 41,
|
||||
HardwareModel_DR_DEV = 41,
|
||||
/* M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, Paper) https://m5stack.com/ */
|
||||
HardwareModel_M5STACK = 42,
|
||||
HardwareModel_M5STACK = 42,
|
||||
/* New Heltec LoRA32 with ESP32-S3 CPU */
|
||||
HardwareModel_HELTEC_V3 = 43,
|
||||
HardwareModel_HELTEC_V3 = 43,
|
||||
/* New Heltec Wireless Stick Lite with ESP32-S3 CPU */
|
||||
HardwareModel_HELTEC_WSL_V3 = 44,
|
||||
HardwareModel_HELTEC_WSL_V3 = 44,
|
||||
/* 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. */
|
||||
HardwareModel_PRIVATE_HW = 255
|
||||
HardwareModel_PRIVATE_HW = 255
|
||||
} HardwareModel;
|
||||
|
||||
/* Shared constants between device and phone */
|
||||
typedef enum _Constants {
|
||||
typedef enum _Constants {
|
||||
/* First enum must be zero, and we are just using this enum to
|
||||
pass int constants between two very different environments */
|
||||
Constants_ZERO = 0,
|
||||
Constants_ZERO = 0,
|
||||
/* From mesh.options
|
||||
note: this payload length is ONLY the bytes that are sent inside of the Data protobuf (excluding protobuf overhead). The 16 byte header is
|
||||
outside of this envelope */
|
||||
Constants_DATA_PAYLOAD_LEN = 237
|
||||
Constants_DATA_PAYLOAD_LEN = 237
|
||||
} Constants;
|
||||
|
||||
/* Error codes for critical errors
|
||||
The device might report these fault codes on the screen.
|
||||
If you encounter a fault code, please post on the meshtastic.discourse.group
|
||||
and we'll try to help. */
|
||||
typedef enum _CriticalErrorCode {
|
||||
typedef enum _CriticalErrorCode {
|
||||
/* TODO: REPLACE */
|
||||
CriticalErrorCode_NONE = 0,
|
||||
CriticalErrorCode_NONE = 0,
|
||||
/* A software bug was detected while trying to send lora */
|
||||
CriticalErrorCode_TX_WATCHDOG = 1,
|
||||
CriticalErrorCode_TX_WATCHDOG = 1,
|
||||
/* A software bug was detected on entry to sleep */
|
||||
CriticalErrorCode_SLEEP_ENTER_WAIT = 2,
|
||||
CriticalErrorCode_SLEEP_ENTER_WAIT = 2,
|
||||
/* No Lora radio hardware could be found */
|
||||
CriticalErrorCode_NO_RADIO = 3,
|
||||
CriticalErrorCode_NO_RADIO = 3,
|
||||
/* Not normally used */
|
||||
CriticalErrorCode_UNSPECIFIED = 4,
|
||||
CriticalErrorCode_UNSPECIFIED = 4,
|
||||
/* We failed while configuring a UBlox GPS */
|
||||
CriticalErrorCode_UBLOX_UNIT_FAILED = 5,
|
||||
CriticalErrorCode_UBLOX_UNIT_FAILED = 5,
|
||||
/* This board was expected to have a power management chip and it is missing or broken */
|
||||
CriticalErrorCode_NO_AXP192 = 6,
|
||||
CriticalErrorCode_NO_AXP192 = 6,
|
||||
/* The channel tried to set a radio setting which is not supported by this chipset,
|
||||
radio comms settings are now undefined. */
|
||||
CriticalErrorCode_INVALID_RADIO_SETTING = 7,
|
||||
CriticalErrorCode_INVALID_RADIO_SETTING = 7,
|
||||
/* Radio transmit hardware failure. We sent data to the radio chip, but it didn't
|
||||
reply with an interrupt. */
|
||||
CriticalErrorCode_TRANSMIT_FAILED = 8,
|
||||
CriticalErrorCode_TRANSMIT_FAILED = 8,
|
||||
/* We detected that the main CPU voltage dropped below the minumum acceptable value */
|
||||
CriticalErrorCode_BROWNOUT = 9,
|
||||
CriticalErrorCode_BROWNOUT = 9,
|
||||
/* Selftest of SX1262 radio chip failed */
|
||||
CriticalErrorCode_SX1262_FAILURE = 10,
|
||||
CriticalErrorCode_SX1262_FAILURE = 10,
|
||||
/* A (likely software but possibly hardware) failure was detected while trying to send packets.
|
||||
If this occurs on your board, please post in the forum so that we can ask you to collect some information to allow fixing this bug */
|
||||
CriticalErrorCode_RADIO_SPI_BUG = 11
|
||||
CriticalErrorCode_RADIO_SPI_BUG = 11
|
||||
} CriticalErrorCode;
|
||||
|
||||
/* Note: these enum names must EXACTLY match the string used in the device
|
||||
bin/build-all.sh script.
|
||||
Because they will be used to find firmware filenames in the android app for OTA updates.
|
||||
To match the old style filenames, _ is converted to -, p is converted to . */
|
||||
typedef enum _Position_LocSource {
|
||||
/* How the location was acquired: manual, onboard GPS, external (EUD) GPS */
|
||||
typedef enum _Position_LocSource {
|
||||
/* TODO: REPLACE */
|
||||
Position_LocSource_LOC_UNSET = 0,
|
||||
Position_LocSource_LOC_UNSET = 0,
|
||||
/* TODO: REPLACE */
|
||||
Position_LocSource_LOC_MANUAL = 1,
|
||||
Position_LocSource_LOC_MANUAL = 1,
|
||||
/* TODO: REPLACE */
|
||||
Position_LocSource_LOC_INTERNAL = 2,
|
||||
Position_LocSource_LOC_INTERNAL = 2,
|
||||
/* TODO: REPLACE */
|
||||
Position_LocSource_LOC_EXTERNAL = 3
|
||||
Position_LocSource_LOC_EXTERNAL = 3
|
||||
} Position_LocSource;
|
||||
|
||||
/* Shared constants between device and phone */
|
||||
typedef enum _Position_AltSource {
|
||||
/* First enum must be zero, and we are just using this enum to
|
||||
pass int constants between two very different environments */
|
||||
Position_AltSource_ALT_UNSET = 0,
|
||||
/* From mesh.options
|
||||
note: this payload length is ONLY the bytes that are sent inside of the Data protobuf (excluding protobuf overhead). The 16 byte header is
|
||||
outside of this envelope */
|
||||
Position_AltSource_ALT_MANUAL = 1,
|
||||
Position_AltSource_ALT_INTERNAL = 2,
|
||||
Position_AltSource_ALT_EXTERNAL = 3,
|
||||
Position_AltSource_ALT_BAROMETRIC = 4
|
||||
/* How the altitude was acquired: manual, GPS int/ext, etc
|
||||
Default: same as location_source if present */
|
||||
typedef enum _Position_AltSource {
|
||||
/* TODO: REPLACE */
|
||||
Position_AltSource_ALT_UNSET = 0,
|
||||
/* TODO: REPLACE */
|
||||
Position_AltSource_ALT_MANUAL = 1,
|
||||
/* TODO: REPLACE */
|
||||
Position_AltSource_ALT_INTERNAL = 2,
|
||||
/* TODO: REPLACE */
|
||||
Position_AltSource_ALT_EXTERNAL = 3,
|
||||
/* TODO: REPLACE */
|
||||
Position_AltSource_ALT_BAROMETRIC = 4
|
||||
} Position_AltSource;
|
||||
|
||||
/* Note: these enum names must EXACTLY match the string used in the device
|
||||
bin/build-all.sh script.
|
||||
Because they will be used to find firmware filenames in the android app for OTA updates.
|
||||
To match the old style filenames, _ is converted to -, p is converted to . */
|
||||
typedef enum _Routing_Error {
|
||||
/* A failure in delivering a message (usually used for routing control messages, but might be provided in addition to ack.fail_id to provide
|
||||
details on the type of failure). */
|
||||
typedef enum _Routing_Error {
|
||||
/* This message is not a failure */
|
||||
Routing_Error_NONE = 0,
|
||||
/* Our node doesn't have a route to the requested destination anymore. */
|
||||
Routing_Error_NO_ROUTE = 1,
|
||||
/* We received a nak while trying to forward on your behalf */
|
||||
Routing_Error_GOT_NAK = 2,
|
||||
/* TODO: REPLACE */
|
||||
Routing_Error_NONE = 0,
|
||||
/* TODO: REPLACE */
|
||||
Routing_Error_NO_ROUTE = 1,
|
||||
/* TODO: REPLACE */
|
||||
Routing_Error_GOT_NAK = 2,
|
||||
/* TODO: REPLACE */
|
||||
Routing_Error_TIMEOUT = 3,
|
||||
/* TODO: REPLACE */
|
||||
Routing_Error_NO_INTERFACE = 4,
|
||||
/* The original heltec WiFi_Lora_32_V2, which had battery voltage sensing hooked to GPIO 13
|
||||
(see HELTEC_V2 for the new version). */
|
||||
Routing_Error_MAX_RETRANSMIT = 5,
|
||||
/* TODO: REPLACE */
|
||||
Routing_Error_NO_CHANNEL = 6,
|
||||
/* TODO: REPLACE */
|
||||
Routing_Error_TOO_LARGE = 7,
|
||||
/* TODO: REPLACE */
|
||||
Routing_Error_NO_RESPONSE = 8,
|
||||
/* TODO: REPLACE */
|
||||
Routing_Error_DUTY_CYCLE_LIMIT = 9,
|
||||
/* The new version of the heltec WiFi_Lora_32_V2 board that has battery sensing hooked to GPIO 37.
|
||||
Sadly they did not update anything on the silkscreen to identify this board */
|
||||
Routing_Error_BAD_REQUEST = 32,
|
||||
/* Ancient heltec WiFi_Lora_32 board */
|
||||
Routing_Error_NOT_AUTHORIZED = 33
|
||||
Routing_Error_TIMEOUT = 3,
|
||||
/* No suitable interface could be found for delivering this packet */
|
||||
Routing_Error_NO_INTERFACE = 4,
|
||||
/* We reached the max retransmission count (typically for naive flood routing) */
|
||||
Routing_Error_MAX_RETRANSMIT = 5,
|
||||
/* No suitable channel was found for sending this packet (i.e. was requested channel index disabled?) */
|
||||
Routing_Error_NO_CHANNEL = 6,
|
||||
/* The packet was too big for sending (exceeds interface MTU after encoding) */
|
||||
Routing_Error_TOO_LARGE = 7,
|
||||
/* The request had want_response set, the request reached the destination node, but no service on that node wants to send a response
|
||||
(possibly due to bad channel permissions) */
|
||||
Routing_Error_NO_RESPONSE = 8,
|
||||
/* Cannot send currently because duty cycle regulations will be violated. */
|
||||
Routing_Error_DUTY_CYCLE_LIMIT = 9,
|
||||
/* The application layer service on the remote node received your request, but considered your request somehow invalid */
|
||||
Routing_Error_BAD_REQUEST = 32,
|
||||
/* The application layer service on the remote node received your request, but considered your request not authorized
|
||||
(i.e you did not send the request on the required bound channel) */
|
||||
Routing_Error_NOT_AUTHORIZED = 33
|
||||
} Routing_Error;
|
||||
|
||||
/* Note: these enum names must EXACTLY match the string used in the device
|
||||
bin/build-all.sh script.
|
||||
Because they will be used to find firmware filenames in the android app for OTA updates.
|
||||
To match the old style filenames, _ is converted to -, p is converted to . */
|
||||
typedef enum _MeshPacket_Priority {
|
||||
/* The priority of this message for sending.
|
||||
Higher priorities are sent first (when managing the transmit queue).
|
||||
This field is never sent over the air, it is only used internally inside of a local device node.
|
||||
API clients (either on the local node or connected directly to the node)
|
||||
can set this parameter if necessary.
|
||||
(values must be <= 127 to keep protobuf field to one byte in size.
|
||||
Detailed background on this field:
|
||||
I noticed a funny side effect of lora being so slow: Usually when making
|
||||
a protocol there isn’t much need to use message priority to change the order
|
||||
of transmission (because interfaces are fairly fast).
|
||||
But for lora where packets can take a few seconds each, it is very important
|
||||
to make sure that critical packets are sent ASAP.
|
||||
In the case of meshtastic that means we want to send protocol acks as soon as possible
|
||||
(to prevent unneeded retransmissions), we want routing messages to be sent next,
|
||||
then messages marked as reliable and finally ‘background’ packets like periodic position updates.
|
||||
So I bit the bullet and implemented a new (internal - not sent over the air)
|
||||
field in MeshPacket called ‘priority’.
|
||||
And the transmission queue in the router object is now a priority queue. */
|
||||
typedef enum _MeshPacket_Priority {
|
||||
/* Treated as Priority.DEFAULT */
|
||||
MeshPacket_Priority_UNSET = 0,
|
||||
/* TODO: REPLACE */
|
||||
MeshPacket_Priority_UNSET = 0,
|
||||
MeshPacket_Priority_MIN = 1,
|
||||
/* Background position updates are sent with very low priority -
|
||||
if the link is super congested they might not go out at all */
|
||||
MeshPacket_Priority_BACKGROUND = 10,
|
||||
/* This priority is used for most messages that don't have a priority set */
|
||||
MeshPacket_Priority_DEFAULT = 64,
|
||||
/* If priority is unset but the message is marked as want_ack,
|
||||
assume it is important and use a slightly higher priority */
|
||||
MeshPacket_Priority_RELIABLE = 70,
|
||||
/* Ack/naks are sent with very high priority to ensure that retransmission
|
||||
stops as soon as possible */
|
||||
MeshPacket_Priority_ACK = 120,
|
||||
/* TODO: REPLACE */
|
||||
MeshPacket_Priority_MIN = 1,
|
||||
/* TODO: REPLACE */
|
||||
MeshPacket_Priority_BACKGROUND = 10,
|
||||
/* TODO: REPLACE */
|
||||
MeshPacket_Priority_DEFAULT = 64,
|
||||
/* TODO: REPLACE */
|
||||
MeshPacket_Priority_RELIABLE = 70,
|
||||
/* The original heltec WiFi_Lora_32_V2, which had battery voltage sensing hooked to GPIO 13
|
||||
(see HELTEC_V2 for the new version). */
|
||||
MeshPacket_Priority_ACK = 120,
|
||||
/* TODO: REPLACE */
|
||||
MeshPacket_Priority_MAX = 127
|
||||
MeshPacket_Priority_MAX = 127
|
||||
} MeshPacket_Priority;
|
||||
|
||||
/* Shared constants between device and phone */
|
||||
typedef enum _MeshPacket_Delayed {
|
||||
/* First enum must be zero, and we are just using this enum to
|
||||
pass int constants between two very different environments */
|
||||
MeshPacket_Delayed_NO_DELAY = 0,
|
||||
/* From mesh.options
|
||||
note: this payload length is ONLY the bytes that are sent inside of the Data protobuf (excluding protobuf overhead). The 16 byte header is
|
||||
outside of this envelope */
|
||||
MeshPacket_Delayed_DELAYED_BROADCAST = 1,
|
||||
MeshPacket_Delayed_DELAYED_DIRECT = 2
|
||||
/* Identify if this is a delayed packet */
|
||||
typedef enum _MeshPacket_Delayed {
|
||||
/* If unset, the message is being sent in real time. */
|
||||
MeshPacket_Delayed_NO_DELAY = 0,
|
||||
/* The message is delayed and was originally a broadcast */
|
||||
MeshPacket_Delayed_DELAYED_BROADCAST = 1,
|
||||
/* The message is delayed and was originally a direct message */
|
||||
MeshPacket_Delayed_DELAYED_DIRECT = 2
|
||||
} MeshPacket_Delayed;
|
||||
|
||||
/* Note: these enum names must EXACTLY match the string used in the device
|
||||
bin/build-all.sh script.
|
||||
Because they will be used to find firmware filenames in the android app for OTA updates.
|
||||
To match the old style filenames, _ is converted to -, p is converted to . */
|
||||
typedef enum _LogRecord_Level {
|
||||
/* TODO: REPLACE */
|
||||
LogRecord_Level_UNSET = 0,
|
||||
/* TODO: REPLACE */
|
||||
LogRecord_Level_CRITICAL = 50,
|
||||
/* TODO: REPLACE */
|
||||
LogRecord_Level_ERROR = 40,
|
||||
/* TODO: REPLACE */
|
||||
LogRecord_Level_WARNING = 30,
|
||||
/* TODO: REPLACE */
|
||||
LogRecord_Level_INFO = 20,
|
||||
/* The original heltec WiFi_Lora_32_V2, which had battery voltage sensing hooked to GPIO 13
|
||||
(see HELTEC_V2 for the new version). */
|
||||
LogRecord_Level_DEBUG = 10,
|
||||
/* TODO: REPLACE */
|
||||
LogRecord_Level_TRACE = 5
|
||||
/* Log levels, chosen to match python logging conventions. */
|
||||
typedef enum _LogRecord_Level {
|
||||
/* Log levels, chosen to match python logging conventions. */
|
||||
LogRecord_Level_UNSET = 0,
|
||||
/* Log levels, chosen to match python logging conventions. */
|
||||
LogRecord_Level_CRITICAL = 50,
|
||||
/* Log levels, chosen to match python logging conventions. */
|
||||
LogRecord_Level_ERROR = 40,
|
||||
/* Log levels, chosen to match python logging conventions. */
|
||||
LogRecord_Level_WARNING = 30,
|
||||
/* Log levels, chosen to match python logging conventions. */
|
||||
LogRecord_Level_INFO = 20,
|
||||
/* Log levels, chosen to match python logging conventions. */
|
||||
LogRecord_Level_DEBUG = 10,
|
||||
/* Log levels, chosen to match python logging conventions. */
|
||||
LogRecord_Level_TRACE = 5
|
||||
} LogRecord_Level;
|
||||
|
||||
/* Struct definitions */
|
||||
typedef PB_BYTES_ARRAY_T(237) Compressed_data_t;
|
||||
/* Compressed message payload */
|
||||
typedef struct _Compressed {
|
||||
/* PortNum to determine the how to handle the compressed payload. */
|
||||
PortNum portnum;
|
||||
/* Compressed data. */
|
||||
Compressed_data_t data;
|
||||
} Compressed;
|
||||
|
||||
typedef PB_BYTES_ARRAY_T(237) Data_payload_t;
|
||||
/* (Formerly called SubPacket)
|
||||
The payload portion fo a packet, this is the actual bytes that are sent
|
||||
inside a radio packet (because from/to are broken out by the comms library) */
|
||||
typedef struct _Data {
|
||||
/* Formerly named typ and of type Type */
|
||||
PortNum portnum;
|
||||
/* TODO: REPLACE */
|
||||
Data_payload_t payload;
|
||||
/* Not normally used, but for testing a sender can request that recipient
|
||||
responds in kind (i.e. if it received a position, it should unicast back it's position).
|
||||
Note: that if you set this on a broadcast you will receive many replies. */
|
||||
bool want_response;
|
||||
/* The address of the destination node.
|
||||
This field is is filled in by the mesh radio device software, application
|
||||
layer software should never need it.
|
||||
RouteDiscovery messages _must_ populate this.
|
||||
Other message types might need to if they are doing multihop routing. */
|
||||
uint32_t dest;
|
||||
/* The address of the original sender for this message.
|
||||
This field should _only_ be populated for reliable multihop packets (to keep
|
||||
packets small). */
|
||||
uint32_t source;
|
||||
/* Only used in routing or response messages.
|
||||
Indicates the original message ID that this message is reporting failure on. (formerly called original_id) */
|
||||
uint32_t request_id;
|
||||
/* If set, this message is intened to be a reply to a previously sent message with the defined id. */
|
||||
uint32_t reply_id;
|
||||
/* Defaults to false. If true, then what is in the payload should be treated as an emoji like giving
|
||||
a message a heart or poop emoji. */
|
||||
uint32_t emoji;
|
||||
} Data;
|
||||
|
||||
/* Debug output from the device.
|
||||
To minimize the size of records inside the device code, if a time/source/level is not set
|
||||
on the message it is assumed to be a continuation of the previously sent message.
|
||||
This allows the device code to use fixed maxlen 64 byte strings for messages,
|
||||
and then extend as needed by emitting multiple records. */
|
||||
typedef struct _LogRecord {
|
||||
/* Log levels, chosen to match python logging conventions. */
|
||||
char message[64];
|
||||
/* Seconds since 1970 - or 0 for unknown/unset */
|
||||
uint32_t time;
|
||||
/* Usually based on thread name - if known */
|
||||
char source[8];
|
||||
/* Not yet set */
|
||||
LogRecord_Level level;
|
||||
} LogRecord;
|
||||
|
||||
/* Unique local debugging info for this node
|
||||
Note: we don't include position or the user info, because that will come in the
|
||||
Sent to the phone in response to WantNodes. */
|
||||
typedef struct _MyNodeInfo {
|
||||
/* Tells the phone what our node number is, default starting value is
|
||||
lowbyte of macaddr, but it will be fixed if that is already in use */
|
||||
uint32_t my_node_num;
|
||||
/* Note: This flag merely means we detected a hardware GPS in our node.
|
||||
Not the same as UserPreferences.location_sharing */
|
||||
bool has_gps;
|
||||
/* The maximum number of 'software' channels that can be set on this node. */
|
||||
uint32_t max_channels;
|
||||
/* 0.0.5 etc... */
|
||||
char firmware_version[18];
|
||||
/* An error message we'd like to report back to the mothership through analytics.
|
||||
It indicates a serious bug occurred on the device, the device coped with it,
|
||||
but we still want to tell the devs about the bug.
|
||||
This field will be cleared after the phone reads 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;
|
||||
/* A numeric error address (nonzero if available) */
|
||||
uint32_t error_address;
|
||||
/* The total number of errors this node has ever encountered
|
||||
(well - since the last time we discarded preferences) */
|
||||
uint32_t error_count;
|
||||
/* The total number of reboots this node has ever encountered
|
||||
(well - since the last time we discarded preferences) */
|
||||
uint32_t reboot_count;
|
||||
/* Calculated bitrate of the current channel (in Bytes Per Second) */
|
||||
float bitrate;
|
||||
/* How long before we consider a message abandoned and we can clear our
|
||||
caches of any messages in flight Normally quite large to handle the worst case
|
||||
message delivery time, 5 minutes.
|
||||
Formerly called FLOOD_EXPIRE_TIME in the device code */
|
||||
uint32_t message_timeout_msec;
|
||||
/* 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_t min_app_version;
|
||||
/* 24 time windows of 1hr each with the airtime transmitted out of the device per hour. */
|
||||
pb_size_t air_period_tx_count;
|
||||
uint32_t air_period_tx[8];
|
||||
/* 24 time windows of 1hr each with the airtime of valid packets for your mesh. */
|
||||
pb_size_t air_period_rx_count;
|
||||
uint32_t air_period_rx[8];
|
||||
/* Is the device wifi capable? */
|
||||
bool has_wifi;
|
||||
/* Utilization for the current channel, including well formed TX, RX and malformed RX (aka noise). */
|
||||
float channel_utilization;
|
||||
/* Percent of airtime for transmission used within the last hour. */
|
||||
float air_util_tx;
|
||||
} MyNodeInfo;
|
||||
|
||||
/* a gps position */
|
||||
typedef struct _Position {
|
||||
typedef struct _Position {
|
||||
/* The new preferred location encoding, multiply by 1e-7 to get degrees
|
||||
in floating point */
|
||||
int32_t latitude_i;
|
||||
@@ -429,13 +324,6 @@ typedef struct _Position {
|
||||
uint32_t seq_number;
|
||||
} Position;
|
||||
|
||||
/* A message used in our Dynamic Source Routing protocol (RFC 4728 based) */
|
||||
typedef struct _RouteDiscovery {
|
||||
/* The list of nodenums this packet has visited so far */
|
||||
pb_size_t route_count;
|
||||
uint32_t route[8];
|
||||
} RouteDiscovery;
|
||||
|
||||
/* Broadcast when a newly powered mesh node wants to find a node num it can use
|
||||
Sent from the phone over bluetooth to set the user id for the owner of this node.
|
||||
Also sent from nodes to each other when a new node signs on (so all clients can have this info)
|
||||
@@ -456,7 +344,7 @@ typedef struct _RouteDiscovery {
|
||||
A few nodenums are reserved and will never be requested:
|
||||
0xff - broadcast
|
||||
0 through 3 - for future use */
|
||||
typedef struct _User {
|
||||
typedef struct _User {
|
||||
/* A globally unique ID string for this user.
|
||||
In the case of Signal that would mean +16504442323, for the default macaddr derived id it would be !<8 hexidecimal bytes>.
|
||||
Note: app developers are encouraged to also use the following standard
|
||||
@@ -481,8 +369,62 @@ typedef struct _User {
|
||||
bool is_licensed;
|
||||
} User;
|
||||
|
||||
/* A message used in our Dynamic Source Routing protocol (RFC 4728 based) */
|
||||
typedef struct _RouteDiscovery {
|
||||
/* The list of nodenums this packet has visited so far */
|
||||
pb_size_t route_count;
|
||||
uint32_t route[8];
|
||||
} RouteDiscovery;
|
||||
|
||||
/* A Routing control Data packet handled by the routing module */
|
||||
typedef struct _Routing {
|
||||
pb_size_t which_variant;
|
||||
union {
|
||||
/* A route request going from the requester */
|
||||
RouteDiscovery route_request;
|
||||
/* A route reply */
|
||||
RouteDiscovery route_reply;
|
||||
/* A failure in delivering a message (usually used for routing control messages, but might be provided
|
||||
in addition to ack.fail_id to provide details on the type of failure). */
|
||||
Routing_Error error_reason;
|
||||
};
|
||||
} Routing;
|
||||
|
||||
typedef PB_BYTES_ARRAY_T(237) Data_payload_t;
|
||||
/* (Formerly called SubPacket)
|
||||
The payload portion fo a packet, this is the actual bytes that are sent
|
||||
inside a radio packet (because from/to are broken out by the comms library) */
|
||||
typedef struct _Data {
|
||||
/* Formerly named typ and of type Type */
|
||||
PortNum portnum;
|
||||
/* TODO: REPLACE */
|
||||
Data_payload_t payload;
|
||||
/* Not normally used, but for testing a sender can request that recipient
|
||||
responds in kind (i.e. if it received a position, it should unicast back it's position).
|
||||
Note: that if you set this on a broadcast you will receive many replies. */
|
||||
bool want_response;
|
||||
/* The address of the destination node.
|
||||
This field is is filled in by the mesh radio device software, application
|
||||
layer software should never need it.
|
||||
RouteDiscovery messages _must_ populate this.
|
||||
Other message types might need to if they are doing multihop routing. */
|
||||
uint32_t dest;
|
||||
/* The address of the original sender for this message.
|
||||
This field should _only_ be populated for reliable multihop packets (to keep
|
||||
packets small). */
|
||||
uint32_t source;
|
||||
/* Only used in routing or response messages.
|
||||
Indicates the original message ID that this message is reporting failure on. (formerly called original_id) */
|
||||
uint32_t request_id;
|
||||
/* If set, this message is intened to be a reply to a previously sent message with the defined id. */
|
||||
uint32_t reply_id;
|
||||
/* Defaults to false. If true, then what is in the payload should be treated as an emoji like giving
|
||||
a message a heart or poop emoji. */
|
||||
uint32_t emoji;
|
||||
} Data;
|
||||
|
||||
/* Waypoint message, used to share arbitrary locations across the mesh */
|
||||
typedef struct _Waypoint {
|
||||
typedef struct _Waypoint {
|
||||
/* Id of the waypoint */
|
||||
uint32_t id;
|
||||
/* latitude_i */
|
||||
@@ -504,7 +446,7 @@ typedef PB_BYTES_ARRAY_T(256) MeshPacket_encrypted_t;
|
||||
/* A packet envelope sent/received over the mesh
|
||||
only payload_variant is sent in the payload portion of the LORA packet.
|
||||
The other fields are either not sent at all, or sent in the special 16 byte LORA header. */
|
||||
typedef struct _MeshPacket {
|
||||
typedef struct _MeshPacket {
|
||||
/* The sending node number.
|
||||
Note: Our crypto implementation uses this field as well.
|
||||
See [crypto](/docs/overview/encryption) for details.
|
||||
@@ -588,7 +530,7 @@ typedef struct _MeshPacket {
|
||||
level etc) SET_CONFIG (switches device to a new set of radio params and
|
||||
preshared key, drops all existing nodes, force our node to rejoin this new group)
|
||||
Full information about a node on the mesh */
|
||||
typedef struct _NodeInfo {
|
||||
typedef struct _NodeInfo {
|
||||
/* The node number */
|
||||
uint32_t num;
|
||||
/* The user info for this node */
|
||||
@@ -608,25 +550,80 @@ typedef struct _NodeInfo {
|
||||
DeviceMetrics device_metrics;
|
||||
} NodeInfo;
|
||||
|
||||
/* A Routing control Data packet handled by the routing module */
|
||||
typedef struct _Routing {
|
||||
pb_size_t which_variant;
|
||||
union {
|
||||
/* A route request going from the requester */
|
||||
RouteDiscovery route_request;
|
||||
/* A route reply */
|
||||
RouteDiscovery route_reply;
|
||||
/* A failure in delivering a message (usually used for routing control messages, but might be provided
|
||||
in addition to ack.fail_id to provide details on the type of failure). */
|
||||
Routing_Error error_reason;
|
||||
};
|
||||
} Routing;
|
||||
/* Unique local debugging info for this node
|
||||
Note: we don't include position or the user info, because that will come in the
|
||||
Sent to the phone in response to WantNodes. */
|
||||
typedef struct _MyNodeInfo {
|
||||
/* Tells the phone what our node number is, default starting value is
|
||||
lowbyte of macaddr, but it will be fixed if that is already in use */
|
||||
uint32_t my_node_num;
|
||||
/* Note: This flag merely means we detected a hardware GPS in our node.
|
||||
Not the same as UserPreferences.location_sharing */
|
||||
bool has_gps;
|
||||
/* The maximum number of 'software' channels that can be set on this node. */
|
||||
uint32_t max_channels;
|
||||
/* 0.0.5 etc... */
|
||||
char firmware_version[18];
|
||||
/* An error message we'd like to report back to the mothership through analytics.
|
||||
It indicates a serious bug occurred on the device, the device coped with it,
|
||||
but we still want to tell the devs about the bug.
|
||||
This field will be cleared after the phone reads 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;
|
||||
/* A numeric error address (nonzero if available) */
|
||||
uint32_t error_address;
|
||||
/* The total number of errors this node has ever encountered
|
||||
(well - since the last time we discarded preferences) */
|
||||
uint32_t error_count;
|
||||
/* The total number of reboots this node has ever encountered
|
||||
(well - since the last time we discarded preferences) */
|
||||
uint32_t reboot_count;
|
||||
/* Calculated bitrate of the current channel (in Bytes Per Second) */
|
||||
float bitrate;
|
||||
/* How long before we consider a message abandoned and we can clear our
|
||||
caches of any messages in flight Normally quite large to handle the worst case
|
||||
message delivery time, 5 minutes.
|
||||
Formerly called FLOOD_EXPIRE_TIME in the device code */
|
||||
uint32_t message_timeout_msec;
|
||||
/* 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_t min_app_version;
|
||||
/* 24 time windows of 1hr each with the airtime transmitted out of the device per hour. */
|
||||
pb_size_t air_period_tx_count;
|
||||
uint32_t air_period_tx[8];
|
||||
/* 24 time windows of 1hr each with the airtime of valid packets for your mesh. */
|
||||
pb_size_t air_period_rx_count;
|
||||
uint32_t air_period_rx[8];
|
||||
/* Is the device wifi capable? */
|
||||
bool has_wifi;
|
||||
/* Utilization for the current channel, including well formed TX, RX and malformed RX (aka noise). */
|
||||
float channel_utilization;
|
||||
/* Percent of airtime for transmission used within the last hour. */
|
||||
float air_util_tx;
|
||||
} MyNodeInfo;
|
||||
|
||||
/* Debug output from the device.
|
||||
To minimize the size of records inside the device code, if a time/source/level is not set
|
||||
on the message it is assumed to be a continuation of the previously sent message.
|
||||
This allows the device code to use fixed maxlen 64 byte strings for messages,
|
||||
and then extend as needed by emitting multiple records. */
|
||||
typedef struct _LogRecord {
|
||||
/* Log levels, chosen to match python logging conventions. */
|
||||
char message[64];
|
||||
/* Seconds since 1970 - or 0 for unknown/unset */
|
||||
uint32_t time;
|
||||
/* Usually based on thread name - if known */
|
||||
char source[8];
|
||||
/* Not yet set */
|
||||
LogRecord_Level level;
|
||||
} LogRecord;
|
||||
|
||||
/* Packets from the radio to the phone will appear on the fromRadio characteristic.
|
||||
It will support READ and NOTIFY. When a new packet arrives the device will BLE notify?
|
||||
It will sit in that descriptor until consumed by the phone,
|
||||
at which point the next item in the FIFO will be populated. */
|
||||
typedef struct _FromRadio {
|
||||
typedef struct _FromRadio {
|
||||
/* The packet id, used to allow the phone to request missing read packets from the FIFO,
|
||||
see our bluetooth docs */
|
||||
uint32_t id;
|
||||
@@ -663,7 +660,7 @@ typedef struct _FromRadio {
|
||||
|
||||
/* Packets/commands to the radio will be written (reliably) to the toRadio characteristic.
|
||||
Once the write completes the phone can assume it is handled. */
|
||||
typedef struct _ToRadio {
|
||||
typedef struct _ToRadio {
|
||||
pb_size_t which_payload_variant;
|
||||
union {
|
||||
/* Send this packet on the mesh */
|
||||
@@ -684,6 +681,19 @@ typedef struct _ToRadio {
|
||||
};
|
||||
} ToRadio;
|
||||
|
||||
typedef PB_BYTES_ARRAY_T(237) Compressed_data_t;
|
||||
/* Compressed message payload */
|
||||
typedef struct _Compressed {
|
||||
/* PortNum to determine the how to handle the compressed payload. */
|
||||
PortNum portnum;
|
||||
/* Compressed data. */
|
||||
Compressed_data_t data;
|
||||
} Compressed;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Helper constants for enums */
|
||||
#define _HardwareModel_MIN HardwareModel_UNSET
|
||||
@@ -722,10 +732,29 @@ typedef struct _ToRadio {
|
||||
#define _LogRecord_Level_MAX LogRecord_Level_CRITICAL
|
||||
#define _LogRecord_Level_ARRAYSIZE ((LogRecord_Level)(LogRecord_Level_CRITICAL+1))
|
||||
|
||||
#define Position_location_source_ENUMTYPE Position_LocSource
|
||||
#define Position_altitude_source_ENUMTYPE Position_AltSource
|
||||
|
||||
#define User_hw_model_ENUMTYPE HardwareModel
|
||||
|
||||
|
||||
#define Routing_variant_error_reason_ENUMTYPE Routing_Error
|
||||
|
||||
#define Data_portnum_ENUMTYPE PortNum
|
||||
|
||||
|
||||
#define MeshPacket_priority_ENUMTYPE MeshPacket_Priority
|
||||
#define MeshPacket_delayed_ENUMTYPE MeshPacket_Delayed
|
||||
|
||||
|
||||
#define MyNodeInfo_error_code_ENUMTYPE CriticalErrorCode
|
||||
|
||||
#define LogRecord_level_ENUMTYPE LogRecord_Level
|
||||
|
||||
|
||||
|
||||
#define Compressed_portnum_ENUMTYPE PortNum
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define Position_init_default {0, 0, 0, 0, _Position_LocSource_MIN, _Position_AltSource_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
@@ -756,36 +785,6 @@ extern "C" {
|
||||
#define Compressed_init_zero {_PortNum_MIN, {0, {0}}}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define Compressed_portnum_tag 1
|
||||
#define Compressed_data_tag 2
|
||||
#define Data_portnum_tag 1
|
||||
#define Data_payload_tag 2
|
||||
#define Data_want_response_tag 3
|
||||
#define Data_dest_tag 4
|
||||
#define Data_source_tag 5
|
||||
#define Data_request_id_tag 6
|
||||
#define Data_reply_id_tag 7
|
||||
#define Data_emoji_tag 8
|
||||
#define LogRecord_message_tag 1
|
||||
#define LogRecord_time_tag 2
|
||||
#define LogRecord_source_tag 3
|
||||
#define LogRecord_level_tag 4
|
||||
#define MyNodeInfo_my_node_num_tag 1
|
||||
#define MyNodeInfo_has_gps_tag 2
|
||||
#define MyNodeInfo_max_channels_tag 3
|
||||
#define MyNodeInfo_firmware_version_tag 4
|
||||
#define MyNodeInfo_error_code_tag 5
|
||||
#define MyNodeInfo_error_address_tag 6
|
||||
#define MyNodeInfo_error_count_tag 7
|
||||
#define MyNodeInfo_reboot_count_tag 8
|
||||
#define MyNodeInfo_bitrate_tag 9
|
||||
#define MyNodeInfo_message_timeout_msec_tag 10
|
||||
#define MyNodeInfo_min_app_version_tag 11
|
||||
#define MyNodeInfo_air_period_tx_tag 12
|
||||
#define MyNodeInfo_air_period_rx_tag 13
|
||||
#define MyNodeInfo_has_wifi_tag 14
|
||||
#define MyNodeInfo_channel_utilization_tag 15
|
||||
#define MyNodeInfo_air_util_tx_tag 16
|
||||
#define Position_latitude_i_tag 1
|
||||
#define Position_longitude_i_tag 2
|
||||
#define Position_altitude_tag 3
|
||||
@@ -808,13 +807,24 @@ extern "C" {
|
||||
#define Position_sensor_id_tag 20
|
||||
#define Position_next_update_tag 21
|
||||
#define Position_seq_number_tag 22
|
||||
#define RouteDiscovery_route_tag 1
|
||||
#define User_id_tag 1
|
||||
#define User_long_name_tag 2
|
||||
#define User_short_name_tag 3
|
||||
#define User_macaddr_tag 4
|
||||
#define User_hw_model_tag 5
|
||||
#define User_is_licensed_tag 6
|
||||
#define RouteDiscovery_route_tag 1
|
||||
#define Routing_route_request_tag 1
|
||||
#define Routing_route_reply_tag 2
|
||||
#define Routing_error_reason_tag 3
|
||||
#define Data_portnum_tag 1
|
||||
#define Data_payload_tag 2
|
||||
#define Data_want_response_tag 3
|
||||
#define Data_dest_tag 4
|
||||
#define Data_source_tag 5
|
||||
#define Data_request_id_tag 6
|
||||
#define Data_reply_id_tag 7
|
||||
#define Data_emoji_tag 8
|
||||
#define Waypoint_id_tag 1
|
||||
#define Waypoint_latitude_i_tag 2
|
||||
#define Waypoint_longitude_i_tag 3
|
||||
@@ -841,9 +851,26 @@ extern "C" {
|
||||
#define NodeInfo_snr_tag 4
|
||||
#define NodeInfo_last_heard_tag 5
|
||||
#define NodeInfo_device_metrics_tag 6
|
||||
#define Routing_route_request_tag 1
|
||||
#define Routing_route_reply_tag 2
|
||||
#define Routing_error_reason_tag 3
|
||||
#define MyNodeInfo_my_node_num_tag 1
|
||||
#define MyNodeInfo_has_gps_tag 2
|
||||
#define MyNodeInfo_max_channels_tag 3
|
||||
#define MyNodeInfo_firmware_version_tag 4
|
||||
#define MyNodeInfo_error_code_tag 5
|
||||
#define MyNodeInfo_error_address_tag 6
|
||||
#define MyNodeInfo_error_count_tag 7
|
||||
#define MyNodeInfo_reboot_count_tag 8
|
||||
#define MyNodeInfo_bitrate_tag 9
|
||||
#define MyNodeInfo_message_timeout_msec_tag 10
|
||||
#define MyNodeInfo_min_app_version_tag 11
|
||||
#define MyNodeInfo_air_period_tx_tag 12
|
||||
#define MyNodeInfo_air_period_rx_tag 13
|
||||
#define MyNodeInfo_has_wifi_tag 14
|
||||
#define MyNodeInfo_channel_utilization_tag 15
|
||||
#define MyNodeInfo_air_util_tx_tag 16
|
||||
#define LogRecord_message_tag 1
|
||||
#define LogRecord_time_tag 2
|
||||
#define LogRecord_source_tag 3
|
||||
#define LogRecord_level_tag 4
|
||||
#define FromRadio_id_tag 1
|
||||
#define FromRadio_packet_tag 2
|
||||
#define FromRadio_my_info_tag 3
|
||||
@@ -857,6 +884,8 @@ extern "C" {
|
||||
#define ToRadio_packet_tag 1
|
||||
#define ToRadio_want_config_id_tag 3
|
||||
#define ToRadio_disconnect_tag 4
|
||||
#define Compressed_portnum_tag 1
|
||||
#define Compressed_data_tag 2
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define Position_FIELDLIST(X, a) \
|
||||
|
||||
Reference in New Issue
Block a user