kopia lustrzana https://github.com/meshtastic/protobufs
1459 wiersze
37 KiB
Protocol Buffer
1459 wiersze
37 KiB
Protocol Buffer
syntax = "proto3";
|
||
|
||
package meshtastic;
|
||
|
||
import "meshtastic/channel.proto";
|
||
import "meshtastic/config.proto";
|
||
import "meshtastic/module_config.proto";
|
||
import "meshtastic/portnums.proto";
|
||
import "meshtastic/telemetry.proto";
|
||
import "meshtastic/xmodem.proto";
|
||
|
||
option csharp_namespace = "Meshtastic.Protobufs";
|
||
option go_package = "github.com/meshtastic/go/generated";
|
||
option java_outer_classname = "MeshProtos";
|
||
option java_package = "com.geeksville.mesh";
|
||
option swift_prefix = "";
|
||
|
||
/*
|
||
* a gps position
|
||
*/
|
||
message Position {
|
||
/*
|
||
* The new preferred location encoding, multiply by 1e-7 to get degrees
|
||
* in floating point
|
||
*/
|
||
sfixed32 latitude_i = 1;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
sfixed32 longitude_i = 2;
|
||
|
||
/*
|
||
* In meters above MSL (but see issue #359)
|
||
*/
|
||
int32 altitude = 3;
|
||
|
||
/*
|
||
* 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
|
||
*/
|
||
fixed32 time = 4;
|
||
|
||
/*
|
||
* How the location was acquired: manual, onboard GPS, external (EUD) GPS
|
||
*/
|
||
enum LocSource {
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
LOC_UNSET = 0;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
LOC_MANUAL = 1;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
LOC_INTERNAL = 2;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
LOC_EXTERNAL = 3;
|
||
}
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
LocSource location_source = 5;
|
||
|
||
/*
|
||
* How the altitude was acquired: manual, GPS int/ext, etc
|
||
* Default: same as location_source if present
|
||
*/
|
||
enum AltSource {
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
ALT_UNSET = 0;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
ALT_MANUAL = 1;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
ALT_INTERNAL = 2;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
ALT_EXTERNAL = 3;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
ALT_BAROMETRIC = 4;
|
||
}
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
AltSource altitude_source = 6;
|
||
|
||
/*
|
||
* Positional timestamp (actual timestamp of GPS solution) in integer epoch seconds
|
||
*/
|
||
fixed32 timestamp = 7;
|
||
|
||
/*
|
||
* Pos. timestamp milliseconds adjustment (rarely available or required)
|
||
*/
|
||
int32 timestamp_millis_adjust = 8;
|
||
|
||
/*
|
||
* HAE altitude in meters - can be used instead of MSL altitude
|
||
*/
|
||
sint32 altitude_hae = 9;
|
||
|
||
/*
|
||
* Geoidal separation in meters
|
||
*/
|
||
sint32 altitude_geoidal_separation = 10;
|
||
|
||
/*
|
||
* 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 PDOP = 11;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
uint32 HDOP = 12;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
uint32 VDOP = 13;
|
||
|
||
/*
|
||
* GPS accuracy (a hardware specific constant) in mm
|
||
* multiplied with DOP to calculate positional accuracy
|
||
* Default: "'bout three meters-ish" :)
|
||
*/
|
||
uint32 gps_accuracy = 14;
|
||
|
||
/*
|
||
* 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 ground_speed = 15;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
uint32 ground_track = 16;
|
||
|
||
/*
|
||
* GPS fix quality (from NMEA GxGGA statement or similar)
|
||
*/
|
||
uint32 fix_quality = 17;
|
||
|
||
/*
|
||
* GPS fix type 2D/3D (from NMEA GxGSA statement)
|
||
*/
|
||
uint32 fix_type = 18;
|
||
|
||
/*
|
||
* GPS "Satellites in View" number
|
||
*/
|
||
uint32 sats_in_view = 19;
|
||
|
||
/*
|
||
* Sensor ID - in case multiple positioning sensors are being used
|
||
*/
|
||
uint32 sensor_id = 20;
|
||
|
||
/*
|
||
* 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 next_update = 21;
|
||
|
||
/*
|
||
* A sequence number, incremented with each Position message to help
|
||
* detect lost updates if needed
|
||
*/
|
||
uint32 seq_number = 22;
|
||
}
|
||
|
||
/*
|
||
* 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 .
|
||
*/
|
||
enum HardwareModel {
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
UNSET = 0;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
TLORA_V2 = 1;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
TLORA_V1 = 2;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
TLORA_V2_1_1P6 = 3;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
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).
|
||
*/
|
||
HELTEC_V2_0 = 5;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
TBEAM_V0P7 = 6;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
T_ECHO = 7;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
TLORA_V1_1P3 = 8;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
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
|
||
*/
|
||
HELTEC_V2_1 = 10;
|
||
|
||
/*
|
||
* Ancient heltec WiFi_Lora_32 board
|
||
*/
|
||
HELTEC_V1 = 11;
|
||
|
||
/*
|
||
* New T-BEAM with ESP32-S3 CPU
|
||
*/
|
||
LILYGO_TBEAM_S3_CORE = 12;
|
||
|
||
/*
|
||
* RAK WisBlock ESP32 core: https://docs.rakwireless.com/Product-Categories/WisBlock/RAK11200/Overview/
|
||
*/
|
||
RAK11200 = 13;
|
||
|
||
/*
|
||
* B&Q Consulting Nano Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:nano
|
||
*/
|
||
NANO_G1 = 14;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
TLORA_V2_1_1P8 = 15;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
TLORA_T3_S3 = 16;
|
||
|
||
/*
|
||
* B&Q Consulting Nano G1 Explorer: https://wiki.uniteng.com/en/meshtastic/nano-g1-explorer
|
||
*/
|
||
NANO_G1_EXPLORER = 17;
|
||
|
||
/*
|
||
* B&Q Consulting Station Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:station
|
||
*/
|
||
STATION_G1 = 25;
|
||
|
||
/*
|
||
* RAK11310 (RP2040 + SX1262)
|
||
*/
|
||
RAK11310 = 26;
|
||
|
||
/*
|
||
* ---------------------------------------------------------------------------
|
||
* Less common/prototype boards listed here (needs one more byte over the air)
|
||
* ---------------------------------------------------------------------------
|
||
*/
|
||
LORA_RELAY_V1 = 32;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
NRF52840DK = 33;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
PPR = 34;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
GENIEBLOCKS = 35;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
NRF52_UNKNOWN = 36;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
PORTDUINO = 37;
|
||
|
||
/*
|
||
* The simulator built into the android app
|
||
*/
|
||
ANDROID_SIM = 38;
|
||
|
||
/*
|
||
* Custom DIY device based on @NanoVHF schematics: https://github.com/NanoVHF/Meshtastic-DIY/tree/main/Schematics
|
||
*/
|
||
DIY_V1 = 39;
|
||
|
||
/*
|
||
* nRF52840 Dongle : https://www.nordicsemi.com/Products/Development-hardware/nrf52840-dongle/
|
||
*/
|
||
NRF52840_PCA10059 = 40;
|
||
|
||
/*
|
||
* Custom Disaster Radio esp32 v3 device https://github.com/sudomesh/disaster-radio/tree/master/hardware/board_esp32_v3
|
||
*/
|
||
DR_DEV = 41;
|
||
|
||
/*
|
||
* M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, Paper) https://m5stack.com/
|
||
*/
|
||
M5STACK = 42;
|
||
|
||
/*
|
||
* New Heltec LoRA32 with ESP32-S3 CPU
|
||
*/
|
||
HELTEC_V3 = 43;
|
||
|
||
/*
|
||
* New Heltec Wireless Stick Lite with ESP32-S3 CPU
|
||
*/
|
||
HELTEC_WSL_V3 = 44;
|
||
|
||
/*
|
||
* New BETAFPV ELRS Micro TX Module 2.4G with ESP32 CPU
|
||
*/
|
||
BETAFPV_2400_TX = 45;
|
||
|
||
/*
|
||
* BetaFPV ExpressLRS "Nano" TX Module 900MHz with ESP32 CPU
|
||
*/
|
||
BETAFPV_900_NANO_TX = 46;
|
||
|
||
/*
|
||
* Raspberry Pi Pico (W) with Waveshare SX1262 LoRa Node Module
|
||
*/
|
||
RPI_PICO = 47;
|
||
|
||
/*
|
||
* ------------------------------------------------------------------------------------------------------------------------------------------
|
||
* 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.
|
||
* ------------------------------------------------------------------------------------------------------------------------------------------
|
||
*/
|
||
PRIVATE_HW = 255;
|
||
}
|
||
|
||
/*
|
||
* 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
|
||
*/
|
||
message 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)
|
||
*/
|
||
string id = 1;
|
||
|
||
/*
|
||
* A full name for this user, i.e. "Kevin Hester"
|
||
*/
|
||
string long_name = 2;
|
||
|
||
/*
|
||
* A VERY short name, ideally two characters.
|
||
* Suitable for a tiny OLED screen
|
||
*/
|
||
string short_name = 3;
|
||
|
||
/*
|
||
* Deprecated in Meshtastic 2.1.x
|
||
* This is the addr of the radio.
|
||
* Not populated by the phone, but added by the esp32 when broadcasting
|
||
*/
|
||
bytes macaddr = 4 [deprecated = true];
|
||
|
||
/*
|
||
* 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 = 5;
|
||
|
||
/*
|
||
* In some regions Ham radio operators have different bandwidth limitations than others.
|
||
* If this user is a licensed operator, set this flag.
|
||
* Also, "long_name" should be their licence number.
|
||
*/
|
||
bool is_licensed = 6;
|
||
}
|
||
|
||
/*
|
||
* A message used in our Dynamic Source Routing protocol (RFC 4728 based)
|
||
*/
|
||
message RouteDiscovery {
|
||
/*
|
||
* The list of nodenums this packet has visited so far
|
||
*/
|
||
repeated fixed32 route = 1;
|
||
}
|
||
|
||
/*
|
||
* A Routing control Data packet handled by the routing module
|
||
*/
|
||
message Routing {
|
||
/*
|
||
* 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).
|
||
*/
|
||
enum Error {
|
||
/*
|
||
* This message is not a failure
|
||
*/
|
||
NONE = 0;
|
||
|
||
/*
|
||
* Our node doesn't have a route to the requested destination anymore.
|
||
*/
|
||
NO_ROUTE = 1;
|
||
|
||
/*
|
||
* We received a nak while trying to forward on your behalf
|
||
*/
|
||
GOT_NAK = 2;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
TIMEOUT = 3;
|
||
|
||
/*
|
||
* No suitable interface could be found for delivering this packet
|
||
*/
|
||
NO_INTERFACE = 4;
|
||
|
||
/*
|
||
* We reached the max retransmission count (typically for naive flood routing)
|
||
*/
|
||
MAX_RETRANSMIT = 5;
|
||
|
||
/*
|
||
* No suitable channel was found for sending this packet (i.e. was requested channel index disabled?)
|
||
*/
|
||
NO_CHANNEL = 6;
|
||
|
||
/*
|
||
* The packet was too big for sending (exceeds interface MTU after encoding)
|
||
*/
|
||
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)
|
||
*/
|
||
NO_RESPONSE = 8;
|
||
|
||
/*
|
||
* Cannot send currently because duty cycle regulations will be violated.
|
||
*/
|
||
DUTY_CYCLE_LIMIT = 9;
|
||
|
||
/*
|
||
* The application layer service on the remote node received your request, but considered your request somehow invalid
|
||
*/
|
||
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)
|
||
*/
|
||
NOT_AUTHORIZED = 33;
|
||
}
|
||
|
||
oneof variant {
|
||
/*
|
||
* A route request going from the requester
|
||
*/
|
||
RouteDiscovery route_request = 1;
|
||
|
||
/*
|
||
* A route reply
|
||
*/
|
||
RouteDiscovery route_reply = 2;
|
||
|
||
/*
|
||
* 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).
|
||
*/
|
||
Error error_reason = 3;
|
||
}
|
||
}
|
||
|
||
/*
|
||
* (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)
|
||
*/
|
||
message Data {
|
||
/*
|
||
* Formerly named typ and of type Type
|
||
*/
|
||
PortNum portnum = 1;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
bytes payload = 2;
|
||
|
||
/*
|
||
* 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 = 3;
|
||
|
||
/*
|
||
* 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.
|
||
*/
|
||
fixed32 dest = 4;
|
||
|
||
/*
|
||
* The address of the original sender for this message.
|
||
* This field should _only_ be populated for reliable multihop packets (to keep
|
||
* packets small).
|
||
*/
|
||
fixed32 source = 5;
|
||
|
||
/*
|
||
* Only used in routing or response messages.
|
||
* Indicates the original message ID that this message is reporting failure on. (formerly called original_id)
|
||
*/
|
||
fixed32 request_id = 6;
|
||
|
||
/*
|
||
* If set, this message is intened to be a reply to a previously sent message with the defined id.
|
||
*/
|
||
fixed32 reply_id = 7;
|
||
|
||
/*
|
||
* 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.
|
||
*/
|
||
fixed32 emoji = 8;
|
||
}
|
||
|
||
/*
|
||
* Waypoint message, used to share arbitrary locations across the mesh
|
||
*/
|
||
message Waypoint {
|
||
/*
|
||
* Id of the waypoint
|
||
*/
|
||
uint32 id = 1;
|
||
|
||
/*
|
||
* latitude_i
|
||
*/
|
||
sfixed32 latitude_i = 2;
|
||
|
||
/*
|
||
* longitude_i
|
||
*/
|
||
sfixed32 longitude_i = 3;
|
||
|
||
/*
|
||
* Time the waypoint is to expire (epoch)
|
||
*/
|
||
uint32 expire = 4;
|
||
|
||
/*
|
||
* If greater than zero, treat the value as a nodenum only allowing them to update the waypoint.
|
||
* If zero, the waypoint is open to be edited by any member of the mesh.
|
||
*/
|
||
uint32 locked_to = 5;
|
||
|
||
/*
|
||
* Name of the waypoint - max 30 chars
|
||
*/
|
||
string name = 6;
|
||
|
||
/*
|
||
* Description of the waypoint - max 100 chars
|
||
*/
|
||
string description = 7;
|
||
|
||
/*
|
||
* Designator icon for the waypoint in the form of a unicode emoji
|
||
*/
|
||
fixed32 icon = 8;
|
||
}
|
||
|
||
/*
|
||
* 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.
|
||
*/
|
||
message MeshPacket {
|
||
/*
|
||
* 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.
|
||
*/
|
||
enum Priority {
|
||
/*
|
||
* Treated as Priority.DEFAULT
|
||
*/
|
||
UNSET = 0;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
MIN = 1;
|
||
|
||
/*
|
||
* Background position updates are sent with very low priority -
|
||
* if the link is super congested they might not go out at all
|
||
*/
|
||
BACKGROUND = 10;
|
||
|
||
/*
|
||
* This priority is used for most messages that don't have a priority set
|
||
*/
|
||
DEFAULT = 64;
|
||
|
||
/*
|
||
* If priority is unset but the message is marked as want_ack,
|
||
* assume it is important and use a slightly higher priority
|
||
*/
|
||
RELIABLE = 70;
|
||
|
||
/*
|
||
* Ack/naks are sent with very high priority to ensure that retransmission
|
||
* stops as soon as possible
|
||
*/
|
||
ACK = 120;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
MAX = 127;
|
||
}
|
||
|
||
/*
|
||
* Identify if this is a delayed packet
|
||
*/
|
||
enum Delayed {
|
||
/*
|
||
* If unset, the message is being sent in real time.
|
||
*/
|
||
NO_DELAY = 0;
|
||
|
||
/*
|
||
* The message is delayed and was originally a broadcast
|
||
*/
|
||
DELAYED_BROADCAST = 1;
|
||
|
||
/*
|
||
* The message is delayed and was originally a direct message
|
||
*/
|
||
DELAYED_DIRECT = 2;
|
||
}
|
||
|
||
/*
|
||
* The sending node number.
|
||
* Note: Our crypto implementation uses this field as well.
|
||
* See [crypto](/docs/overview/encryption) for details.
|
||
* FIXME - really should be fixed32 instead, this encoding only hurts the ble link though.
|
||
*/
|
||
fixed32 from = 1;
|
||
|
||
/*
|
||
* The (immediatSee Priority description for more details.y should be fixed32 instead, this encoding only
|
||
* hurts the ble link though.
|
||
*/
|
||
fixed32 to = 2;
|
||
|
||
/*
|
||
* (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 payload_variant is an 'encrypted'.
|
||
*/
|
||
uint32 channel = 3;
|
||
|
||
/*
|
||
* Internally to the mesh radios we will route SubPackets encrypted per [this](docs/developers/firmware/encryption).
|
||
* However, when a particular node has the correct
|
||
* key to decode a particular packet, it will decode the payload into a SubPacket protobuf structure.
|
||
* Software outside of the device nodes will never encounter a packet where
|
||
* "decoded" is not populated (i.e. any encryption/decryption happens before reaching the applications)
|
||
* The numeric IDs for these fields were selected to keep backwards compatibility with old applications.
|
||
*/
|
||
|
||
oneof payload_variant {
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
Data decoded = 4;
|
||
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
bytes encrypted = 5;
|
||
}
|
||
|
||
/*
|
||
* 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/overview/encryption) for details.
|
||
* FIXME - really should be fixed32 instead, this encoding only
|
||
* hurts the ble link though.
|
||
*/
|
||
fixed32 id = 6;
|
||
|
||
/*
|
||
* 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)
|
||
*/
|
||
fixed32 rx_time = 7;
|
||
|
||
/*
|
||
* *Never* sent over the radio links.
|
||
* Set during reception to indicate the SNR of this packet.
|
||
* Used to collect statistics on current link quality.
|
||
*/
|
||
float rx_snr = 8;
|
||
|
||
/*
|
||
* 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.
|
||
*/
|
||
uint32 hop_limit = 9;
|
||
|
||
/*
|
||
* 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
|
||
*/
|
||
bool want_ack = 10;
|
||
|
||
/*
|
||
* The priority of this message for sending.
|
||
* See MeshPacket.Priority description for more details.
|
||
*/
|
||
Priority priority = 11;
|
||
|
||
/*
|
||
* rssi of received packet. Only sent to phone for dispay purposes.
|
||
*/
|
||
int32 rx_rssi = 12;
|
||
|
||
/*
|
||
* Describe if this message is delayed
|
||
*/
|
||
Delayed delayed = 13;
|
||
}
|
||
|
||
/*
|
||
* Shared constants between device and phone
|
||
*/
|
||
enum Constants {
|
||
/*
|
||
* First enum must be zero, and we are just using this enum to
|
||
* pass int constants between two very different environments
|
||
*/
|
||
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
|
||
*/
|
||
DATA_PAYLOAD_LEN = 237;
|
||
}
|
||
|
||
/*
|
||
* 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
|
||
*/
|
||
message NodeInfo {
|
||
/*
|
||
* The node number
|
||
*/
|
||
uint32 num = 1;
|
||
|
||
/*
|
||
* The user info for this node
|
||
*/
|
||
User user = 2;
|
||
|
||
/*
|
||
* 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.
|
||
*/
|
||
Position position = 3;
|
||
|
||
/*
|
||
* 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 = 4;
|
||
|
||
/*
|
||
* TODO: REMOVE/INTEGRATE
|
||
* Returns the last measured frequency error.
|
||
* The LoRa receiver estimates the frequency offset between the receiver
|
||
* center frequency and that of the received LoRa signal. This function
|
||
* returns the estimates offset (in Hz) of the last received message.
|
||
* Caution: this measurement is not absolute, but is measured relative to the
|
||
* local receiver's oscillator. Apparent errors may be due to the
|
||
* transmitter, the receiver or both. \return The estimated center frequency
|
||
* offset in Hz of the last received message.
|
||
* int32 frequency_error = 6;
|
||
* enum RouteState {
|
||
* Invalid = 0;
|
||
* Discovering = 1;
|
||
* Valid = 2;
|
||
* }
|
||
* Not needed?
|
||
* RouteState route = 4;
|
||
*/
|
||
|
||
/*
|
||
* TODO: REMOVE/INTEGRATE
|
||
* Not currently used (till full DSR deployment?) Our current preferred node node for routing - might be the same as num if
|
||
* we are adjacent Or zero if we don't yet know a route to this node.
|
||
* fixed32 next_hop = 5;
|
||
*/
|
||
|
||
/*
|
||
* Set to indicate the last time we received a packet from this node
|
||
*/
|
||
fixed32 last_heard = 5;
|
||
/*
|
||
* The latest device metrics for the node.
|
||
*/
|
||
DeviceMetrics device_metrics = 6;
|
||
|
||
/*
|
||
* local channel index we heard that node on. Only populated if its not the default channel.
|
||
*/
|
||
uint32 channel = 7;
|
||
}
|
||
|
||
/*
|
||
* 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.
|
||
*/
|
||
enum CriticalErrorCode {
|
||
/*
|
||
* TODO: REPLACE
|
||
*/
|
||
NONE = 0;
|
||
|
||
/*
|
||
* A software bug was detected while trying to send lora
|
||
*/
|
||
TX_WATCHDOG = 1;
|
||
|
||
/*
|
||
* A software bug was detected on entry to sleep
|
||
*/
|
||
SLEEP_ENTER_WAIT = 2;
|
||
|
||
/*
|
||
* No Lora radio hardware could be found
|
||
*/
|
||
NO_RADIO = 3;
|
||
|
||
/*
|
||
* Not normally used
|
||
*/
|
||
UNSPECIFIED = 4;
|
||
|
||
/*
|
||
* We failed while configuring a UBlox GPS
|
||
*/
|
||
UBLOX_UNIT_FAILED = 5;
|
||
|
||
/*
|
||
* This board was expected to have a power management chip and it is missing or broken
|
||
*/
|
||
NO_AXP192 = 6;
|
||
|
||
/*
|
||
* The channel tried to set a radio setting which is not supported by this chipset,
|
||
* radio comms settings are now undefined.
|
||
*/
|
||
INVALID_RADIO_SETTING = 7;
|
||
|
||
/*
|
||
* Radio transmit hardware failure. We sent data to the radio chip, but it didn't
|
||
* reply with an interrupt.
|
||
*/
|
||
TRANSMIT_FAILED = 8;
|
||
|
||
/*
|
||
* We detected that the main CPU voltage dropped below the minumum acceptable value
|
||
*/
|
||
BROWNOUT = 9;
|
||
|
||
/* Selftest of SX1262 radio chip failed */
|
||
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
|
||
*/
|
||
RADIO_SPI_BUG = 11;
|
||
}
|
||
|
||
/*
|
||
* 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.
|
||
*/
|
||
message 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 my_node_num = 1;
|
||
|
||
/*
|
||
* Note: This flag merely means we detected a hardware GPS in our node.
|
||
* Not the same as UserPreferences.location_sharing
|
||
*/
|
||
bool has_gps = 2;
|
||
|
||
/*
|
||
* Deprecated in 2.1.x
|
||
* The maximum number of 'software' channels that can be set on this node.
|
||
*/
|
||
uint32 max_channels = 3 [deprecated = true];
|
||
|
||
/*
|
||
* 0.0.5 etc...
|
||
*/
|
||
string firmware_version = 4;
|
||
|
||
/*
|
||
* 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 = 5;
|
||
|
||
/*
|
||
* A numeric error address (nonzero if available)
|
||
*/
|
||
uint32 error_address = 6;
|
||
|
||
/*
|
||
* The total number of errors this node has ever encountered
|
||
* (well - since the last time we discarded preferences)
|
||
*/
|
||
uint32 error_count = 7;
|
||
|
||
/*
|
||
* The total number of reboots this node has ever encountered
|
||
* (well - since the last time we discarded preferences)
|
||
*/
|
||
uint32 reboot_count = 8;
|
||
|
||
/*
|
||
* Calculated bitrate of the current channel (in Bytes Per Second)
|
||
*/
|
||
float bitrate = 9;
|
||
|
||
/*
|
||
* 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 message_timeout_msec = 10;
|
||
|
||
/*
|
||
* The minimum app version that can talk to this device.
|
||
* Phone/PC apps should compare this to their build number and if too low tell the user they must update their app
|
||
*/
|
||
uint32 min_app_version = 11;
|
||
|
||
/*
|
||
* 24 time windows of 1hr each with the airtime transmitted out of the device per hour.
|
||
*/
|
||
repeated uint32 air_period_tx = 12;
|
||
|
||
/*
|
||
* 24 time windows of 1hr each with the airtime of valid packets for your mesh.
|
||
*/
|
||
repeated uint32 air_period_rx = 13;
|
||
|
||
/*
|
||
* Is the device wifi capable?
|
||
*/
|
||
bool has_wifi = 14;
|
||
|
||
/*
|
||
* Utilization for the current channel, including well formed TX, RX and malformed RX (aka noise).
|
||
*/
|
||
float channel_utilization = 15;
|
||
|
||
/*
|
||
* Percent of airtime for transmission used within the last hour.
|
||
*/
|
||
float air_util_tx = 16;
|
||
}
|
||
|
||
/*
|
||
* 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.
|
||
*/
|
||
message LogRecord {
|
||
/*
|
||
* Log levels, chosen to match python logging conventions.
|
||
*/
|
||
enum Level {
|
||
/*
|
||
* Log levels, chosen to match python logging conventions.
|
||
*/
|
||
UNSET = 0;
|
||
|
||
/*
|
||
* Log levels, chosen to match python logging conventions.
|
||
*/
|
||
CRITICAL = 50;
|
||
|
||
/*
|
||
* Log levels, chosen to match python logging conventions.
|
||
*/
|
||
ERROR = 40;
|
||
|
||
/*
|
||
* Log levels, chosen to match python logging conventions.
|
||
*/
|
||
WARNING = 30;
|
||
|
||
/*
|
||
* Log levels, chosen to match python logging conventions.
|
||
*/
|
||
INFO = 20;
|
||
|
||
/*
|
||
* Log levels, chosen to match python logging conventions.
|
||
*/
|
||
DEBUG = 10;
|
||
|
||
/*
|
||
* Log levels, chosen to match python logging conventions.
|
||
*/
|
||
TRACE = 5;
|
||
}
|
||
|
||
/*
|
||
* Log levels, chosen to match python logging conventions.
|
||
*/
|
||
string message = 1;
|
||
|
||
/*
|
||
* Seconds since 1970 - or 0 for unknown/unset
|
||
*/
|
||
fixed32 time = 2;
|
||
|
||
/*
|
||
* Usually based on thread name - if known
|
||
*/
|
||
string source = 3;
|
||
|
||
/*
|
||
* Not yet set
|
||
*/
|
||
Level level = 4;
|
||
}
|
||
|
||
message QueueStatus {
|
||
/* Last attempt to queue status, ErrorCode */
|
||
int32 res = 1;
|
||
|
||
/* Free entries in the outgoing queue */
|
||
uint32 free = 2;
|
||
|
||
/* Maximum entries in the outgoing queue */
|
||
uint32 maxlen = 3;
|
||
|
||
/* What was mesh packet id that generated this response? */
|
||
uint32 mesh_packet_id = 4;
|
||
}
|
||
|
||
/*
|
||
* 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.
|
||
*/
|
||
message FromRadio {
|
||
/*
|
||
* The packet id, used to allow the phone to request missing read packets from the FIFO,
|
||
* see our bluetooth docs
|
||
*/
|
||
uint32 id = 1;
|
||
|
||
/*
|
||
* Log levels, chosen to match python logging conventions.
|
||
*/
|
||
oneof payload_variant {
|
||
/*
|
||
* Log levels, chosen to match python logging conventions.
|
||
*/
|
||
MeshPacket packet = 2;
|
||
|
||
/*
|
||
* 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 = 3;
|
||
|
||
/*
|
||
* One packet is sent for each node in the on radio DB
|
||
* starts over with the first node in our DB
|
||
*/
|
||
NodeInfo node_info = 4;
|
||
|
||
/*
|
||
* Include a part of the config (was: RadioConfig radio)
|
||
*/
|
||
Config config = 5;
|
||
|
||
/*
|
||
* Set to send debug console output over our protobuf stream
|
||
*/
|
||
LogRecord log_record = 6;
|
||
|
||
/*
|
||
* 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 config_complete_id = 7;
|
||
|
||
/*
|
||
* 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 = 8;
|
||
|
||
/*
|
||
* Include module config
|
||
*/
|
||
ModuleConfig moduleConfig = 9;
|
||
|
||
/*
|
||
* One packet is sent for each channel
|
||
*/
|
||
Channel channel = 10;
|
||
|
||
/*
|
||
* Queue status info
|
||
*/
|
||
QueueStatus queueStatus = 11;
|
||
|
||
/*
|
||
* File Transfer Chunk
|
||
*/
|
||
XModem xmodemPacket = 12;
|
||
|
||
/*
|
||
* Device metadata message
|
||
*/
|
||
DeviceMetadata metadata = 13;
|
||
}
|
||
}
|
||
|
||
/*
|
||
* Packets/commands to the radio will be written (reliably) to the toRadio characteristic.
|
||
* Once the write completes the phone can assume it is handled.
|
||
*/
|
||
message ToRadio {
|
||
/*
|
||
* Log levels, chosen to match python logging conventions.
|
||
*/
|
||
oneof payload_variant {
|
||
/*
|
||
* Send this packet on the mesh
|
||
*/
|
||
MeshPacket packet = 1;
|
||
|
||
/*
|
||
* 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 want_config_id = 3;
|
||
|
||
/*
|
||
* Tell API server we are disconnecting now.
|
||
* This is useful for serial links where there is no hardware/protocol based notification that the client has dropped the link.
|
||
* (Sending this message is optional for clients)
|
||
*/
|
||
bool disconnect = 4;
|
||
|
||
/*
|
||
* File Transfer Chunk
|
||
*/
|
||
|
||
XModem xmodemPacket = 5;
|
||
}
|
||
}
|
||
|
||
/*
|
||
* Compressed message payload
|
||
*/
|
||
message Compressed {
|
||
/*
|
||
* PortNum to determine the how to handle the compressed payload.
|
||
*/
|
||
PortNum portnum = 1;
|
||
|
||
/*
|
||
* Compressed data.
|
||
*/
|
||
bytes data = 2;
|
||
}
|
||
|
||
/*
|
||
* Full info on edges for a single node
|
||
*/
|
||
message NeighborInfo {
|
||
/*
|
||
* The node ID of the node sending info on its neighbors
|
||
*/
|
||
uint32 node_id = 1;
|
||
/*
|
||
* Field to pass neighbor info for the next sending cycle
|
||
*/
|
||
uint32 last_sent_by_id = 2;
|
||
/*
|
||
* The list of out edges from this node
|
||
*/
|
||
repeated Neighbor neighbors = 3;
|
||
}
|
||
|
||
/*
|
||
* A single edge in the mesh
|
||
*/
|
||
message Neighbor {
|
||
/*
|
||
* Node ID of neighbor
|
||
*/
|
||
uint32 node_id = 1;
|
||
|
||
/*
|
||
* SNR of last heard message
|
||
*/
|
||
float snr = 2;
|
||
}
|
||
|
||
/*
|
||
* Device metadata response
|
||
*/
|
||
message DeviceMetadata {
|
||
/*
|
||
* Device firmware version string
|
||
*/
|
||
string firmware_version = 1;
|
||
|
||
/*
|
||
* Device state version
|
||
*/
|
||
uint32 device_state_version = 2;
|
||
|
||
/*
|
||
* Indicates whether the device can shutdown CPU natively or via power management chip
|
||
*/
|
||
bool canShutdown = 3;
|
||
|
||
/*
|
||
* Indicates that the device has native wifi capability
|
||
*/
|
||
bool hasWifi = 4;
|
||
|
||
/*
|
||
* Indicates that the device has native bluetooth capability
|
||
*/
|
||
bool hasBluetooth = 5;
|
||
|
||
/*
|
||
* Indicates that the device has an ethernet peripheral
|
||
*/
|
||
bool hasEthernet = 6;
|
||
|
||
/*
|
||
* Indicates that the device's role in the mesh
|
||
*/
|
||
Config.DeviceConfig.Role role = 7;
|
||
|
||
/*
|
||
* Indicates the device's current enabled position flags
|
||
*/
|
||
uint32 position_flags = 8;
|
||
|
||
/*
|
||
* Device hardware model
|
||
*/
|
||
HardwareModel hw_model = 9;
|
||
|
||
/*
|
||
* Has Remote Hardware enabled
|
||
*/
|
||
bool hasRemoteHardware = 10;
|
||
} |