Upgrade to nanopb 0.4.6 (#1523)

This commit is contained in:
Ben Meadors
2022-06-17 08:37:52 -05:00
committed by GitHub
parent c3c359c0cb
commit 9285316c78
31 changed files with 410 additions and 328 deletions

View File

@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.5 */
/* Generated by nanopb-0.4.6 */
#ifndef PB_MESH_PB_H_INCLUDED
#define PB_MESH_PB_H_INCLUDED
@@ -238,22 +238,22 @@ typedef enum _LogRecord_Level {
/* Struct definitions */
typedef PB_BYTES_ARRAY_T(237) Compressed_data_t;
typedef struct _Compressed {
PortNum portnum;
Compressed_data_t data;
PortNum portnum;
Compressed_data_t data;
} Compressed;
/* Location of a waypoint to associate with a message */
typedef struct _Location {
/* Id of the location */
uint32_t id;
uint32_t id;
/* latitude_i */
int32_t latitude_i;
int32_t latitude_i;
/* longitude_i */
int32_t longitude_i;
int32_t longitude_i;
/* Time the location is to expire (epoch) */
uint32_t expire;
uint32_t expire;
/* If true, only allow the original sender to update the location. */
bool locked;
bool locked;
} Location;
/* Debug output from the device.
@@ -263,13 +263,13 @@ typedef struct _Location {
and then extend as needed by emitting multiple records. */
typedef struct _LogRecord {
/* Log levels, chosen to match python logging conventions. */
char message[64];
char message[64];
/* Seconds since 1970 - or 0 for unknown/unset */
uint32_t time;
uint32_t time;
/* Usually based on thread name - if known */
char source[8];
char source[8];
/* Not yet set */
LogRecord_Level level;
LogRecord_Level level;
} LogRecord;
/* Unique local debugging info for this node
@@ -278,134 +278,134 @@ typedef struct _LogRecord {
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;
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 firmware_version[18];
bool has_gps;
/* 0.0.5 etc... */
CriticalErrorCode error_code;
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 */
uint32_t error_address;
CriticalErrorCode error_code;
/* A numeric error address (nonzero if available) */
uint32_t error_count;
uint32_t error_address;
/* The total number of errors this node has ever encountered
(well - since the last time we discarded preferences) */
uint32_t reboot_count;
uint32_t error_count;
/* The total number of reboots this node has ever encountered
(well - since the last time we discarded preferences) */
float bitrate;
uint32_t reboot_count;
/* Calculated bitrate of the current channel (in Bytes Per Second) */
uint32_t message_timeout_msec;
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 min_app_version;
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 max_channels;
uint32_t min_app_version;
/* The maximum number of 'software' channels that can be set on this node. */
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];
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];
uint32_t air_period_rx[8];
/* Is the device wifi capable? */
bool has_wifi;
bool has_wifi;
/* Utilization for the current channel, including well formed TX, RX and malformed RX (aka noise). */
float channel_utilization;
float channel_utilization;
/* Percent of airtime for transmission used within the last hour. */
float air_util_tx;
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;
int32_t latitude_i;
/* TODO: REPLACE */
int32_t longitude_i;
int32_t longitude_i;
/* In meters above MSL (but see issue #359) */
int32_t altitude;
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;
uint32_t time;
/* TODO: REPLACE */
Position_LocSource location_source;
Position_LocSource location_source;
/* TODO: REPLACE */
Position_AltSource altitude_source;
Position_AltSource altitude_source;
/* Positional timestamp (actual timestamp of GPS solution) in integer epoch seconds */
uint32_t pos_timestamp;
uint32_t pos_timestamp;
/* Pos. timestamp milliseconds adjustment (rarely available or required) */
int32_t pos_time_millis;
int32_t pos_time_millis;
/* HAE altitude in meters - can be used instead of MSL altitude */
int32_t altitude_hae;
int32_t altitude_hae;
/* Geoidal separation in meters */
int32_t alt_geoid_sep;
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;
uint32_t PDOP;
/* TODO: REPLACE */
uint32_t HDOP;
uint32_t HDOP;
/* TODO: REPLACE */
uint32_t VDOP;
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;
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;
uint32_t ground_speed;
/* TODO: REPLACE */
uint32_t ground_track;
uint32_t ground_track;
/* GPS fix quality (from NMEA GxGGA statement or similar) */
uint32_t fix_quality;
uint32_t fix_quality;
/* GPS fix type 2D/3D (from NMEA GxGSA statement) */
uint32_t fix_type;
uint32_t fix_type;
/* GPS "Satellites in View" number */
uint32_t sats_in_view;
uint32_t sats_in_view;
/* Sensor ID - in case multiple positioning sensors are being used */
uint32_t sensor_id;
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;
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;
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];
uint32_t route[8];
} RouteDiscovery;
/* Compressed message payload */
typedef struct _ToRadio_PeerInfo {
/* PortNum to determine the how to handle the compressed payload. */
uint32_t app_version;
uint32_t app_version;
/* Compressed data. */
bool mqtt_gateway;
bool mqtt_gateway;
} ToRadio_PeerInfo;
/* Broadcast when a newly powered mesh node wants to find a node num it can use
@@ -433,35 +433,35 @@ typedef struct _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];
char id[16];
/* A full name for this user, i.e. "Kevin Hester" */
char long_name[40];
char long_name[40];
/* A VERY short name, ideally two characters.
Suitable for a tiny OLED screen */
char short_name[5];
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];
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;
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;
bool is_licensed;
/* 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;
uint32_t tx_power_dbm;
/* Antenna gain (applicable to both Tx and Rx), in decibel-isotropic */
uint32_t ant_gain_dbi;
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;
uint32_t ant_azimuth;
} User;
typedef PB_BYTES_ARRAY_T(237) Data_payload_t;
@@ -470,34 +470,34 @@ typedef PB_BYTES_ARRAY_T(237) Data_payload_t;
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;
PortNum portnum;
/* TODO: REPLACE */
Data_payload_t payload;
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;
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;
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;
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;
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;
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;
uint32_t emoji;
/* Location structure */
bool has_location;
Location location;
Location location;
} Data;
/* The bluetooth to device link:
@@ -518,33 +518,36 @@ typedef struct _Data {
Full information about a node on the mesh */
typedef struct _NodeInfo {
/* The node number */
uint32_t num;
uint32_t num;
/* The user info for this node */
bool has_user;
User 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;
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;
float snr;
/* Set to indicate the last time we received a packet from this node */
uint32_t last_heard;
uint32_t last_heard;
/* The latest device metrics for the node. */
bool has_device_metrics;
DeviceMetrics device_metrics;
DeviceMetrics device_metrics;
} 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 {
/* 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(256) MeshPacket_encrypted_t;
@@ -556,10 +559,10 @@ typedef struct _MeshPacket {
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;
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;
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.
@@ -567,15 +570,14 @@ typedef struct _MeshPacket {
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 */
uint8_t channel;
pb_size_t which_payloadVariant;
union {
/* TODO: REPLACE */
Data decoded;
/* TODO: REPLACE */
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.
@@ -586,21 +588,21 @@ typedef struct _MeshPacket {
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;
uint32_t id;
/* 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;
uint32_t rx_time;
/* *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;
float rx_snr;
/* 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;
uint8_t hop_limit;
/* 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
@@ -610,12 +612,14 @@ typedef struct _MeshPacket {
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;
bool want_ack;
/* The priority of this message for sending.
See MeshPacket.Priority description for more details. */
int32_t rx_rssi;
MeshPacket_Priority priority;
/* rssi of received packet. Only sent to phone for dispay purposes. */
MeshPacket_Delayed delayed;
int32_t rx_rssi;
/* Describe if this message is delayed */
MeshPacket_Delayed delayed;
} MeshPacket;
/* Packets from the radio to the phone will appear on the fromRadio characteristic.
@@ -625,31 +629,58 @@ typedef struct _MeshPacket {
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. */
uint32_t id;
pb_size_t which_payloadVariant;
union {
/* Tells the phone what our node number is, can be -1 if we've not yet joined a mesh.
NOTE: This ID must not change - to keep (minimal) compatibility with <1.2 version of android apps. */
MyNodeInfo my_info;
/* One packet is sent for each node in the on radio DB
starts over with the first node in our DB */
NodeInfo node_info;
/* Include a part of the config (was: RadioConfig radio) */
Config config;
/* Set to send debug console output over our protobuf stream */
LogRecord log_record;
/* Sent as true once the device has finished sending all of the responses to want_config
recipient should check if this ID matches our original request nonce, if
not, it means your config responses haven't started yet.
NOTE: This ID must not change - to keep (minimal) compatibility with <1.2 version of android apps. */
uint32_t config_complete_id;
/* Sent to tell clients the radio has just rebooted.
Set to true if present.
Not used on all transports, currently just used for the serial console.
NOTE: This ID must not change - to keep (minimal) compatibility with <1.2 version of android apps. */
bool rebooted;
/* Log levels, chosen to match python logging conventions. */
MeshPacket packet;
};
};
} 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 {
/* Send this packet on the mesh */
MeshPacket packet;
/* Information about the peer, sent after the phone sneds want_config_id.
Old clients do not send this, which is fine. */
ToRadio_PeerInfo peer_info;
/* Phone wants radio to send full node db to the phone, This is
typically the first packet sent to the radio when the phone gets a
bluetooth connection. The radio will respond by sending back a
MyNodeInfo, a owner, a radio config and a series of
FromRadio.node_infos, and config_complete
the integer you write into this field will be reported back in the
config_complete_id response this allows clients to never be confused by
a stale old partially sent config. */
uint32_t want_config_id;
/* Tell API server we are disconnecting now.
This is useful for serial links where there is no hardware/protocol based notification that the client has dropped the link.
(Sending this message is optional for clients) */
bool disconnect;
};
};
} ToRadio;