From 034a18143632d4cf17e0acfff66915646f217c27 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 7 Nov 2024 06:17:39 -0600 Subject: [PATCH] Direct neighbor for clarity --- meshtastic/device_only/deviceonly.proto | 235 ++++++++++++++++++++++++ meshtastic/deviceonly.proto | 2 +- meshtastic/mesh.proto | 6 +- 3 files changed, 239 insertions(+), 4 deletions(-) create mode 100644 meshtastic/device_only/deviceonly.proto diff --git a/meshtastic/device_only/deviceonly.proto b/meshtastic/device_only/deviceonly.proto new file mode 100644 index 00000000..b199bc34 --- /dev/null +++ b/meshtastic/device_only/deviceonly.proto @@ -0,0 +1,235 @@ +syntax = "proto3"; + +package meshtastic; + +import "channel.proto"; +import "localonly.proto"; +import "mesh.proto"; +import "telemetry.proto"; +import "config.proto"; +import "nanopb.proto"; + +option csharp_namespace = "Meshtastic.Protobufs"; +option go_package = "github.com/meshtastic/go/generated"; +option java_outer_classname = "DeviceOnly"; +option java_package = "com.geeksville.mesh"; +option swift_prefix = ""; +option (nanopb_fileopt).include = ""; + + +/* + * Position with static location information only for NodeDBLite + */ +message PositionLite { + /* + * 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; + + /* + * TODO: REPLACE + */ + Position.LocSource location_source = 5; +} + +message UserLite { + /* + * This is the addr of the radio. + */ + bytes macaddr = 1 [deprecated = true]; + + /* + * 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; + + /* + * 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 = 4; + + /* + * 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 = 5; + + /* + * Indicates that the user's role in the mesh + */ + Config.DeviceConfig.Role role = 6; + + /* + * The public key of the user's device. + * This is sent out to other nodes on the mesh to allow them to compute a shared secret key. + */ + bytes public_key = 7; +} + +message NodeInfoLite { + /* + * The node number + */ + uint32 num = 1; + + /* + * The user info for this node + */ + UserLite 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. + */ + PositionLite 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; + + /* + * 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; + + /* + * True if we witnessed the node over MQTT instead of LoRA transport + */ + bool via_mqtt = 8; + + /* + * Number of hops away from us this node is (0 if direct neighbor) + */ + optional uint32 hops_away = 9; + + /* + * True if node is in our favorites list + * Persists between NodeDB internal clean ups + */ + bool is_favorite = 10; +} + +/* + * 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 + */ +message DeviceState { + /* + * Read only settings/info about this node + */ + MyNodeInfo my_node = 2; + + /* + * My owner info + */ + User owner = 3; + + /* + * Received packets saved for delivery to the phone + */ + repeated MeshPacket receive_queue = 5; + + /* + * 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. + */ + uint32 version = 8; + + /* + * We keep the last received text message (only) stored in the device flash, + * so we can show it on the screen. + * Might be null + */ + MeshPacket rx_text_message = 7; + + /* + * Used only during development. + * Indicates developer is testing and changes should never be saved to flash. + * Deprecated in 2.3.1 + */ + bool no_save = 9 [deprecated = true]; + + /* + * Some GPS receivers seem to have bogus settings from the factory, so we always do one factory reset. + */ + bool did_gps_reset = 11; + + /* + * We keep the last received waypoint stored in the device flash, + * so we can show it on the screen. + * Might be null + */ + MeshPacket rx_waypoint = 12; + + /* + * The mesh's nodes with their available gpio pins for RemoteHardware module + */ + repeated NodeRemoteHardwarePin node_remote_hardware_pins = 13; + + /* + * New lite version of NodeDB to decrease memory footprint + */ + repeated NodeInfoLite node_db_lite = 14 [(nanopb).callback_datatype = "std::vector"]; +} + +/* + * The on-disk saved channels + */ +message ChannelFile { + /* + * The channels our node knows about + */ + repeated Channel channels = 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. + */ + uint32 version = 2; +} diff --git a/meshtastic/deviceonly.proto b/meshtastic/deviceonly.proto index 76bdfa8b..d08c605e 100644 --- a/meshtastic/deviceonly.proto +++ b/meshtastic/deviceonly.proto @@ -138,7 +138,7 @@ message NodeInfoLite { bool via_mqtt = 8; /* - * Number of hops away from us this node is (0 if adjacent) + * Number of hops away from us this node is (0 if direct neighbor) */ optional uint32 hops_away = 9; diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index 8fa16aaf..1fca39f9 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -1177,7 +1177,7 @@ message MeshPacket { float rx_snr = 8; /* - * If unset treated as zero (no forwarding, send to adjacent nodes only) + * If unset treated as zero (no forwarding, send to direct neighbor 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. @@ -1317,7 +1317,7 @@ message NodeInfo { /* * 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. + * we are direct neighbor or zero if we don't yet know a route to this node. * fixed32 next_hop = 5; */ @@ -1341,7 +1341,7 @@ message NodeInfo { bool via_mqtt = 8; /* - * Number of hops away from us this node is (0 if adjacent) + * Number of hops away from us this node is (0 if direct neighbor) */ optional uint32 hops_away = 9;