Regen protos with support for messaged waypoints

This commit is contained in:
Jm Casler 2022-03-26 07:48:35 -07:00
parent 9bece843c3
commit 48fa2b6b9b
24 changed files with 1321 additions and 553 deletions

View File

@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.4 */
/* Generated by nanopb-0.4.5 */
#include "admin.pb.h"
#if PB_PROTO_HEADER_VERSION != 40

View File

@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.4 */
/* Generated by nanopb-0.4.5 */
#ifndef PB_ADMIN_PB_H_INCLUDED
#define PB_ADMIN_PB_H_INCLUDED
@ -13,7 +13,11 @@
#endif
/* Struct definitions */
/* This message is handled by the Admin module and is responsible for all settings/channel read/write operations.
This message is used to do settings operations to both remote AND local nodes.
(Prior to 1.2 these operations were done via special ToRadio operations) */
typedef struct _AdminMessage {
/* Set the radio provisioning for this node */
pb_size_t which_variant;
union {
RadioConfig set_radio;

View File

@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.4 */
/* Generated by nanopb-0.4.5 */
#include "apponly.pb.h"
#if PB_PROTO_HEADER_VERSION != 40

View File

@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.4 */
/* Generated by nanopb-0.4.5 */
#ifndef PB_APPONLY_PB_H_INCLUDED
#define PB_APPONLY_PB_H_INCLUDED
@ -11,7 +11,13 @@
#endif
/* Struct definitions */
/* This is the most compact possible representation for a set of channels.
It includes only one PRIMARY channel (which must be first) and
any SECONDARY channels.
No DISABLED channels are included.
This abstraction is used only on the the 'app side' of the world (ie python, javascript and android etc) to show a group of Channels as a (long) URL */
typedef struct _ChannelSet {
/* TODO: REPLACE */
pb_callback_t settings;
} ChannelSet;

View File

@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.4 */
/* Generated by nanopb-0.4.5 */
#include "cannedmessages.pb.h"
#if PB_PROTO_HEADER_VERSION != 40

View File

@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.4 */
/* Generated by nanopb-0.4.5 */
#ifndef PB_CANNEDMESSAGES_PB_H_INCLUDED
#define PB_CANNEDMESSAGES_PB_H_INCLUDED
@ -10,10 +10,15 @@
#endif
/* Struct definitions */
/* Canned message module configuration. */
typedef struct _CannedMessageModuleConfig {
/* Predefined messages for canned message module separated by '|' characters. */
char messagesPart1[201];
/* TODO: REPLACE */
char messagesPart2[201];
/* TODO: REPLACE */
char messagesPart3[201];
/* TODO: REPLACE */
char messagesPart4[201];
} CannedMessageModuleConfig;

View File

@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.4 */
/* Generated by nanopb-0.4.5 */
#include "channel.pb.h"
#if PB_PROTO_HEADER_VERSION != 40

View File

@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.4 */
/* Generated by nanopb-0.4.5 */
#ifndef PB_CHANNEL_PB_H_INCLUDED
#define PB_CHANNEL_PB_H_INCLUDED
@ -28,24 +28,116 @@ typedef enum _Channel_Role {
/* Struct definitions */
typedef PB_BYTES_ARRAY_T(32) ChannelSettings_psk_t;
/* Full settings (center freq, spread factor, pre-shared secret key etc...)
needed to configure a radio for speaking on a particular channel This
information can be encoded as a QRcode/url so that other users can configure
their radio to join the same channel.
A note about how channel names are shown to users: channelname-Xy
poundsymbol is a prefix used to indicate this is a channel name (idea from @professr).
Where X is a letter from A-Z (base 26) representing a hash of the PSK for this
channel - so that if the user changes anything about the channel (which does
force a new PSK) this letter will also change. Thus preventing user confusion if
two friends try to type in a channel name of "BobsChan" and then can't talk
because their PSKs will be different.
The PSK is hashed into this letter by "0x41 + [xor all bytes of the psk ] modulo 26"
This also allows the option of someday if people have the PSK off (zero), the
users COULD type in a channel name and be able to talk.
Y is a lower case letter from a-z that represents the channel 'speed' settings
(for some future definition of speed)
FIXME: Add description of multi-channel support and how primary vs secondary channels are used.
FIXME: explain how apps use channels for security.
explain how remote settings and remote gpio are managed as an example */
typedef struct _ChannelSettings {
/* If zero then, use default max legal continuous power (ie. something that won't
burn out the radio hardware)
In most cases you should use zero here.
Units are in dBm. */
int8_t tx_power;
/* Note: This is the 'old' mechanism for specifying channel parameters.
Either modem_config or bandwidth/spreading/coding will be specified - NOT BOTH.
As a heuristic: If bandwidth is specified, do not use modem_config.
Because protobufs take ZERO space when the value is zero this works out nicely.
This value is replaced by bandwidth/spread_factor/coding_rate.
If you'd like to experiment with other options add them to MeshRadio.cpp in the device code. */
ChannelSettings_ModemConfig modem_config;
/* Bandwidth in MHz
Certain bandwidth numbers are 'special' and will be converted to the
appropriate floating point value: 31 -> 31.25MHz */
ChannelSettings_psk_t psk;
/* A number from 7 to 12.
Indicates number of chirps per symbol as 1<<spread_factor. */
char name[12];
/* The denominator of the coding rate.
ie for 4/8, the value is 8. 5/8 the value is 5. */
uint16_t bandwidth;
/* NOTE: this field is _independent_ and unrelated to the concepts in channel.proto.
this is controlling the actual hardware frequency the radio is transmitting on.
In a perfect world we would have called it something else (band?) but I forgot to make this change during the big 1.2 renaming.
Most users should never need to be exposed to this field/concept.
A channel number between 1 and 13 (or whatever the max is in the current
region). If ZERO then the rule is "use the old channel name hash based
algorithm to derive the channel number")
If using the hash algorithm the channel number will be: hash(channel_name) %
NUM_CHANNELS (Where num channels depends on the regulatory region).
NUM_CHANNELS_US is 13, for other values see MeshRadio.h in the device code.
hash a string into an integer - djb2 by Dan Bernstein. -
http://www.cse.yorku.ca/~oz/hash.html
unsigned long hash(char *str) {
unsigned long hash = 5381; int c;
while ((c = *str++) != 0)
hash = ((hash << 5) + hash) + (unsigned char) c;
return hash;
} */
uint32_t spread_factor;
/* A simple pre-shared key for now for crypto.
Must be either 0 bytes (no crypto), 16 bytes (AES128), or 32 bytes (AES256).
A special shorthand is used for 1 byte long psks.
These psks should be treated as only minimally secure,
because they are listed in this source code.
Those bytes are mapped using the following scheme:
`0` = No crypto
`1` = The special "default" channel key: {0xd4, 0xf1, 0xbb, 0x3a, 0x20, 0x29, 0x07, 0x59, 0xf0, 0xbc, 0xff, 0xab, 0xcf, 0x4e, 0x69, 0xbf}
`2` through 10 = The default channel key, except with 1 through 9 added to the last byte.
Shown to user as simple1 through 10 */
uint8_t coding_rate;
/* A SHORT name that will be packed into the URL.
Less than 12 bytes.
Something for end users to call the channel
If this is the empty string it is assumed that this channel
is the special (minimally secure) "Default"channel.
In user interfaces it should be rendered as a local language translation of "X".
For channel_num hashing empty string will be treated as "X".
Where "X" is selected based on the English words listed above for ModemConfig */
uint8_t channel_num;
/* Used to construct a globally unique channel ID.
The full globally unique ID will be: "name.id" where ID is shown as base36.
Assuming that the number of meshtastic users is below 20K (true for a long time)
the chance of this 64 bit random number colliding with anyone else is super low.
And the penalty for collision is low as well, it just means that anyone trying to decrypt channel messages might need to
try multiple candidate channels.
Any time a non wire compatible change is made to a channel, this field should be regenerated.
There are a small number of 'special' globally known (and fairly) insecure standard channels.
Those channels do not have a numeric id included in the settings, but instead it is pulled from
a table of well known IDs.
(see Well Known Channels FIXME) */
uint32_t id;
/* If true, messages on the mesh will be sent to the *public* internet by any gateway ndoe */
bool uplink_enabled;
/* If true, messages seen on the internet will be forwarded to the local mesh. */
bool downlink_enabled;
} ChannelSettings;
/* A pair of a channel number, mode and the (sharable) settings for that channel */
typedef struct _Channel {
/* The index of this channel in the channel table (from 0 to MAX_NUM_CHANNELS-1)
(Someday - not currently implemented) An index of -1 could be used to mean "set by name",
in which case the target node will find and set the channel by settings.name. */
int8_t index;
/* The new settings, or NULL to disable that channel */
bool has_settings;
ChannelSettings settings;
/* TODO: REPLACE */
Channel_Role role;
} Channel;

View File

@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.4 */
/* Generated by nanopb-0.4.5 */
#include "deviceonly.pb.h"
#if PB_PROTO_HEADER_VERSION != 40

View File

@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.4 */
/* Generated by nanopb-0.4.5 */
#ifndef PB_DEVICEONLY_PB_H_INCLUDED
#define PB_DEVICEONLY_PB_H_INCLUDED
@ -12,24 +12,44 @@
#endif
/* Struct definitions */
/* The on-disk saved channels */
typedef struct _ChannelFile {
/* The channels our node knows about */
pb_size_t channels_count;
Channel channels[8];
} ChannelFile;
/* This message is never sent over the wire, but it is used for serializing DB
state to flash in the device code
FIXME, since we write this each time we enter deep sleep (and have infinite
flash) it would be better to use some sort of append only data structure for
the receive queue and use the preferences store for the other stuff */
typedef struct _DeviceState {
/* Read only settings/info about this node */
bool has_my_node;
MyNodeInfo my_node;
/* My owner info */
bool has_owner;
User owner;
/* TODO: REPLACE */
pb_size_t node_db_count;
NodeInfo node_db[32];
/* Received packets saved for delivery to the phone */
pb_size_t receive_queue_count;
MeshPacket receive_queue[1];
/* A version integer used to invalidate old save files when we make
incompatible changes This integer is set at build time and is private to
NodeDB.cpp in the device code. */
bool has_rx_text_message;
MeshPacket rx_text_message;
/* We keep the last received text message (only) stored in the device flash,
so we can show it on the screen.
Might be null */
uint32_t version;
/* Used only during development.
Indicates developer is testing and changes should never be saved to flash. */
bool no_save;
/* Some GPSes seem to have bogus settings from the factory, so we always do one factory reset. */
bool did_gps_reset;
} DeviceState;
@ -87,10 +107,8 @@ extern const pb_msgdesc_t ChannelFile_msg;
#define ChannelFile_fields &ChannelFile_msg
/* Maximum encoded size of messages (where known) */
#if defined(Telemetry_size)
#define DeviceState_size (9685 + 32*Telemetry_size)
#endif
#define ChannelFile_size 832
#define DeviceState_size 11199
#ifdef __cplusplus
} /* extern "C" */

View File

@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.4 */
/* Generated by nanopb-0.4.5 */
#include "mesh.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
@ -21,10 +21,13 @@ PB_BIND(Routing, Routing, AUTO)
PB_BIND(Data, Data, 2)
PB_BIND(Location, Location, AUTO)
PB_BIND(MeshPacket, MeshPacket, 2)
PB_BIND(NodeInfo, NodeInfo, AUTO)
PB_BIND(NodeInfo, NodeInfo, 2)
PB_BIND(MyNodeInfo, MyNodeInfo, AUTO)

View File

@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.4 */
/* Generated by nanopb-0.4.5 */
#ifndef PB_MESH_PB_H_INCLUDED
#define PB_MESH_PB_H_INCLUDED
@ -12,192 +12,421 @@
#endif
/* Enum definitions */
/* 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 _HardwareModel {
/* TODO: REPLACE */
HardwareModel_UNSET = 0,
/* TODO: REPLACE */
HardwareModel_TLORA_V2 = 1,
/* TODO: REPLACE */
HardwareModel_TLORA_V1 = 2,
/* TODO: REPLACE */
HardwareModel_TLORA_V2_1_1p6 = 3,
/* TODO: REPLACE */
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,
/* TODO: REPLACE */
HardwareModel_TBEAM0p7 = 6,
/* TODO: REPLACE */
HardwareModel_T_ECHO = 7,
/* TODO: REPLACE */
HardwareModel_TLORA_V1_1p3 = 8,
/* TODO: REPLACE */
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,
/* Ancient heltec WiFi_Lora_32 board */
HardwareModel_HELTEC_V1 = 11,
/* Less common/prototype boards listed here (needs one more byte over the air) */
HardwareModel_LORA_RELAY_V1 = 32,
/* TODO: REPLACE */
HardwareModel_NRF52840DK = 33,
/* TODO: REPLACE */
HardwareModel_PPR = 34,
/* TODO: REPLACE */
HardwareModel_GENIEBLOCKS = 35,
/* TODO: REPLACE */
HardwareModel_NRF52_UNKNOWN = 36,
/* TODO: REPLACE */
HardwareModel_PORTDUINO = 37,
/* The simulator built into the android app */
HardwareModel_ANDROID_SIM = 38,
/* Custom DIY device based on @NanoVHF schematics: https://github.com/NanoVHF/Meshtastic-DIY/tree/main/Schematics */
HardwareModel_DIY_V1 = 39,
/* RAK WisBlock ESP32 core: https://docs.rakwireless.com/Product-Categories/WisBlock/RAK11200/Overview/ */
HardwareModel_RAK11200 = 40,
/* 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;
/* The team colors are based on the names of "friendly teams" in ATAK:
https://github.com/deptofdefense/AndroidTacticalAssaultKit-CIV/blob/master/atak/ATAK/app/src/main/assets/filters/team_filters.xml */
typedef enum _Team {
/* the default (unset) is "achromatic" (unaffiliated) */
Team_CLEAR = 0,
/* TODO: REPLACE */
Team_CYAN = 1,
/* TODO: REPLACE */
Team_WHITE = 2,
/* TODO: REPLACE */
Team_YELLOW = 3,
/* TODO: REPLACE */
Team_ORANGE = 4,
/* TODO: REPLACE */
Team_MAGENTA = 5,
/* TODO: REPLACE */
Team_RED = 6,
/* TODO: REPLACE */
Team_MAROON = 7,
/* TODO: REPLACE */
Team_PURPLE = 8,
/* TODO: REPLACE */
Team_DARK_BLUE = 9,
/* TODO: REPLACE */
Team_BLUE = 10,
/* TODO: REPLACE */
Team_TEAL = 11,
/* TODO: REPLACE */
Team_GREEN = 12,
/* TODO: REPLACE */
Team_DARK_GREEN = 13,
/* TODO: REPLACE */
Team_BROWN = 14
} Team;
/* Shared constants between device and phone */
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_Unused = 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;
/* 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 {
/* TODO: REPLACE */
CriticalErrorCode_None = 0,
/* A software bug was detected while trying to send lora */
CriticalErrorCode_TxWatchdog = 1,
/* A software bug was detected on entry to sleep */
CriticalErrorCode_SleepEnterWait = 2,
/* No Lora radio hardware could be found */
CriticalErrorCode_NoRadio = 3,
/* Not normally used */
CriticalErrorCode_Unspecified = 4,
/* We failed while configuring a UBlox GPS */
CriticalErrorCode_UBloxInitFailed = 5,
/* This board was expected to have a power management chip and it is missing or broken */
CriticalErrorCode_NoAXP192 = 6,
/* The channel tried to set a radio setting which is not supported by this chipset,
radio comms settings are now undefined. */
CriticalErrorCode_InvalidRadioSetting = 7,
/* Radio transmit hardware failure. We sent data to the radio chip, but it didn't
reply with an interrupt. */
CriticalErrorCode_TransmitFailed = 8,
/* We detected that the main CPU voltage dropped below the minumum acceptable value */
CriticalErrorCode_Brownout = 9,
/* Selftest of SX1262 radio chip failed */
CriticalErrorCode_SX1262Failure = 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_RadioSpiBug = 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 {
/* TODO: REPLACE */
Position_LocSource_LOCSRC_UNSPECIFIED = 0,
/* TODO: REPLACE */
Position_LocSource_LOCSRC_MANUAL_ENTRY = 1,
/* TODO: REPLACE */
Position_LocSource_LOCSRC_GPS_INTERNAL = 2,
/* TODO: REPLACE */
Position_LocSource_LOCSRC_GPS_EXTERNAL = 3
} Position_LocSource;
/* The team colors are based on the names of "friendly teams" in ATAK:
https://github.com/deptofdefense/AndroidTacticalAssaultKit-CIV/blob/master/atak/ATAK/app/src/main/assets/filters/team_filters.xml */
typedef enum _Position_AltSource {
/* the default (unset) is "achromatic" (unaffiliated) */
Position_AltSource_ALTSRC_UNSPECIFIED = 0,
/* TODO: REPLACE */
Position_AltSource_ALTSRC_MANUAL_ENTRY = 1,
/* TODO: REPLACE */
Position_AltSource_ALTSRC_GPS_INTERNAL = 2,
/* TODO: REPLACE */
Position_AltSource_ALTSRC_GPS_EXTERNAL = 3,
/* TODO: REPLACE */
Position_AltSource_ALTSRC_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 {
/* 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_BAD_REQUEST = 32,
/* 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_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 {
/* TODO: REPLACE */
MeshPacket_Priority_UNSET = 0,
/* 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;
/* The team colors are based on the names of "friendly teams" in ATAK:
https://github.com/deptofdefense/AndroidTacticalAssaultKit-CIV/blob/master/atak/ATAK/app/src/main/assets/filters/team_filters.xml */
typedef enum _MeshPacket_Delayed {
/* the default (unset) is "achromatic" (unaffiliated) */
MeshPacket_Delayed_NO_DELAY = 0,
/* TODO: REPLACE */
MeshPacket_Delayed_DELAYED_BROADCAST = 1,
/* TODO: REPLACE */
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
} LogRecord_Level;
/* Struct definitions */
typedef PB_BYTES_ARRAY_T(237) Data_payload_t;
typedef struct _Data {
PortNum portnum;
Data_payload_t payload;
bool want_response;
uint32_t dest;
uint32_t source;
uint32_t request_id;
uint32_t reply_id;
bool is_tapback;
} Data;
/* Location of a waypoint to associate with a message */
typedef struct _Location {
/* Id of the location */
uint32_t id;
/* latitude_i */
int32_t latitude_i;
/* longitude_i */
int32_t longitude_i;
/* Time the location is to expire (epoch) */
uint32_t expire;
/* If true, only allow the original sender to update the location. */
bool locked;
} Location;
/* 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. */
char region[12];
/* Deprecated! ONLY USED IN DEVICE CODE (for upgrading old 1.0 firmwares) DO NOT READ ELSEWHERE.
The region code for my radio (US, CN, etc...)
Note: This string is deprecated.
The 1.0 builds populate it based on the flashed firmware name.
But for newer builds this string will be unpopulated (missing/null).
For those builds you should instead look at the new read/write region enum in UserSettings
The format of this string was 1.0-US or 1.0-CN etc.. Or empty string if unset. */
char firmware_version[18];
/* 0.0.5 etc... */
CriticalErrorCode error_code;
/* 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 */
uint32_t error_address;
/* A numeric error address (nonzero if available) */
uint32_t error_count;
/* The total number of errors this node has ever encountered
(well - since the last time we discarded preferences) */
uint32_t reboot_count;
/* The total number of reboots this node has ever encountered
(well - since the last time we discarded preferences) */
float bitrate;
/* Calculated bitrate of the current channel (in Bytes Per Second) */
uint32_t message_timeout_msec;
/* 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 min_app_version;
/* 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 max_channels;
/* 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 {
/* The new preferred location encoding, divide by 1e-7 to get degrees
in floating point */
int32_t latitude_i;
/* TODO: REPLACE */
int32_t longitude_i;
/* In meters above MSL (but see issue #359) */
int32_t altitude;
/* This is usually not sent over the mesh (to save space), but it is sent
from the phone so that the local device can set its RTC If it is sent over
the mesh (because there are devices on the mesh without GPS), it will only
be sent by devices which has a hardware GPS clock.
seconds since 1970 */
uint32_t time;
/* TODO: REPLACE */
Position_LocSource location_source;
/* TODO: REPLACE */
Position_AltSource altitude_source;
/* Positional timestamp (actual timestamp of GPS solution) in integer epoch seconds */
uint32_t pos_timestamp;
/* Pos. timestamp milliseconds adjustment (rarely available or required) */
int32_t pos_time_millis;
/* HAE altitude in meters - can be used instead of MSL altitude */
int32_t altitude_hae;
/* Geoidal separation in meters */
int32_t alt_geoid_sep;
/* Horizontal, Vertical and Position Dilution of Precision, in 1/100 units
- PDOP is sufficient for most cases
- for higher precision scenarios, HDOP and VDOP can be used instead,
in which case PDOP becomes redundant (PDOP=sqrt(HDOP^2 + VDOP^2))
TODO: REMOVE/INTEGRATE */
uint32_t PDOP;
/* TODO: REPLACE */
uint32_t HDOP;
/* TODO: REPLACE */
uint32_t VDOP;
/* GPS accuracy (a hardware specific constant) in mm
multiplied with DOP to calculate positional accuracy
Default: "'bout three meters-ish" :) */
uint32_t gps_accuracy;
/* Ground speed in m/s and True North TRACK in 1/100 degrees
Clarification of terms:
- "track" is the direction of motion (measured in horizontal plane)
- "heading" is where the fuselage points (measured in horizontal plane)
- "yaw" indicates a relative rotation about the vertical axis
TODO: REMOVE/INTEGRATE */
uint32_t ground_speed;
/* TODO: REPLACE */
uint32_t ground_track;
/* GPS fix quality (from NMEA GxGGA statement or similar) */
uint32_t fix_quality;
/* GPS fix type 2D/3D (from NMEA GxGSA statement) */
uint32_t fix_type;
/* GPS "Satellites in View" number */
uint32_t sats_in_view;
/* Sensor ID - in case multiple positioning sensors are being used */
uint32_t sensor_id;
/* Estimated/expected time (in seconds) until next update:
- if we update at fixed intervals of X seconds, use X
- if we update at dynamic intervals (based on relative movement etc),
but "AT LEAST every Y seconds", use Y */
uint32_t pos_next_update;
/* A sequence number, incremented with each Position message to help
detect lost updates if needed */
uint32_t pos_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;
@ -207,52 +436,152 @@ typedef struct _ToRadio_PeerInfo {
bool mqtt_gateway;
} ToRadio_PeerInfo;
/* 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)
The algorithm is as follows:
when a node starts up, it broadcasts their user and the normal flow is for all
other nodes to reply with their User as well (so the new node can build its nodedb)
If a node ever receives a User (not just the first broadcast) message where
the sender node number equals our node number, that indicates a collision has
occurred and the following steps should happen:
If the receiving node (that was already in the mesh)'s macaddr is LOWER than the
new User who just tried to sign in: it gets to keep its nodenum.
We send a broadcast message of OUR User (we use a broadcast so that the other node can
receive our message, considering we have the same id - it also serves to let
observers correct their nodedb) - this case is rare so it should be okay.
If any node receives a User where the macaddr is GTE than their local macaddr,
they have been vetoed and should pick a new random nodenum (filtering against
whatever it knows about the nodedb) and rebroadcast their User.
A few nodenums are reserved and will never be requested:
0xff - broadcast
0 through 3 - for future use */
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
node IDs "^all" (for broadcast), "^local" (for the locally connected node) */
char id[16];
/* A full name for this user, i.e. "Kevin Hester" */
char long_name[40];
/* A VERY short name, ideally two characters.
Suitable for a tiny OLED screen */
char short_name[5];
/* This is the addr of the radio.
Not populated by the phone, but added by the esp32 when broadcasting */
pb_byte_t macaddr[6];
/* TBEAM, HELTEC, etc...
Starting in 1.2.11 moved to hw_model enum in the NodeInfo object.
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;
/* 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;
/* Participants in the same network can self-group into different teams.
Short-term this can be used to visually differentiate them on the map;
in the longer term it could also help users to semi-automatically
select or ignore messages according to team affiliation.
In total, 14 teams are defined (encoded in 4 bits) */
Team team;
/* Transmit power at antenna connector, in decibel-milliwatt
An optional self-reported value useful in network planning, discovery
and positioning - along with ant_gain_dbi and ant_azimuth below */
uint32_t tx_power_dbm;
/* Antenna gain (applicable to both Tx and Rx), in decibel-isotropic */
uint32_t ant_gain_dbi;
/* Directional antenna true azimuth *if applicable*, in degrees (0-360)
Only applicable in case of stationary nodes with a directional antenna
Zero = not applicable (mobile or omni) or not specified
(use a value of 360 to indicate an antenna azimuth of zero degrees) */
uint32_t ant_azimuth;
} User;
typedef PB_BYTES_ARRAY_T(256) MeshPacket_encrypted_t;
typedef struct _MeshPacket {
uint32_t from;
uint32_t to;
uint8_t channel;
pb_size_t which_payloadVariant;
union {
Data decoded;
MeshPacket_encrypted_t encrypted;
};
uint32_t id;
uint32_t rx_time;
float rx_snr;
uint8_t hop_limit;
bool want_ack;
MeshPacket_Priority priority;
int32_t rx_rssi;
MeshPacket_Delayed delayed;
} MeshPacket;
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;
/* Location structure */
bool has_location;
Location location;
} Data;
/* The bluetooth to device link:
Old BTLE protocol docs from TODO, merge in above and make real docs...
use protocol buffers, and NanoPB
messages from device to phone:
POSITION_UPDATE (..., time)
TEXT_RECEIVED(from, text, time)
OPAQUE_RECEIVED(from, payload, time) (for signal messages or other applications)
messages from phone to device:
SET_MYID(id, human readable long, human readable short) (send down the unique ID
string used for this node, a human readable string shown for that id, and a very
short human readable string suitable for oled screen) SEND_OPAQUE(dest, payload)
(for signal messages or other applications) SEND_TEXT(dest, text) Get all
nodes() (returns list of nodes, with full info, last time seen, loc, battery
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 {
/* The node number */
uint32_t num;
/* The user info for this node */
bool has_user;
User user;
/* This position data. Note: before 1.2.14 we would also store the last time we've heard from this node in position.time, that is no longer true.
Position.time now indicates the last time we received a POSITION from that node. */
bool has_position;
Position position;
/* Returns the Signal-to-noise ratio (SNR) of the last received message,
as measured by the receiver. Return SNR of the last received message in dB */
float snr;
/* Set to indicate the last time we received a packet from this node */
uint32_t last_heard;
/* The latest telemetry data for the node. */
bool has_telemetry;
Telemetry telemetry;
} NodeInfo;
/* A Routing control Data packet handled by the routing module */
typedef struct _Routing {
/* A route request going from the requester */
pb_size_t which_variant;
union {
RouteDiscovery route_request;
@ -261,8 +590,86 @@ typedef struct _Routing {
};
} Routing;
typedef struct _FromRadio {
typedef PB_BYTES_ARRAY_T(256) MeshPacket_encrypted_t;
/* A packet envelope sent/received over the mesh
only payloadVariant 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 {
/* The sending node number.
Note: Our crypto implementation uses this field as well.
See [crypto](/docs/developers/firmware/encryption) for details.
FIXME - really should be fixed32 instead, this encoding only hurts the ble link though. */
uint32_t from;
/* The (immediatSee Priority description for more details.y should be fixed32 instead, this encoding only
hurts the ble link though. */
uint32_t to;
/* (Usually) If set, this indicates the index in the secondary_channels table that this packet was sent/received on.
If unset, packet was on the primary channel.
A particular node might know only a subset of channels in use on the mesh.
Therefore channel_index is inherently a local concept and meaningless to send between nodes.
Very briefly, while sending and receiving deep inside the device Router code, this field instead
contains the 'channel hash' instead of the index.
This 'trick' is only used while the payloadVariant is an 'encrypted'. */
uint8_t channel;
/* TODO: REPLACE */
pb_size_t which_payloadVariant;
union {
Data decoded;
MeshPacket_encrypted_t encrypted;
};
/* TODO: REPLACE */
uint32_t id;
/* A unique ID for this packet.
Always 0 for no-ack packets or non broadcast packets (and therefore take zero bytes of space).
Otherwise a unique ID for this packet, useful for flooding algorithms.
ID only needs to be unique on a _per sender_ basis, and it only
needs to be unique for a few minutes (long enough to last for the length of
any ACK or the completion of a mesh broadcast flood).
Note: Our crypto implementation uses this id as well.
See [crypto](/docs/developers/firmware/encryption) for details.
FIXME - really should be fixed32 instead, this encoding only
hurts the ble link though. */
uint32_t rx_time;
/* The time this message was received by the esp32 (secs since 1970).
Note: this field is _never_ sent on the radio link itself (to save space) Times
are typically not sent over the mesh, but they will be added to any Packet
(chain of SubPacket) sent to the phone (so the phone can know exact time of reception) */
float rx_snr;
/* *Never* sent over the radio links.
Set during reception to indicate the SNR of this packet.
Used to collect statistics on current link quality. */
uint8_t hop_limit;
/* If unset treated as zero (no forwarding, send to adjacent nodes only)
if 1, allow hopping through one node, etc...
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. */
bool want_ack;
/* This packet is being sent as a reliable message, we would prefer it to arrive at the destination.
We would like to receive a ack packet in response.
Broadcasts messages treat this flag specially: Since acks for broadcasts would
rapidly flood the channel, the normal ack behavior is suppressed.
Instead, the original sender listens to see if at least one node is rebroadcasting this packet (because naive flooding algorithm).
If it hears that the odds (given typical LoRa topologies) the odds are very high that every node should eventually receive the message.
So FloodingRouter.cpp generates an implicit ack which is delivered to the original sender.
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 */
MeshPacket_Priority priority;
/* The priority of this message for sending.
See MeshPacket.Priority description for more details. */
int32_t rx_rssi;
/* rssi of received packet. Only sent to phone for dispay purposes. */
MeshPacket_Delayed delayed;
} MeshPacket;
/* 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 {
/* The packet id, used to allow the phone to request missing read packets from the FIFO,
see our bluetooth docs */
uint32_t id;
/* Log levels, chosen to match python logging conventions. */
pb_size_t which_payloadVariant;
union {
MyNodeInfo my_info;
@ -274,7 +681,10 @@ typedef struct _FromRadio {
};
} 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 {
/* Send this packet on the mesh */
pb_size_t which_payloadVariant;
union {
MeshPacket packet;
@ -336,7 +746,8 @@ extern "C" {
#define User_init_default {"", "", "", {0}, _HardwareModel_MIN, 0, _Team_MIN, 0, 0, 0}
#define RouteDiscovery_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}}
#define Routing_init_default {0, {RouteDiscovery_init_default}}
#define Data_init_default {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0}
#define Data_init_default {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0, false, Location_init_default}
#define Location_init_default {0, 0, 0, 0, 0}
#define MeshPacket_init_default {0, 0, 0, 0, {Data_init_default}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN, 0, _MeshPacket_Delayed_MIN}
#define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, 0, 0, false, Telemetry_init_default}
#define MyNodeInfo_init_default {0, 0, "", "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0}
@ -348,7 +759,8 @@ extern "C" {
#define User_init_zero {"", "", "", {0}, _HardwareModel_MIN, 0, _Team_MIN, 0, 0, 0}
#define RouteDiscovery_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}}
#define Routing_init_zero {0, {RouteDiscovery_init_zero}}
#define Data_init_zero {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0}
#define Data_init_zero {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0, false, Location_init_zero}
#define Location_init_zero {0, 0, 0, 0, 0}
#define MeshPacket_init_zero {0, 0, 0, 0, {Data_init_zero}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN, 0, _MeshPacket_Delayed_MIN}
#define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, 0, 0, false, Telemetry_init_zero}
#define MyNodeInfo_init_zero {0, 0, "", "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0}
@ -358,14 +770,11 @@ extern "C" {
#define ToRadio_PeerInfo_init_zero {0, 0}
/* Field tags (for use in manual encoding/decoding) */
#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_is_tapback_tag 8
#define Location_id_tag 1
#define Location_latitude_i_tag 2
#define Location_longitude_i_tag 3
#define Location_expire_tag 4
#define Location_locked_tag 5
#define LogRecord_message_tag 1
#define LogRecord_time_tag 2
#define LogRecord_source_tag 3
@ -422,6 +831,24 @@ extern "C" {
#define User_tx_power_dbm_tag 10
#define User_ant_gain_dbi_tag 11
#define User_ant_azimuth_tag 12
#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 Data_location_tag 9
#define NodeInfo_num_tag 1
#define NodeInfo_user_tag 2
#define NodeInfo_position_tag 3
#define NodeInfo_snr_tag 4
#define NodeInfo_last_heard_tag 5
#define NodeInfo_telemetry_tag 6
#define Routing_route_request_tag 1
#define Routing_route_reply_tag 2
#define Routing_error_reason_tag 3
#define MeshPacket_from_tag 1
#define MeshPacket_to_tag 2
#define MeshPacket_channel_tag 3
@ -435,15 +862,6 @@ extern "C" {
#define MeshPacket_priority_tag 12
#define MeshPacket_rx_rssi_tag 13
#define MeshPacket_delayed_tag 15
#define NodeInfo_num_tag 1
#define NodeInfo_user_tag 2
#define NodeInfo_position_tag 3
#define NodeInfo_snr_tag 4
#define NodeInfo_last_heard_tag 5
#define NodeInfo_telemetry_tag 6
#define Routing_route_request_tag 1
#define Routing_route_reply_tag 2
#define Routing_error_reason_tag 3
#define FromRadio_id_tag 1
#define FromRadio_my_info_tag 3
#define FromRadio_node_info_tag 4
@ -519,9 +937,20 @@ X(a, STATIC, SINGULAR, FIXED32, dest, 4) \
X(a, STATIC, SINGULAR, FIXED32, source, 5) \
X(a, STATIC, SINGULAR, FIXED32, request_id, 6) \
X(a, STATIC, SINGULAR, FIXED32, reply_id, 7) \
X(a, STATIC, SINGULAR, BOOL, is_tapback, 8)
X(a, STATIC, SINGULAR, FIXED32, emoji, 8) \
X(a, STATIC, OPTIONAL, MESSAGE, location, 9)
#define Data_CALLBACK NULL
#define Data_DEFAULT NULL
#define Data_location_MSGTYPE Location
#define Location_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, id, 1) \
X(a, STATIC, SINGULAR, SFIXED32, latitude_i, 2) \
X(a, STATIC, SINGULAR, SFIXED32, longitude_i, 3) \
X(a, STATIC, SINGULAR, UINT32, expire, 4) \
X(a, STATIC, SINGULAR, BOOL, locked, 5)
#define Location_CALLBACK NULL
#define Location_DEFAULT NULL
#define MeshPacket_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, FIXED32, from, 1) \
@ -619,6 +1048,7 @@ extern const pb_msgdesc_t User_msg;
extern const pb_msgdesc_t RouteDiscovery_msg;
extern const pb_msgdesc_t Routing_msg;
extern const pb_msgdesc_t Data_msg;
extern const pb_msgdesc_t Location_msg;
extern const pb_msgdesc_t MeshPacket_msg;
extern const pb_msgdesc_t NodeInfo_msg;
extern const pb_msgdesc_t MyNodeInfo_msg;
@ -633,6 +1063,7 @@ extern const pb_msgdesc_t ToRadio_PeerInfo_msg;
#define RouteDiscovery_fields &RouteDiscovery_msg
#define Routing_fields &Routing_msg
#define Data_fields &Data_msg
#define Location_fields &Location_msg
#define MeshPacket_fields &MeshPacket_msg
#define NodeInfo_fields &NodeInfo_msg
#define MyNodeInfo_fields &MyNodeInfo_msg
@ -642,18 +1073,19 @@ extern const pb_msgdesc_t ToRadio_PeerInfo_msg;
#define ToRadio_PeerInfo_fields &ToRadio_PeerInfo_msg
/* Maximum encoded size of messages (where known) */
#define Data_size 296
#define FromRadio_size 356
#define Location_size 24
#define LogRecord_size 81
#define MeshPacket_size 347
#define MyNodeInfo_size 210
#define NodeInfo_size 315
#define Position_size 142
#define User_size 97
#define RouteDiscovery_size 40
#define Routing_size 42
#define Data_size 267
#define MeshPacket_size 318
#define NodeInfo_size 315
#define MyNodeInfo_size 210
#define LogRecord_size 81
#define FromRadio_size 327
#define ToRadio_size 321
#define ToRadio_PeerInfo_size 8
#define ToRadio_size 350
#define User_size 97
#ifdef __cplusplus
} /* extern "C" */

View File

@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.4 */
/* Generated by nanopb-0.4.5 */
#include "mqtt.pb.h"
#if PB_PROTO_HEADER_VERSION != 40

View File

@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.4 */
/* Generated by nanopb-0.4.5 */
#ifndef PB_MQTT_PB_H_INCLUDED
#define PB_MQTT_PB_H_INCLUDED
@ -11,9 +11,15 @@
#endif
/* Struct definitions */
/* This message wraps a MeshPacket with extra metadata about the sender and how it arrived. */
typedef struct _ServiceEnvelope {
/* The (probably encrypted) packet */
struct _MeshPacket *packet;
/* The global channel ID it was sent on */
char *channel_id;
/* The sending gateway node ID. Can we use this to authenticate/prevent fake
nodeid impersonation for senders? - i.e. use gateway/mesh id (which is authenticated) + local node id as
the globally trusted nodenum */
char *gateway_id;
} ServiceEnvelope;

View File

@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.4 */
/* Generated by nanopb-0.4.5 */
#include "portnums.pb.h"
#if PB_PROTO_HEADER_VERSION != 40

View File

@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.4 */
/* Generated by nanopb-0.4.5 */
#ifndef PB_PORTNUMS_PB_H_INCLUDED
#define PB_PORTNUMS_PB_H_INCLUDED
@ -10,23 +10,78 @@
#endif
/* Enum definitions */
/* For any new 'apps' that run on the device or via sister apps on phones/PCs they should pick and use a
unique 'portnum' for their application.
If you are making a new app using meshtastic, please send in a pull request to add your 'portnum' to this
master table.
PortNums should be assigned in the following range:
0-63 Core Meshtastic use, do not use for third party apps
64-127 Registered 3rd party apps, send in a pull request that adds a new entry to portnums.proto to register your application
256-511 Use one of these portnums for your private applications that you don't want to register publically
All other values are reserved.
Note: This was formerly a Type enum named 'typ' with the same id #
We have change to this 'portnum' based scheme for specifying app handlers for particular payloads.
This change is backwards compatible by treating the legacy OPAQUE/CLEAR_TEXT values identically. */
typedef enum _PortNum {
/* Deprecated: do not use in new code (formerly called OPAQUE)
A message sent from a device outside of the mesh, in a form the mesh does not understand
NOTE: This must be 0, because it is documented in IMeshService.aidl to be so */
PortNum_UNKNOWN_APP = 0,
/* A simple UTF-8 text message, which even the little micros in the mesh
can understand and show on their screen eventually in some circumstances
even signal might send messages in this form (see below)
Formerly called CLEAR_TEXT */
PortNum_TEXT_MESSAGE_APP = 1,
/* Reserved for built-in GPIO/example app.
See remote_hardware.proto/HardwareMessage for details on the message sent/received to this port number */
PortNum_REMOTE_HARDWARE_APP = 2,
/* The built-in position messaging app.
Payload is a [Position](/docs/developers/protobufs/api#position) message */
PortNum_POSITION_APP = 3,
/* The built-in user info app.
Payload is a [User](/docs/developers/protobufs/api#user) message */
PortNum_NODEINFO_APP = 4,
/* Protocol control packets for mesh protocol use.
Payload is a [Routing](/docs/developers/protobufs/api#routing) message */
PortNum_ROUTING_APP = 5,
/* Admin control packets.
Payload is a [AdminMessage](/docs/developers/protobufs/api#adminmessage) message */
PortNum_ADMIN_APP = 6,
/* Provides a 'ping' service that replies to any packet it receives.
Also serves as a small example module. */
PortNum_REPLY_APP = 32,
/* Used for the python IP tunnel feature */
PortNum_IP_TUNNEL_APP = 33,
/* Provides a hardware serial interface to send and receive from the Meshtastic network.
Connect to the RX/TX pins of a device with 38400 8N1. Packets received from the Meshtastic
network is forwarded to the RX pin while sending a packet to TX will go out to the Mesh network.
Maximum packet size of 240 bytes.
Module is disabled by default can be turned on by setting SERIAL_MODULE_ENABLED = 1 in SerialPlugh.cpp. */
PortNum_SERIAL_APP = 64,
/* STORE_FORWARD_APP (Work in Progress)
Maintained by Jm Casler (MC Hamster) : jm@casler.org */
PortNum_STORE_FORWARD_APP = 65,
/* Optional port for messages for the range test module. */
PortNum_RANGE_TEST_APP = 66,
/* Provides a format to send and receive telemetry data from the Meshtastic network.
Maintained by Charles Crossan (crossan007) : crossan007@gmail.com */
PortNum_TELEMETRY_APP = 67,
/* Experimental tools for estimating node position without a GPS
Maintained by Github user a-f-G-U-C (a Meshtastic contributor)
Project files at https://github.com/a-f-G-U-C/Meshtastic-ZPS */
PortNum_ZPS_APP = 68,
/* Private applications should use portnums >= 256.
To simplify initial development and testing you can use "PRIVATE_APP"
in your code without needing to rebuild protobuf files (via [regen-protos.sh](https://github.com/meshtastic/Meshtastic-device/blob/master/bin/regen-protos.sh)) */
PortNum_PRIVATE_APP = 256,
/* ATAK Forwarder Module https://github.com/paulmandal/atak-forwarder */
PortNum_ATAK_FORWARDER = 257,
/* Currently we limit port nums to no higher than this value */
PortNum_MAX = 511
} PortNum;

View File

@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.4 */
/* Generated by nanopb-0.4.5 */
#include "radioconfig.pb.h"
#if PB_PROTO_HEADER_VERSION != 40

View File

@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.4 */
/* Generated by nanopb-0.4.5 */
#ifndef PB_RADIOCONFIG_PB_H_INCLUDED
#define PB_RADIOCONFIG_PB_H_INCLUDED
@ -10,90 +10,195 @@
#endif
/* Enum definitions */
/* The frequency/regulatory region the user has selected.
Note: In 1.0 builds (which must still be supported by the android app for a
long time) this field will be unpopulated.
If firmware is ever upgraded from an old 1.0ish build, the old
MyNodeInfo.region string will be used to set UserPreferences.region and the
old value will be no longer set. */
typedef enum _RegionCode {
/* TODO: REPLACE */
RegionCode_Unset = 0,
/* TODO: REPLACE */
RegionCode_US = 1,
/* TODO: REPLACE */
RegionCode_EU433 = 2,
/* TODO: REPLACE */
RegionCode_EU868 = 3,
/* TODO: REPLACE */
RegionCode_CN = 4,
/* TODO: REPLACE */
RegionCode_JP = 5,
/* TODO: REPLACE */
RegionCode_ANZ = 6,
/* TODO: REPLACE */
RegionCode_KR = 7,
/* TODO: REPLACE */
RegionCode_TW = 8,
/* TODO: REPLACE */
RegionCode_RU = 9,
/* TODO: REPLACE */
RegionCode_IN = 10,
/* TODO: REPLACE */
RegionCode_NZ865 = 11,
/* TODO: REPLACE */
RegionCode_TH = 12
} RegionCode;
/* Defines the device's role on the Mesh network
unset
Behave normally.
Router
Functions as a router */
typedef enum _Role {
/* Default device role */
Role_Default = 0,
/* Router device role */
Role_Router = 1
} Role;
/* Sets the charge control current of devices with a battery charger that can be
configured. This is passed into the axp power management chip like on the tbeam. */
typedef enum _ChargeCurrent {
/* TODO: REPLACE */
ChargeCurrent_MAUnset = 0,
/* TODO: REPLACE */
ChargeCurrent_MA100 = 1,
/* TODO: REPLACE */
ChargeCurrent_MA190 = 2,
/* TODO: REPLACE */
ChargeCurrent_MA280 = 3,
/* TODO: REPLACE */
ChargeCurrent_MA360 = 4,
/* TODO: REPLACE */
ChargeCurrent_MA450 = 5,
/* TODO: REPLACE */
ChargeCurrent_MA550 = 6,
/* TODO: REPLACE */
ChargeCurrent_MA630 = 7,
/* TODO: REPLACE */
ChargeCurrent_MA700 = 8,
/* TODO: REPLACE */
ChargeCurrent_MA780 = 9,
/* TODO: REPLACE */
ChargeCurrent_MA880 = 10,
/* TODO: REPLACE */
ChargeCurrent_MA960 = 11,
/* TODO: REPLACE */
ChargeCurrent_MA1000 = 12,
/* TODO: REPLACE */
ChargeCurrent_MA1080 = 13,
/* TODO: REPLACE */
ChargeCurrent_MA1160 = 14,
/* TODO: REPLACE */
ChargeCurrent_MA1240 = 15,
/* TODO: REPLACE */
ChargeCurrent_MA1320 = 16
} ChargeCurrent;
/* How the GPS coordinates are displayed on the OLED screen. */
typedef enum _GpsCoordinateFormat {
/* GPS coordinates are displayed in the normal decimal degrees format:
DD.DDDDDD DDD.DDDDDD */
GpsCoordinateFormat_GpsFormatDec = 0,
/* GPS coordinates are displayed in the degrees minutes seconds format:
DD°MM'SS"C DDD°MM'SS"C, where C is the compass point representing the locations quadrant */
GpsCoordinateFormat_GpsFormatDMS = 1,
/* GPS coordinates are displayed in Universal Transverse Mercator format:
ZZB EEEEEE NNNNNNN, where Z is zone, B is band, E is easting, N is northing */
GpsCoordinateFormat_GpsFormatUTM = 2,
/* GPS coordinates are displayed in Military Grid Reference System format:
ZZB CD EEEEE NNNNN, where Z is zone, B is band, C is the east 100k square, D is the north 100k square,
E is easting, N is northing */
GpsCoordinateFormat_GpsFormatMGRS = 3,
/* GPS coordinates are displayed in Open Location Code (aka Plus Codes). */
GpsCoordinateFormat_GpsFormatOLC = 4,
/* GPS coordinates are displayed in Ordnance Survey Grid Reference (the National Grid System of the UK).
Format: AB EEEEE NNNNN, where A is the east 100k square, B is the north 100k square, E is the easting,
N is the northing */
GpsCoordinateFormat_GpsFormatOSGR = 5
} GpsCoordinateFormat;
/* Bit field of boolean configuration options, indicating which optional
fields to include when assembling POSITION messages
Longitude and latitude are always included (also time if GPS-synced)
NOTE: the more fields are included, the larger the message will be -
leading to longer airtime and a higher risk of packet loss */
typedef enum _PositionFlags {
/* Required for compilation */
PositionFlags_POS_UNDEFINED = 0,
/* Include an altitude value (if available) */
PositionFlags_POS_ALTITUDE = 1,
/* Altitude value is MSL */
PositionFlags_POS_ALT_MSL = 2,
/* Include geoidal separation */
PositionFlags_POS_GEO_SEP = 4,
/* Include the DOP value ; PDOP used by default, see below */
PositionFlags_POS_DOP = 8,
/* If POS_DOP set, send separate HDOP / VDOP values instead of PDOP */
PositionFlags_POS_HVDOP = 16,
/* Include battery level */
PositionFlags_POS_BATTERY = 32,
/* Include number of "satellites in view" */
PositionFlags_POS_SATINVIEW = 64,
/* Include a sequence number incremented per packet */
PositionFlags_POS_SEQ_NOS = 128,
/* Include positional timestamp (from GPS solution) */
PositionFlags_POS_TIMESTAMP = 256
} PositionFlags;
/* TODO: REPLACE */
typedef enum _InputEventChar {
/* TODO: REPLACE */
InputEventChar_KEY_NONE = 0,
/* TODO: REPLACE */
InputEventChar_KEY_UP = 17,
/* TODO: REPLACE */
InputEventChar_KEY_DOWN = 18,
/* TODO: REPLACE */
InputEventChar_KEY_LEFT = 19,
/* TODO: REPLACE */
InputEventChar_KEY_RIGHT = 20,
/* '\n' */
InputEventChar_KEY_SELECT = 10,
/* TODO: REPLACE */
InputEventChar_KEY_BACK = 27,
/* TODO: REPLACE */
InputEventChar_KEY_CANCEL = 24
} InputEventChar;
/* The frequency/regulatory region the user has selected.
Note: In 1.0 builds (which must still be supported by the android app for a
long time) this field will be unpopulated.
If firmware is ever upgraded from an old 1.0ish build, the old
MyNodeInfo.region string will be used to set UserPreferences.region and the
old value will be no longer set. */
typedef enum _RadioConfig_UserPreferences_TelemetrySensorType {
/* TODO: REPLACE */
RadioConfig_UserPreferences_TelemetrySensorType_None = 0,
/* TODO: REPLACE */
RadioConfig_UserPreferences_TelemetrySensorType_DHT11 = 1,
/* TODO: REPLACE */
RadioConfig_UserPreferences_TelemetrySensorType_DS18B20 = 2,
/* TODO: REPLACE */
RadioConfig_UserPreferences_TelemetrySensorType_DHT12 = 3,
/* TODO: REPLACE */
RadioConfig_UserPreferences_TelemetrySensorType_DHT21 = 4,
/* TODO: REPLACE */
RadioConfig_UserPreferences_TelemetrySensorType_DHT22 = 5,
/* TODO: REPLACE */
RadioConfig_UserPreferences_TelemetrySensorType_BME280 = 6,
/* TODO: REPLACE */
RadioConfig_UserPreferences_TelemetrySensorType_BME680 = 7,
/* TODO: REPLACE */
RadioConfig_UserPreferences_TelemetrySensorType_MCP9808 = 8,
/* TODO: REPLACE */
RadioConfig_UserPreferences_TelemetrySensorType_SHTC3 = 9
} RadioConfig_UserPreferences_TelemetrySensorType;
@ -186,7 +291,11 @@ typedef struct _RadioConfig_UserPreferences {
uint32_t serial_module_baud;
} RadioConfig_UserPreferences;
/* The entire set of user settable/readable settings for our radio device.
Includes both the current channel settings and any preferences the user has
set for behavior of their node */
typedef struct _RadioConfig {
/* TODO: REPLACE */
bool has_preferences;
RadioConfig_UserPreferences preferences;
} RadioConfig;
@ -422,8 +531,8 @@ extern const pb_msgdesc_t RadioConfig_UserPreferences_msg;
#define RadioConfig_UserPreferences_fields &RadioConfig_UserPreferences_msg
/* Maximum encoded size of messages (where known) */
#define RadioConfig_size 608
#define RadioConfig_UserPreferences_size 605
#define RadioConfig_size 608
#ifdef __cplusplus
} /* extern "C" */

View File

@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.4 */
/* Generated by nanopb-0.4.5 */
#include "remote_hardware.pb.h"
#if PB_PROTO_HEADER_VERSION != 40

View File

@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.4 */
/* Generated by nanopb-0.4.5 */
#ifndef PB_REMOTE_HARDWARE_PB_H_INCLUDED
#define PB_REMOTE_HARDWARE_PB_H_INCLUDED
@ -20,9 +20,25 @@ typedef enum _HardwareMessage_Type {
} HardwareMessage_Type;
/* Struct definitions */
/* An example app to show off the module system. This message is used for
REMOTE_HARDWARE_APP PortNums.
Also provides easy remote access to any GPIO.
In the future other remote hardware operations can be added based on user interest
(i.e. serial output, spi/i2c input/output).
FIXME - currently this feature is turned on by default which is dangerous
because no security yet (beyond the channel mechanism).
It should be off by default and then protected based on some TBD mechanism
(a special channel once multichannel support is included?) */
typedef struct _HardwareMessage {
/* What type of HardwareMessage is this? */
HardwareMessage_Type typ;
/* What gpios are we changing. Not used for all MessageTypes, see MessageType for details */
uint64_t gpio_mask;
/* For gpios that were listed in gpio_mask as valid, what are the signal levels for those gpios.
Not used for all MessageTypes, see MessageType for details */
uint64_t gpio_value;
} HardwareMessage;

View File

@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.4 */
/* Generated by nanopb-0.4.5 */
#include "storeforward.pb.h"
#if PB_PROTO_HEADER_VERSION != 40

View File

@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.4 */
/* Generated by nanopb-0.4.5 */
#ifndef PB_STOREFORWARD_PB_H_INCLUDED
#define PB_STOREFORWARD_PB_H_INCLUDED
@ -50,12 +50,17 @@ typedef struct _StoreAndForward_Statistics {
uint32_t return_window;
} StoreAndForward_Statistics;
/* TODO: REPLACE */
typedef struct _StoreAndForward {
/* TODO: REPLACE */
StoreAndForward_RequestResponse rr;
/* TODO: REPLACE */
bool has_stats;
StoreAndForward_Statistics stats;
/* TODO: REPLACE */
bool has_history;
StoreAndForward_History history;
/* TODO: REPLACE */
bool has_heartbeat;
StoreAndForward_Heartbeat heartbeat;
} StoreAndForward;
@ -151,10 +156,10 @@ extern const pb_msgdesc_t StoreAndForward_Heartbeat_msg;
#define StoreAndForward_Heartbeat_fields &StoreAndForward_Heartbeat_msg
/* Maximum encoded size of messages (where known) */
#define StoreAndForward_size 88
#define StoreAndForward_Statistics_size 50
#define StoreAndForward_History_size 18
#define StoreAndForward_Heartbeat_size 12
#define StoreAndForward_History_size 18
#define StoreAndForward_Statistics_size 50
#define StoreAndForward_size 88
#ifdef __cplusplus
} /* extern "C" */

View File

@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.4 */
/* Generated by nanopb-0.4.5 */
#include "telemetry.pb.h"
#if PB_PROTO_HEADER_VERSION != 40

View File

@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.4 */
/* Generated by nanopb-0.4.5 */
#ifndef PB_TELEMETRY_PB_H_INCLUDED
#define PB_TELEMETRY_PB_H_INCLUDED
@ -10,17 +10,34 @@
#endif
/* Struct definitions */
/* TODO: REPLACE */
typedef struct _Telemetry {
/* This is usually not sent over the mesh (to save space), but it is sent
from the phone so that the local device can set its RTC If it is sent over
the mesh (because there are devices on the mesh without GPS), it will only
be sent by devices which has a hardware GPS clock (IE Mobile Phone).
seconds since 1970 */
uint32_t time;
/* 1-100 (0 means powered) */
uint32_t battery_level;
/* 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;
/* This is sent by node only if it a router and if hop_limit is set to 0
and is not being sent as a reliable message. */
bool router_heartbeat;
/* Temperature measured */
float temperature;
/* Relative humidity percent measured */
float relative_humidity;
/* Barometric pressure in hPA measured */
float barometric_pressure;
/* Gas resistance in mOhm measured */
float gas_resistance;
/* Voltage measured */
float voltage;
/* Current measured */
float current;
} Telemetry;