# Conflicts:
#	mesh.proto
This commit is contained in:
Kevin Hester 2021-02-08 12:21:31 +08:00
commit 8492e4030a
10 changed files with 1550 additions and 854 deletions

3
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,3 @@
{
"cmake.configureOnOpen": false
}

29
apponly.proto Normal file
View file

@ -0,0 +1,29 @@
syntax = "proto3";
option java_package = "com.geeksville.mesh";
option java_outer_classname = "AppOnly";
option optimize_for = LITE_RUNTIME;
import "mesh.proto";
/*
* This message wraps a MeshPacket with extra metadata about the sender and how it arrived.
*/
message ServiceEnvelope {
/*
* The (probably encrypted) packet
*/
MeshPacket packet = 1;
/*
* The global channel ID it was sent on
*/
string channel_id = 2;
/*
* The sending gateway. 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
*/
string gateway_id = 3;
}

11
deviceonly.options Normal file
View file

@ -0,0 +1,11 @@
# options for nanopb
# https://jpa.kapsi.fi/nanopb/docs/reference.html#proto-file-options
# FIXME pick a higher number someday? or do dynamic alloc in nanopb?
*DeviceState.node_db max_count:32
# FIXME - max_count is actually 32 but we save/load this as one long string of preencoded MeshPacket bytes - not a big array in RAM
*DeviceState.receive_queue max_count:1
*DeviceState.secondary_channels max_count:7

67
deviceonly.proto Normal file
View file

@ -0,0 +1,67 @@
syntax = "proto3";
option java_package = "com.geeksville.mesh";
option java_outer_classname = "DeviceOnly";
option optimize_for = LITE_RUNTIME;
import "mesh.proto";
/*
* 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 {
RadioConfig radio = 1;
/*
* Read only settings/info about this node
*/
MyNodeInfo my_node = 2;
/*
* My owner info
*/
User owner = 3;
repeated NodeInfo node_db = 4;
/*
* 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.
*/
bool no_save = 9;
/*
* Some GPSes seem to have bogus settings from the factory, so we always do one factory reset.
*/
bool did_gps_reset = 11;
/*
* Secondary channels are only used for encryption/decryption/authentication purposes. Their radio settings (freq etc)
* are ignored, only psk is used.
* Note: this is not kept inside of RadioConfig because that would make ToRadio/FromRadio worse case > 512 bytes (to big for BLE)
*/
repeated ChannelSettings secondary_channels = 12;
}

View file

@ -3,12 +3,17 @@
## Table of Contents
- [apponly.proto](#apponly.proto)
- [ServiceEnvelope](#.ServiceEnvelope)
- [deviceonly.proto](#deviceonly.proto)
- [DeviceState](#.DeviceState)
- [mesh.proto](#mesh.proto)
- [ChannelSettings](#.ChannelSettings)
- [Data](#.Data)
- [DebugString](#.DebugString)
- [DeviceState](#.DeviceState)
- [FromRadio](#.FromRadio)
- [LogRecord](#.LogRecord)
- [MeshPacket](#.MeshPacket)
- [MyNodeInfo](#.MyNodeInfo)
- [NodeInfo](#.NodeInfo)
@ -21,9 +26,12 @@
- [User](#.User)
- [ChannelSettings.ModemConfig](#.ChannelSettings.ModemConfig)
- [ChargeCurrent](#.ChargeCurrent)
- [Constants](#.Constants)
- [CriticalErrorCode](#.CriticalErrorCode)
- [GpsOperation](#.GpsOperation)
- [LocationSharing](#.LocationSharing)
- [LogRecord.Level](#.LogRecord.Level)
- [RegionCode](#.RegionCode)
- [RouteError](#.RouteError)
@ -39,99 +47,43 @@
<a name="mesh.proto"></a>
<a name="apponly.proto"></a>
<p align="right"><a href="#top">Top</a></p>
## mesh.proto
Meshtastic protobufs
For more information on protobufs (and tools to use them with the language of
your choice) see
https://developers.google.com/protocol-buffers/docs/proto3
We are not placing any of these defs inside a package, because if you do the
resulting nanopb version is super verbose package mesh.
Protobuf build instructions:
To build java classes for reading writing:
protoc -I=. --java_out /tmp mesh.proto
To generate Nanopb c code:
/home/kevinh/packages/nanopb-0.4.0-linux-x86/generator-bin/protoc
--nanopb_out=/tmp -I=app/src/main/proto mesh.proto
Nanopb binaries available here: https://jpa.kapsi.fi/nanopb/download/ use nanopb
0.4.0
## apponly.proto
<a name=".ChannelSettings"></a>
### ChannelSettings
Full settings (center freq, spread factor, pre-shared secret key etc...)
needed to configure a radio for speaking on a particlar 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 aboute 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 &#34;BobsChan&#34; and then can&#39;t talk
because their PSKs will be different. The PSK is hashed into this letter by
&#34;0x41 &#43; [xor all bytes of the psk ] modulo 26&#34;
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 &#39;speed&#39; settings
(for some future definition of speed)
<a name=".ServiceEnvelope"></a>
### ServiceEnvelope
This message wraps a MeshPacket with extra metadata about the sender and how it arrived.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| tx_power | [int32](#int32) | | If zero then, use default max legal continuous power (ie. something that won&#39;t burn out the radio hardware) In most cases you should use zero here. |
| modem_config | [ChannelSettings.ModemConfig](#ChannelSettings.ModemConfig) | | Note: This is the &#39;old&#39; 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&#39;d like to experiment with other options add them to MeshRadio.cpp in the device code. |
| bandwidth | [uint32](#uint32) | | Bandwidth in MHz Certain bandwidth numbers are &#39;special&#39; and will be converted to the appropriate floating point value: 31 -&gt; 31.25MHz |
| spread_factor | [uint32](#uint32) | | A number from 7 to 12. Indicates number of chirps per symbol as 1&lt;&lt;spread_factor. |
| coding_rate | [uint32](#uint32) | | The denominator of the coding rate. ie for 4/8, the value is 8. 5/8 the value is 5. |
| channel_num | [uint32](#uint32) | | A channel number between 1 and 13 (or whatever the max is in the current region). If ZERO then the rule is &#34;use the old channel name hash based algoritm to derive the channel number&#34;) 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&#43;&#43;) != 0) hash = ((hash &lt;&lt; 5) &#43; hash) &#43; (unsigned char) c; return hash; } |
| psk | [bytes](#bytes) | | A simple preshared 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 |
| name | [string](#string) | | 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 (minimially secure) &#34;Default&#34; channel. In user interfaces it should be rendered as a local language translation of &#34;X&#34;. For channel_num hashing empty string will be treated as &#34;X&#34;. Where &#34;X&#34; is selected based on the english words listed above for ModemConfig |
| packet | [MeshPacket](#MeshPacket) | | The (probably encrypted) packet |
| channel_id | [string](#string) | | The global channel ID it was sent on |
| gateway_id | [string](#string) | | The sending gateway. Can we use this to authenticate/prevent fake nodeid impersonation for senders? - i.e. use gateway/mesh id (which is authenticated) &#43; local node id as the globally trusted nodenum |
<a name=".Data"></a>
### Data
a data message to forward to an external app (or possibly also be consumed
internally in the case of CLEAR_TEXT and CLEAR_READACK)
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| portnum | [PortNum](#PortNum) | | formerly named typ and of type Type |
| payload | [bytes](#bytes) | | required |
<a name="deviceonly.proto"></a>
<p align="right"><a href="#top">Top</a></p>
<a name=".DebugString"></a>
### DebugString
Debug output from the device
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| message | [string](#string) | | |
## deviceonly.proto
@ -155,10 +107,101 @@ the receive queue and use the preferences store for the other stuff
| version | [uint32](#uint32) | | 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. |
| rx_text_message | [MeshPacket](#MeshPacket) | | We keep the last received text message (only) stored in the device flash, so we can show it on the screen. Might be null |
| no_save | [bool](#bool) | | Used only during development. Indicates developer is testing and changes should never be saved to flash. |
| did_gps_reset | [bool](#bool) | | Some GPSes seem to have bogus settings from the factory, so we always do one factory reset |
| secondary_channels | [ChannelSettings](#ChannelSettings) | repeated | Secondary channels are only used for encryption/decryption/authentication purposes. Their radio settings (freq etc) are ignored, only psk is used.
| did_gps_reset | [bool](#bool) | | Some GPSes seem to have bogus settings from the factory, so we always do one factory reset. |
| secondary_channels | [ChannelSettings](#ChannelSettings) | repeated | Secondary channels are only used for encryption/decryption/authentication purposes. Their radio settings (freq etc) are ignored, only psk is used. Note: this is not kept inside of RadioConfig because that would make ToRadio/FromRadio worse case &gt; 512 bytes (to big for BLE) |
Note: this is not kept inside of RadioConfig because that would make ToRadio/FromRadio worse case &gt; 512 bytes (to big for BLE) |
<a name="mesh.proto"></a>
<p align="right"><a href="#top">Top</a></p>
## mesh.proto
Meshtastic protobufs
For more information on protobufs (and tools to use them with the language of your choice) see
https://developers.google.com/protocol-buffers/docs/proto3
We are not placing any of these defs inside a package, because if you do the
resulting nanopb version is super verbose package mesh.
Protobuf build instructions:
To build java classes for reading writing:
protoc -I=. --java_out /tmp mesh.proto
To generate Nanopb c code:
/home/kevinh/packages/nanopb-0.4.0-linux-x86/generator-bin/protoc --nanopb_out=/tmp -I=app/src/main/proto mesh.proto
Nanopb binaries available here: https://jpa.kapsi.fi/nanopb/download/ use nanopb 0.4.0
<a name=".ChannelSettings"></a>
### ChannelSettings
Full settings (center freq, spread factor, pre-shared secret key etc...)
needed to configure a radio for speaking on a particlar 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 aboute 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 &#34;BobsChan&#34; and then can&#39;t talk
because their PSKs will be different. The PSK is hashed into this letter by
&#34;0x41 &#43; [xor all bytes of the psk ] modulo 26&#34;
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 &#39;speed&#39; 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
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| tx_power | [int32](#int32) | | If zero then, use default max legal continuous power (ie. something that won&#39;t burn out the radio hardware) In most cases you should use zero here. |
| modem_config | [ChannelSettings.ModemConfig](#ChannelSettings.ModemConfig) | | Note: This is the &#39;old&#39; 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&#39;d like to experiment with other options add them to MeshRadio.cpp in the device code. |
| bandwidth | [uint32](#uint32) | | Bandwidth in MHz Certain bandwidth numbers are &#39;special&#39; and will be converted to the appropriate floating point value: 31 -&gt; 31.25MHz |
| spread_factor | [uint32](#uint32) | | A number from 7 to 12. Indicates number of chirps per symbol as 1&lt;&lt;spread_factor. |
| coding_rate | [uint32](#uint32) | | The denominator of the coding rate. ie for 4/8, the value is 8. 5/8 the value is 5. |
| channel_num | [uint32](#uint32) | | A channel number between 1 and 13 (or whatever the max is in the current region). If ZERO then the rule is &#34;use the old channel name hash based algoritm to derive the channel number&#34;) 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&#43;&#43;) != 0) hash = ((hash &lt;&lt; 5) &#43; hash) &#43; (unsigned char) c; return hash; } |
| psk | [bytes](#bytes) | | A simple preshared 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 |
| name | [string](#string) | | 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 (minimially secure) &#34;Default&#34; channel. In user interfaces it should be rendered as a local language translation of &#34;X&#34;. For channel_num hashing empty string will be treated as &#34;X&#34;. Where &#34;X&#34; is selected based on the english words listed above for ModemConfig |
| id | [fixed32](#fixed32) | | Used to construct a globally unique channel ID. The full globally unique ID will be: &#34;name.id&#34; 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 &#39;special&#39; 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) |
| uplink_enabled | [bool](#bool) | | If true, messages on the mesh will be sent to the *public* internet by any gateway ndoe |
| downlink_enabled | [bool](#bool) | | If true, messages seen on the internet will be forwarded to the local mesh. |
<a name=".Data"></a>
### Data
a data message to forward to an external app (or possibly also be consumed
internally in the case of CLEAR_TEXT and CLEAR_READACK)
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| portnum | [PortNum](#PortNum) | | Formerly named typ and of type Type |
| payload | [bytes](#bytes) | | Required |
@ -168,11 +211,9 @@ Note: this is not kept inside of RadioConfig because that would make ToRadio/Fro
<a name=".FromRadio"></a>
### FromRadio
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.
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.
| Field | Type | Label | Description |
@ -182,10 +223,33 @@ FIFO will be populated.
| my_info | [MyNodeInfo](#MyNodeInfo) | | Tells the phone what our node number is, can be -1 if we&#39;ve not yet joined a mesh. |
| node_info | [NodeInfo](#NodeInfo) | | One packet is sent for each node in the on radio DB starts over with the first node in our DB |
| radio | [RadioConfig](#RadioConfig) | | In rev1 this was the radio BLE characteristic |
| debug_string | [DebugString](#DebugString) | | set to send debug console output over our protobuf stream |
| config_complete_id | [uint32](#uint32) | | 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&#39;t started yet |
| log_record | [LogRecord](#LogRecord) | | set to send debug console output over our protobuf stream |
| config_complete_id | [uint32](#uint32) | | 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&#39;t started yet. |
| rebooted | [bool](#bool) | | 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. |
| secondary_channel | [ChannelSettings](#ChannelSettings) | | One of the secondary channels, they are all sent during config download |
| channel | [ChannelSettings](#ChannelSettings) | | One of the channels, they are all sent during config download The first channel is the &#34;primary&#34; channel all other channels are secondary channels The primary channel is also sent as part of RadioConfig (which is deprecated, but to support older clients) |
<a name=".LogRecord"></a>
### LogRecord
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 contuinuation 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.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| message | [string](#string) | | |
| time | [fixed32](#fixed32) | | Seconds since 1970 - or 0 for unknown/unset |
| source | [string](#string) | | Usually based on thread name - if known |
| level | [LogRecord.Level](#LogRecord.Level) | | Not yet set |
@ -197,20 +261,19 @@ FIFO will be populated.
### MeshPacket
A full packet sent/received over the mesh
Note: For simplicity reasons (and that we want to keep over the radio packets
very small, we now assume that there is only _one_ SubPacket in each
MeshPacket).
very small, we now assume that there is only _one_ SubPacket in each MeshPacket).
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| from | [uint32](#uint32) | | The sending node number. Note: Our crypto implementation uses this field as well. See docs/software/crypto.md for details. FIXME - really should be fixed32 instead, this encoding only hurts the ble link though. |
| to | [uint32](#uint32) | | The (immediate) destination for this packet. If we are using routing, the final destination will be in payload.dest FIXME - really should be fixed32 instead, this encoding only hurts the ble link though. |
| channel_index | [uint32](#uint32) | | 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. |
| channel_index | [uint32](#uint32) | | 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. |
| decoded | [SubPacket](#SubPacket) | | |
| encrypted | [bytes](#bytes) | | |
| id | [uint32](#uint32) | | 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 docs/software/crypto.md for details. FIXME - really should be fixed32 instead, this encoding only hurts the ble link though. |
| rx_time | [fixed32](#fixed32) | | 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) |
| rx_snr | [float](#float) | | Never* sent over the radio links. Set during reception to indicate the / SNR / of this packet. Used to collect statistics on current link waulity. |
| id | [uint32](#uint32) | | 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 docs/software/crypto.md for details. FIXME - really should be fixed32 instead, this encoding only hurts the ble link though. |
| rx_time | [fixed32](#fixed32) | | 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) |
| rx_snr | [float](#float) | | Never* sent over the radio links. Set during reception to indicate the SNR of this packet. Used to collect statistics on current link waulity. |
| hop_limit | [uint32](#uint32) | | If unset treated as zero (no fowarding, 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. |
| want_ack | [bool](#bool) | | 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 algoritm). 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&#39;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 |
@ -223,23 +286,21 @@ MeshPacket).
### MyNodeInfo
Unique local debugging info for this node
Note: we don&#39;t include position or the user info, because that will come in the
Sent to the phone in response to WantNodes.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| my_node_num | [uint32](#uint32) | | 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 |
| my_node_num | [uint32](#uint32) | | 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 |
| has_gps | [bool](#bool) | | Note: this bool no longer means &#34;we have our own GPS&#34;. Because gps_operation is more advanced, but we&#39;d like old phone apps to keep working. So for legacy reasons we set this flag as follows: if false it would be great if the phone can help provide gps coordinates. If true we don&#39;t need location assistance from the phone. |
| num_channels | [int32](#int32) | | # of legal channels (set at build time in the device flash image) |
| region | [string](#string) | | 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. |
| hw_model | [string](#string) | | TBEAM, HELTEC, etc... |
| firmware_version | [string](#string) | | 0.0.5 etc... |
| error_code | [uint32](#uint32) | | An error message we&#39;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 |
| error_code | [CriticalErrorCode](#CriticalErrorCode) | | An error message we&#39;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 onlybe reported once) a numeric error code to go with error message, zero means no error |
| error_address | [uint32](#uint32) | | A numeric error address (nonzero if available) |
| error_count | [uint32](#uint32) | | The total number of errors this node has ever encountered (well - since / the last time we discarded preferences) |
| error_count | [uint32](#uint32) | | The total number of errors this node has ever encountered (well - since the last time we discarded preferences) |
| packet_id_bits | [uint32](#uint32) | | How many bits are used for the packetid. If zero it is assumed we use eight bit packetids Old device loads (older that 0.6.5 do not populate this field, but all newer loads do). |
| current_packet_id | [uint32](#uint32) | | The current ID this node is using for sending new packets (exposed so that the phone can self assign packet IDs if it wishes by picking packet IDs from the opposite side of the pacekt ID space). Old device loads (older that 0.6.5 do not populate this field, but all newer loads do). FIXME: that we need to expose this is a bit of a mistake. Really the phones should be modeled/treated as 1st class nodes like any other, and the radio connected to the phone just routes like any other. This would allow all sorts of clean/clever routing topologies in the future. |
| node_num_bits | [uint32](#uint32) | | How many bits are used for the nodenum. If zero it is assumed we use eight bit nodenums New device loads will user 32 bit nodenum. Old device loads (older that 0.6.5 do not populate this field, but all newer loads do). |
@ -254,6 +315,26 @@ Sent to the phone in response to WantNodes.
<a name=".NodeInfo"></a>
### NodeInfo
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
@ -262,8 +343,14 @@ Full information about a node on the mesh
| num | [uint32](#uint32) | | the node number |
| user | [User](#User) | | The user info for this node |
| position | [Position](#Position) | | This position data will also contain a time last seen |
| snr | [float](#float) | | 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 |
| next_hop | [uint32](#uint32) | | Our current preferred node node for routing - might be the same as num if / we are adjacent Or zero if we don&#39;t yet know a route to this node. |
| snr | [float](#float) | | 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 |
| next_hop | [uint32](#uint32) | | Returns the last measured frequency error. The LoRa receiver estimates the frequency offset between the receiver centre 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&#39;s oscillator. Apparent errors may be due to the transmitter, the receiver or both. \return The estimated centre 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;
Our current preferred node node for routing - might be the same as num if we are adjacent Or zero if we don&#39;t yet know a route to this node. |
@ -282,7 +369,7 @@ a gps position
| longitude_i | [sint32](#sint32) | | |
| altitude | [int32](#int32) | | In meters above MSL |
| battery_level | [int32](#int32) | | 1-100 (0 means not provided) |
| time | [fixed32](#fixed32) | | 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 |
| time | [fixed32](#fixed32) | | 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 |
@ -300,7 +387,7 @@ set for behavior of their node
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| preferences | [RadioConfig.UserPreferences](#RadioConfig.UserPreferences) | | |
| channel_settings | [ChannelSettings](#ChannelSettings) | | |
| channel_settings | [ChannelSettings](#ChannelSettings) | | The preferred way to find channel settings is now in FromRadio. |
@ -315,7 +402,7 @@ see sw-design.md for more information on these preferences
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| position_broadcast_secs | [uint32](#uint32) | | We should send our position this often (but only if it has changed significantly). Defaults to 15 minutes |
| position_broadcast_secs | [uint32](#uint32) | | We should send our position this often (but only if it has changed significantly) Defaults to 15 minutes |
| send_owner_interval | [uint32](#uint32) | | Send our owner info at least this often (also we always send once at boot - to rejoin the mesh) |
| wait_bluetooth_secs | [uint32](#uint32) | | Power management state machine option. See https://github.com/meshtastic/Meshtastic-device/blob/master/docs/software/power.md for details. 0 for default of 1 minute |
| screen_on_secs | [uint32](#uint32) | | Power management state machine option. See https://github.com/meshtastic/Meshtastic-device/blob/master/docs/software/power.md for details. 0 for default of one minute |
@ -329,16 +416,37 @@ see sw-design.md for more information on these preferences
| wifi_password | [string](#string) | | If set, will be use to authenticate to the named wifi |
| wifi_ap_mode | [bool](#bool) | | If set, the node will operate as an AP (and DHCP server), otherwise it will be a station |
| region | [RegionCode](#RegionCode) | | The region code for my radio (US, CN, EU433, etc...) |
| charge_current | [ChargeCurrent](#ChargeCurrent) | | Sets the current of the battery charger |
| is_router | [bool](#bool) | | Are we operating as a router. Changes behavior in the following ways: The device will only sleep for critically low battery level (i.e. always tries to stay alive for the mesh) In the future routing decisions will preferentially route packets through nodes with this attribute (because assumed good line of sight) |
| is_low_power | [bool](#bool) | | If set, we are powered from a low-current source (i.e. solar), so even if it looks like we have power flowing in we should try to minimize power consumption as much as possible. Often combined with is_router. |
| is_low_power | [bool](#bool) | | If set, we are powered from a low-current source (i.e. solar), so even if it looks like we have power flowing in we should try to minimize power consumption as much as possible. YOU DO NOT NEED TO SET THIS IF YOU&#39;VE set is_router (it is implied in that case). |
| fixed_position | [bool](#bool) | | If set, this node is at a fixed position. We will generate GPS position updates at the regular interval, but use whatever the last lat/lon/alt we have for the node. The lat/lon/alt can be set by an internal GPS or with the help of the app. |
| factory_reset | [bool](#bool) | | This setting is never saved to disk, but if set, all device settings will be returned to factory defaults. (Region, serial number etc... will be preserved) |
| debug_log_enabled | [bool](#bool) | | By default we turn off logging as soon as an API client connects (to keep shared serial link quiet). Set this to true to leave the debug log outputting even when API is active. |
| location_share | [LocationSharing](#LocationSharing) | | How our location is shared with other nodes (or the local phone) |
| gps_operation | [GpsOperation](#GpsOperation) | | How the GPS hardware in this unit is operated. Note: This is independent of how our location is shared with other devices. For that see LocationSharing |
| gps_update_interval | [uint32](#uint32) | | How often should we try to get GPS position (in seconds) when we are in GpsOpMobile mode? or zero for the default of once every 120 seconds or a very large value (maxint) to update only once at boot. |
| gps_update_interval | [uint32](#uint32) | | How often should we try to get GPS position (in seconds) when we are in GpsOpMobile mode? or zero for the default of once every 30 seconds or a very large value (maxint) to update only once at boot. |
| gps_attempt_time | [uint32](#uint32) | | How long should we try to get our position during each gps_update_interval attempt? (in seconds) Or if zero, use the default of 30 seconds. If we don&#39;t get a new gps fix in that time, the gps will be put into sleep until the next gps_update_rate window. |
| ignore_incoming | [uint32](#uint32) | repeated | For testing it is useful sometimes to force a node to never listen to particular other nodes (simulating radio out of range). All nodenums listed in ignore_incoming will have packets they send droped on receive (by router.cpp) |
| ignore_incoming | [uint32](#uint32) | repeated | If true, radio should not try to be smart about what packets to queue to the phone bool keep_all_packets = 101;
If true, we will try to capture all the packets sent on the mesh, not just the ones destined to our node. bool promiscuous_mode = 102;
For testing it is useful sometimes to force a node to never listen to particular other nodes (simulating radio out of range). All nodenums listed in ignore_incoming will have packets they send droped on receive (by router.cpp) |
| serialplugin_enabled | [bool](#bool) | | Preferences for the SerialPlugin
FIXME - Move this out of UserPreferences and into a section for plugin configuration. |
| serialplugin_echo | [bool](#bool) | | |
| serialplugin_rxd | [uint32](#uint32) | | |
| serialplugin_txd | [uint32](#uint32) | | |
| serialplugin_timeout | [uint32](#uint32) | | |
| serialplugin_mode | [uint32](#uint32) | | |
| ext_notification_plugin_enabled | [bool](#bool) | | Preferences for the ExternalNotificationPlugin
FIXME - Move this out of UserPreferences and into a section for plugin configuration. |
| ext_notification_plugin_output_ms | [uint32](#uint32) | | |
| ext_notification_plugin_output | [uint32](#uint32) | | |
| ext_notification_plugin_active | [bool](#bool) | | |
| ext_notification_plugin_alert_message | [bool](#bool) | | |
| ext_notification_plugin_alert_bell | [bool](#bool) | | |
@ -369,13 +477,13 @@ inside a radio packet (because from/to are broken out by the comms library)
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| position | [Position](#Position) | | Prior to 1.20 positions were communicated as a special payload type, now they are GPS_POSITION_APP Data |
| data | [Data](#Data) | | |
| user | [User](#User) | | Prior to 1.20 positions were communicated as a special payload type, now they are MESH_USERINFO_APP |
| route_request | [RouteDiscovery](#RouteDiscovery) | | A route request going from the requester |
| route_request | [RouteDiscovery](#RouteDiscovery) | | A route request going from the requester FIXME - these route messages should be moved into regular data packets and use the regular on device plugin mechanism. |
| route_reply | [RouteDiscovery](#RouteDiscovery) | | A route reply |
| route_error | [RouteError](#RouteError) | | A failure in a routed message |
| want_response | [bool](#bool) | | 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 its position). Note: that if you set this on a broadcast you will receive many replies. |
| position | [Position](#Position) | | Prior to 1.20 positions were communicated as a special payload type, now they are GPS_POSITION_APP Data |
| user | [User](#User) | | Prior to 1.20 positions were communicated as a special payload type, now they are MESH_USERINFO_APP |
| want_response | [bool](#bool) | | 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&#39;s position). Note: that if you set this on a broadcast you will receive many replies. |
| success_id | [uint32](#uint32) | | This packet is a requested acknoledgement indicating that we have received the specified message ID. This packet type can be used both for immediate (0 hops) messages or can be routed through multiple hops if dest is set. Note: As an optimization, recipients can _also_ populate a field in payload if they think the recipient would appreciate that extra state. |
| fail_id | [uint32](#uint32) | | This is a nak, we failed to deliver this message. |
| dest | [uint32](#uint32) | | The address of the destination node. This field is is filled in by the mesh radio device software, applicaiton layer software should never need it. RouteDiscovery messages _must_ populate this. Other message types might need to if they are doing multihop routing. |
@ -390,8 +498,8 @@ inside a radio packet (because from/to are broken out by the comms library)
<a name=".ToRadio"></a>
### ToRadio
packets/commands to the radio will be written (reliably) to the toRadio
characteristic. Once the write completes the phone can assume it is handled.
packets/commands to the radio will be written (reliably) to the toRadio characteristic.
Once the write completes the phone can assume it is handled.
| Field | Type | Label | Description |
@ -400,6 +508,7 @@ characteristic. Once the write completes the phone can assume it is handled.
| want_config_id | [uint32](#uint32) | | 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. |
| set_radio | [RadioConfig](#RadioConfig) | | set the radio provisioning for this node |
| set_owner | [User](#User) | | Set the owner for this node |
| set_channel | [ChannelSettings](#ChannelSettings) | | Set channels (using the new API). The first sent channel is assumed to be channel index 0 the &#34;primary channel&#34;. Following records are secondary channels. |
@ -410,15 +519,12 @@ characteristic. Once the write completes the phone can assume it is handled.
### User
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)
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 node
db)
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:
@ -440,7 +546,7 @@ A few nodenums are reserved and will never be requested:
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| id | [string](#string) | | a globally unique ID string for this user. In the case of Signal that would mean &#43;16504442323, for the default macaddr derived id it would be !&lt;6 hexidecimal bytes&gt; |
| id | [string](#string) | | A globally unique ID string for this user. In the case of Signal that would mean &#43;16504442323, for the default macaddr derived id it would be !&lt;6 hexidecimal bytes&gt; |
| long_name | [string](#string) | | A full name for this user, i.e. &#34;Kevin Hester&#34; |
| short_name | [string](#string) | | A VERY short name, ideally two characters. Suitable for a tiny OLED screen |
| macaddr | [bytes](#bytes) | | This is the addr of the radio. Not populated by the phone, but added by the esp32 when broadcasting |
@ -460,10 +566,38 @@ Note: these mappings must match ModemConfigChoice in the device code.
| Name | Number | Description |
| ---- | ------ | ----------- |
| Bw125Cr45Sf128 | 0 | &lt; Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC |
| Bw500Cr45Sf128 | 1 | &lt; Bw = 500 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC |
| Bw31_25Cr48Sf512 | 2 | &lt; Bw = 31.25 kHz, Cr = 4/8, Sf = 512chips/symbol, |
| Bw125Cr48Sf4096 | 3 | &lt; Bw = 125 kHz, Cr = 4/8, Sf = 4096chips/symbol, CRC |
| Bw125Cr45Sf128 | 0 | &lt; Bw = 125 kHz, Cr = 4/5, Sf(7) = 128chips/symbol, CRC &lt; on. Default medium range (5.469 kbps) |
| Bw500Cr45Sf128 | 1 | &lt; Bw = 500 kHz, Cr = 4/5, Sf(7) = 128chips/symbol, CRC &lt; on. Fast&#43;short range (21.875 kbps) |
| Bw31_25Cr48Sf512 | 2 | &lt; Bw = 31.25 kHz, Cr = 4/8, Sf(9) = 512chips/symbol, &lt; CRC on. Slow&#43;long range (275 bps) |
| Bw125Cr48Sf4096 | 3 | &lt; Bw = 125 kHz, Cr = 4/8, Sf(12) = 4096chips/symbol, CRC &lt; on. Slow&#43;long range (183 bps) |
<a name=".ChargeCurrent"></a>
### ChargeCurrent
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.
| Name | Number | Description |
| ---- | ------ | ----------- |
| MAUnset | 0 | |
| MA100 | 1 | |
| MA190 | 2 | |
| MA280 | 3 | |
| MA360 | 4 | |
| MA450 | 5 | |
| MA550 | 6 | |
| MA630 | 7 | |
| MA700 | 8 | |
| MA780 | 9 | |
| MA880 | 10 | |
| MA960 | 11 | |
| MA1000 | 12 | |
| MA1080 | 13 | |
| MA1160 | 14 | |
| MA1240 | 15 | |
| MA1320 | 16 | |
@ -479,16 +613,40 @@ Shared constants between device and phone
<a name=".CriticalErrorCode"></a>
### CriticalErrorCode
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&#39;ll try to help.
| Name | Number | Description |
| ---- | ------ | ----------- |
| None | 0 | |
| TxWatchdog | 1 | A software bug was detected while trying to send lora |
| SleepEnterWait | 2 | A software bug was detected on entry to sleep |
| NoRadio | 3 | No Lora radio hardware could be found |
| Unspecified | 4 | Not normally used |
| UBloxInitFailed | 5 | We failed while configuring a UBlox GPS |
| NoAXP192 | 6 | This board was expected to have a power management chip and it is missing or broken |
| InvalidRadioSetting | 7 | The channel tried to set a radio setting which is not supported by this chipset, radio comms settings are now undefined. |
| TransmitFailed | 8 | Radio transmit hardware failure. We sent data to the radio chip, but it didn&#39;t reply with an interrupt. |
<a name=".GpsOperation"></a>
### GpsOperation
How the GPS hardware in this unit is operated.
Note: This is independent of how our location is shared with other devices. For that see LocationSharing
| Name | Number | Description |
| ---- | ------ | ----------- |
| GpsOpUnset | 0 | This is treated as GpsOpMobile - it is the default settting |
| GpsOpStationary | 1 | Note: This mode was removed, because it is identical go GpsOpMobile with a gps_update_rate of once per day
This node is mostly stationary, we should try to get location only once per day, Once we have that position we should turn the GPS to sleep mode This is the recommendated configuration for stationary &#39;router&#39; nodes |
| GpsOpMobile | 2 | This node is mobile and we should get GPS position at a rate governed by gps_update_rate |
| GpsOpTimeOnly | 3 | We should only use the GPS to get time (no location data should be acquired/stored) Once we have the time we treat gps_update_interval as MAXINT (i.e. sleep forever) |
| GpsOpDisabled | 4 | GPS is always turned off - this mode is not recommended - use GpsOpTimeOnly instead |
@ -508,6 +666,23 @@ How our location is shared with other nodes (or the local phone)
<a name=".LogRecord.Level"></a>
### LogRecord.Level
Log levels, chosen to match python logging conventions.
| Name | Number | Description |
| ---- | ------ | ----------- |
| UNSET | 0 | |
| CRITICAL | 50 | |
| ERROR | 40 | |
| WARNING | 30 | |
| INFO | 20 | |
| DEBUG | 10 | |
| TRACE | 5 | |
<a name=".RegionCode"></a>
### RegionCode
@ -574,10 +749,8 @@ If you are making a new app using meshtastic, please send in a pull request to a
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
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&#39;t want to register publically
1024-66559 Are reserved for use by IP tunneling (see FIXME for more information)
All other values are reserved.
@ -589,13 +762,28 @@ This change is backwards compatible by treating the legacy OPAQUE/CLEAR_TEXT val
| Name | Number | Description |
| ---- | ------ | ----------- |
| UNKNOWN_APP | 0 | 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 |
| TEXT_MESSAGE_APP | 1 | 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 |
| REMOTE_HARDWARE_APP | 2 | Reserved for built-in GPIO/example app. See remote_hardware.proto/HardwareMessage for details on the message sent/received to this port number |
| TEXT_MESSAGE_APP | 1 | 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 |
| REMOTE_HARDWARE_APP | 2 | A message receive acknowledgement, sent in cleartext - allows radio to show user that a message has been read by the recipient, optional
Note: this concept has been removed for now. Once READACK is implemented, use the new packet type/port number stuff?
@exclude
CLEAR_READACK = 2;
Reserved for built-in GPIO/example app. See remote_hardware.proto/HardwareMessage for details on the message sent/received to this port number |
| POSITION_APP | 3 | The built-in position messaging app. See Position for details on the message sent to this port number. |
| NODEINFO_APP | 4 | The built-in user info app. See User for details on the message sent to this port number. |
| REPLY_APP | 32 | Provides a &#39;ping&#39; service that replies to any packet it receives. Also this serves as a small example plugin. |
| IP_TUNNEL_APP | 33 | Used for the python IP tunnel feature |
| SERIAL_APP | 64 | 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.
Maintained by Jm Casler (MC Hamster) : jm@casler.org |
| STORE_REQUEST_APP | 65 | STORE_REQUEST_APP (Work in Progress)
Maintained by Jm Casler (MC Hamster) : jm@casler.org |
| PRIVATE_APP | 256 | Private applications should use portnums &gt;= 256. To simplify initial development and testing you can use &#34;PRIVATE_APP&#34; in your code without needing to rebuild protobuf files (via bin/regin_protos.sh) |
| IP_TUNNEL_APP | 1024 | 1024-66559 Are reserved for use by IP tunneling (see FIXME for more information) |
| ATAK_FORWARDER | 257 | ATAK Forwarder Plugin https://github.com/paulmandal/atak-forwarder |
@ -620,12 +808,10 @@ A example app to show off the plugin system. This message is used for REMOTE_HAR
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).
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?)
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?)
| Field | Type | Label | Description |

View file

@ -7,14 +7,6 @@
*User.long_name max_size:40
*User.short_name max_size:5
# FIXME pick a higher number someday? or do dynamic alloc in nanopb?
*DeviceState.node_db max_count:32
# FIXME - max_count is actually 32 but we save/load this as one long string of preencoded MeshPacket bytes - not a big array in RAM
*DeviceState.receive_queue max_count:1
*DeviceState.secondary_channels max_count:4
*RouteDiscovery.route max_count:8
# FIXME, max out based on total SubPacket size And do fragmentation and reassembly (for larger payloads) at the Android layer, not the esp32 layer.
@ -45,6 +37,9 @@
# Max of three ignored nodes for our testing
*UserPreferences.ignore_incoming max_count:3
*LogRecord.message max_size:64
*LogRecord.source max_size:8
# MyMessage.name max_size:40
# or fixed_length or fixed_count, or max_count

1577
mesh.proto

File diff suppressed because it is too large Load diff

View file

@ -1,29 +1,37 @@
syntax = "proto3";
/** This file documents protobufs that are being considered but are not yet in use
*/
/*
* This file documents protobufs that are being considered but are not yet in use
*/
/**
Placeholder for data we will eventually set during initial programming. This
will allow us to stop having a load for each region.
*/
/*
* Placeholder for data we will eventually set during initial programming. This
* will allow us to stop having a load for each region.
*/
message ManufacturingData {
/// center frequency for the radio hardware that was stuffed
uint32 fradioFreq = 1;
/// TBEAM, HELTEC, etc...
/*
* center frequency for the radio hardware that was stuffed
*/
uint32 fradioFreq = 1;
/*
* TBEAM, HELTEC, etc...
*/
string hw_model = 2;
// Hardware version number
/*
* Hardware version number
*/
string hw_version = 3;
/**
This code is written during manfacturing time and allows users to confirm that
the initial manufacturing tests succeeded.
0 means no test performed.
1 means all tests passed
negative numbers indicate particular error codes
*/
/*
* This code is written during manfacturing time and allows users to confirm that
* the initial manufacturing tests succeeded.
*
* 0 means no test performed.
* 1 means all tests passed
* negative numbers indicate particular error codes
*/
sint32 selftest_result = 4;
}

View file

@ -4,75 +4,105 @@ option java_package = "com.geeksville.mesh";
option java_outer_classname = "Portnums";
option optimize_for = LITE_RUNTIME;
/**
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.
*/
/*
* 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.
*/
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
*/
/*
* 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
*/
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 */
/*
* 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
*/
TEXT_MESSAGE_APP = 1;
/** a message receive acknowledgement, sent in cleartext - allows radio to
show user that a message has been read by the recipient, optional
Note: this concept has been removed for now. Once READACK is implemented, use the
new packet type/port number stuff?
@exclude
CLEAR_READACK = 2;
*/
/** Reserved for built-in GPIO/example app.
See remote_hardware.proto/HardwareMessage for details on the message sent/received to this port number
*/
/*
* A message receive acknowledgement, sent in cleartext - allows radio to
* show user that a message has been read by the recipient, optional
*
* Note: this concept has been removed for now. Once READACK is implemented, use the
* new packet type/port number stuff?
*
* @exclude
*
* CLEAR_READACK = 2;
*
* Reserved for built-in GPIO/example app.
* See remote_hardware.proto/HardwareMessage for details on the message sent/received to this port number
*/
REMOTE_HARDWARE_APP = 2;
/** The built-in position messaging app.
See Position for details on the message sent to this port number.
*/
/*
* The built-in position messaging app.
* See Position for details on the message sent to this port number.
*/
POSITION_APP = 3;
/** The built-in user info app.
See User for details on the message sent to this port number.
*/
/*
* The built-in user info app.
* See User for details on the message sent to this port number.
*/
NODEINFO_APP = 4;
/** Provides a 'ping' service that replies to any packet it receives. Also this serves as a
small example plugin.
*/
/*
* Provides a 'ping' service that replies to any packet it receives. Also this serves as a small example plugin.
*/
REPLY_APP = 32;
/** Used for the python IP tunnel feature */
/*
* Used for the python IP tunnel feature
*/
IP_TUNNEL_APP = 33;
/** 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 bin/regin_protos.sh) */
/*
* 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.
*
* Maintained by Jm Casler (MC Hamster) : jm@casler.org
*/
SERIAL_APP = 64;
/*
* STORE_FORWARD_APP (Work in Progress)
*
* Maintained by Jm Casler (MC Hamster) : jm@casler.org
*/
STORE_FORWARD_APP = 65;
/*
* 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 bin/regin_protos.sh)
*/
PRIVATE_APP = 256;
}
/*
* ATAK Forwarder Plugin https://github.com/paulmandal/atak-forwarder
*/
ATAK_FORWARDER = 257;
}

View file

@ -4,49 +4,65 @@ option java_package = "com.geeksville.mesh";
option java_outer_classname = "RemoteHardware";
option optimize_for = LITE_RUNTIME;
/** A example app to show off the plugin 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?)
*/
/* A example app to show off the plugin 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?)
*/
message HardwareMessage {
enum Type {
/** Unset/unused */
/*
* Unset/unused
*/
UNSET = 0;
/** Set gpio gpios based on gpio_mask/gpio_value */
/*
* Set gpio gpios based on gpio_mask/gpio_value
*/
WRITE_GPIOS = 1;
/** We are now interested in watching the gpio_mask gpios. If the selected gpios change, please broadcast
GPIOS_CHANGED.
Will implicitly change the gpios requested to be INPUT gpios.
*/
/*
* We are now interested in watching the gpio_mask gpios.
* If the selected gpios change, please broadcast GPIOS_CHANGED.
*
* Will implicitly change the gpios requested to be INPUT gpios.
*/
WATCH_GPIOS = 2;
/** The gpios listed in gpio_mask have changed, the new values are listed in gpio_value */
/*
* The gpios listed in gpio_mask have changed, the new values are listed in gpio_value
*/
GPIOS_CHANGED = 3;
/** Read the gpios specified in gpio_mask, send back a READ_GPIOS_REPLY reply with gpio_value populated */
/*
* Read the gpios specified in gpio_mask, send back a READ_GPIOS_REPLY reply with gpio_value populated
*/
READ_GPIOS = 4;
/** A reply to READ_GPIOS. gpio_mask and gpio_value will be populated */
/*
* A reply to READ_GPIOS. gpio_mask and gpio_value will be populated
*/
READ_GPIOS_REPLY = 5;
}
/** What type of HardwareMessage is this? */
/*
* What type of HardwareMessage is this?
*/
Type typ = 1;
/** What gpios are we changing. Not used for all MessageTypes, see MessageType for details */
/*
* What gpios are we changing. Not used for all MessageTypes, see MessageType for details
*/
uint64 gpio_mask = 2;
/** 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 */
/*
* 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 gpio_value = 3;
}
}