diff --git a/src/mesh/generated/admin.pb.c b/src/mesh/generated/admin.pb.c index 4b90c51ae..688cba334 100644 --- a/src/mesh/generated/admin.pb.c +++ b/src/mesh/generated/admin.pb.c @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.4 */ +/* Generated by nanopb-0.4.5 */ #include "admin.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/admin.pb.h b/src/mesh/generated/admin.pb.h index 6230efbe2..8a6034182 100644 --- a/src/mesh/generated/admin.pb.h +++ b/src/mesh/generated/admin.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.4 */ +/* Generated by nanopb-0.4.5 */ #ifndef PB_ADMIN_PB_H_INCLUDED #define PB_ADMIN_PB_H_INCLUDED @@ -13,7 +13,11 @@ #endif /* Struct definitions */ -typedef struct _AdminMessage { +/* This message is handled by the Admin module and is responsible for all settings/channel read/write operations. + This message is used to do settings operations to both remote AND local nodes. + (Prior to 1.2 these operations were done via special ToRadio operations) */ +typedef struct _AdminMessage { + /* Set the radio provisioning for this node */ pb_size_t which_variant; union { RadioConfig set_radio; @@ -42,7 +46,7 @@ typedef struct _AdminMessage { char set_canned_message_module_part3[201]; char set_canned_message_module_part4[201]; int32_t shutdown_seconds; - }; + }; } AdminMessage; diff --git a/src/mesh/generated/apponly.pb.c b/src/mesh/generated/apponly.pb.c index bebc8b75b..6e02c499c 100644 --- a/src/mesh/generated/apponly.pb.c +++ b/src/mesh/generated/apponly.pb.c @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.4 */ +/* Generated by nanopb-0.4.5 */ #include "apponly.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/apponly.pb.h b/src/mesh/generated/apponly.pb.h index f1421b5e7..49b9f75fd 100644 --- a/src/mesh/generated/apponly.pb.h +++ b/src/mesh/generated/apponly.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.4 */ +/* Generated by nanopb-0.4.5 */ #ifndef PB_APPONLY_PB_H_INCLUDED #define PB_APPONLY_PB_H_INCLUDED @@ -11,8 +11,14 @@ #endif /* Struct definitions */ -typedef struct _ChannelSet { - pb_callback_t settings; +/* This is the most compact possible representation for a set of channels. + It includes only one PRIMARY channel (which must be first) and + any SECONDARY channels. + No DISABLED channels are included. + This abstraction is used only on the the 'app side' of the world (ie python, javascript and android etc) to show a group of Channels as a (long) URL */ +typedef struct _ChannelSet { + /* TODO: REPLACE */ + pb_callback_t settings; } ChannelSet; diff --git a/src/mesh/generated/cannedmessages.pb.c b/src/mesh/generated/cannedmessages.pb.c index e50dc685c..a0e8565f6 100644 --- a/src/mesh/generated/cannedmessages.pb.c +++ b/src/mesh/generated/cannedmessages.pb.c @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.4 */ +/* Generated by nanopb-0.4.5 */ #include "cannedmessages.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/cannedmessages.pb.h b/src/mesh/generated/cannedmessages.pb.h index c6d6c86ff..a546d0130 100644 --- a/src/mesh/generated/cannedmessages.pb.h +++ b/src/mesh/generated/cannedmessages.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.4 */ +/* Generated by nanopb-0.4.5 */ #ifndef PB_CANNEDMESSAGES_PB_H_INCLUDED #define PB_CANNEDMESSAGES_PB_H_INCLUDED @@ -10,11 +10,16 @@ #endif /* Struct definitions */ -typedef struct _CannedMessageModuleConfig { - char messagesPart1[201]; - char messagesPart2[201]; - char messagesPart3[201]; - char messagesPart4[201]; +/* Canned message module configuration. */ +typedef struct _CannedMessageModuleConfig { + /* Predefined messages for canned message module separated by '|' characters. */ + char messagesPart1[201]; + /* TODO: REPLACE */ + char messagesPart2[201]; + /* TODO: REPLACE */ + char messagesPart3[201]; + /* TODO: REPLACE */ + char messagesPart4[201]; } CannedMessageModuleConfig; diff --git a/src/mesh/generated/channel.pb.c b/src/mesh/generated/channel.pb.c index 329314dae..6244818fb 100644 --- a/src/mesh/generated/channel.pb.c +++ b/src/mesh/generated/channel.pb.c @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.4 */ +/* Generated by nanopb-0.4.5 */ #include "channel.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/channel.pb.h b/src/mesh/generated/channel.pb.h index e4b54aeab..8d39397b0 100644 --- a/src/mesh/generated/channel.pb.h +++ b/src/mesh/generated/channel.pb.h @@ -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<. + Note: app developers are encouraged to also use the following standard + node IDs "^all" (for broadcast), "^local" (for the locally connected node) */ + char id[16]; + /* A full name for this user, i.e. "Kevin Hester" */ + char long_name[40]; + /* A VERY short name, ideally two characters. + Suitable for a tiny OLED screen */ + char short_name[5]; + /* This is the addr of the radio. + Not populated by the phone, but added by the esp32 when broadcasting */ + pb_byte_t macaddr[6]; + /* 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; + /* 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; + /* Participants in the same network can self-group into different teams. + Short-term this can be used to visually differentiate them on the map; + in the longer term it could also help users to semi-automatically + select or ignore messages according to team affiliation. + In total, 14 teams are defined (encoded in 4 bits) */ + Team team; + /* Transmit power at antenna connector, in decibel-milliwatt + An optional self-reported value useful in network planning, discovery + and positioning - along with ant_gain_dbi and ant_azimuth below */ + uint32_t tx_power_dbm; + /* Antenna gain (applicable to both Tx and Rx), in decibel-isotropic */ + uint32_t ant_gain_dbi; + /* Directional antenna true azimuth *if applicable*, in degrees (0-360) + Only applicable in case of stationary nodes with a directional antenna + Zero = not applicable (mobile or omni) or not specified + (use a value of 360 to indicate an antenna azimuth of zero degrees) */ + uint32_t ant_azimuth; } User; -typedef PB_BYTES_ARRAY_T(256) MeshPacket_encrypted_t; -typedef struct _MeshPacket { - uint32_t from; - uint32_t to; - uint8_t channel; - pb_size_t which_payloadVariant; - union { - Data decoded; - MeshPacket_encrypted_t encrypted; - }; - uint32_t id; - uint32_t rx_time; - float rx_snr; - uint8_t hop_limit; - bool want_ack; - MeshPacket_Priority priority; - int32_t rx_rssi; - MeshPacket_Delayed delayed; -} MeshPacket; +typedef PB_BYTES_ARRAY_T(237) Data_payload_t; +/* (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) */ +typedef struct _Data { + /* Formerly named typ and of type Type */ + PortNum portnum; + /* TODO: REPLACE */ + Data_payload_t payload; + /* Not normally used, but for testing a sender can request that recipient + responds in kind (i.e. if it received a position, it should unicast back it's position). + Note: that if you set this on a broadcast you will receive many replies. */ + bool want_response; + /* The address of the destination node. + This field is is filled in by the mesh radio device software, application + layer software should never need it. + RouteDiscovery messages _must_ populate this. + Other message types might need to if they are doing multihop routing. */ + uint32_t dest; + /* The address of the original sender for this message. + This field should _only_ be populated for reliable multihop packets (to keep + packets small). */ + uint32_t source; + /* Only used in routing or response messages. + Indicates the original message ID that this message is reporting failure on. (formerly called original_id) */ + uint32_t request_id; + /* If set, this message is intened to be a reply to a previously sent message with the defined id. */ + uint32_t reply_id; + /* Defaults to false. If true, then what is in the payload should be treated as an emoji like giving + a message a heart or poop emoji. */ + uint32_t emoji; + /* Location structure */ + bool has_location; + Location location; +} Data; -typedef struct _NodeInfo { - uint32_t num; +/* 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 */ +typedef struct _NodeInfo { + /* The node number */ + uint32_t num; + /* The user info for this node */ bool has_user; - User user; + User user; + /* This position data. Note: before 1.2.14 we would also store the last time we've heard from this node in position.time, that is no longer true. + Position.time now indicates the last time we received a POSITION from that node. */ bool has_position; - Position position; - float snr; - uint32_t last_heard; + Position position; + /* Returns the Signal-to-noise ratio (SNR) of the last received message, + as measured by the receiver. Return SNR of the last received message in dB */ + float snr; + /* Set to indicate the last time we received a packet from this node */ + uint32_t last_heard; + /* The latest telemetry data for the node. */ bool has_telemetry; - Telemetry telemetry; + Telemetry telemetry; } NodeInfo; -typedef struct _Routing { +/* A Routing control Data packet handled by the routing module */ +typedef struct _Routing { + /* A route request going from the requester */ pb_size_t which_variant; union { RouteDiscovery route_request; RouteDiscovery route_reply; Routing_Error error_reason; - }; + }; } Routing; -typedef struct _FromRadio { - uint32_t id; +typedef PB_BYTES_ARRAY_T(256) MeshPacket_encrypted_t; +/* A packet envelope sent/received over the mesh + only payloadVariant 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. */ +typedef struct _MeshPacket { + /* The sending node number. + Note: Our crypto implementation uses this field as well. + See [crypto](/docs/developers/firmware/encryption) for details. + FIXME - really should be fixed32 instead, this encoding only hurts the ble link though. */ + uint32_t from; + /* The (immediatSee Priority description for more details.y should be fixed32 instead, this encoding only + hurts the ble link though. */ + uint32_t to; + /* (Usually) If set, this indicates the index in the secondary_channels table that this packet was sent/received on. + If unset, packet was on the primary channel. + A particular node might know only a subset of channels in use on the mesh. + 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 payloadVariant is an 'encrypted'. */ + uint8_t channel; + /* TODO: REPLACE */ + pb_size_t which_payloadVariant; + union { + Data decoded; + MeshPacket_encrypted_t encrypted; + }; + /* TODO: REPLACE */ + uint32_t id; + /* A unique ID for this packet. + Always 0 for no-ack packets or non broadcast packets (and therefore take zero bytes of space). + Otherwise a unique ID for this packet, useful for flooding algorithms. + 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/developers/firmware/encryption) for details. + FIXME - really should be fixed32 instead, this encoding only + hurts the ble link though. */ + uint32_t rx_time; + /* The time this message was received by the esp32 (secs since 1970). + Note: this field is _never_ sent on the radio link itself (to save space) Times + are typically not sent over the mesh, but they will be added to any Packet + (chain of SubPacket) sent to the phone (so the phone can know exact time of reception) */ + float rx_snr; + /* *Never* sent over the radio links. + Set during reception to indicate the SNR of this packet. + Used to collect statistics on current link quality. */ + uint8_t hop_limit; + /* If unset treated as zero (no forwarding, send to adjacent nodes only) + if 1, allow hopping through one node, etc... + For our usecase real world topologies probably have a max of about 3. + This field is normally placed into a few of bits in the header. */ + bool want_ack; + /* 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 */ + MeshPacket_Priority priority; + /* The priority of this message for sending. + See MeshPacket.Priority description for more details. */ + int32_t rx_rssi; + /* rssi of received packet. Only sent to phone for dispay purposes. */ + MeshPacket_Delayed delayed; +} MeshPacket; + +/* 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. */ +typedef struct _FromRadio { + /* The packet id, used to allow the phone to request missing read packets from the FIFO, + see our bluetooth docs */ + uint32_t id; + /* Log levels, chosen to match python logging conventions. */ pb_size_t which_payloadVariant; union { MyNodeInfo my_info; @@ -271,17 +678,20 @@ typedef struct _FromRadio { uint32_t config_complete_id; bool rebooted; MeshPacket packet; - }; + }; } FromRadio; -typedef struct _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. */ +typedef struct _ToRadio { + /* Send this packet on the mesh */ pb_size_t which_payloadVariant; union { MeshPacket packet; ToRadio_PeerInfo peer_info; uint32_t want_config_id; bool disconnect; - }; + }; } ToRadio; @@ -336,7 +746,8 @@ extern "C" { #define User_init_default {"", "", "", {0}, _HardwareModel_MIN, 0, _Team_MIN, 0, 0, 0} #define RouteDiscovery_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}} #define Routing_init_default {0, {RouteDiscovery_init_default}} -#define Data_init_default {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0} +#define Data_init_default {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0, false, Location_init_default} +#define Location_init_default {0, 0, 0, 0, 0} #define MeshPacket_init_default {0, 0, 0, 0, {Data_init_default}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN, 0, _MeshPacket_Delayed_MIN} #define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, 0, 0, false, Telemetry_init_default} #define MyNodeInfo_init_default {0, 0, "", "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0} @@ -348,7 +759,8 @@ extern "C" { #define User_init_zero {"", "", "", {0}, _HardwareModel_MIN, 0, _Team_MIN, 0, 0, 0} #define RouteDiscovery_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}} #define Routing_init_zero {0, {RouteDiscovery_init_zero}} -#define Data_init_zero {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0} +#define Data_init_zero {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0, false, Location_init_zero} +#define Location_init_zero {0, 0, 0, 0, 0} #define MeshPacket_init_zero {0, 0, 0, 0, {Data_init_zero}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN, 0, _MeshPacket_Delayed_MIN} #define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, 0, 0, false, Telemetry_init_zero} #define MyNodeInfo_init_zero {0, 0, "", "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0} @@ -358,14 +770,11 @@ extern "C" { #define ToRadio_PeerInfo_init_zero {0, 0} /* Field tags (for use in manual encoding/decoding) */ -#define Data_portnum_tag 1 -#define Data_payload_tag 2 -#define Data_want_response_tag 3 -#define Data_dest_tag 4 -#define Data_source_tag 5 -#define Data_request_id_tag 6 -#define Data_reply_id_tag 7 -#define Data_is_tapback_tag 8 +#define Location_id_tag 1 +#define Location_latitude_i_tag 2 +#define Location_longitude_i_tag 3 +#define Location_expire_tag 4 +#define Location_locked_tag 5 #define LogRecord_message_tag 1 #define LogRecord_time_tag 2 #define LogRecord_source_tag 3 @@ -422,6 +831,24 @@ extern "C" { #define User_tx_power_dbm_tag 10 #define User_ant_gain_dbi_tag 11 #define User_ant_azimuth_tag 12 +#define Data_portnum_tag 1 +#define Data_payload_tag 2 +#define Data_want_response_tag 3 +#define Data_dest_tag 4 +#define Data_source_tag 5 +#define Data_request_id_tag 6 +#define Data_reply_id_tag 7 +#define Data_emoji_tag 8 +#define Data_location_tag 9 +#define NodeInfo_num_tag 1 +#define NodeInfo_user_tag 2 +#define NodeInfo_position_tag 3 +#define NodeInfo_snr_tag 4 +#define NodeInfo_last_heard_tag 5 +#define NodeInfo_telemetry_tag 6 +#define Routing_route_request_tag 1 +#define Routing_route_reply_tag 2 +#define Routing_error_reason_tag 3 #define MeshPacket_from_tag 1 #define MeshPacket_to_tag 2 #define MeshPacket_channel_tag 3 @@ -435,15 +862,6 @@ extern "C" { #define MeshPacket_priority_tag 12 #define MeshPacket_rx_rssi_tag 13 #define MeshPacket_delayed_tag 15 -#define NodeInfo_num_tag 1 -#define NodeInfo_user_tag 2 -#define NodeInfo_position_tag 3 -#define NodeInfo_snr_tag 4 -#define NodeInfo_last_heard_tag 5 -#define NodeInfo_telemetry_tag 6 -#define Routing_route_request_tag 1 -#define Routing_route_reply_tag 2 -#define Routing_error_reason_tag 3 #define FromRadio_id_tag 1 #define FromRadio_my_info_tag 3 #define FromRadio_node_info_tag 4 @@ -519,9 +937,20 @@ X(a, STATIC, SINGULAR, FIXED32, dest, 4) \ X(a, STATIC, SINGULAR, FIXED32, source, 5) \ X(a, STATIC, SINGULAR, FIXED32, request_id, 6) \ X(a, STATIC, SINGULAR, FIXED32, reply_id, 7) \ -X(a, STATIC, SINGULAR, BOOL, is_tapback, 8) +X(a, STATIC, SINGULAR, FIXED32, emoji, 8) \ +X(a, STATIC, OPTIONAL, MESSAGE, location, 9) #define Data_CALLBACK NULL #define Data_DEFAULT NULL +#define Data_location_MSGTYPE Location + +#define Location_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, UINT32, id, 1) \ +X(a, STATIC, SINGULAR, SFIXED32, latitude_i, 2) \ +X(a, STATIC, SINGULAR, SFIXED32, longitude_i, 3) \ +X(a, STATIC, SINGULAR, UINT32, expire, 4) \ +X(a, STATIC, SINGULAR, BOOL, locked, 5) +#define Location_CALLBACK NULL +#define Location_DEFAULT NULL #define MeshPacket_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, FIXED32, from, 1) \ @@ -619,6 +1048,7 @@ extern const pb_msgdesc_t User_msg; extern const pb_msgdesc_t RouteDiscovery_msg; extern const pb_msgdesc_t Routing_msg; extern const pb_msgdesc_t Data_msg; +extern const pb_msgdesc_t Location_msg; extern const pb_msgdesc_t MeshPacket_msg; extern const pb_msgdesc_t NodeInfo_msg; extern const pb_msgdesc_t MyNodeInfo_msg; @@ -633,6 +1063,7 @@ extern const pb_msgdesc_t ToRadio_PeerInfo_msg; #define RouteDiscovery_fields &RouteDiscovery_msg #define Routing_fields &Routing_msg #define Data_fields &Data_msg +#define Location_fields &Location_msg #define MeshPacket_fields &MeshPacket_msg #define NodeInfo_fields &NodeInfo_msg #define MyNodeInfo_fields &MyNodeInfo_msg @@ -642,18 +1073,19 @@ extern const pb_msgdesc_t ToRadio_PeerInfo_msg; #define ToRadio_PeerInfo_fields &ToRadio_PeerInfo_msg /* Maximum encoded size of messages (where known) */ +#define Data_size 296 +#define FromRadio_size 356 +#define Location_size 24 +#define LogRecord_size 81 +#define MeshPacket_size 347 +#define MyNodeInfo_size 210 +#define NodeInfo_size 315 #define Position_size 142 -#define User_size 97 #define RouteDiscovery_size 40 #define Routing_size 42 -#define Data_size 267 -#define MeshPacket_size 318 -#define NodeInfo_size 315 -#define MyNodeInfo_size 210 -#define LogRecord_size 81 -#define FromRadio_size 327 -#define ToRadio_size 321 #define ToRadio_PeerInfo_size 8 +#define ToRadio_size 350 +#define User_size 97 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/mqtt.pb.c b/src/mesh/generated/mqtt.pb.c index a93584c3b..4645903a7 100644 --- a/src/mesh/generated/mqtt.pb.c +++ b/src/mesh/generated/mqtt.pb.c @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.4 */ +/* Generated by nanopb-0.4.5 */ #include "mqtt.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/mqtt.pb.h b/src/mesh/generated/mqtt.pb.h index a8f55470a..ffb1a65fe 100644 --- a/src/mesh/generated/mqtt.pb.h +++ b/src/mesh/generated/mqtt.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.4 */ +/* Generated by nanopb-0.4.5 */ #ifndef PB_MQTT_PB_H_INCLUDED #define PB_MQTT_PB_H_INCLUDED @@ -11,10 +11,16 @@ #endif /* Struct definitions */ -typedef struct _ServiceEnvelope { - struct _MeshPacket *packet; - char *channel_id; - char *gateway_id; +/* This message wraps a MeshPacket with extra metadata about the sender and how it arrived. */ +typedef struct _ServiceEnvelope { + /* The (probably encrypted) packet */ + struct _MeshPacket *packet; + /* The global channel ID it was sent on */ + char *channel_id; + /* The sending gateway node ID. 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 */ + char *gateway_id; } ServiceEnvelope; diff --git a/src/mesh/generated/portnums.pb.c b/src/mesh/generated/portnums.pb.c index 4220806db..fe5402a04 100644 --- a/src/mesh/generated/portnums.pb.c +++ b/src/mesh/generated/portnums.pb.c @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.4 */ +/* Generated by nanopb-0.4.5 */ #include "portnums.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/portnums.pb.h b/src/mesh/generated/portnums.pb.h index 0ba48d592..38dfa0aae 100644 --- a/src/mesh/generated/portnums.pb.h +++ b/src/mesh/generated/portnums.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.4 */ +/* Generated by nanopb-0.4.5 */ #ifndef PB_PORTNUMS_PB_H_INCLUDED #define PB_PORTNUMS_PB_H_INCLUDED @@ -10,24 +10,79 @@ #endif /* Enum definitions */ -typedef enum _PortNum { - PortNum_UNKNOWN_APP = 0, - PortNum_TEXT_MESSAGE_APP = 1, - PortNum_REMOTE_HARDWARE_APP = 2, - PortNum_POSITION_APP = 3, - PortNum_NODEINFO_APP = 4, - PortNum_ROUTING_APP = 5, - PortNum_ADMIN_APP = 6, - PortNum_REPLY_APP = 32, - PortNum_IP_TUNNEL_APP = 33, - PortNum_SERIAL_APP = 64, - PortNum_STORE_FORWARD_APP = 65, - PortNum_RANGE_TEST_APP = 66, - PortNum_TELEMETRY_APP = 67, - PortNum_ZPS_APP = 68, - PortNum_PRIVATE_APP = 256, - PortNum_ATAK_FORWARDER = 257, - PortNum_MAX = 511 +/* 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. */ +typedef 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 */ + PortNum_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 */ + PortNum_TEXT_MESSAGE_APP = 1, + /* Reserved for built-in GPIO/example app. + See remote_hardware.proto/HardwareMessage for details on the message sent/received to this port number */ + PortNum_REMOTE_HARDWARE_APP = 2, + /* The built-in position messaging app. + Payload is a [Position](/docs/developers/protobufs/api#position) message */ + PortNum_POSITION_APP = 3, + /* The built-in user info app. + Payload is a [User](/docs/developers/protobufs/api#user) message */ + PortNum_NODEINFO_APP = 4, + /* Protocol control packets for mesh protocol use. + Payload is a [Routing](/docs/developers/protobufs/api#routing) message */ + PortNum_ROUTING_APP = 5, + /* Admin control packets. + Payload is a [AdminMessage](/docs/developers/protobufs/api#adminmessage) message */ + PortNum_ADMIN_APP = 6, + /* Provides a 'ping' service that replies to any packet it receives. + Also serves as a small example module. */ + PortNum_REPLY_APP = 32, + /* Used for the python IP tunnel feature */ + PortNum_IP_TUNNEL_APP = 33, + /* 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. + Module is disabled by default can be turned on by setting SERIAL_MODULE_ENABLED = 1 in SerialPlugh.cpp. */ + PortNum_SERIAL_APP = 64, + /* STORE_FORWARD_APP (Work in Progress) + Maintained by Jm Casler (MC Hamster) : jm@casler.org */ + PortNum_STORE_FORWARD_APP = 65, + /* Optional port for messages for the range test module. */ + PortNum_RANGE_TEST_APP = 66, + /* Provides a format to send and receive telemetry data from the Meshtastic network. + Maintained by Charles Crossan (crossan007) : crossan007@gmail.com */ + PortNum_TELEMETRY_APP = 67, + /* Experimental tools for estimating node position without a GPS + Maintained by Github user a-f-G-U-C (a Meshtastic contributor) + Project files at https://github.com/a-f-G-U-C/Meshtastic-ZPS */ + PortNum_ZPS_APP = 68, + /* 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 [regen-protos.sh](https://github.com/meshtastic/Meshtastic-device/blob/master/bin/regen-protos.sh)) */ + PortNum_PRIVATE_APP = 256, + /* ATAK Forwarder Module https://github.com/paulmandal/atak-forwarder */ + PortNum_ATAK_FORWARDER = 257, + /* Currently we limit port nums to no higher than this value */ + PortNum_MAX = 511 } PortNum; /* Helper constants for enums */ diff --git a/src/mesh/generated/radioconfig.pb.c b/src/mesh/generated/radioconfig.pb.c index 26930ae3c..ea4516306 100644 --- a/src/mesh/generated/radioconfig.pb.c +++ b/src/mesh/generated/radioconfig.pb.c @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.4 */ +/* Generated by nanopb-0.4.5 */ #include "radioconfig.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/radioconfig.pb.h b/src/mesh/generated/radioconfig.pb.h index 0efd9cedb..c7a230500 100644 --- a/src/mesh/generated/radioconfig.pb.h +++ b/src/mesh/generated/radioconfig.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.4 */ +/* Generated by nanopb-0.4.5 */ #ifndef PB_RADIOCONFIG_PB_H_INCLUDED #define PB_RADIOCONFIG_PB_H_INCLUDED @@ -10,185 +10,294 @@ #endif /* Enum definitions */ -typedef enum _RegionCode { - RegionCode_Unset = 0, - RegionCode_US = 1, - RegionCode_EU433 = 2, - RegionCode_EU868 = 3, - RegionCode_CN = 4, - RegionCode_JP = 5, - RegionCode_ANZ = 6, - RegionCode_KR = 7, - RegionCode_TW = 8, - RegionCode_RU = 9, - RegionCode_IN = 10, - RegionCode_NZ865 = 11, - RegionCode_TH = 12 +/* The frequency/regulatory region the user has selected. + + Note: In 1.0 builds (which must still be supported by the android app for a + long time) this field will be unpopulated. + + If firmware is ever upgraded from an old 1.0ish build, the old + MyNodeInfo.region string will be used to set UserPreferences.region and the + old value will be no longer set. */ +typedef enum _RegionCode { + /* TODO: REPLACE */ + RegionCode_Unset = 0, + /* TODO: REPLACE */ + RegionCode_US = 1, + /* TODO: REPLACE */ + RegionCode_EU433 = 2, + /* TODO: REPLACE */ + RegionCode_EU868 = 3, + /* TODO: REPLACE */ + RegionCode_CN = 4, + /* TODO: REPLACE */ + RegionCode_JP = 5, + /* TODO: REPLACE */ + RegionCode_ANZ = 6, + /* TODO: REPLACE */ + RegionCode_KR = 7, + /* TODO: REPLACE */ + RegionCode_TW = 8, + /* TODO: REPLACE */ + RegionCode_RU = 9, + /* TODO: REPLACE */ + RegionCode_IN = 10, + /* TODO: REPLACE */ + RegionCode_NZ865 = 11, + /* TODO: REPLACE */ + RegionCode_TH = 12 } RegionCode; -typedef enum _Role { - Role_Default = 0, - Role_Router = 1 +/* Defines the device's role on the Mesh network + unset + Behave normally. + + Router + Functions as a router */ +typedef enum _Role { + /* Default device role */ + Role_Default = 0, + /* Router device role */ + Role_Router = 1 } Role; -typedef enum _ChargeCurrent { - ChargeCurrent_MAUnset = 0, - ChargeCurrent_MA100 = 1, - ChargeCurrent_MA190 = 2, - ChargeCurrent_MA280 = 3, - ChargeCurrent_MA360 = 4, - ChargeCurrent_MA450 = 5, - ChargeCurrent_MA550 = 6, - ChargeCurrent_MA630 = 7, - ChargeCurrent_MA700 = 8, - ChargeCurrent_MA780 = 9, - ChargeCurrent_MA880 = 10, - ChargeCurrent_MA960 = 11, - ChargeCurrent_MA1000 = 12, - ChargeCurrent_MA1080 = 13, - ChargeCurrent_MA1160 = 14, - ChargeCurrent_MA1240 = 15, - ChargeCurrent_MA1320 = 16 +/* 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. */ +typedef enum _ChargeCurrent { + /* TODO: REPLACE */ + ChargeCurrent_MAUnset = 0, + /* TODO: REPLACE */ + ChargeCurrent_MA100 = 1, + /* TODO: REPLACE */ + ChargeCurrent_MA190 = 2, + /* TODO: REPLACE */ + ChargeCurrent_MA280 = 3, + /* TODO: REPLACE */ + ChargeCurrent_MA360 = 4, + /* TODO: REPLACE */ + ChargeCurrent_MA450 = 5, + /* TODO: REPLACE */ + ChargeCurrent_MA550 = 6, + /* TODO: REPLACE */ + ChargeCurrent_MA630 = 7, + /* TODO: REPLACE */ + ChargeCurrent_MA700 = 8, + /* TODO: REPLACE */ + ChargeCurrent_MA780 = 9, + /* TODO: REPLACE */ + ChargeCurrent_MA880 = 10, + /* TODO: REPLACE */ + ChargeCurrent_MA960 = 11, + /* TODO: REPLACE */ + ChargeCurrent_MA1000 = 12, + /* TODO: REPLACE */ + ChargeCurrent_MA1080 = 13, + /* TODO: REPLACE */ + ChargeCurrent_MA1160 = 14, + /* TODO: REPLACE */ + ChargeCurrent_MA1240 = 15, + /* TODO: REPLACE */ + ChargeCurrent_MA1320 = 16 } ChargeCurrent; -typedef enum _GpsCoordinateFormat { - GpsCoordinateFormat_GpsFormatDec = 0, - GpsCoordinateFormat_GpsFormatDMS = 1, - GpsCoordinateFormat_GpsFormatUTM = 2, - GpsCoordinateFormat_GpsFormatMGRS = 3, - GpsCoordinateFormat_GpsFormatOLC = 4, - GpsCoordinateFormat_GpsFormatOSGR = 5 +/* How the GPS coordinates are displayed on the OLED screen. */ +typedef enum _GpsCoordinateFormat { + /* GPS coordinates are displayed in the normal decimal degrees format: + DD.DDDDDD DDD.DDDDDD */ + GpsCoordinateFormat_GpsFormatDec = 0, + /* GPS coordinates are displayed in the degrees minutes seconds format: + DD°MM'SS"C DDD°MM'SS"C, where C is the compass point representing the locations quadrant */ + GpsCoordinateFormat_GpsFormatDMS = 1, + /* GPS coordinates are displayed in Universal Transverse Mercator format: + ZZB EEEEEE NNNNNNN, where Z is zone, B is band, E is easting, N is northing */ + GpsCoordinateFormat_GpsFormatUTM = 2, + /* GPS coordinates are displayed in Military Grid Reference System format: + ZZB CD EEEEE NNNNN, where Z is zone, B is band, C is the east 100k square, D is the north 100k square, + E is easting, N is northing */ + GpsCoordinateFormat_GpsFormatMGRS = 3, + /* GPS coordinates are displayed in Open Location Code (aka Plus Codes). */ + GpsCoordinateFormat_GpsFormatOLC = 4, + /* GPS coordinates are displayed in Ordnance Survey Grid Reference (the National Grid System of the UK). + Format: AB EEEEE NNNNN, where A is the east 100k square, B is the north 100k square, E is the easting, + N is the northing */ + GpsCoordinateFormat_GpsFormatOSGR = 5 } GpsCoordinateFormat; -typedef enum _PositionFlags { - PositionFlags_POS_UNDEFINED = 0, - PositionFlags_POS_ALTITUDE = 1, - PositionFlags_POS_ALT_MSL = 2, - PositionFlags_POS_GEO_SEP = 4, - PositionFlags_POS_DOP = 8, - PositionFlags_POS_HVDOP = 16, - PositionFlags_POS_BATTERY = 32, - PositionFlags_POS_SATINVIEW = 64, - PositionFlags_POS_SEQ_NOS = 128, - PositionFlags_POS_TIMESTAMP = 256 +/* Bit field of boolean configuration options, indicating which optional + fields to include when assembling POSITION messages + Longitude and latitude are always included (also time if GPS-synced) + + NOTE: the more fields are included, the larger the message will be - + leading to longer airtime and a higher risk of packet loss */ +typedef enum _PositionFlags { + /* Required for compilation */ + PositionFlags_POS_UNDEFINED = 0, + /* Include an altitude value (if available) */ + PositionFlags_POS_ALTITUDE = 1, + /* Altitude value is MSL */ + PositionFlags_POS_ALT_MSL = 2, + /* Include geoidal separation */ + PositionFlags_POS_GEO_SEP = 4, + /* Include the DOP value ; PDOP used by default, see below */ + PositionFlags_POS_DOP = 8, + /* If POS_DOP set, send separate HDOP / VDOP values instead of PDOP */ + PositionFlags_POS_HVDOP = 16, + /* Include battery level */ + PositionFlags_POS_BATTERY = 32, + /* Include number of "satellites in view" */ + PositionFlags_POS_SATINVIEW = 64, + /* Include a sequence number incremented per packet */ + PositionFlags_POS_SEQ_NOS = 128, + /* Include positional timestamp (from GPS solution) */ + PositionFlags_POS_TIMESTAMP = 256 } PositionFlags; -typedef enum _InputEventChar { - InputEventChar_KEY_NONE = 0, - InputEventChar_KEY_UP = 17, - InputEventChar_KEY_DOWN = 18, - InputEventChar_KEY_LEFT = 19, - InputEventChar_KEY_RIGHT = 20, - InputEventChar_KEY_SELECT = 10, - InputEventChar_KEY_BACK = 27, - InputEventChar_KEY_CANCEL = 24 +/* TODO: REPLACE */ +typedef enum _InputEventChar { + /* TODO: REPLACE */ + InputEventChar_KEY_NONE = 0, + /* TODO: REPLACE */ + InputEventChar_KEY_UP = 17, + /* TODO: REPLACE */ + InputEventChar_KEY_DOWN = 18, + /* TODO: REPLACE */ + InputEventChar_KEY_LEFT = 19, + /* TODO: REPLACE */ + InputEventChar_KEY_RIGHT = 20, + /* '\n' */ + InputEventChar_KEY_SELECT = 10, + /* TODO: REPLACE */ + InputEventChar_KEY_BACK = 27, + /* TODO: REPLACE */ + InputEventChar_KEY_CANCEL = 24 } InputEventChar; -typedef enum _RadioConfig_UserPreferences_TelemetrySensorType { - RadioConfig_UserPreferences_TelemetrySensorType_None = 0, - RadioConfig_UserPreferences_TelemetrySensorType_DHT11 = 1, - RadioConfig_UserPreferences_TelemetrySensorType_DS18B20 = 2, - RadioConfig_UserPreferences_TelemetrySensorType_DHT12 = 3, - RadioConfig_UserPreferences_TelemetrySensorType_DHT21 = 4, - RadioConfig_UserPreferences_TelemetrySensorType_DHT22 = 5, - RadioConfig_UserPreferences_TelemetrySensorType_BME280 = 6, - RadioConfig_UserPreferences_TelemetrySensorType_BME680 = 7, - RadioConfig_UserPreferences_TelemetrySensorType_MCP9808 = 8, - RadioConfig_UserPreferences_TelemetrySensorType_SHTC3 = 9 +/* The frequency/regulatory region the user has selected. + + Note: In 1.0 builds (which must still be supported by the android app for a + long time) this field will be unpopulated. + + If firmware is ever upgraded from an old 1.0ish build, the old + MyNodeInfo.region string will be used to set UserPreferences.region and the + old value will be no longer set. */ +typedef enum _RadioConfig_UserPreferences_TelemetrySensorType { + /* TODO: REPLACE */ + RadioConfig_UserPreferences_TelemetrySensorType_None = 0, + /* TODO: REPLACE */ + RadioConfig_UserPreferences_TelemetrySensorType_DHT11 = 1, + /* TODO: REPLACE */ + RadioConfig_UserPreferences_TelemetrySensorType_DS18B20 = 2, + /* TODO: REPLACE */ + RadioConfig_UserPreferences_TelemetrySensorType_DHT12 = 3, + /* TODO: REPLACE */ + RadioConfig_UserPreferences_TelemetrySensorType_DHT21 = 4, + /* TODO: REPLACE */ + RadioConfig_UserPreferences_TelemetrySensorType_DHT22 = 5, + /* TODO: REPLACE */ + RadioConfig_UserPreferences_TelemetrySensorType_BME280 = 6, + /* TODO: REPLACE */ + RadioConfig_UserPreferences_TelemetrySensorType_BME680 = 7, + /* TODO: REPLACE */ + RadioConfig_UserPreferences_TelemetrySensorType_MCP9808 = 8, + /* TODO: REPLACE */ + RadioConfig_UserPreferences_TelemetrySensorType_SHTC3 = 9 } RadioConfig_UserPreferences_TelemetrySensorType; /* Struct definitions */ -typedef struct _RadioConfig_UserPreferences { - uint32_t position_broadcast_secs; - uint32_t send_owner_interval; - uint32_t wait_bluetooth_secs; - uint32_t screen_on_secs; - uint32_t phone_timeout_secs; - uint32_t phone_sds_timeout_sec; - uint32_t mesh_sds_timeout_secs; - uint32_t sds_secs; - uint32_t ls_secs; - uint32_t min_wake_secs; - char wifi_ssid[33]; - char wifi_password[64]; - bool wifi_ap_mode; - RegionCode region; - ChargeCurrent charge_current; - bool position_broadcast_smart_disabled; - Role role; - bool location_share_disabled; - bool gps_disabled; - uint32_t gps_update_interval; - uint32_t gps_attempt_time; - bool is_low_power; - bool fixed_position; - bool serial_disabled; - float frequency_offset; - char mqtt_server[32]; - bool mqtt_disabled; - GpsCoordinateFormat gps_format; - bool gps_accept_2d; - uint32_t gps_max_dop; - bool factory_reset; - bool debug_log_enabled; +typedef struct _RadioConfig_UserPreferences { + uint32_t position_broadcast_secs; + uint32_t send_owner_interval; + uint32_t wait_bluetooth_secs; + uint32_t screen_on_secs; + uint32_t phone_timeout_secs; + uint32_t phone_sds_timeout_sec; + uint32_t mesh_sds_timeout_secs; + uint32_t sds_secs; + uint32_t ls_secs; + uint32_t min_wake_secs; + char wifi_ssid[33]; + char wifi_password[64]; + bool wifi_ap_mode; + RegionCode region; + ChargeCurrent charge_current; + bool position_broadcast_smart_disabled; + Role role; + bool location_share_disabled; + bool gps_disabled; + uint32_t gps_update_interval; + uint32_t gps_attempt_time; + bool is_low_power; + bool fixed_position; + bool serial_disabled; + float frequency_offset; + char mqtt_server[32]; + bool mqtt_disabled; + GpsCoordinateFormat gps_format; + bool gps_accept_2d; + uint32_t gps_max_dop; + bool factory_reset; + bool debug_log_enabled; pb_size_t ignore_incoming_count; - uint32_t ignore_incoming[3]; - bool serial_module_enabled; - bool serial_module_echo; - uint32_t serial_module_rxd; - uint32_t serial_module_txd; - uint32_t serial_module_timeout; - uint32_t serial_module_mode; - bool ext_notification_module_enabled; - uint32_t ext_notification_module_output_ms; - uint32_t ext_notification_module_output; - bool ext_notification_module_active; - bool ext_notification_module_alert_message; - bool ext_notification_module_alert_bell; - bool range_test_module_enabled; - uint32_t range_test_module_sender; - bool range_test_module_save; - uint32_t store_forward_module_records; - uint32_t store_forward_module_history_return_max; - uint32_t store_forward_module_history_return_window; - bool telemetry_module_measurement_enabled; - bool telemetry_module_screen_enabled; - uint32_t telemetry_module_read_error_count_threshold; - uint32_t telemetry_module_update_interval; - uint32_t telemetry_module_recovery_interval; - bool telemetry_module_display_fahrenheit; - RadioConfig_UserPreferences_TelemetrySensorType telemetry_module_sensor_type; - uint32_t telemetry_module_sensor_pin; - bool store_forward_module_enabled; - bool store_forward_module_heartbeat; - uint32_t position_flags; - bool is_always_powered; - uint32_t auto_screen_carousel_secs; - uint32_t on_battery_shutdown_after_secs; - uint32_t hop_limit; - char mqtt_username[32]; - char mqtt_password[32]; - bool is_lora_tx_disabled; - bool is_power_saving; - bool rotary1_enabled; - uint32_t inputbroker_pin_a; - uint32_t inputbroker_pin_b; - uint32_t inputbroker_pin_press; - InputEventChar inputbroker_event_cw; - InputEventChar inputbroker_event_ccw; - InputEventChar inputbroker_event_press; - bool updown1_enabled; - bool canned_message_module_enabled; - char canned_message_module_allow_input_source[16]; - bool canned_message_module_send_bell; - bool mqtt_encryption_enabled; - float adc_multiplier_override; - uint32_t serial_module_baud; + uint32_t ignore_incoming[3]; + bool serial_module_enabled; + bool serial_module_echo; + uint32_t serial_module_rxd; + uint32_t serial_module_txd; + uint32_t serial_module_timeout; + uint32_t serial_module_mode; + bool ext_notification_module_enabled; + uint32_t ext_notification_module_output_ms; + uint32_t ext_notification_module_output; + bool ext_notification_module_active; + bool ext_notification_module_alert_message; + bool ext_notification_module_alert_bell; + bool range_test_module_enabled; + uint32_t range_test_module_sender; + bool range_test_module_save; + uint32_t store_forward_module_records; + uint32_t store_forward_module_history_return_max; + uint32_t store_forward_module_history_return_window; + bool telemetry_module_measurement_enabled; + bool telemetry_module_screen_enabled; + uint32_t telemetry_module_read_error_count_threshold; + uint32_t telemetry_module_update_interval; + uint32_t telemetry_module_recovery_interval; + bool telemetry_module_display_fahrenheit; + RadioConfig_UserPreferences_TelemetrySensorType telemetry_module_sensor_type; + uint32_t telemetry_module_sensor_pin; + bool store_forward_module_enabled; + bool store_forward_module_heartbeat; + uint32_t position_flags; + bool is_always_powered; + uint32_t auto_screen_carousel_secs; + uint32_t on_battery_shutdown_after_secs; + uint32_t hop_limit; + char mqtt_username[32]; + char mqtt_password[32]; + bool is_lora_tx_disabled; + bool is_power_saving; + bool rotary1_enabled; + uint32_t inputbroker_pin_a; + uint32_t inputbroker_pin_b; + uint32_t inputbroker_pin_press; + InputEventChar inputbroker_event_cw; + InputEventChar inputbroker_event_ccw; + InputEventChar inputbroker_event_press; + bool updown1_enabled; + bool canned_message_module_enabled; + char canned_message_module_allow_input_source[16]; + bool canned_message_module_send_bell; + bool mqtt_encryption_enabled; + float adc_multiplier_override; + uint32_t serial_module_baud; } RadioConfig_UserPreferences; -typedef struct _RadioConfig { +/* The entire set of user settable/readable settings for our radio device. + Includes both the current channel settings and any preferences the user has + set for behavior of their node */ +typedef struct _RadioConfig { + /* TODO: REPLACE */ bool has_preferences; - RadioConfig_UserPreferences preferences; + RadioConfig_UserPreferences preferences; } RadioConfig; @@ -422,8 +531,8 @@ extern const pb_msgdesc_t RadioConfig_UserPreferences_msg; #define RadioConfig_UserPreferences_fields &RadioConfig_UserPreferences_msg /* Maximum encoded size of messages (where known) */ -#define RadioConfig_size 608 #define RadioConfig_UserPreferences_size 605 +#define RadioConfig_size 608 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/remote_hardware.pb.c b/src/mesh/generated/remote_hardware.pb.c index 77c01e60f..4a1e51035 100644 --- a/src/mesh/generated/remote_hardware.pb.c +++ b/src/mesh/generated/remote_hardware.pb.c @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.4 */ +/* Generated by nanopb-0.4.5 */ #include "remote_hardware.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/remote_hardware.pb.h b/src/mesh/generated/remote_hardware.pb.h index 853566f0c..34830ae57 100644 --- a/src/mesh/generated/remote_hardware.pb.h +++ b/src/mesh/generated/remote_hardware.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.4 */ +/* Generated by nanopb-0.4.5 */ #ifndef PB_REMOTE_HARDWARE_PB_H_INCLUDED #define PB_REMOTE_HARDWARE_PB_H_INCLUDED @@ -10,20 +10,36 @@ #endif /* Enum definitions */ -typedef enum _HardwareMessage_Type { - HardwareMessage_Type_UNSET = 0, - HardwareMessage_Type_WRITE_GPIOS = 1, - HardwareMessage_Type_WATCH_GPIOS = 2, - HardwareMessage_Type_GPIOS_CHANGED = 3, - HardwareMessage_Type_READ_GPIOS = 4, - HardwareMessage_Type_READ_GPIOS_REPLY = 5 +typedef enum _HardwareMessage_Type { + HardwareMessage_Type_UNSET = 0, + HardwareMessage_Type_WRITE_GPIOS = 1, + HardwareMessage_Type_WATCH_GPIOS = 2, + HardwareMessage_Type_GPIOS_CHANGED = 3, + HardwareMessage_Type_READ_GPIOS = 4, + HardwareMessage_Type_READ_GPIOS_REPLY = 5 } HardwareMessage_Type; /* Struct definitions */ -typedef struct _HardwareMessage { - HardwareMessage_Type typ; - uint64_t gpio_mask; - uint64_t gpio_value; +/* An example app to show off the module 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?) */ +typedef struct _HardwareMessage { + /* What type of HardwareMessage is this? */ + HardwareMessage_Type typ; + /* What gpios are we changing. Not used for all MessageTypes, see MessageType for details */ + uint64_t gpio_mask; + /* 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_t gpio_value; } HardwareMessage; diff --git a/src/mesh/generated/storeforward.pb.c b/src/mesh/generated/storeforward.pb.c index 51f7c3b92..f4f4b1777 100644 --- a/src/mesh/generated/storeforward.pb.c +++ b/src/mesh/generated/storeforward.pb.c @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.4 */ +/* Generated by nanopb-0.4.5 */ #include "storeforward.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/storeforward.pb.h b/src/mesh/generated/storeforward.pb.h index 9c346cd96..7d7bdf9c4 100644 --- a/src/mesh/generated/storeforward.pb.h +++ b/src/mesh/generated/storeforward.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.4 */ +/* Generated by nanopb-0.4.5 */ #ifndef PB_STOREFORWARD_PB_H_INCLUDED #define PB_STOREFORWARD_PB_H_INCLUDED @@ -10,54 +10,59 @@ #endif /* Enum definitions */ -typedef enum _StoreAndForward_RequestResponse { - StoreAndForward_RequestResponse_UNSET = 0, - StoreAndForward_RequestResponse_ROUTER_ERROR = 1, - StoreAndForward_RequestResponse_ROUTER_HEARTBEAT = 2, - StoreAndForward_RequestResponse_ROUTER_PING = 3, - StoreAndForward_RequestResponse_ROUTER_PONG = 4, - StoreAndForward_RequestResponse_ROUTER_BUSY = 5, - StoreAndForward_RequestResponse_ROUTER_HISTORY = 6, - StoreAndForward_RequestResponse_CLIENT_ERROR = 101, - StoreAndForward_RequestResponse_CLIENT_HISTORY = 102, - StoreAndForward_RequestResponse_CLIENT_STATS = 103, - StoreAndForward_RequestResponse_CLIENT_PING = 104, - StoreAndForward_RequestResponse_CLIENT_PONG = 105, - StoreAndForward_RequestResponse_CLIENT_ABORT = 106 +typedef enum _StoreAndForward_RequestResponse { + StoreAndForward_RequestResponse_UNSET = 0, + StoreAndForward_RequestResponse_ROUTER_ERROR = 1, + StoreAndForward_RequestResponse_ROUTER_HEARTBEAT = 2, + StoreAndForward_RequestResponse_ROUTER_PING = 3, + StoreAndForward_RequestResponse_ROUTER_PONG = 4, + StoreAndForward_RequestResponse_ROUTER_BUSY = 5, + StoreAndForward_RequestResponse_ROUTER_HISTORY = 6, + StoreAndForward_RequestResponse_CLIENT_ERROR = 101, + StoreAndForward_RequestResponse_CLIENT_HISTORY = 102, + StoreAndForward_RequestResponse_CLIENT_STATS = 103, + StoreAndForward_RequestResponse_CLIENT_PING = 104, + StoreAndForward_RequestResponse_CLIENT_PONG = 105, + StoreAndForward_RequestResponse_CLIENT_ABORT = 106 } StoreAndForward_RequestResponse; /* Struct definitions */ -typedef struct _StoreAndForward_Heartbeat { - uint32_t period; - uint32_t secondary; +typedef struct _StoreAndForward_Heartbeat { + uint32_t period; + uint32_t secondary; } StoreAndForward_Heartbeat; -typedef struct _StoreAndForward_History { - uint32_t history_messages; - uint32_t window; - uint32_t last_request; +typedef struct _StoreAndForward_History { + uint32_t history_messages; + uint32_t window; + uint32_t last_request; } StoreAndForward_History; -typedef struct _StoreAndForward_Statistics { - uint32_t messages_total; - uint32_t messages_saved; - uint32_t messages_max; - uint32_t up_time; - uint32_t requests; - uint32_t requests_history; - bool heartbeat; - uint32_t return_max; - uint32_t return_window; +typedef struct _StoreAndForward_Statistics { + uint32_t messages_total; + uint32_t messages_saved; + uint32_t messages_max; + uint32_t up_time; + uint32_t requests; + uint32_t requests_history; + bool heartbeat; + uint32_t return_max; + uint32_t return_window; } StoreAndForward_Statistics; -typedef struct _StoreAndForward { - StoreAndForward_RequestResponse rr; +/* TODO: REPLACE */ +typedef struct _StoreAndForward { + /* TODO: REPLACE */ + StoreAndForward_RequestResponse rr; + /* TODO: REPLACE */ bool has_stats; - StoreAndForward_Statistics stats; + StoreAndForward_Statistics stats; + /* TODO: REPLACE */ bool has_history; - StoreAndForward_History history; + StoreAndForward_History history; + /* TODO: REPLACE */ bool has_heartbeat; - StoreAndForward_Heartbeat heartbeat; + StoreAndForward_Heartbeat heartbeat; } StoreAndForward; @@ -151,10 +156,10 @@ extern const pb_msgdesc_t StoreAndForward_Heartbeat_msg; #define StoreAndForward_Heartbeat_fields &StoreAndForward_Heartbeat_msg /* Maximum encoded size of messages (where known) */ -#define StoreAndForward_size 88 -#define StoreAndForward_Statistics_size 50 -#define StoreAndForward_History_size 18 #define StoreAndForward_Heartbeat_size 12 +#define StoreAndForward_History_size 18 +#define StoreAndForward_Statistics_size 50 +#define StoreAndForward_size 88 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/telemetry.pb.c b/src/mesh/generated/telemetry.pb.c index 25f04010a..11d7b0d06 100644 --- a/src/mesh/generated/telemetry.pb.c +++ b/src/mesh/generated/telemetry.pb.c @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.4 */ +/* Generated by nanopb-0.4.5 */ #include "telemetry.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/telemetry.pb.h b/src/mesh/generated/telemetry.pb.h index cc1825c3e..f71aa58f2 100644 --- a/src/mesh/generated/telemetry.pb.h +++ b/src/mesh/generated/telemetry.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.4 */ +/* Generated by nanopb-0.4.5 */ #ifndef PB_TELEMETRY_PB_H_INCLUDED #define PB_TELEMETRY_PB_H_INCLUDED @@ -10,18 +10,35 @@ #endif /* Struct definitions */ -typedef struct _Telemetry { - uint32_t time; - uint32_t battery_level; - float channel_utilization; - float air_util_tx; - bool router_heartbeat; - float temperature; - float relative_humidity; - float barometric_pressure; - float gas_resistance; - float voltage; - float current; +/* TODO: REPLACE */ +typedef struct _Telemetry { + /* 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 (IE Mobile Phone). + seconds since 1970 */ + uint32_t time; + /* 1-100 (0 means powered) */ + uint32_t battery_level; + /* Utilization for the current channel, including well formed TX, RX and malformed RX (aka noise). */ + float channel_utilization; + /* Percent of airtime for transmission used within the last hour. */ + float air_util_tx; + /* This is sent by node only if it a router and if hop_limit is set to 0 + and is not being sent as a reliable message. */ + bool router_heartbeat; + /* Temperature measured */ + float temperature; + /* Relative humidity percent measured */ + float relative_humidity; + /* Barometric pressure in hPA measured */ + float barometric_pressure; + /* Gas resistance in mOhm measured */ + float gas_resistance; + /* Voltage measured */ + float voltage; + /* Current measured */ + float current; } Telemetry;