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