Merge branch 'master' into rsyslog-client
This commit is contained in:
+38
-39
@@ -45,23 +45,23 @@ int16_t Channels::generateHash(ChannelIndex channelNum)
|
||||
/**
|
||||
* Validate a channel, fixing any errors as needed
|
||||
*/
|
||||
Channel &Channels::fixupChannel(ChannelIndex chIndex)
|
||||
meshtastic_Channel &Channels::fixupChannel(ChannelIndex chIndex)
|
||||
{
|
||||
Channel &ch = getByIndex(chIndex);
|
||||
meshtastic_Channel &ch = getByIndex(chIndex);
|
||||
|
||||
ch.index = chIndex; // Preinit the index so it be ready to share with the phone (we'll never change it later)
|
||||
|
||||
if (!ch.has_settings) {
|
||||
// No settings! Must disable and skip
|
||||
ch.role = Channel_Role_DISABLED;
|
||||
ch.role = meshtastic_Channel_Role_DISABLED;
|
||||
memset(&ch.settings, 0, sizeof(ch.settings));
|
||||
ch.has_settings = true;
|
||||
} else {
|
||||
ChannelSettings &channelSettings = ch.settings;
|
||||
meshtastic_ChannelSettings &meshtastic_channelSettings = ch.settings;
|
||||
|
||||
// Convert the old string "Default" to our new short representation
|
||||
if (strcmp(channelSettings.name, "Default") == 0)
|
||||
*channelSettings.name = '\0';
|
||||
if (strcmp(meshtastic_channelSettings.name, "Default") == 0)
|
||||
*meshtastic_channelSettings.name = '\0';
|
||||
}
|
||||
|
||||
hashes[chIndex] = generateHash(chIndex);
|
||||
@@ -74,11 +74,11 @@ Channel &Channels::fixupChannel(ChannelIndex chIndex)
|
||||
*/
|
||||
void Channels::initDefaultChannel(ChannelIndex chIndex)
|
||||
{
|
||||
Channel &ch = getByIndex(chIndex);
|
||||
ChannelSettings &channelSettings = ch.settings;
|
||||
Config_LoRaConfig &loraConfig = config.lora;
|
||||
meshtastic_Channel &ch = getByIndex(chIndex);
|
||||
meshtastic_ChannelSettings &channelSettings = ch.settings;
|
||||
meshtastic_Config_LoRaConfig &loraConfig = config.lora;
|
||||
|
||||
loraConfig.modem_preset = Config_LoRaConfig_ModemPreset_LONG_FAST; // Default to Long Range & Fast
|
||||
loraConfig.modem_preset = meshtastic_Config_LoRaConfig_ModemPreset_LONG_FAST; // Default to Long Range & Fast
|
||||
loraConfig.use_preset = true;
|
||||
loraConfig.tx_power = 0; // default
|
||||
uint8_t defaultpskIndex = 1;
|
||||
@@ -87,25 +87,25 @@ void Channels::initDefaultChannel(ChannelIndex chIndex)
|
||||
strncpy(channelSettings.name, "", sizeof(channelSettings.name));
|
||||
|
||||
ch.has_settings = true;
|
||||
ch.role = Channel_Role_PRIMARY;
|
||||
ch.role = meshtastic_Channel_Role_PRIMARY;
|
||||
}
|
||||
|
||||
CryptoKey Channels::getKey(ChannelIndex chIndex)
|
||||
{
|
||||
Channel &ch = getByIndex(chIndex);
|
||||
const ChannelSettings &channelSettings = ch.settings;
|
||||
meshtastic_Channel &ch = getByIndex(chIndex);
|
||||
const meshtastic_ChannelSettings &channelSettings = ch.settings;
|
||||
assert(ch.has_settings);
|
||||
|
||||
CryptoKey k;
|
||||
memset(k.bytes, 0, sizeof(k.bytes)); // In case the user provided a short key, we want to pad the rest with zeros
|
||||
|
||||
if (ch.role == Channel_Role_DISABLED) {
|
||||
if (ch.role == meshtastic_Channel_Role_DISABLED) {
|
||||
k.length = -1; // invalid
|
||||
} else {
|
||||
memcpy(k.bytes, channelSettings.psk.bytes, channelSettings.psk.size);
|
||||
k.length = channelSettings.psk.size;
|
||||
if (k.length == 0) {
|
||||
if (ch.role == Channel_Role_SECONDARY) {
|
||||
if (ch.role == meshtastic_Channel_Role_SECONDARY) {
|
||||
LOG_DEBUG("Unset PSK for secondary channel %s. using primary key\n", ch.settings.name);
|
||||
k = getKey(primaryIndex);
|
||||
} else
|
||||
@@ -120,7 +120,7 @@ CryptoKey Channels::getKey(ChannelIndex chIndex)
|
||||
else if (oemStore.oem_aes_key.size > 1) {
|
||||
// Use the OEM key
|
||||
LOG_DEBUG("Using OEM Key with %d bytes\n", oemStore.oem_aes_key.size);
|
||||
memcpy(k.bytes, oemStore.oem_aes_key.bytes , oemStore.oem_aes_key.size);
|
||||
memcpy(k.bytes, oemStore.oem_aes_key.bytes, oemStore.oem_aes_key.size);
|
||||
k.length = oemStore.oem_aes_key.size;
|
||||
// Bump up the last byte of PSK as needed
|
||||
uint8_t *last = k.bytes + oemStore.oem_aes_key.size - 1;
|
||||
@@ -182,24 +182,24 @@ void Channels::onConfigChanged()
|
||||
{
|
||||
// Make sure the phone hasn't mucked anything up
|
||||
for (int i = 0; i < channelFile.channels_count; i++) {
|
||||
Channel &ch = fixupChannel(i);
|
||||
meshtastic_Channel &ch = fixupChannel(i);
|
||||
|
||||
if (ch.role == Channel_Role_PRIMARY)
|
||||
if (ch.role == meshtastic_Channel_Role_PRIMARY)
|
||||
primaryIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
Channel &Channels::getByIndex(ChannelIndex chIndex)
|
||||
meshtastic_Channel &Channels::getByIndex(ChannelIndex chIndex)
|
||||
{
|
||||
// remove this assert cause malformed packets can make our firmware reboot here.
|
||||
if (chIndex < channelFile.channels_count) { // This should be equal to MAX_NUM_CHANNELS
|
||||
Channel *ch = channelFile.channels + chIndex;
|
||||
meshtastic_Channel *ch = channelFile.channels + chIndex;
|
||||
return *ch;
|
||||
} else {
|
||||
LOG_ERROR("Invalid channel index %d > %d, malformed packet received?\n", chIndex , channelFile.channels_count);
|
||||
LOG_ERROR("Invalid channel index %d > %d, malformed packet received?\n", chIndex, channelFile.channels_count);
|
||||
|
||||
static Channel *ch = (Channel *)malloc(sizeof(Channel));
|
||||
memset(ch, 0, sizeof(Channel));
|
||||
static meshtastic_Channel *ch = (meshtastic_Channel *)malloc(sizeof(meshtastic_Channel));
|
||||
memset(ch, 0, sizeof(meshtastic_Channel));
|
||||
// ch.index -1 means we don't know the channel locally and need to look it up by settings.name
|
||||
// not sure this is handled right everywhere
|
||||
ch->index = -1;
|
||||
@@ -207,7 +207,7 @@ Channel &Channels::getByIndex(ChannelIndex chIndex)
|
||||
}
|
||||
}
|
||||
|
||||
Channel &Channels::getByName(const char* chName)
|
||||
meshtastic_Channel &Channels::getByName(const char *chName)
|
||||
{
|
||||
for (ChannelIndex i = 0; i < getNumChannels(); i++) {
|
||||
if (strcasecmp(getGlobalId(i), chName) == 0) {
|
||||
@@ -218,15 +218,15 @@ Channel &Channels::getByName(const char* chName)
|
||||
return getByIndex(getPrimaryIndex());
|
||||
}
|
||||
|
||||
void Channels::setChannel(const Channel &c)
|
||||
void Channels::setChannel(const meshtastic_Channel &c)
|
||||
{
|
||||
Channel &old = getByIndex(c.index);
|
||||
meshtastic_Channel &old = getByIndex(c.index);
|
||||
|
||||
// if this is the new primary, demote any existing roles
|
||||
if (c.role == Channel_Role_PRIMARY)
|
||||
if (c.role == meshtastic_Channel_Role_PRIMARY)
|
||||
for (int i = 0; i < getNumChannels(); i++)
|
||||
if (channelFile.channels[i].role == Channel_Role_PRIMARY)
|
||||
channelFile.channels[i].role = Channel_Role_SECONDARY;
|
||||
if (channelFile.channels[i].role == meshtastic_Channel_Role_PRIMARY)
|
||||
channelFile.channels[i].role = meshtastic_Channel_Role_SECONDARY;
|
||||
|
||||
old = c; // slam in the new settings/role
|
||||
}
|
||||
@@ -234,7 +234,7 @@ void Channels::setChannel(const Channel &c)
|
||||
const char *Channels::getName(size_t chIndex)
|
||||
{
|
||||
// Convert the short "" representation for Default into a usable string
|
||||
const ChannelSettings &channelSettings = getByIndex(chIndex).settings;
|
||||
const meshtastic_ChannelSettings &channelSettings = getByIndex(chIndex).settings;
|
||||
const char *channelName = channelSettings.name;
|
||||
if (!*channelName) { // emptystring
|
||||
// Per mesh.proto spec, if bandwidth is specified we must ignore modemPreset enum, we assume that in that case
|
||||
@@ -242,33 +242,32 @@ const char *Channels::getName(size_t chIndex)
|
||||
|
||||
if (config.lora.use_preset) {
|
||||
switch (config.lora.modem_preset) {
|
||||
case Config_LoRaConfig_ModemPreset_SHORT_SLOW:
|
||||
case meshtastic_Config_LoRaConfig_ModemPreset_SHORT_SLOW:
|
||||
channelName = "ShortSlow";
|
||||
break;
|
||||
case Config_LoRaConfig_ModemPreset_SHORT_FAST:
|
||||
case meshtastic_Config_LoRaConfig_ModemPreset_SHORT_FAST:
|
||||
channelName = "ShortFast";
|
||||
break;
|
||||
case Config_LoRaConfig_ModemPreset_MEDIUM_SLOW:
|
||||
case meshtastic_Config_LoRaConfig_ModemPreset_MEDIUM_SLOW:
|
||||
channelName = "MediumSlow";
|
||||
break;
|
||||
case Config_LoRaConfig_ModemPreset_MEDIUM_FAST:
|
||||
case meshtastic_Config_LoRaConfig_ModemPreset_MEDIUM_FAST:
|
||||
channelName = "MediumFast";
|
||||
break;
|
||||
case Config_LoRaConfig_ModemPreset_LONG_SLOW:
|
||||
case meshtastic_Config_LoRaConfig_ModemPreset_LONG_SLOW:
|
||||
channelName = "LongSlow";
|
||||
break;
|
||||
case Config_LoRaConfig_ModemPreset_LONG_FAST:
|
||||
case meshtastic_Config_LoRaConfig_ModemPreset_LONG_FAST:
|
||||
channelName = "LongFast";
|
||||
break;
|
||||
case Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW:
|
||||
case meshtastic_Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW:
|
||||
channelName = "VLongSlow";
|
||||
break;
|
||||
default:
|
||||
channelName = "Invalid";
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
channelName = "Custom";
|
||||
}
|
||||
}
|
||||
|
||||
+6
-7
@@ -29,24 +29,23 @@ class Channels
|
||||
int16_t hashes[MAX_NUM_CHANNELS] = {};
|
||||
|
||||
public:
|
||||
|
||||
Channels() {}
|
||||
|
||||
/// Well known channel names
|
||||
static const char *adminChannel, *gpioChannel, *serialChannel;
|
||||
|
||||
const ChannelSettings &getPrimary() { return getByIndex(getPrimaryIndex()).settings; }
|
||||
const meshtastic_ChannelSettings &getPrimary() { return getByIndex(getPrimaryIndex()).settings; }
|
||||
|
||||
/** Return the Channel for a specified index */
|
||||
Channel &getByIndex(ChannelIndex chIndex);
|
||||
meshtastic_Channel &getByIndex(ChannelIndex chIndex);
|
||||
|
||||
/** Return the Channel for a specified name, return primary if not found. */
|
||||
Channel &getByName(const char* chName);
|
||||
/** Return the Channel for a specified name, return primary if not found. */
|
||||
meshtastic_Channel &getByName(const char *chName);
|
||||
|
||||
/** Using the index inside the channel, update the specified channel's settings and role. If this channel is being promoted
|
||||
* to be primary, force all other channels to be secondary.
|
||||
*/
|
||||
void setChannel(const Channel &c);
|
||||
void setChannel(const meshtastic_Channel &c);
|
||||
|
||||
/** Return a human friendly name for this channel (and expand any short strings as needed)
|
||||
*/
|
||||
@@ -125,7 +124,7 @@ class Channels
|
||||
/**
|
||||
* Validate a channel, fixing any errors as needed
|
||||
*/
|
||||
Channel &fixupChannel(ChannelIndex chIndex);
|
||||
meshtastic_Channel &fixupChannel(ChannelIndex chIndex);
|
||||
|
||||
/**
|
||||
* Write a default channel to the specified channel index
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "configuration.h"
|
||||
#include "CryptoEngine.h"
|
||||
#include "configuration.h"
|
||||
|
||||
void CryptoEngine::setKey(const CryptoKey &k)
|
||||
{
|
||||
|
||||
+16
-13
@@ -9,7 +9,7 @@ FloodingRouter::FloodingRouter() {}
|
||||
* later free() the packet to pool. This routine is not allowed to stall.
|
||||
* If the txmit queue is full it might return an error
|
||||
*/
|
||||
ErrorCode FloodingRouter::send(MeshPacket *p)
|
||||
ErrorCode FloodingRouter::send(meshtastic_MeshPacket *p)
|
||||
{
|
||||
// Add any messages _we_ send to the seen message list (so we will ignore all retransmissions we see)
|
||||
wasSeenRecently(p); // FIXME, move this to a sniffSent method
|
||||
@@ -17,7 +17,7 @@ ErrorCode FloodingRouter::send(MeshPacket *p)
|
||||
return Router::send(p);
|
||||
}
|
||||
|
||||
bool FloodingRouter::shouldFilterReceived(const MeshPacket *p)
|
||||
bool FloodingRouter::shouldFilterReceived(const meshtastic_MeshPacket *p)
|
||||
{
|
||||
if (wasSeenRecently(p)) { // Note: this will also add a recent packet record
|
||||
printPacket("Ignoring incoming msg, because we've already seen it", p);
|
||||
@@ -27,40 +27,43 @@ bool FloodingRouter::shouldFilterReceived(const MeshPacket *p)
|
||||
return Router::shouldFilterReceived(p);
|
||||
}
|
||||
|
||||
void FloodingRouter::sniffReceived(const MeshPacket *p, const Routing *c)
|
||||
void FloodingRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtastic_Routing *c)
|
||||
{
|
||||
bool isAck = ((c && c->error_reason == Routing_Error_NONE)); // consider only ROUTING_APP message without error as ACK
|
||||
bool isAck =
|
||||
((c && c->error_reason == meshtastic_Routing_Error_NONE)); // consider only ROUTING_APP message without error as ACK
|
||||
if (isAck && p->to != getNodeNum()) {
|
||||
// do not flood direct message that is ACKed
|
||||
// do not flood direct message that is ACKed
|
||||
LOG_DEBUG("Receiving an ACK not for me, but don't need to rebroadcast this direct message anymore.\n");
|
||||
Router::cancelSending(p->to, p->decoded.request_id); // cancel rebroadcast for this DM
|
||||
}
|
||||
Router::cancelSending(p->to, p->decoded.request_id); // cancel rebroadcast for this DM
|
||||
}
|
||||
if ((p->to != getNodeNum()) && (p->hop_limit > 0) && (getFrom(p) != getNodeNum())) {
|
||||
if (p->id != 0) {
|
||||
if (config.device.role != Config_DeviceConfig_Role_CLIENT_MUTE) {
|
||||
MeshPacket *tosend = packetPool.allocCopy(*p); // keep a copy because we will be sending it
|
||||
if (config.device.role != meshtastic_Config_DeviceConfig_Role_CLIENT_MUTE) {
|
||||
meshtastic_MeshPacket *tosend = packetPool.allocCopy(*p); // keep a copy because we will be sending it
|
||||
|
||||
tosend->hop_limit--; // bump down the hop count
|
||||
|
||||
// If it is a traceRoute request, update the route that it went via me
|
||||
if (p->which_payload_variant == MeshPacket_decoded_tag && traceRouteModule->wantPacket(p)) {
|
||||
if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag && traceRouteModule->wantPacket(p)) {
|
||||
traceRouteModule->updateRoute(tosend);
|
||||
}
|
||||
|
||||
LOG_INFO("Rebroadcasting received floodmsg to neighbors", p);
|
||||
LOG_INFO("Rebroadcasting received floodmsg to neighbors\n");
|
||||
// Note: we are careful to resend using the original senders node id
|
||||
// We are careful not to call our hooked version of send() - because we don't want to check this again
|
||||
Router::send(tosend);
|
||||
|
||||
} else {
|
||||
LOG_DEBUG("Not rebroadcasting. Role = Role_ClientMute\n");
|
||||
}
|
||||
|
||||
} else {
|
||||
LOG_DEBUG("Ignoring a simple (0 id) broadcast\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (config.device.rebroadcast_mode == meshtastic_Config_DeviceConfig_RebroadcastMode_LOCAL_ONLY) {
|
||||
LOG_DEBUG("Cancelling rebroadcast of message from node on a foreign mesh, due to local only rebroadcast mode\n");
|
||||
Router::cancelSending(p->to, p->decoded.request_id);
|
||||
}
|
||||
// handle the packet as normal
|
||||
Router::sniffReceived(p, c);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class FloodingRouter : public Router, protected PacketHistory
|
||||
* later free() the packet to pool. This routine is not allowed to stall.
|
||||
* If the txmit queue is full it might return an error
|
||||
*/
|
||||
virtual ErrorCode send(MeshPacket *p) override;
|
||||
virtual ErrorCode send(meshtastic_MeshPacket *p) override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
@@ -51,10 +51,10 @@ class FloodingRouter : public Router, protected PacketHistory
|
||||
* Called immedately on receiption, before any further processing.
|
||||
* @return true to abandon the packet
|
||||
*/
|
||||
virtual bool shouldFilterReceived(const MeshPacket *p) override;
|
||||
virtual bool shouldFilterReceived(const meshtastic_MeshPacket *p) override;
|
||||
|
||||
/**
|
||||
* Look for broadcasts we need to rebroadcast
|
||||
*/
|
||||
virtual void sniffReceived(const MeshPacket *p, const Routing *c) override;
|
||||
virtual void sniffReceived(const meshtastic_MeshPacket *p, const meshtastic_Routing *c) override;
|
||||
};
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "SX126xInterface.h"
|
||||
#include "SX126xInterface.cpp"
|
||||
#include "SX128xInterface.h"
|
||||
#include "SX126xInterface.h"
|
||||
#include "SX128xInterface.cpp"
|
||||
#include "api/ServerAPI.h"
|
||||
#include "SX128xInterface.h"
|
||||
#include "api/ServerAPI.cpp"
|
||||
#include "api/ServerAPI.h"
|
||||
|
||||
// We need this declaration for proper linking in derived classes
|
||||
template class SX126xInterface<SX1262>;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "configuration.h"
|
||||
#include "LLCC68Interface.h"
|
||||
#include "configuration.h"
|
||||
#include "error.h"
|
||||
|
||||
LLCC68Interface::LLCC68Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy,
|
||||
|
||||
+36
-42
@@ -1,20 +1,20 @@
|
||||
#include "configuration.h"
|
||||
#include "MeshModule.h"
|
||||
#include "Channels.h"
|
||||
#include "MeshService.h"
|
||||
#include "NodeDB.h"
|
||||
#include "configuration.h"
|
||||
#include "modules/RoutingModule.h"
|
||||
#include <assert.h>
|
||||
|
||||
std::vector<MeshModule *> *MeshModule::modules;
|
||||
|
||||
const MeshPacket *MeshModule::currentRequest;
|
||||
const meshtastic_MeshPacket *MeshModule::currentRequest;
|
||||
|
||||
/**
|
||||
* If any of the current chain of modules has already sent a reply, it will be here. This is useful to allow
|
||||
* the RoutingPlugin to avoid sending redundant acks
|
||||
*/
|
||||
MeshPacket *MeshModule::currentReply;
|
||||
meshtastic_MeshPacket *MeshModule::currentReply;
|
||||
|
||||
MeshModule::MeshModule(const char *_name) : name(_name)
|
||||
{
|
||||
@@ -32,21 +32,22 @@ MeshModule::~MeshModule()
|
||||
assert(0); // FIXME - remove from list of modules once someone needs this feature
|
||||
}
|
||||
|
||||
MeshPacket *MeshModule::allocAckNak(Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex)
|
||||
meshtastic_MeshPacket *MeshModule::allocAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex)
|
||||
{
|
||||
Routing c = Routing_init_default;
|
||||
meshtastic_Routing c = meshtastic_Routing_init_default;
|
||||
|
||||
c.error_reason = err;
|
||||
c.which_variant = Routing_error_reason_tag;
|
||||
c.which_variant = meshtastic_Routing_error_reason_tag;
|
||||
|
||||
// Now that we have moded sendAckNak up one level into the class heirarchy we can no longer assume we are a RoutingPlugin
|
||||
// So we manually call pb_encode_to_bytes and specify routing port number
|
||||
// auto p = allocDataProtobuf(c);
|
||||
MeshPacket *p = router->allocForSending();
|
||||
p->decoded.portnum = PortNum_ROUTING_APP;
|
||||
p->decoded.payload.size = pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), &Routing_msg, &c);
|
||||
meshtastic_MeshPacket *p = router->allocForSending();
|
||||
p->decoded.portnum = meshtastic_PortNum_ROUTING_APP;
|
||||
p->decoded.payload.size =
|
||||
pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), &meshtastic_Routing_msg, &c);
|
||||
|
||||
p->priority = MeshPacket_Priority_ACK;
|
||||
p->priority = meshtastic_MeshPacket_Priority_ACK;
|
||||
|
||||
p->hop_limit = config.lora.hop_limit; // Flood ACK back to original sender
|
||||
p->to = to;
|
||||
@@ -57,7 +58,7 @@ MeshPacket *MeshModule::allocAckNak(Routing_Error err, NodeNum to, PacketId idFr
|
||||
return p;
|
||||
}
|
||||
|
||||
MeshPacket *MeshModule::allocErrorResponse(Routing_Error err, const MeshPacket *p)
|
||||
meshtastic_MeshPacket *MeshModule::allocErrorResponse(meshtastic_Routing_Error err, const meshtastic_MeshPacket *p)
|
||||
{
|
||||
auto r = allocAckNak(err, getFrom(p), p->id, p->channel);
|
||||
|
||||
@@ -66,13 +67,13 @@ MeshPacket *MeshModule::allocErrorResponse(Routing_Error err, const MeshPacket *
|
||||
return r;
|
||||
}
|
||||
|
||||
void MeshModule::callPlugins(const MeshPacket &mp, RxSource src)
|
||||
void MeshModule::callPlugins(const meshtastic_MeshPacket &mp, RxSource src)
|
||||
{
|
||||
// LOG_DEBUG("In call modules\n");
|
||||
bool moduleFound = false;
|
||||
|
||||
// We now allow **encrypted** packets to pass through the modules
|
||||
bool isDecoded = mp.which_payload_variant == MeshPacket_decoded_tag;
|
||||
bool isDecoded = mp.which_payload_variant == meshtastic_MeshPacket_decoded_tag;
|
||||
|
||||
currentReply = NULL; // No reply yet
|
||||
|
||||
@@ -101,13 +102,13 @@ void MeshModule::callPlugins(const MeshPacket &mp, RxSource src)
|
||||
moduleFound = true;
|
||||
|
||||
/// received channel (or NULL if not decoded)
|
||||
Channel *ch = isDecoded ? &channels.getByIndex(mp.channel) : NULL;
|
||||
meshtastic_Channel *ch = isDecoded ? &channels.getByIndex(mp.channel) : NULL;
|
||||
|
||||
/// Is the channel this packet arrived on acceptable? (security check)
|
||||
/// Note: we can't know channel names for encrypted packets, so those are NEVER sent to boundChannel modules
|
||||
|
||||
/// Also: if a packet comes in on the local PC interface, we don't check for bound channels, because it is TRUSTED and it needs to
|
||||
/// to be able to fetch the initial admin packets without yet knowing any channels.
|
||||
/// Also: if a packet comes in on the local PC interface, we don't check for bound channels, because it is TRUSTED and
|
||||
/// it needs to to be able to fetch the initial admin packets without yet knowing any channels.
|
||||
|
||||
bool rxChannelOk = !pi.boundChannel || (mp.from == 0) || (strcasecmp(ch->settings.name, pi.boundChannel) == 0);
|
||||
|
||||
@@ -117,7 +118,7 @@ void MeshModule::callPlugins(const MeshPacket &mp, RxSource src)
|
||||
|
||||
if (mp.decoded.want_response) {
|
||||
printPacket("packet on wrong channel, returning error", &mp);
|
||||
currentReply = pi.allocErrorResponse(Routing_Error_NOT_AUTHORIZED, &mp);
|
||||
currentReply = pi.allocErrorResponse(meshtastic_Routing_Error_NOT_AUTHORIZED, &mp);
|
||||
} else
|
||||
printPacket("packet on wrong channel, but can't respond", &mp);
|
||||
} else {
|
||||
@@ -161,7 +162,7 @@ void MeshModule::callPlugins(const MeshPacket &mp, RxSource src)
|
||||
printPacket("Sending response", currentReply);
|
||||
service.sendToMesh(currentReply);
|
||||
currentReply = NULL;
|
||||
} else if(mp.from != ourNodeNum) {
|
||||
} else if (mp.from != ourNodeNum) {
|
||||
// Note: if the message started with the local node we don't want to send a no response reply
|
||||
|
||||
// No one wanted to reply to this requst, tell the requster that happened
|
||||
@@ -170,17 +171,16 @@ void MeshModule::callPlugins(const MeshPacket &mp, RxSource src)
|
||||
// SECURITY NOTE! I considered sending back a different error code if we didn't find the psk (i.e. !isDecoded)
|
||||
// but opted NOT TO. Because it is not a good idea to let remote nodes 'probe' to find out which PSKs were "good" vs
|
||||
// bad.
|
||||
routingModule->sendAckNak(Routing_Error_NO_RESPONSE, getFrom(&mp), mp.id, mp.channel);
|
||||
routingModule->sendAckNak(meshtastic_Routing_Error_NO_RESPONSE, getFrom(&mp), mp.id, mp.channel);
|
||||
}
|
||||
}
|
||||
|
||||
if (!moduleFound)
|
||||
LOG_DEBUG("No modules interested in portnum=%d, src=%s\n",
|
||||
mp.decoded.portnum,
|
||||
(src == RX_SRC_LOCAL) ? "LOCAL":"REMOTE");
|
||||
LOG_DEBUG("No modules interested in portnum=%d, src=%s\n", mp.decoded.portnum,
|
||||
(src == RX_SRC_LOCAL) ? "LOCAL" : "REMOTE");
|
||||
}
|
||||
|
||||
MeshPacket *MeshModule::allocReply()
|
||||
meshtastic_MeshPacket *MeshModule::allocReply()
|
||||
{
|
||||
auto r = myReply;
|
||||
myReply = NULL; // Only use each reply once
|
||||
@@ -191,7 +191,7 @@ MeshPacket *MeshModule::allocReply()
|
||||
* so that subclasses can (optionally) send a response back to the original sender. Implementing this method
|
||||
* is optional
|
||||
*/
|
||||
void MeshModule::sendResponse(const MeshPacket &req)
|
||||
void MeshModule::sendResponse(const meshtastic_MeshPacket &req)
|
||||
{
|
||||
auto r = allocReply();
|
||||
if (r) {
|
||||
@@ -206,16 +206,16 @@ void MeshModule::sendResponse(const MeshPacket &req)
|
||||
/** set the destination and packet parameters of packet p intended as a reply to a particular "to" packet
|
||||
* This ensures that if the request packet was sent reliably, the reply is sent that way as well.
|
||||
*/
|
||||
void setReplyTo(MeshPacket *p, const MeshPacket &to)
|
||||
void setReplyTo(meshtastic_MeshPacket *p, const meshtastic_MeshPacket &to)
|
||||
{
|
||||
assert(p->which_payload_variant == MeshPacket_decoded_tag); // Should already be set by now
|
||||
assert(p->which_payload_variant == meshtastic_MeshPacket_decoded_tag); // Should already be set by now
|
||||
p->to = getFrom(&to); // Make sure that if we are sending to the local node, we use our local node addr, not 0
|
||||
p->channel = to.channel; // Use the same channel that the request came in on
|
||||
|
||||
// No need for an ack if we are just delivering locally (it just generates an ignored ack)
|
||||
p->want_ack = (to.from != 0) ? to.want_ack : false;
|
||||
if (p->priority == MeshPacket_Priority_UNSET)
|
||||
p->priority = MeshPacket_Priority_RELIABLE;
|
||||
if (p->priority == meshtastic_MeshPacket_Priority_UNSET)
|
||||
p->priority = meshtastic_MeshPacket_Priority_RELIABLE;
|
||||
p->decoded.request_id = to.id;
|
||||
}
|
||||
|
||||
@@ -235,14 +235,12 @@ std::vector<MeshModule *> MeshModule::GetMeshModulesWithUIFrames()
|
||||
return modulesWithUIFrames;
|
||||
}
|
||||
|
||||
void MeshModule::observeUIEvents(
|
||||
Observer<const UIFrameEvent *> *observer)
|
||||
void MeshModule::observeUIEvents(Observer<const UIFrameEvent *> *observer)
|
||||
{
|
||||
if (modules) {
|
||||
for (auto i = modules->begin(); i != modules->end(); ++i) {
|
||||
auto &pi = **i;
|
||||
Observable<const UIFrameEvent *> *observable =
|
||||
pi.getUIFrameObservable();
|
||||
Observable<const UIFrameEvent *> *observable = pi.getUIFrameObservable();
|
||||
if (observable != NULL) {
|
||||
LOG_DEBUG("Module wants a UI Frame\n");
|
||||
observer->observe(observable);
|
||||
@@ -251,24 +249,20 @@ void MeshModule::observeUIEvents(
|
||||
}
|
||||
}
|
||||
|
||||
AdminMessageHandleResult MeshModule::handleAdminMessageForAllPlugins(const MeshPacket &mp, AdminMessage *request, AdminMessage *response)
|
||||
AdminMessageHandleResult MeshModule::handleAdminMessageForAllPlugins(const meshtastic_MeshPacket &mp,
|
||||
meshtastic_AdminMessage *request,
|
||||
meshtastic_AdminMessage *response)
|
||||
{
|
||||
AdminMessageHandleResult handled = AdminMessageHandleResult::NOT_HANDLED;
|
||||
if (modules) {
|
||||
for (auto i = modules->begin(); i != modules->end(); ++i) {
|
||||
auto &pi = **i;
|
||||
AdminMessageHandleResult h = pi.handleAdminMessageForModule(mp, request, response);
|
||||
if (h == AdminMessageHandleResult::HANDLED_WITH_RESPONSE)
|
||||
{
|
||||
if (h == AdminMessageHandleResult::HANDLED_WITH_RESPONSE) {
|
||||
// In case we have a response it always has priority.
|
||||
LOG_DEBUG("Reply prepared by module '%s' of variant: %d\n",
|
||||
pi.name,
|
||||
response->which_payload_variant);
|
||||
LOG_DEBUG("Reply prepared by module '%s' of variant: %d\n", pi.name, response->which_payload_variant);
|
||||
handled = h;
|
||||
}
|
||||
else if ((handled != AdminMessageHandleResult::HANDLED_WITH_RESPONSE) &&
|
||||
(h == AdminMessageHandleResult::HANDLED))
|
||||
{
|
||||
} else if ((handled != AdminMessageHandleResult::HANDLED_WITH_RESPONSE) && (h == AdminMessageHandleResult::HANDLED)) {
|
||||
// In case the message is handled it should be populated, but will not overwrite
|
||||
// a result with response.
|
||||
handled = h;
|
||||
|
||||
+53
-37
@@ -10,15 +10,14 @@
|
||||
#endif
|
||||
|
||||
/** handleReceived return enumeration
|
||||
*
|
||||
*
|
||||
* Use ProcessMessage::CONTINUE to allows other modules to process a message.
|
||||
*
|
||||
*
|
||||
* Use ProcessMessage::STOP to stop further message processing.
|
||||
*/
|
||||
enum class ProcessMessage
|
||||
{
|
||||
CONTINUE = 0,
|
||||
STOP = 1,
|
||||
enum class ProcessMessage {
|
||||
CONTINUE = 0,
|
||||
STOP = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -27,8 +26,7 @@ enum class ProcessMessage
|
||||
* If response is also prepared for the request, then HANDLED_WITH_RESPONSE
|
||||
* should be returned.
|
||||
*/
|
||||
enum class AdminMessageHandleResult
|
||||
{
|
||||
enum class AdminMessageHandleResult {
|
||||
NOT_HANDLED = 0,
|
||||
HANDLED = 1,
|
||||
HANDLED_WITH_RESPONSE = 2,
|
||||
@@ -66,14 +64,18 @@ class MeshModule
|
||||
|
||||
/** For use only by MeshService
|
||||
*/
|
||||
static void callPlugins(const MeshPacket &mp, RxSource src = RX_SRC_RADIO);
|
||||
static void callPlugins(const meshtastic_MeshPacket &mp, RxSource src = RX_SRC_RADIO);
|
||||
|
||||
static std::vector<MeshModule *> GetMeshModulesWithUIFrames();
|
||||
static void observeUIEvents(Observer<const UIFrameEvent *> *observer);
|
||||
static AdminMessageHandleResult handleAdminMessageForAllPlugins(
|
||||
const MeshPacket &mp, AdminMessage *request, AdminMessage *response);
|
||||
static AdminMessageHandleResult handleAdminMessageForAllPlugins(const meshtastic_MeshPacket &mp,
|
||||
meshtastic_AdminMessage *request,
|
||||
meshtastic_AdminMessage *response);
|
||||
#if HAS_SCREEN
|
||||
virtual void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) { return; }
|
||||
virtual void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
protected:
|
||||
const char *name;
|
||||
@@ -107,12 +109,12 @@ class MeshModule
|
||||
* Note: this can be static because we are guaranteed to be processing only one
|
||||
* plumodulegin at a time.
|
||||
*/
|
||||
static const MeshPacket *currentRequest;
|
||||
static const meshtastic_MeshPacket *currentRequest;
|
||||
|
||||
/**
|
||||
* If your handler wants to send a response, simply set currentReply and it will be sent at the end of response handling.
|
||||
*/
|
||||
MeshPacket *myReply = NULL;
|
||||
meshtastic_MeshPacket *myReply = NULL;
|
||||
|
||||
/**
|
||||
* Initialize your module. This setup function is called once after all hardware and mesh protocol layers have
|
||||
@@ -123,13 +125,17 @@ class MeshModule
|
||||
/**
|
||||
* @return true if you want to receive the specified portnum
|
||||
*/
|
||||
virtual bool wantPacket(const MeshPacket *p) = 0;
|
||||
virtual bool wantPacket(const meshtastic_MeshPacket *p) = 0;
|
||||
|
||||
/** Called to handle a particular incoming message
|
||||
|
||||
@return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for it
|
||||
@return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for
|
||||
it
|
||||
*/
|
||||
virtual ProcessMessage handleReceived(const MeshPacket &mp) { return ProcessMessage::CONTINUE; }
|
||||
virtual ProcessMessage handleReceived(const meshtastic_MeshPacket &mp)
|
||||
{
|
||||
return ProcessMessage::CONTINUE;
|
||||
}
|
||||
|
||||
/** Messages can be received that have the want_response bit set. If set, this callback will be invoked
|
||||
* so that subclasses can (optionally) send a response back to the original sender.
|
||||
@@ -137,38 +143,48 @@ class MeshModule
|
||||
* Note: most implementers don't need to override this, instead: If while handling a request you have a reply, just set
|
||||
* the protected reply field in this instance.
|
||||
* */
|
||||
virtual MeshPacket *allocReply();
|
||||
virtual meshtastic_MeshPacket *allocReply();
|
||||
|
||||
/***
|
||||
* @return true if you want to be alloced a UI screen frame
|
||||
*/
|
||||
virtual bool wantUIFrame() { return false; }
|
||||
virtual Observable<const UIFrameEvent *>* getUIFrameObservable() { return NULL; }
|
||||
virtual bool wantUIFrame()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual Observable<const UIFrameEvent *> *getUIFrameObservable()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MeshPacket *allocAckNak(Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex);
|
||||
meshtastic_MeshPacket *allocAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex);
|
||||
|
||||
/// Send an error response for the specified packet.
|
||||
MeshPacket *allocErrorResponse(Routing_Error err, const MeshPacket *p);
|
||||
meshtastic_MeshPacket *allocErrorResponse(meshtastic_Routing_Error err, const meshtastic_MeshPacket *p);
|
||||
|
||||
/**
|
||||
* @brief An admin message arrived to AdminModule. Module was asked whether it want to handle the request.
|
||||
*
|
||||
* @param mp The mesh packet arrived.
|
||||
* @param request The AdminMessage request extracted from the packet.
|
||||
* @param response The prepared response
|
||||
* @return AdminMessageHandleResult
|
||||
* HANDLED if message was handled
|
||||
* HANDLED_WITH_RESPONSE if a response is also prepared and to be sent.
|
||||
*/
|
||||
virtual AdminMessageHandleResult handleAdminMessageForModule(
|
||||
const MeshPacket &mp, AdminMessage *request, AdminMessage *response) { return AdminMessageHandleResult::NOT_HANDLED; };
|
||||
/**
|
||||
* @brief An admin message arrived to AdminModule. Module was asked whether it want to handle the request.
|
||||
*
|
||||
* @param mp The mesh packet arrived.
|
||||
* @param request The AdminMessage request extracted from the packet.
|
||||
* @param response The prepared response
|
||||
* @return AdminMessageHandleResult
|
||||
* HANDLED if message was handled
|
||||
* HANDLED_WITH_RESPONSE if a response is also prepared and to be sent.
|
||||
*/
|
||||
virtual AdminMessageHandleResult handleAdminMessageForModule(const meshtastic_MeshPacket &mp,
|
||||
meshtastic_AdminMessage *request,
|
||||
meshtastic_AdminMessage *response)
|
||||
{
|
||||
return AdminMessageHandleResult::NOT_HANDLED;
|
||||
};
|
||||
|
||||
private:
|
||||
/**
|
||||
* If any of the current chain of modules has already sent a reply, it will be here. This is useful to allow
|
||||
* the RoutingModule to avoid sending redundant acks
|
||||
*/
|
||||
static MeshPacket *currentReply;
|
||||
static meshtastic_MeshPacket *currentReply;
|
||||
|
||||
friend class ReliableRouter;
|
||||
|
||||
@@ -176,10 +192,10 @@ class MeshModule
|
||||
* so that subclasses can (optionally) send a response back to the original sender. This method calls allocReply()
|
||||
* to generate the reply message, and if !NULL that message will be delivered to whoever sent req
|
||||
*/
|
||||
void sendResponse(const MeshPacket &req);
|
||||
void sendResponse(const meshtastic_MeshPacket &req);
|
||||
};
|
||||
|
||||
/** set the destination and packet parameters of packet p intended as a reply to a particular "to" packet
|
||||
* This ensures that if the request packet was sent reliably, the reply is sent that way as well.
|
||||
*/
|
||||
void setReplyTo(MeshPacket *p, const MeshPacket &to);
|
||||
void setReplyTo(meshtastic_MeshPacket *p, const meshtastic_MeshPacket &to);
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
#include "configuration.h"
|
||||
#include "MeshPacketQueue.h"
|
||||
#include "configuration.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
/// @return the priority of the specified packet
|
||||
inline uint32_t getPriority(const MeshPacket *p)
|
||||
inline uint32_t getPriority(const meshtastic_MeshPacket *p)
|
||||
{
|
||||
auto pri = p->priority;
|
||||
return pri;
|
||||
}
|
||||
|
||||
/// @return "true" if "p1" is ordered before "p2"
|
||||
bool CompareMeshPacketFunc(const MeshPacket *p1, const MeshPacket *p2)
|
||||
bool CompareMeshPacketFunc(const meshtastic_MeshPacket *p1, const meshtastic_MeshPacket *p2)
|
||||
{
|
||||
assert(p1 && p2);
|
||||
auto p1p = getPriority(p1), p2p = getPriority(p2);
|
||||
@@ -26,27 +26,29 @@ bool CompareMeshPacketFunc(const MeshPacket *p1, const MeshPacket *p2)
|
||||
|
||||
MeshPacketQueue::MeshPacketQueue(size_t _maxLen) : maxLen(_maxLen) {}
|
||||
|
||||
bool MeshPacketQueue::empty() {
|
||||
bool MeshPacketQueue::empty()
|
||||
{
|
||||
return queue.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Some clients might not properly set priority, therefore we fix it here.
|
||||
*/
|
||||
void fixPriority(MeshPacket *p)
|
||||
void fixPriority(meshtastic_MeshPacket *p)
|
||||
{
|
||||
// We might receive acks from other nodes (and since generated remotely, they won't have priority assigned. Check for that
|
||||
// and fix it
|
||||
if (p->priority == MeshPacket_Priority_UNSET) {
|
||||
if (p->priority == meshtastic_MeshPacket_Priority_UNSET) {
|
||||
// if acks give high priority
|
||||
// if a reliable message give a bit higher default priority
|
||||
p->priority = (p->decoded.portnum == PortNum_ROUTING_APP) ? MeshPacket_Priority_ACK :
|
||||
(p->want_ack ? MeshPacket_Priority_RELIABLE : MeshPacket_Priority_DEFAULT);
|
||||
p->priority = (p->decoded.portnum == meshtastic_PortNum_ROUTING_APP)
|
||||
? meshtastic_MeshPacket_Priority_ACK
|
||||
: (p->want_ack ? meshtastic_MeshPacket_Priority_RELIABLE : meshtastic_MeshPacket_Priority_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
/** enqueue a packet, return false if full */
|
||||
bool MeshPacketQueue::enqueue(MeshPacket *p)
|
||||
bool MeshPacketQueue::enqueue(meshtastic_MeshPacket *p)
|
||||
{
|
||||
fixPriority(p);
|
||||
|
||||
@@ -60,7 +62,7 @@ bool MeshPacketQueue::enqueue(MeshPacket *p)
|
||||
return true;
|
||||
}
|
||||
|
||||
MeshPacket *MeshPacketQueue::dequeue()
|
||||
meshtastic_MeshPacket *MeshPacketQueue::dequeue()
|
||||
{
|
||||
if (empty()) {
|
||||
return NULL;
|
||||
@@ -73,7 +75,7 @@ MeshPacket *MeshPacketQueue::dequeue()
|
||||
return p;
|
||||
}
|
||||
|
||||
MeshPacket *MeshPacketQueue::getFront()
|
||||
meshtastic_MeshPacket *MeshPacketQueue::getFront()
|
||||
{
|
||||
if (empty()) {
|
||||
return NULL;
|
||||
@@ -84,7 +86,7 @@ MeshPacket *MeshPacketQueue::getFront()
|
||||
}
|
||||
|
||||
/** Attempt to find and remove a packet from this queue. Returns a pointer to the removed packet, or NULL if not found */
|
||||
MeshPacket *MeshPacketQueue::remove(NodeNum from, PacketId id)
|
||||
meshtastic_MeshPacket *MeshPacketQueue::remove(NodeNum from, PacketId id)
|
||||
{
|
||||
for (auto it = queue.begin(); it != queue.end(); it++) {
|
||||
auto p = (*it);
|
||||
@@ -99,7 +101,8 @@ MeshPacket *MeshPacketQueue::remove(NodeNum from, PacketId id)
|
||||
}
|
||||
|
||||
/** Attempt to find and remove a packet from this queue. Returns the packet which was removed from the queue */
|
||||
bool MeshPacketQueue::replaceLowerPriorityPacket(MeshPacket *p) {
|
||||
bool MeshPacketQueue::replaceLowerPriorityPacket(meshtastic_MeshPacket *p)
|
||||
{
|
||||
std::sort_heap(queue.begin(), queue.end(), &CompareMeshPacketFunc); // sort ascending based on priority (0 -> 127)
|
||||
|
||||
// find first packet which does not compare less (in priority) than parameter packet
|
||||
@@ -119,7 +122,7 @@ bool MeshPacketQueue::replaceLowerPriorityPacket(MeshPacket *p) {
|
||||
|
||||
if (getPriority(p) > getPriority(*low)) {
|
||||
packetPool.release(*low); // deallocate and drop the packet we're replacing
|
||||
*low = p; // replace low-pri packet at this position with incoming packet with higher priority
|
||||
*low = p; // replace low-pri packet at this position with incoming packet with higher priority
|
||||
}
|
||||
|
||||
std::make_heap(queue.begin(), queue.end(), &CompareMeshPacketFunc);
|
||||
|
||||
@@ -4,23 +4,23 @@
|
||||
|
||||
#include <queue>
|
||||
|
||||
|
||||
/**
|
||||
* A priority queue of packets
|
||||
*/
|
||||
class MeshPacketQueue
|
||||
{
|
||||
size_t maxLen;
|
||||
std::vector<MeshPacket *> queue;
|
||||
std::vector<meshtastic_MeshPacket *> queue;
|
||||
|
||||
/** Replace a lower priority package in the queue with 'mp' (provided there are lower pri packages). Return true if replaced. */
|
||||
bool replaceLowerPriorityPacket(MeshPacket *mp);
|
||||
/** Replace a lower priority package in the queue with 'mp' (provided there are lower pri packages). Return true if replaced.
|
||||
*/
|
||||
bool replaceLowerPriorityPacket(meshtastic_MeshPacket *mp);
|
||||
|
||||
public:
|
||||
explicit MeshPacketQueue(size_t _maxLen);
|
||||
|
||||
/** enqueue a packet, return false if full */
|
||||
bool enqueue(MeshPacket *p);
|
||||
bool enqueue(meshtastic_MeshPacket *p);
|
||||
|
||||
/** return true if the queue is empty */
|
||||
bool empty();
|
||||
@@ -31,10 +31,10 @@ class MeshPacketQueue
|
||||
/** return total size of the Queue */
|
||||
size_t getMaxLen() { return maxLen; }
|
||||
|
||||
MeshPacket *dequeue();
|
||||
meshtastic_MeshPacket *dequeue();
|
||||
|
||||
MeshPacket *getFront();
|
||||
meshtastic_MeshPacket *getFront();
|
||||
|
||||
/** Attempt to find and remove a packet from this queue. Returns the packet which was removed from the queue */
|
||||
MeshPacket *remove(NodeNum from, PacketId id);
|
||||
meshtastic_MeshPacket *remove(NodeNum from, PacketId id);
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
// Map from old region names to new region enums
|
||||
struct RegionInfo {
|
||||
Config_LoRaConfig_RegionCode code;
|
||||
meshtastic_Config_LoRaConfig_RegionCode code;
|
||||
float freqStart;
|
||||
float freqEnd;
|
||||
float dutyCycle;
|
||||
|
||||
+34
-33
@@ -2,9 +2,9 @@
|
||||
#include <assert.h>
|
||||
#include <string>
|
||||
|
||||
#include "GPS.h"
|
||||
#include "../concurrency/Periodic.h"
|
||||
#include "BluetoothCommon.h" // needed for updateBatteryLevel, FIXME, eventually when we pull mesh out into a lib we shouldn't be whacking bluetooth from here
|
||||
#include "GPS.h"
|
||||
#include "MeshService.h"
|
||||
#include "NodeDB.h"
|
||||
#include "PowerFSM.h"
|
||||
@@ -51,15 +51,15 @@ FIXME in the initial proof of concept we just skip the entire want/deny flow and
|
||||
|
||||
MeshService service;
|
||||
|
||||
static MemoryDynamic<QueueStatus> staticQueueStatusPool;
|
||||
static MemoryDynamic<meshtastic_QueueStatus> staticQueueStatusPool;
|
||||
|
||||
Allocator<QueueStatus> &queueStatusPool = staticQueueStatusPool;
|
||||
Allocator<meshtastic_QueueStatus> &queueStatusPool = staticQueueStatusPool;
|
||||
|
||||
#include "Router.h"
|
||||
|
||||
MeshService::MeshService() : toPhoneQueue(MAX_RX_TOPHONE), toPhoneQueueStatusQueue(MAX_RX_TOPHONE)
|
||||
{
|
||||
lastQueueStatus = { 0, 0, 16, 0 };
|
||||
lastQueueStatus = {0, 0, 16, 0};
|
||||
}
|
||||
|
||||
void MeshService::init()
|
||||
@@ -71,14 +71,14 @@ void MeshService::init()
|
||||
gpsObserver.observe(&gps->newStatus);
|
||||
}
|
||||
|
||||
int MeshService::handleFromRadio(const MeshPacket *mp)
|
||||
int MeshService::handleFromRadio(const meshtastic_MeshPacket *mp)
|
||||
{
|
||||
powerFSM.trigger(EVENT_PACKET_FOR_PHONE); // Possibly keep the node from sleeping
|
||||
|
||||
printPacket("Forwarding to phone", mp);
|
||||
nodeDB.updateFrom(*mp); // update our DB state based off sniffing every RX packet from the radio
|
||||
|
||||
sendToPhone((MeshPacket *)mp);
|
||||
sendToPhone((meshtastic_MeshPacket *)mp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -87,7 +87,7 @@ int MeshService::handleFromRadio(const MeshPacket *mp)
|
||||
void MeshService::loop()
|
||||
{
|
||||
if (lastQueueStatus.free == 0) { // check if there is now free space in TX queue
|
||||
QueueStatus qs = router->getQueueStatus();
|
||||
meshtastic_QueueStatus qs = router->getQueueStatus();
|
||||
if (qs.free != lastQueueStatus.free)
|
||||
(void)sendQueueStatusToPhone(qs, 0, 0);
|
||||
}
|
||||
@@ -130,31 +130,32 @@ void MeshService::reloadOwner(bool shouldSave)
|
||||
* Called by PhoneAPI.handleToRadio. Note: p is a scratch buffer, this function is allowed to write to it but it can not keep a
|
||||
* reference
|
||||
*/
|
||||
void MeshService::handleToRadio(MeshPacket &p)
|
||||
void MeshService::handleToRadio(meshtastic_MeshPacket &p)
|
||||
{
|
||||
#ifdef ARCH_PORTDUINO
|
||||
#ifdef ARCH_PORTDUINO
|
||||
// Simulates device is receiving a packet via the LoRa chip
|
||||
if (p.decoded.portnum == PortNum_SIMULATOR_APP) {
|
||||
if (p.decoded.portnum == meshtastic_PortNum_SIMULATOR_APP) {
|
||||
// Simulator packet (=Compressed packet) is encapsulated in a MeshPacket, so need to unwrap first
|
||||
Compressed scratch;
|
||||
Compressed *decoded = NULL;
|
||||
if (p.which_payload_variant == MeshPacket_decoded_tag) {
|
||||
meshtastic_Compressed scratch;
|
||||
meshtastic_Compressed *decoded = NULL;
|
||||
if (p.which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
|
||||
memset(&scratch, 0, sizeof(scratch));
|
||||
p.decoded.payload.size = pb_decode_from_bytes(p.decoded.payload.bytes, p.decoded.payload.size, &Compressed_msg, &scratch);
|
||||
p.decoded.payload.size =
|
||||
pb_decode_from_bytes(p.decoded.payload.bytes, p.decoded.payload.size, &meshtastic_Compressed_msg, &scratch);
|
||||
if (p.decoded.payload.size) {
|
||||
decoded = &scratch;
|
||||
// Extract the original payload and replace
|
||||
memcpy(&p.decoded.payload, &decoded->data, sizeof(decoded->data));
|
||||
// Switch the port from PortNum_SIMULATOR_APP back to the original PortNum
|
||||
// Switch the port from PortNum_SIMULATOR_APP back to the original PortNum
|
||||
p.decoded.portnum = decoded->portnum;
|
||||
} else
|
||||
LOG_ERROR("Error decoding protobuf for simulator message!\n");
|
||||
}
|
||||
// Let SimRadio receive as if it did via its LoRa chip
|
||||
SimRadio::instance->startReceive(&p);
|
||||
return;
|
||||
SimRadio::instance->startReceive(&p);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
if (p.from != 0) { // We don't let phones assign nodenums to their sent messages
|
||||
LOG_WARN("phone tried to pick a nodenum, we don't allow that.\n");
|
||||
p.from = 0;
|
||||
@@ -187,16 +188,16 @@ bool MeshService::cancelSending(PacketId id)
|
||||
return router->cancelSending(nodeDB.getNodeNum(), id);
|
||||
}
|
||||
|
||||
ErrorCode MeshService::sendQueueStatusToPhone(const QueueStatus &qs, ErrorCode res, uint32_t mesh_packet_id)
|
||||
ErrorCode MeshService::sendQueueStatusToPhone(const meshtastic_QueueStatus &qs, ErrorCode res, uint32_t mesh_packet_id)
|
||||
{
|
||||
QueueStatus *copied = queueStatusPool.allocCopy(qs);
|
||||
meshtastic_QueueStatus *copied = queueStatusPool.allocCopy(qs);
|
||||
|
||||
copied->res = res;
|
||||
copied->mesh_packet_id = mesh_packet_id;
|
||||
|
||||
if (toPhoneQueueStatusQueue.numFree() == 0) {
|
||||
LOG_DEBUG("NOTE: tophone queue status queue is full, discarding oldest\n");
|
||||
QueueStatus *d = toPhoneQueueStatusQueue.dequeuePtr(0);
|
||||
meshtastic_QueueStatus *d = toPhoneQueueStatusQueue.dequeuePtr(0);
|
||||
if (d)
|
||||
releaseQueueStatusToPool(d);
|
||||
}
|
||||
@@ -209,7 +210,7 @@ ErrorCode MeshService::sendQueueStatusToPhone(const QueueStatus &qs, ErrorCode r
|
||||
return res ? ERRNO_OK : ERRNO_UNKNOWN;
|
||||
}
|
||||
|
||||
void MeshService::sendToMesh(MeshPacket *p, RxSource src, bool ccToPhone)
|
||||
void MeshService::sendToMesh(meshtastic_MeshPacket *p, RxSource src, bool ccToPhone)
|
||||
{
|
||||
uint32_t mesh_packet_id = p->id;
|
||||
nodeDB.updateFrom(*p); // update our local DB for this packet (because phone might have sent position packets etc...)
|
||||
@@ -219,7 +220,7 @@ void MeshService::sendToMesh(MeshPacket *p, RxSource src, bool ccToPhone)
|
||||
|
||||
/* NOTE(pboldin): Prepare and send QueueStatus message to the phone as a
|
||||
* high-priority message. */
|
||||
QueueStatus qs = router->getQueueStatus();
|
||||
meshtastic_QueueStatus qs = router->getQueueStatus();
|
||||
ErrorCode r = sendQueueStatusToPhone(qs, res, mesh_packet_id);
|
||||
if (r != ERRNO_OK) {
|
||||
LOG_DEBUG("Can't send status to phone");
|
||||
@@ -232,7 +233,7 @@ void MeshService::sendToMesh(MeshPacket *p, RxSource src, bool ccToPhone)
|
||||
|
||||
void MeshService::sendNetworkPing(NodeNum dest, bool wantReplies)
|
||||
{
|
||||
NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
|
||||
meshtastic_NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
|
||||
assert(node);
|
||||
|
||||
if (node->has_position && (node->position.latitude_i != 0 || node->position.longitude_i != 0)) {
|
||||
@@ -248,24 +249,24 @@ void MeshService::sendNetworkPing(NodeNum dest, bool wantReplies)
|
||||
}
|
||||
}
|
||||
|
||||
void MeshService::sendToPhone(MeshPacket *p)
|
||||
void MeshService::sendToPhone(meshtastic_MeshPacket *p)
|
||||
{
|
||||
if (toPhoneQueue.numFree() == 0) {
|
||||
LOG_WARN("ToPhone queue is full, discarding oldest\n");
|
||||
MeshPacket *d = toPhoneQueue.dequeuePtr(0);
|
||||
meshtastic_MeshPacket *d = toPhoneQueue.dequeuePtr(0);
|
||||
if (d)
|
||||
releaseToPool(d);
|
||||
}
|
||||
|
||||
MeshPacket *copied = packetPool.allocCopy(*p);
|
||||
meshtastic_MeshPacket *copied = packetPool.allocCopy(*p);
|
||||
perhapsDecode(copied);
|
||||
assert(toPhoneQueue.enqueue(copied, 0));
|
||||
fromNum++;
|
||||
}
|
||||
|
||||
NodeInfo *MeshService::refreshMyNodeInfo()
|
||||
meshtastic_NodeInfo *MeshService::refreshMyNodeInfo()
|
||||
{
|
||||
NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
|
||||
meshtastic_NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
|
||||
assert(node);
|
||||
|
||||
// We might not have a position yet for our local node, in that case, at least try to send the time
|
||||
@@ -274,7 +275,7 @@ NodeInfo *MeshService::refreshMyNodeInfo()
|
||||
node->has_position = true;
|
||||
}
|
||||
|
||||
Position &position = node->position;
|
||||
meshtastic_Position &position = node->position;
|
||||
|
||||
// Update our local node info with our time (even if we don't decide to update anyone else)
|
||||
node->last_heard =
|
||||
@@ -290,8 +291,8 @@ NodeInfo *MeshService::refreshMyNodeInfo()
|
||||
int MeshService::onGPSChanged(const meshtastic::GPSStatus *newStatus)
|
||||
{
|
||||
// Update our local node info with our position (even if we don't decide to update anyone else)
|
||||
NodeInfo *node = refreshMyNodeInfo();
|
||||
Position pos = Position_init_default;
|
||||
meshtastic_NodeInfo *node = refreshMyNodeInfo();
|
||||
meshtastic_Position pos = meshtastic_Position_init_default;
|
||||
|
||||
if (newStatus->getHasLock()) {
|
||||
// load data from GPS object, will add timestamp + battery further down
|
||||
@@ -323,7 +324,7 @@ int MeshService::onGPSChanged(const meshtastic::GPSStatus *newStatus)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool MeshService::isToPhoneQueueEmpty()
|
||||
bool MeshService::isToPhoneQueueEmpty()
|
||||
{
|
||||
return toPhoneQueue.isEmpty();
|
||||
}
|
||||
|
||||
+16
-16
@@ -14,7 +14,7 @@
|
||||
#include "../platform/portduino/SimRadio.h"
|
||||
#endif
|
||||
|
||||
extern Allocator<QueueStatus> &queueStatusPool;
|
||||
extern Allocator<meshtastic_QueueStatus> &queueStatusPool;
|
||||
|
||||
/**
|
||||
* Top level app for this service. keeps the mesh, the radio config and the queue of received packets.
|
||||
@@ -29,13 +29,13 @@ class MeshService
|
||||
/// FIXME, change to a DropOldestQueue and keep a count of the number of dropped packets to ensure
|
||||
/// we never hang because android hasn't been there in a while
|
||||
/// FIXME - save this to flash on deep sleep
|
||||
PointerQueue<MeshPacket> toPhoneQueue;
|
||||
PointerQueue<meshtastic_MeshPacket> toPhoneQueue;
|
||||
|
||||
// keep list of QueueStatus packets to be send to the phone
|
||||
PointerQueue<QueueStatus> toPhoneQueueStatusQueue;
|
||||
PointerQueue<meshtastic_QueueStatus> toPhoneQueueStatusQueue;
|
||||
|
||||
// This holds the last QueueStatus send
|
||||
QueueStatus lastQueueStatus;
|
||||
meshtastic_QueueStatus lastQueueStatus;
|
||||
|
||||
/// The current nonce for the newest packet which has been queued for the phone
|
||||
uint32_t fromNum = 0;
|
||||
@@ -59,28 +59,28 @@ class MeshService
|
||||
|
||||
/// Return the next packet destined to the phone. FIXME, somehow use fromNum to allow the phone to retry the
|
||||
/// last few packets if needs to.
|
||||
MeshPacket *getForPhone() { return toPhoneQueue.dequeuePtr(0); }
|
||||
meshtastic_MeshPacket *getForPhone() { return toPhoneQueue.dequeuePtr(0); }
|
||||
|
||||
/// Allows the bluetooth handler to free packets after they have been sent
|
||||
void releaseToPool(MeshPacket *p) { packetPool.release(p); }
|
||||
void releaseToPool(meshtastic_MeshPacket *p) { packetPool.release(p); }
|
||||
|
||||
/// Return the next QueueStatus packet destined to the phone.
|
||||
QueueStatus *getQueueStatusForPhone() { return toPhoneQueueStatusQueue.dequeuePtr(0); }
|
||||
meshtastic_QueueStatus *getQueueStatusForPhone() { return toPhoneQueueStatusQueue.dequeuePtr(0); }
|
||||
|
||||
// Release QueueStatus packet to pool
|
||||
void releaseQueueStatusToPool(QueueStatus *p) { queueStatusPool.release(p); }
|
||||
void releaseQueueStatusToPool(meshtastic_QueueStatus *p) { queueStatusPool.release(p); }
|
||||
|
||||
/**
|
||||
* Given a ToRadio buffer parse it and properly handle it (setup radio, owner or send packet into the mesh)
|
||||
* Called by PhoneAPI.handleToRadio. Note: p is a scratch buffer, this function is allowed to write to it but it can not keep
|
||||
* a reference
|
||||
*/
|
||||
void handleToRadio(MeshPacket &p);
|
||||
void handleToRadio(meshtastic_MeshPacket &p);
|
||||
|
||||
/** The radioConfig object just changed, call this to force the hw to change to the new settings
|
||||
* @return true if client devices should be sent a new set of radio configs
|
||||
*/
|
||||
bool reloadConfig(int saveWhat=SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS);
|
||||
bool reloadConfig(int saveWhat = SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS);
|
||||
|
||||
/// The owner User record just got updated, update our node DB and broadcast the info into the mesh
|
||||
void reloadOwner(bool shouldSave = true);
|
||||
@@ -92,16 +92,16 @@ class MeshService
|
||||
/// Send a packet into the mesh - note p must have been allocated from packetPool. We will return it to that pool after
|
||||
/// sending. This is the ONLY function you should use for sending messages into the mesh, because it also updates the nodedb
|
||||
/// cache
|
||||
void sendToMesh(MeshPacket *p, RxSource src = RX_SRC_LOCAL, bool ccToPhone = false);
|
||||
void sendToMesh(meshtastic_MeshPacket *p, RxSource src = RX_SRC_LOCAL, bool ccToPhone = false);
|
||||
|
||||
/** Attempt to cancel a previously sent packet from this _local_ node. Returns true if a packet was found we could cancel */
|
||||
bool cancelSending(PacketId id);
|
||||
|
||||
/// Pull the latest power and time info into my nodeinfo
|
||||
NodeInfo *refreshMyNodeInfo();
|
||||
meshtastic_NodeInfo *refreshMyNodeInfo();
|
||||
|
||||
/// Send a packet to the phone
|
||||
void sendToPhone(MeshPacket *p);
|
||||
/// Send a packet to the phone
|
||||
void sendToPhone(meshtastic_MeshPacket *p);
|
||||
|
||||
bool isToPhoneQueueEmpty();
|
||||
|
||||
@@ -112,10 +112,10 @@ class MeshService
|
||||
|
||||
/// Handle a packet that just arrived from the radio. This method does _ReliableRouternot_ free the provided packet. If it
|
||||
/// needs to keep the packet around it makes a copy
|
||||
int handleFromRadio(const MeshPacket *p);
|
||||
int handleFromRadio(const meshtastic_MeshPacket *p);
|
||||
friend class RoutingModule;
|
||||
|
||||
ErrorCode sendQueueStatusToPhone(const QueueStatus &qs, ErrorCode res, uint32_t mesh_packet_id);
|
||||
ErrorCode sendQueueStatusToPhone(const meshtastic_QueueStatus &qs, ErrorCode res, uint32_t mesh_packet_id);
|
||||
};
|
||||
|
||||
extern MeshService service;
|
||||
|
||||
@@ -19,9 +19,9 @@ typedef uint32_t PacketId; // A packet sequence number
|
||||
* Source of a received message
|
||||
*/
|
||||
enum RxSource {
|
||||
RX_SRC_LOCAL, // message was generated locally
|
||||
RX_SRC_RADIO, // message was received from radio mesh
|
||||
RX_SRC_USER // message was received from end-user device
|
||||
RX_SRC_LOCAL, // message was generated locally
|
||||
RX_SRC_RADIO, // message was received from radio mesh
|
||||
RX_SRC_USER // message was received from end-user device
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -39,10 +39,10 @@ enum RxSource {
|
||||
typedef int ErrorCode;
|
||||
|
||||
/// Alloc and free packets to our global, ISR safe pool
|
||||
extern Allocator<MeshPacket> &packetPool;
|
||||
extern Allocator<meshtastic_MeshPacket> &packetPool;
|
||||
|
||||
/**
|
||||
* Most (but not always) of the time we want to treat packets 'from' the local phone (where from == 0), as if they originated on
|
||||
* the local node. If from is zero this function returns our node number instead
|
||||
*/
|
||||
NodeNum getFrom(const MeshPacket *p);
|
||||
NodeNum getFrom(const meshtastic_MeshPacket *p);
|
||||
+89
-63
@@ -13,9 +13,9 @@
|
||||
#include "error.h"
|
||||
#include "main.h"
|
||||
#include "mesh-pb-constants.h"
|
||||
#include <ErriezCRC32.h>
|
||||
#include <pb_decode.h>
|
||||
#include <pb_encode.h>
|
||||
#include <ErriezCRC32.h>
|
||||
|
||||
#ifdef ARCH_ESP32
|
||||
#include "mesh/http/WiFiAPClient.h"
|
||||
@@ -32,12 +32,12 @@
|
||||
NodeDB nodeDB;
|
||||
|
||||
// we have plenty of ram so statically alloc this tempbuf (for now)
|
||||
EXT_RAM_ATTR DeviceState devicestate;
|
||||
MyNodeInfo &myNodeInfo = devicestate.my_node;
|
||||
LocalConfig config;
|
||||
LocalModuleConfig moduleConfig;
|
||||
ChannelFile channelFile;
|
||||
OEMStore oemStore;
|
||||
EXT_RAM_ATTR meshtastic_DeviceState devicestate;
|
||||
meshtastic_MyNodeInfo &myNodeInfo = devicestate.my_node;
|
||||
meshtastic_LocalConfig config;
|
||||
meshtastic_LocalModuleConfig moduleConfig;
|
||||
meshtastic_ChannelFile channelFile;
|
||||
meshtastic_OEMStore oemStore;
|
||||
|
||||
/** The current change # for radio settings. Starts at 0 on boot and any time the radio settings
|
||||
* might have changed is incremented. Allows others to detect they might now be on a new channel.
|
||||
@@ -53,7 +53,7 @@ extern void getMacAddr(uint8_t *dmac);
|
||||
* But there are some special ids used when we haven't yet been configured by a user. In that case
|
||||
* we use !macaddr (no colons).
|
||||
*/
|
||||
User &owner = devicestate.owner;
|
||||
meshtastic_User &owner = devicestate.owner;
|
||||
|
||||
static uint8_t ourMacAddr[6];
|
||||
|
||||
@@ -69,7 +69,7 @@ NodeDB::NodeDB() : nodes(devicestate.node_db), numNodes(&devicestate.node_db_cou
|
||||
* Most (but not always) of the time we want to treat packets 'from' the local phone (where from == 0), as if they originated on
|
||||
* the local node. If from is zero this function returns our node number instead
|
||||
*/
|
||||
NodeNum getFrom(const MeshPacket *p)
|
||||
NodeNum getFrom(const meshtastic_MeshPacket *p)
|
||||
{
|
||||
return (p->from == 0) ? nodeDB.getNodeNum() : p->from;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ bool NodeDB::resetRadioConfig(bool factory_reset)
|
||||
radioGeneration++;
|
||||
|
||||
if (factory_reset) {
|
||||
didFactoryReset = factoryReset();
|
||||
didFactoryReset = factoryReset();
|
||||
}
|
||||
|
||||
if (channelFile.channels_count != MAX_NUM_CHANNELS) {
|
||||
@@ -102,7 +102,7 @@ bool NodeDB::resetRadioConfig(bool factory_reset)
|
||||
config.power.wait_bluetooth_secs = 10;
|
||||
config.position.position_broadcast_secs = 6 * 60;
|
||||
config.power.ls_secs = 60;
|
||||
config.lora.region = Config_LoRaConfig_RegionCode_TW;
|
||||
config.lora.region = meshtastic_Config_LoRaConfig_RegionCode_TW;
|
||||
|
||||
// Enter super deep sleep soon and stay there not very long
|
||||
// radioConfig.preferences.mesh_sds_timeout_secs = 10;
|
||||
@@ -121,7 +121,7 @@ bool NodeDB::resetRadioConfig(bool factory_reset)
|
||||
return didFactoryReset;
|
||||
}
|
||||
|
||||
bool NodeDB::factoryReset()
|
||||
bool NodeDB::factoryReset()
|
||||
{
|
||||
LOG_INFO("Performing factory reset!\n");
|
||||
// first, remove the "/prefs" (this removes most prefs)
|
||||
@@ -151,7 +151,7 @@ bool NodeDB::factoryReset()
|
||||
void NodeDB::installDefaultConfig()
|
||||
{
|
||||
LOG_INFO("Installing default LocalConfig\n");
|
||||
memset(&config, 0, sizeof(LocalConfig));
|
||||
memset(&config, 0, sizeof(meshtastic_LocalConfig));
|
||||
config.version = DEVICESTATE_CUR_VER;
|
||||
config.has_device = true;
|
||||
config.has_display = true;
|
||||
@@ -160,10 +160,13 @@ void NodeDB::installDefaultConfig()
|
||||
config.has_power = true;
|
||||
config.has_network = true;
|
||||
config.has_bluetooth = true;
|
||||
config.lora.tx_enabled = true; // FIXME: maybe false in the future, and setting region to enable it. (unset region forces it off)
|
||||
config.lora.override_duty_cycle = false;
|
||||
config.lora.region = Config_LoRaConfig_RegionCode_UNSET;
|
||||
config.lora.modem_preset = Config_LoRaConfig_ModemPreset_LONG_FAST;
|
||||
config.device.rebroadcast_mode = meshtastic_Config_DeviceConfig_RebroadcastMode_ALL;
|
||||
config.lora.sx126x_rx_boosted_gain = false;
|
||||
config.lora.tx_enabled =
|
||||
true; // FIXME: maybe false in the future, and setting region to enable it. (unset region forces it off)
|
||||
config.lora.override_duty_cycle = false;
|
||||
config.lora.region = meshtastic_Config_LoRaConfig_RegionCode_UNSET;
|
||||
config.lora.modem_preset = meshtastic_Config_LoRaConfig_ModemPreset_LONG_FAST;
|
||||
config.lora.hop_limit = HOP_RELIABLE;
|
||||
config.position.gps_enabled = true;
|
||||
config.position.position_broadcast_smart_enabled = true;
|
||||
@@ -178,14 +181,16 @@ void NodeDB::installDefaultConfig()
|
||||
#else
|
||||
bool hasScreen = screen_found;
|
||||
#endif
|
||||
config.bluetooth.mode = hasScreen ? Config_BluetoothConfig_PairingMode_RANDOM_PIN : Config_BluetoothConfig_PairingMode_FIXED_PIN;
|
||||
config.bluetooth.mode = hasScreen ? meshtastic_Config_BluetoothConfig_PairingMode_RANDOM_PIN
|
||||
: meshtastic_Config_BluetoothConfig_PairingMode_FIXED_PIN;
|
||||
// for backward compat, default position flags are ALT+MSL
|
||||
config.position.position_flags = (Config_PositionConfig_PositionFlags_ALTITUDE | Config_PositionConfig_PositionFlags_ALTITUDE_MSL);
|
||||
|
||||
config.position.position_flags =
|
||||
(meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE | meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE_MSL);
|
||||
|
||||
initConfigIntervals();
|
||||
}
|
||||
|
||||
void NodeDB::initConfigIntervals()
|
||||
void NodeDB::initConfigIntervals()
|
||||
{
|
||||
config.position.gps_update_interval = default_gps_update_interval;
|
||||
config.position.gps_attempt_time = default_gps_attempt_time;
|
||||
@@ -196,15 +201,15 @@ void NodeDB::initConfigIntervals()
|
||||
config.power.min_wake_secs = default_min_wake_secs;
|
||||
config.power.sds_secs = default_sds_secs;
|
||||
config.power.wait_bluetooth_secs = default_wait_bluetooth_secs;
|
||||
|
||||
|
||||
config.display.screen_on_secs = default_screen_on_secs;
|
||||
}
|
||||
|
||||
void NodeDB::installDefaultModuleConfig()
|
||||
{
|
||||
LOG_INFO("Installing default ModuleConfig\n");
|
||||
memset(&moduleConfig, 0, sizeof(ModuleConfig));
|
||||
|
||||
memset(&moduleConfig, 0, sizeof(meshtastic_ModuleConfig));
|
||||
|
||||
moduleConfig.version = DEVICESTATE_CUR_VER;
|
||||
moduleConfig.has_mqtt = true;
|
||||
moduleConfig.has_range_test = true;
|
||||
@@ -221,7 +226,26 @@ void NodeDB::installDefaultModuleConfig()
|
||||
initModuleConfigIntervals();
|
||||
}
|
||||
|
||||
void NodeDB::initModuleConfigIntervals()
|
||||
void NodeDB::installRoleDefaults(meshtastic_Config_DeviceConfig_Role role)
|
||||
{
|
||||
if (role == meshtastic_Config_DeviceConfig_Role_ROUTER) {
|
||||
initConfigIntervals();
|
||||
initModuleConfigIntervals();
|
||||
} else if (role == meshtastic_Config_DeviceConfig_Role_REPEATER) {
|
||||
config.display.screen_on_secs = 1;
|
||||
meshtastic_Channel &ch = channels.getByIndex(channels.getPrimaryIndex());
|
||||
meshtastic_ChannelSettings &channelSettings = ch.settings;
|
||||
uint8_t defaultpskIndex = 1;
|
||||
channelSettings.psk.bytes[0] = defaultpskIndex;
|
||||
channelSettings.psk.size = 1;
|
||||
} else if (role == meshtastic_Config_DeviceConfig_Role_TRACKER) {
|
||||
config.position.position_broadcast_smart_enabled = false;
|
||||
config.position.position_broadcast_secs = 120;
|
||||
config.position.gps_update_interval = 60;
|
||||
}
|
||||
}
|
||||
|
||||
void NodeDB::initModuleConfigIntervals()
|
||||
{
|
||||
moduleConfig.telemetry.device_update_interval = default_broadcast_interval_secs;
|
||||
moduleConfig.telemetry.environment_update_interval = default_broadcast_interval_secs;
|
||||
@@ -230,7 +254,7 @@ void NodeDB::initModuleConfigIntervals()
|
||||
void NodeDB::installDefaultChannels()
|
||||
{
|
||||
LOG_INFO("Installing default ChannelFile\n");
|
||||
memset(&channelFile, 0, sizeof(ChannelFile));
|
||||
memset(&channelFile, 0, sizeof(meshtastic_ChannelFile));
|
||||
channelFile.version = DEVICESTATE_CUR_VER;
|
||||
}
|
||||
|
||||
@@ -244,10 +268,10 @@ void NodeDB::resetNodes()
|
||||
void NodeDB::installDefaultDeviceState()
|
||||
{
|
||||
LOG_INFO("Installing default DeviceState\n");
|
||||
memset(&devicestate, 0, sizeof(DeviceState));
|
||||
memset(&devicestate, 0, sizeof(meshtastic_DeviceState));
|
||||
|
||||
*numNodes = 0;
|
||||
|
||||
|
||||
// init our devicestate with valid flags so protobuf writing/reading will work
|
||||
devicestate.has_my_node = true;
|
||||
devicestate.has_owner = true;
|
||||
@@ -285,7 +309,8 @@ void NodeDB::init()
|
||||
|
||||
myNodeInfo.max_channels = MAX_NUM_CHANNELS; // tell others the max # of channels we can understand
|
||||
|
||||
myNodeInfo.error_code = CriticalErrorCode_NONE; // For the error code, only show values from this boot (discard value from flash)
|
||||
myNodeInfo.error_code =
|
||||
meshtastic_CriticalErrorCode_NONE; // For the error code, only show values from this boot (discard value from flash)
|
||||
myNodeInfo.error_address = 0;
|
||||
|
||||
// likewise - we always want the app requirements to come from the running appload
|
||||
@@ -299,7 +324,7 @@ void NodeDB::init()
|
||||
owner.hw_model = HW_VENDOR;
|
||||
|
||||
// Include our owner in the node db under our nodenum
|
||||
NodeInfo *info = getOrCreateNode(getNodeNum());
|
||||
meshtastic_NodeInfo *info = getOrCreateNode(getNodeNum());
|
||||
info->user = owner;
|
||||
info->has_user = true;
|
||||
|
||||
@@ -348,7 +373,7 @@ void NodeDB::pickNewNodeNum()
|
||||
if (r == NODENUM_BROADCAST || r < NUM_RESERVED)
|
||||
r = NUM_RESERVED; // don't pick a reserved node number
|
||||
|
||||
NodeInfo *found;
|
||||
meshtastic_NodeInfo *found;
|
||||
while ((found = getNode(r)) && memcmp(found->user.macaddr, owner.macaddr, sizeof(owner.macaddr))) {
|
||||
NodeNum n = random(NUM_RESERVED, NODENUM_BROADCAST); // try a new random choice
|
||||
LOG_DEBUG("NOTE! Our desired nodenum 0x%x is in use, so trying for 0x%x\n", r, n);
|
||||
@@ -364,7 +389,6 @@ static const char *moduleConfigFileName = "/prefs/module.proto";
|
||||
static const char *channelFileName = "/prefs/channels.proto";
|
||||
static const char *oemConfigFile = "/oem/oem.proto";
|
||||
|
||||
|
||||
/** Load a protobuf from a file, return true for success */
|
||||
bool NodeDB::loadProto(const char *filename, size_t protoSize, size_t objSize, const pb_msgdesc_t *fields, void *dest_struct)
|
||||
{
|
||||
@@ -400,7 +424,8 @@ bool NodeDB::loadProto(const char *filename, size_t protoSize, size_t objSize, c
|
||||
void NodeDB::loadFromDisk()
|
||||
{
|
||||
// static DeviceState scratch; We no longer read into a tempbuf because this structure is 15KB of valuable RAM
|
||||
if (!loadProto(prefFileName, DeviceState_size, sizeof(DeviceState), &DeviceState_msg, &devicestate)) {
|
||||
if (!loadProto(prefFileName, meshtastic_DeviceState_size, sizeof(meshtastic_DeviceState), &meshtastic_DeviceState_msg,
|
||||
&devicestate)) {
|
||||
installDefaultDeviceState(); // Our in RAM copy might now be corrupt
|
||||
} else {
|
||||
if (devicestate.version < DEVICESTATE_MIN_VER) {
|
||||
@@ -411,7 +436,8 @@ void NodeDB::loadFromDisk()
|
||||
}
|
||||
}
|
||||
|
||||
if (!loadProto(configFileName, LocalConfig_size, sizeof(LocalConfig), &LocalConfig_msg, &config)) {
|
||||
if (!loadProto(configFileName, meshtastic_LocalConfig_size, sizeof(meshtastic_LocalConfig), &meshtastic_LocalConfig_msg,
|
||||
&config)) {
|
||||
installDefaultConfig(); // Our in RAM copy might now be corrupt
|
||||
} else {
|
||||
if (config.version < DEVICESTATE_MIN_VER) {
|
||||
@@ -422,7 +448,8 @@ void NodeDB::loadFromDisk()
|
||||
}
|
||||
}
|
||||
|
||||
if (!loadProto(moduleConfigFileName, LocalModuleConfig_size, sizeof(LocalModuleConfig), &LocalModuleConfig_msg, &moduleConfig)) {
|
||||
if (!loadProto(moduleConfigFileName, meshtastic_LocalModuleConfig_size, sizeof(meshtastic_LocalModuleConfig),
|
||||
&meshtastic_LocalModuleConfig_msg, &moduleConfig)) {
|
||||
installDefaultModuleConfig(); // Our in RAM copy might now be corrupt
|
||||
} else {
|
||||
if (moduleConfig.version < DEVICESTATE_MIN_VER) {
|
||||
@@ -433,7 +460,8 @@ void NodeDB::loadFromDisk()
|
||||
}
|
||||
}
|
||||
|
||||
if (!loadProto(channelFileName, ChannelFile_size, sizeof(ChannelFile), &ChannelFile_msg, &channelFile)) {
|
||||
if (!loadProto(channelFileName, meshtastic_ChannelFile_size, sizeof(meshtastic_ChannelFile), &meshtastic_ChannelFile_msg,
|
||||
&channelFile)) {
|
||||
installDefaultChannels(); // Our in RAM copy might now be corrupt
|
||||
} else {
|
||||
if (channelFile.version < DEVICESTATE_MIN_VER) {
|
||||
@@ -444,7 +472,7 @@ void NodeDB::loadFromDisk()
|
||||
}
|
||||
}
|
||||
|
||||
if (loadProto(oemConfigFile, OEMStore_size, sizeof(OEMStore), &OEMStore_msg, &oemStore))
|
||||
if (loadProto(oemConfigFile, meshtastic_OEMStore_size, sizeof(meshtastic_OEMStore), &meshtastic_OEMStore_msg, &oemStore))
|
||||
LOG_INFO("Loaded OEMStore\n");
|
||||
}
|
||||
|
||||
@@ -478,9 +506,9 @@ bool NodeDB::saveProto(const char *filename, size_t protoSize, const pb_msgdesc_
|
||||
#ifdef ARCH_NRF52
|
||||
static uint8_t failedCounter = 0;
|
||||
failedCounter++;
|
||||
if(failedCounter >= 2){
|
||||
if (failedCounter >= 2) {
|
||||
FSCom.format();
|
||||
//After formatting, the device needs to be restarted
|
||||
// After formatting, the device needs to be restarted
|
||||
nodeDB.resetRadioConfig(true);
|
||||
}
|
||||
#endif
|
||||
@@ -497,17 +525,17 @@ void NodeDB::saveChannelsToDisk()
|
||||
#ifdef FSCom
|
||||
FSCom.mkdir("/prefs");
|
||||
#endif
|
||||
saveProto(channelFileName, ChannelFile_size, &ChannelFile_msg, &channelFile);
|
||||
saveProto(channelFileName, meshtastic_ChannelFile_size, &meshtastic_ChannelFile_msg, &channelFile);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeDB::saveDeviceStateToDisk()
|
||||
void NodeDB::saveDeviceStateToDisk()
|
||||
{
|
||||
if (!devicestate.no_save) {
|
||||
#ifdef FSCom
|
||||
FSCom.mkdir("/prefs");
|
||||
#endif
|
||||
saveProto(prefFileName, DeviceState_size, &DeviceState_msg, &devicestate);
|
||||
saveProto(prefFileName, meshtastic_DeviceState_size, &meshtastic_DeviceState_msg, &devicestate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -529,7 +557,7 @@ void NodeDB::saveToDisk(int saveWhat)
|
||||
config.has_power = true;
|
||||
config.has_network = true;
|
||||
config.has_bluetooth = true;
|
||||
saveProto(configFileName, LocalConfig_size, &LocalConfig_msg, &config);
|
||||
saveProto(configFileName, meshtastic_LocalConfig_size, &meshtastic_LocalConfig_msg, &config);
|
||||
}
|
||||
|
||||
if (saveWhat & SEGMENT_MODULECONFIG) {
|
||||
@@ -540,7 +568,7 @@ void NodeDB::saveToDisk(int saveWhat)
|
||||
moduleConfig.has_serial = true;
|
||||
moduleConfig.has_store_forward = true;
|
||||
moduleConfig.has_telemetry = true;
|
||||
saveProto(moduleConfigFileName, LocalModuleConfig_size, &LocalModuleConfig_msg, &moduleConfig);
|
||||
saveProto(moduleConfigFileName, meshtastic_LocalModuleConfig_size, &meshtastic_LocalModuleConfig_msg, &moduleConfig);
|
||||
}
|
||||
|
||||
if (saveWhat & SEGMENT_CHANNELS) {
|
||||
@@ -551,7 +579,7 @@ void NodeDB::saveToDisk(int saveWhat)
|
||||
}
|
||||
}
|
||||
|
||||
const NodeInfo *NodeDB::readNextInfo()
|
||||
const meshtastic_NodeInfo *NodeDB::readNextInfo()
|
||||
{
|
||||
if (readPointer < *numNodes)
|
||||
return &nodes[readPointer++];
|
||||
@@ -560,7 +588,7 @@ const NodeInfo *NodeDB::readNextInfo()
|
||||
}
|
||||
|
||||
/// Given a node, return how many seconds in the past (vs now) that we last heard from it
|
||||
uint32_t sinceLastSeen(const NodeInfo *n)
|
||||
uint32_t sinceLastSeen(const meshtastic_NodeInfo *n)
|
||||
{
|
||||
uint32_t now = getTime();
|
||||
|
||||
@@ -589,9 +617,9 @@ size_t NodeDB::getNumOnlineNodes()
|
||||
|
||||
/** Update position info for this node based on received position data
|
||||
*/
|
||||
void NodeDB::updatePosition(uint32_t nodeId, const Position &p, RxSource src)
|
||||
void NodeDB::updatePosition(uint32_t nodeId, const meshtastic_Position &p, RxSource src)
|
||||
{
|
||||
NodeInfo *info = getOrCreateNode(nodeId);
|
||||
meshtastic_NodeInfo *info = getOrCreateNode(nodeId);
|
||||
if (!info) {
|
||||
return;
|
||||
}
|
||||
@@ -599,15 +627,13 @@ void NodeDB::updatePosition(uint32_t nodeId, const Position &p, RxSource src)
|
||||
if (src == RX_SRC_LOCAL) {
|
||||
// Local packet, fully authoritative
|
||||
LOG_INFO("updatePosition LOCAL pos@%x, time=%u, latI=%d, lonI=%d, alt=%d\n", p.timestamp, p.time, p.latitude_i,
|
||||
p.longitude_i, p.altitude);
|
||||
p.longitude_i, p.altitude);
|
||||
info->position = p;
|
||||
|
||||
} else if ((p.time > 0) && !p.latitude_i && !p.longitude_i && !p.timestamp && !p.location_source) {
|
||||
// FIXME SPECIAL TIME SETTING PACKET FROM EUD TO RADIO
|
||||
// (stop-gap fix for issue #900)
|
||||
LOG_DEBUG("updatePosition SPECIAL time setting time=%u\n", p.time);
|
||||
info->position.time = p.time;
|
||||
|
||||
} else {
|
||||
// Be careful to only update fields that have been set by the REMOTE sender
|
||||
// A lot of position reports don't have time populated. In that case, be careful to not blow away the time we
|
||||
@@ -634,11 +660,11 @@ void NodeDB::updatePosition(uint32_t nodeId, const Position &p, RxSource src)
|
||||
/** Update telemetry info for this node based on received metrics
|
||||
* We only care about device telemetry here
|
||||
*/
|
||||
void NodeDB::updateTelemetry(uint32_t nodeId, const Telemetry &t, RxSource src)
|
||||
void NodeDB::updateTelemetry(uint32_t nodeId, const meshtastic_Telemetry &t, RxSource src)
|
||||
{
|
||||
NodeInfo *info = getOrCreateNode(nodeId);
|
||||
meshtastic_NodeInfo *info = getOrCreateNode(nodeId);
|
||||
// Environment metrics should never go to NodeDb but we'll safegaurd anyway
|
||||
if (!info || t.which_variant != Telemetry_device_metrics_tag) {
|
||||
if (!info || t.which_variant != meshtastic_Telemetry_device_metrics_tag) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -656,9 +682,9 @@ void NodeDB::updateTelemetry(uint32_t nodeId, const Telemetry &t, RxSource src)
|
||||
|
||||
/** Update user info for this node based on received user data
|
||||
*/
|
||||
void NodeDB::updateUser(uint32_t nodeId, const User &p)
|
||||
void NodeDB::updateUser(uint32_t nodeId, const meshtastic_User &p)
|
||||
{
|
||||
NodeInfo *info = getOrCreateNode(nodeId);
|
||||
meshtastic_NodeInfo *info = getOrCreateNode(nodeId);
|
||||
if (!info) {
|
||||
return;
|
||||
}
|
||||
@@ -685,12 +711,12 @@ void NodeDB::updateUser(uint32_t nodeId, const User &p)
|
||||
|
||||
/// given a subpacket sniffed from the network, update our DB state
|
||||
/// we updateGUI and updateGUIforNode if we think our this change is big enough for a redraw
|
||||
void NodeDB::updateFrom(const MeshPacket &mp)
|
||||
void NodeDB::updateFrom(const meshtastic_MeshPacket &mp)
|
||||
{
|
||||
if (mp.which_payload_variant == MeshPacket_decoded_tag && mp.from) {
|
||||
if (mp.which_payload_variant == meshtastic_MeshPacket_decoded_tag && mp.from) {
|
||||
LOG_DEBUG("Update DB node 0x%x, rx_time=%u\n", mp.from, mp.rx_time);
|
||||
|
||||
NodeInfo *info = getOrCreateNode(getFrom(&mp));
|
||||
meshtastic_NodeInfo *info = getOrCreateNode(getFrom(&mp));
|
||||
if (!info) {
|
||||
return;
|
||||
}
|
||||
@@ -705,7 +731,7 @@ void NodeDB::updateFrom(const MeshPacket &mp)
|
||||
|
||||
/// Find a node in our DB, return null for missing
|
||||
/// NOTE: This function might be called from an ISR
|
||||
NodeInfo *NodeDB::getNode(NodeNum n)
|
||||
meshtastic_NodeInfo *NodeDB::getNode(NodeNum n)
|
||||
{
|
||||
for (int i = 0; i < *numNodes; i++)
|
||||
if (nodes[i].num == n)
|
||||
@@ -715,9 +741,9 @@ NodeInfo *NodeDB::getNode(NodeNum n)
|
||||
}
|
||||
|
||||
/// Find a node in our DB, create an empty NodeInfo if missing
|
||||
NodeInfo *NodeDB::getOrCreateNode(NodeNum n)
|
||||
meshtastic_NodeInfo *NodeDB::getOrCreateNode(NodeNum n)
|
||||
{
|
||||
NodeInfo *info = getNode(n);
|
||||
meshtastic_NodeInfo *info = getNode(n);
|
||||
|
||||
if (!info) {
|
||||
if (*numNodes >= MAX_NUM_NODES) {
|
||||
@@ -749,7 +775,7 @@ NodeInfo *NodeDB::getOrCreateNode(NodeNum n)
|
||||
}
|
||||
|
||||
/// Record an error that should be reported via analytics
|
||||
void recordCriticalError(CriticalErrorCode code, uint32_t address, const char *filename)
|
||||
void recordCriticalError(meshtastic_CriticalErrorCode code, uint32_t address, const char *filename)
|
||||
{
|
||||
// Print error to screen and serial port
|
||||
String lcd = String("Critical error ") + code + "!\n";
|
||||
|
||||
+35
-28
@@ -21,16 +21,16 @@ DeviceState versions used to be defined in the .proto file but really only this
|
||||
#define DEVICESTATE_CUR_VER 20
|
||||
#define DEVICESTATE_MIN_VER DEVICESTATE_CUR_VER
|
||||
|
||||
extern DeviceState devicestate;
|
||||
extern ChannelFile channelFile;
|
||||
extern MyNodeInfo &myNodeInfo;
|
||||
extern LocalConfig config;
|
||||
extern LocalModuleConfig moduleConfig;
|
||||
extern OEMStore oemStore;
|
||||
extern User &owner;
|
||||
extern meshtastic_DeviceState devicestate;
|
||||
extern meshtastic_ChannelFile channelFile;
|
||||
extern meshtastic_MyNodeInfo &myNodeInfo;
|
||||
extern meshtastic_LocalConfig config;
|
||||
extern meshtastic_LocalModuleConfig moduleConfig;
|
||||
extern meshtastic_OEMStore oemStore;
|
||||
extern meshtastic_User &owner;
|
||||
|
||||
/// Given a node, return how many seconds in the past (vs now) that we last heard from it
|
||||
uint32_t sinceLastSeen(const NodeInfo *n);
|
||||
uint32_t sinceLastSeen(const meshtastic_NodeInfo *n);
|
||||
|
||||
class NodeDB
|
||||
{
|
||||
@@ -40,14 +40,14 @@ class NodeDB
|
||||
// Eventually use a smarter datastructure
|
||||
// HashMap<NodeNum, NodeInfo> nodes;
|
||||
// Note: these two references just point into our static array we serialize to/from disk
|
||||
NodeInfo *nodes;
|
||||
meshtastic_NodeInfo *nodes;
|
||||
pb_size_t *numNodes;
|
||||
|
||||
uint32_t readPointer = 0;
|
||||
|
||||
public:
|
||||
bool updateGUI = false; // we think the gui should definitely be redrawn, screen will clear this once handled
|
||||
NodeInfo *updateGUIforNode = NULL; // if currently showing this node, we think you should update the GUI
|
||||
bool updateGUI = false; // we think the gui should definitely be redrawn, screen will clear this once handled
|
||||
meshtastic_NodeInfo *updateGUIforNode = NULL; // if currently showing this node, we think you should update the GUI
|
||||
Observable<const meshtastic::NodeStatus *> newStatus;
|
||||
|
||||
/// don't do mesh based algoritm for node id assignment (initially)
|
||||
@@ -58,7 +58,8 @@ class NodeDB
|
||||
void init();
|
||||
|
||||
/// write to flash
|
||||
void saveToDisk(int saveWhat = SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS), saveChannelsToDisk(), saveDeviceStateToDisk();
|
||||
void saveToDisk(int saveWhat = SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS),
|
||||
saveChannelsToDisk(), saveDeviceStateToDisk();
|
||||
|
||||
/** Reinit radio config if needed, because either:
|
||||
* a) sometimes a buggy android app might send us bogus settings or
|
||||
@@ -70,19 +71,19 @@ class NodeDB
|
||||
|
||||
/// given a subpacket sniffed from the network, update our DB state
|
||||
/// we updateGUI and updateGUIforNode if we think our this change is big enough for a redraw
|
||||
void updateFrom(const MeshPacket &p);
|
||||
void updateFrom(const meshtastic_MeshPacket &p);
|
||||
|
||||
/** Update position info for this node based on received position data
|
||||
*/
|
||||
void updatePosition(uint32_t nodeId, const Position &p, RxSource src = RX_SRC_RADIO);
|
||||
void updatePosition(uint32_t nodeId, const meshtastic_Position &p, RxSource src = RX_SRC_RADIO);
|
||||
|
||||
/** Update telemetry info for this node based on received metrics
|
||||
*/
|
||||
void updateTelemetry(uint32_t nodeId, const Telemetry &t, RxSource src = RX_SRC_RADIO);
|
||||
void updateTelemetry(uint32_t nodeId, const meshtastic_Telemetry &t, RxSource src = RX_SRC_RADIO);
|
||||
|
||||
/** Update user info for this node based on received user data
|
||||
*/
|
||||
void updateUser(uint32_t nodeId, const User &p);
|
||||
void updateUser(uint32_t nodeId, const meshtastic_User &p);
|
||||
|
||||
/// @return our node number
|
||||
NodeNum getNodeNum() { return myNodeInfo.my_node_num; }
|
||||
@@ -104,15 +105,15 @@ class NodeDB
|
||||
void resetReadPointer() { readPointer = 0; }
|
||||
|
||||
/// Allow the bluetooth layer to read our next nodeinfo record, or NULL if done reading
|
||||
const NodeInfo *readNextInfo();
|
||||
const meshtastic_NodeInfo *readNextInfo();
|
||||
|
||||
/// pick a provisional nodenum we hope no one is using
|
||||
void pickNewNodeNum();
|
||||
|
||||
/// Find a node in our DB, return null for missing
|
||||
NodeInfo *getNode(NodeNum n);
|
||||
meshtastic_NodeInfo *getNode(NodeNum n);
|
||||
|
||||
NodeInfo *getNodeByIndex(size_t x)
|
||||
meshtastic_NodeInfo *getNodeByIndex(size_t x)
|
||||
{
|
||||
assert(x < *numNodes);
|
||||
return &nodes[x];
|
||||
@@ -122,15 +123,17 @@ class NodeDB
|
||||
size_t getNumOnlineNodes();
|
||||
|
||||
void initConfigIntervals(), initModuleConfigIntervals(), resetNodes();
|
||||
|
||||
|
||||
bool factoryReset();
|
||||
|
||||
bool loadProto(const char *filename, size_t protoSize, size_t objSize, const pb_msgdesc_t *fields, void *dest_struct);
|
||||
bool saveProto(const char *filename, size_t protoSize, const pb_msgdesc_t *fields, const void *dest_struct);
|
||||
|
||||
void installRoleDefaults(meshtastic_Config_DeviceConfig_Role role);
|
||||
|
||||
private:
|
||||
/// Find a node in our DB, create an empty NodeInfo if missing
|
||||
NodeInfo *getOrCreateNode(NodeNum n);
|
||||
meshtastic_NodeInfo *getOrCreateNode(NodeNum n);
|
||||
|
||||
/// Notify observers of changes to the DB
|
||||
void notifyObservers(bool forceUpdate = false)
|
||||
@@ -140,13 +143,11 @@ class NodeDB
|
||||
newStatus.notifyObservers(&status);
|
||||
}
|
||||
|
||||
|
||||
/// read our db from flash
|
||||
void loadFromDisk();
|
||||
|
||||
/// Reinit device state from scratch (not loading from disk)
|
||||
void installDefaultDeviceState(), installDefaultChannels(), installDefaultConfig(),
|
||||
installDefaultModuleConfig();
|
||||
void installDefaultDeviceState(), installDefaultChannels(), installDefaultConfig(), installDefaultModuleConfig();
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -183,7 +184,8 @@ extern NodeDB nodeDB;
|
||||
// Our delay functions check for this for times that should never expire
|
||||
#define NODE_DELAY_FOREVER 0xffffffff
|
||||
|
||||
#define IF_ROUTER(routerVal, normalVal) ((config.device.role == Config_DeviceConfig_Role_ROUTER) ? (routerVal) : (normalVal))
|
||||
#define IF_ROUTER(routerVal, normalVal) \
|
||||
((config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER) ? (routerVal) : (normalVal))
|
||||
|
||||
#define ONE_DAY 24 * 60 * 60
|
||||
|
||||
@@ -203,13 +205,15 @@ extern NodeDB nodeDB;
|
||||
|
||||
inline uint32_t getConfiguredOrDefaultMs(uint32_t configuredInterval)
|
||||
{
|
||||
if (configuredInterval > 0) return configuredInterval * 1000;
|
||||
if (configuredInterval > 0)
|
||||
return configuredInterval * 1000;
|
||||
return default_broadcast_interval_secs * 1000;
|
||||
}
|
||||
|
||||
inline uint32_t getConfiguredOrDefaultMs(uint32_t configuredInterval, uint32_t defaultInterval)
|
||||
{
|
||||
if (configuredInterval > 0) return configuredInterval * 1000;
|
||||
if (configuredInterval > 0)
|
||||
return configuredInterval * 1000;
|
||||
return defaultInterval * 1000;
|
||||
}
|
||||
|
||||
@@ -218,4 +222,7 @@ inline uint32_t getConfiguredOrDefaultMs(uint32_t configuredInterval, uint32_t d
|
||||
*/
|
||||
extern uint32_t radioGeneration;
|
||||
|
||||
#define Module_Config_size (ModuleConfig_CannedMessageConfig_size + ModuleConfig_ExternalNotificationConfig_size + ModuleConfig_MQTTConfig_size + ModuleConfig_RangeTestConfig_size + ModuleConfig_SerialConfig_size + ModuleConfig_StoreForwardConfig_size + ModuleConfig_TelemetryConfig_size + ModuleConfig_size)
|
||||
#define Module_Config_size \
|
||||
(ModuleConfig_CannedMessageConfig_size + ModuleConfig_ExternalNotificationConfig_size + ModuleConfig_MQTTConfig_size + \
|
||||
ModuleConfig_RangeTestConfig_size + ModuleConfig_SerialConfig_size + ModuleConfig_StoreForwardConfig_size + \
|
||||
ModuleConfig_TelemetryConfig_size + ModuleConfig_size)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "configuration.h"
|
||||
#include "PacketHistory.h"
|
||||
#include "configuration.h"
|
||||
#include "mesh-pb-constants.h"
|
||||
|
||||
PacketHistory::PacketHistory()
|
||||
@@ -11,7 +11,7 @@ PacketHistory::PacketHistory()
|
||||
/**
|
||||
* Update recentBroadcasts and return true if we have already seen this packet
|
||||
*/
|
||||
bool PacketHistory::wasSeenRecently(const MeshPacket *p, bool withUpdate)
|
||||
bool PacketHistory::wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpdate)
|
||||
{
|
||||
if (p->id == 0) {
|
||||
LOG_DEBUG("Ignoring message with zero id\n");
|
||||
@@ -26,10 +26,10 @@ bool PacketHistory::wasSeenRecently(const MeshPacket *p, bool withUpdate)
|
||||
r.rxTimeMsec = now;
|
||||
|
||||
auto found = recentPackets.find(r);
|
||||
bool seenRecently = (found != recentPackets.end()); // found not equal to .end() means packet was seen recently
|
||||
bool seenRecently = (found != recentPackets.end()); // found not equal to .end() means packet was seen recently
|
||||
|
||||
if (seenRecently && (now - found->rxTimeMsec) >= FLOOD_EXPIRE_TIME) { // Check whether found packet has already expired
|
||||
recentPackets.erase(found); // Erase and pretend packet has not been seen recently
|
||||
recentPackets.erase(found); // Erase and pretend packet has not been seen recently
|
||||
found = recentPackets.end();
|
||||
seenRecently = false;
|
||||
}
|
||||
@@ -58,12 +58,13 @@ bool PacketHistory::wasSeenRecently(const MeshPacket *p, bool withUpdate)
|
||||
/**
|
||||
* Iterate through all recent packets, and remove all older than FLOOD_EXPIRE_TIME
|
||||
*/
|
||||
void PacketHistory::clearExpiredRecentPackets() {
|
||||
void PacketHistory::clearExpiredRecentPackets()
|
||||
{
|
||||
uint32_t now = millis();
|
||||
|
||||
LOG_DEBUG("recentPackets size=%ld\n", recentPackets.size());
|
||||
|
||||
for (auto it = recentPackets.begin(); it != recentPackets.end(); ) {
|
||||
for (auto it = recentPackets.begin(); it != recentPackets.end();) {
|
||||
if ((now - it->rxTimeMsec) >= FLOOD_EXPIRE_TIME) {
|
||||
it = recentPackets.erase(it); // erase returns iterator pointing to element immediately following the one erased
|
||||
} else {
|
||||
|
||||
@@ -41,5 +41,5 @@ class PacketHistory
|
||||
*
|
||||
* @param withUpdate if true and not found we add an entry to recentPackets
|
||||
*/
|
||||
bool wasSeenRecently(const MeshPacket *p, bool withUpdate = true);
|
||||
bool wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpdate = true);
|
||||
};
|
||||
|
||||
+60
-60
@@ -80,20 +80,20 @@ bool PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength)
|
||||
// return (lastContactMsec != 0) &&
|
||||
|
||||
memset(&toRadioScratch, 0, sizeof(toRadioScratch));
|
||||
if (pb_decode_from_bytes(buf, bufLength, &ToRadio_msg, &toRadioScratch)) {
|
||||
if (pb_decode_from_bytes(buf, bufLength, &meshtastic_ToRadio_msg, &toRadioScratch)) {
|
||||
switch (toRadioScratch.which_payload_variant) {
|
||||
case ToRadio_packet_tag:
|
||||
case meshtastic_ToRadio_packet_tag:
|
||||
return handleToRadioPacket(toRadioScratch.packet);
|
||||
case ToRadio_want_config_id_tag:
|
||||
case meshtastic_ToRadio_want_config_id_tag:
|
||||
config_nonce = toRadioScratch.want_config_id;
|
||||
LOG_INFO("Client wants config, nonce=%u\n", config_nonce);
|
||||
handleStartConfig();
|
||||
break;
|
||||
case ToRadio_disconnect_tag:
|
||||
case meshtastic_ToRadio_disconnect_tag:
|
||||
LOG_INFO("Disconnecting from phone\n");
|
||||
close();
|
||||
break;
|
||||
case ToRadio_xmodemPacket_tag:
|
||||
case meshtastic_ToRadio_xmodemPacket_tag:
|
||||
LOG_INFO("Got xmodem packet\n");
|
||||
xModem.handlePacket(toRadioScratch.xmodemPacket);
|
||||
break;
|
||||
@@ -143,7 +143,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||
// If the user has specified they don't want our node to share its location, make sure to tell the phone
|
||||
// app not to send locations on our behalf.
|
||||
myNodeInfo.has_gps = gps && gps->isConnected(); // Update with latest GPS connect info
|
||||
fromRadioScratch.which_payload_variant = FromRadio_my_info_tag;
|
||||
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_my_info_tag;
|
||||
fromRadioScratch.my_info = myNodeInfo;
|
||||
state = STATE_SEND_NODEINFO;
|
||||
|
||||
@@ -152,13 +152,13 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||
|
||||
case STATE_SEND_NODEINFO: {
|
||||
LOG_INFO("getFromRadio=STATE_SEND_NODEINFO\n");
|
||||
const NodeInfo *info = nodeInfoForPhone;
|
||||
const meshtastic_NodeInfo *info = nodeInfoForPhone;
|
||||
nodeInfoForPhone = NULL; // We just consumed a nodeinfo, will need a new one next time
|
||||
|
||||
if (info) {
|
||||
LOG_INFO("Sending nodeinfo: num=0x%x, lastseen=%u, id=%s, name=%s\n", info->num, info->last_heard, info->user.id,
|
||||
info->user.long_name);
|
||||
fromRadioScratch.which_payload_variant = FromRadio_node_info_tag;
|
||||
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_node_info_tag;
|
||||
fromRadioScratch.node_info = *info;
|
||||
// Stay in current state until done sending nodeinfos
|
||||
} else {
|
||||
@@ -172,47 +172,47 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||
|
||||
case STATE_SEND_CHANNELS:
|
||||
LOG_INFO("getFromRadio=STATE_SEND_CHANNELS\n");
|
||||
fromRadioScratch.which_payload_variant = FromRadio_channel_tag;
|
||||
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_channel_tag;
|
||||
fromRadioScratch.channel = channels.getByIndex(config_state);
|
||||
config_state++;
|
||||
// Advance when we have sent all of our Channels
|
||||
if (config_state >= MAX_NUM_CHANNELS) {
|
||||
state = STATE_SEND_CONFIG;
|
||||
config_state = _AdminMessage_ConfigType_MIN + 1;
|
||||
config_state = _meshtastic_AdminMessage_ConfigType_MIN + 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case STATE_SEND_CONFIG:
|
||||
LOG_INFO("getFromRadio=STATE_SEND_CONFIG\n");
|
||||
fromRadioScratch.which_payload_variant = FromRadio_config_tag;
|
||||
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_config_tag;
|
||||
switch (config_state) {
|
||||
case Config_device_tag:
|
||||
fromRadioScratch.config.which_payload_variant = Config_device_tag;
|
||||
case meshtastic_Config_device_tag:
|
||||
fromRadioScratch.config.which_payload_variant = meshtastic_Config_device_tag;
|
||||
fromRadioScratch.config.payload_variant.device = config.device;
|
||||
break;
|
||||
case Config_position_tag:
|
||||
fromRadioScratch.config.which_payload_variant = Config_position_tag;
|
||||
case meshtastic_Config_position_tag:
|
||||
fromRadioScratch.config.which_payload_variant = meshtastic_Config_position_tag;
|
||||
fromRadioScratch.config.payload_variant.position = config.position;
|
||||
break;
|
||||
case Config_power_tag:
|
||||
fromRadioScratch.config.which_payload_variant = Config_power_tag;
|
||||
case meshtastic_Config_power_tag:
|
||||
fromRadioScratch.config.which_payload_variant = meshtastic_Config_power_tag;
|
||||
fromRadioScratch.config.payload_variant.power = config.power;
|
||||
fromRadioScratch.config.payload_variant.power.ls_secs = default_ls_secs;
|
||||
break;
|
||||
case Config_network_tag:
|
||||
fromRadioScratch.config.which_payload_variant = Config_network_tag;
|
||||
case meshtastic_Config_network_tag:
|
||||
fromRadioScratch.config.which_payload_variant = meshtastic_Config_network_tag;
|
||||
fromRadioScratch.config.payload_variant.network = config.network;
|
||||
break;
|
||||
case Config_display_tag:
|
||||
fromRadioScratch.config.which_payload_variant = Config_display_tag;
|
||||
case meshtastic_Config_display_tag:
|
||||
fromRadioScratch.config.which_payload_variant = meshtastic_Config_display_tag;
|
||||
fromRadioScratch.config.payload_variant.display = config.display;
|
||||
break;
|
||||
case Config_lora_tag:
|
||||
fromRadioScratch.config.which_payload_variant = Config_lora_tag;
|
||||
case meshtastic_Config_lora_tag:
|
||||
fromRadioScratch.config.which_payload_variant = meshtastic_Config_lora_tag;
|
||||
fromRadioScratch.config.payload_variant.lora = config.lora;
|
||||
break;
|
||||
case Config_bluetooth_tag:
|
||||
fromRadioScratch.config.which_payload_variant = Config_bluetooth_tag;
|
||||
case meshtastic_Config_bluetooth_tag:
|
||||
fromRadioScratch.config.which_payload_variant = meshtastic_Config_bluetooth_tag;
|
||||
fromRadioScratch.config.payload_variant.bluetooth = config.bluetooth;
|
||||
break;
|
||||
default:
|
||||
@@ -224,50 +224,50 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||
|
||||
config_state++;
|
||||
// Advance when we have sent all of our config objects
|
||||
if (config_state > (_AdminMessage_ConfigType_MAX + 1)) {
|
||||
if (config_state > (_meshtastic_AdminMessage_ConfigType_MAX + 1)) {
|
||||
state = STATE_SEND_MODULECONFIG;
|
||||
config_state = _AdminMessage_ModuleConfigType_MIN + 1;
|
||||
config_state = _meshtastic_AdminMessage_ModuleConfigType_MIN + 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case STATE_SEND_MODULECONFIG:
|
||||
LOG_INFO("getFromRadio=STATE_SEND_MODULECONFIG\n");
|
||||
fromRadioScratch.which_payload_variant = FromRadio_moduleConfig_tag;
|
||||
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_moduleConfig_tag;
|
||||
switch (config_state) {
|
||||
case ModuleConfig_mqtt_tag:
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = ModuleConfig_mqtt_tag;
|
||||
case meshtastic_ModuleConfig_mqtt_tag:
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_mqtt_tag;
|
||||
fromRadioScratch.moduleConfig.payload_variant.mqtt = moduleConfig.mqtt;
|
||||
break;
|
||||
case ModuleConfig_serial_tag:
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = ModuleConfig_serial_tag;
|
||||
case meshtastic_ModuleConfig_serial_tag:
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_serial_tag;
|
||||
fromRadioScratch.moduleConfig.payload_variant.serial = moduleConfig.serial;
|
||||
break;
|
||||
case ModuleConfig_external_notification_tag:
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = ModuleConfig_external_notification_tag;
|
||||
case meshtastic_ModuleConfig_external_notification_tag:
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_external_notification_tag;
|
||||
fromRadioScratch.moduleConfig.payload_variant.external_notification = moduleConfig.external_notification;
|
||||
break;
|
||||
case ModuleConfig_store_forward_tag:
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = ModuleConfig_store_forward_tag;
|
||||
case meshtastic_ModuleConfig_store_forward_tag:
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_store_forward_tag;
|
||||
fromRadioScratch.moduleConfig.payload_variant.store_forward = moduleConfig.store_forward;
|
||||
break;
|
||||
case ModuleConfig_range_test_tag:
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = ModuleConfig_range_test_tag;
|
||||
case meshtastic_ModuleConfig_range_test_tag:
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_range_test_tag;
|
||||
fromRadioScratch.moduleConfig.payload_variant.range_test = moduleConfig.range_test;
|
||||
break;
|
||||
case ModuleConfig_telemetry_tag:
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = ModuleConfig_telemetry_tag;
|
||||
case meshtastic_ModuleConfig_telemetry_tag:
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_telemetry_tag;
|
||||
fromRadioScratch.moduleConfig.payload_variant.telemetry = moduleConfig.telemetry;
|
||||
break;
|
||||
case ModuleConfig_canned_message_tag:
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = ModuleConfig_canned_message_tag;
|
||||
case meshtastic_ModuleConfig_canned_message_tag:
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_canned_message_tag;
|
||||
fromRadioScratch.moduleConfig.payload_variant.canned_message = moduleConfig.canned_message;
|
||||
break;
|
||||
case ModuleConfig_audio_tag:
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = ModuleConfig_audio_tag;
|
||||
case meshtastic_ModuleConfig_audio_tag:
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_audio_tag;
|
||||
fromRadioScratch.moduleConfig.payload_variant.audio = moduleConfig.audio;
|
||||
break;
|
||||
case ModuleConfig_remote_hardware_tag:
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = ModuleConfig_remote_hardware_tag;
|
||||
case meshtastic_ModuleConfig_remote_hardware_tag:
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_remote_hardware_tag;
|
||||
fromRadioScratch.moduleConfig.payload_variant.remote_hardware = moduleConfig.remote_hardware;
|
||||
break;
|
||||
default:
|
||||
@@ -276,7 +276,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||
|
||||
config_state++;
|
||||
// Advance when we have sent all of our ModuleConfig objects
|
||||
if (config_state > (_AdminMessage_ModuleConfigType_MAX + 1)) {
|
||||
if (config_state > (_meshtastic_AdminMessage_ModuleConfigType_MAX + 1)) {
|
||||
state = STATE_SEND_COMPLETE_ID;
|
||||
config_state = 0;
|
||||
}
|
||||
@@ -284,7 +284,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||
|
||||
case STATE_SEND_COMPLETE_ID:
|
||||
LOG_INFO("getFromRadio=STATE_SEND_COMPLETE_ID\n");
|
||||
fromRadioScratch.which_payload_variant = FromRadio_config_complete_id_tag;
|
||||
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_config_complete_id_tag;
|
||||
fromRadioScratch.config_complete_id = config_nonce;
|
||||
config_nonce = 0;
|
||||
state = STATE_SEND_PACKETS;
|
||||
@@ -294,19 +294,18 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||
// Do we have a message from the mesh?
|
||||
LOG_INFO("getFromRadio=STATE_SEND_PACKETS\n");
|
||||
if (queueStatusPacketForPhone) {
|
||||
fromRadioScratch.which_payload_variant = FromRadio_queueStatus_tag;
|
||||
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_queueStatus_tag;
|
||||
fromRadioScratch.queueStatus = *queueStatusPacketForPhone;
|
||||
releaseQueueStatusPhonePacket();
|
||||
} else if (xmodemPacketForPhone) {
|
||||
fromRadioScratch.which_payload_variant = FromRadio_xmodemPacket_tag;
|
||||
fromRadioScratch.xmodemPacket = *xmodemPacketForPhone;
|
||||
free(xmodemPacketForPhone);
|
||||
xmodemPacketForPhone = NULL;
|
||||
} else if (xmodemPacketForPhone.control != meshtastic_XModem_Control_NUL) {
|
||||
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_xmodemPacket_tag;
|
||||
fromRadioScratch.xmodemPacket = xmodemPacketForPhone;
|
||||
xmodemPacketForPhone = meshtastic_XModem_init_zero;
|
||||
} else if (packetForPhone) {
|
||||
printPacket("phone downloaded packet", packetForPhone);
|
||||
|
||||
// Encapsulate as a FromRadio packet
|
||||
fromRadioScratch.which_payload_variant = FromRadio_packet_tag;
|
||||
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_packet_tag;
|
||||
fromRadioScratch.packet = *packetForPhone;
|
||||
releasePhonePacket();
|
||||
}
|
||||
@@ -319,7 +318,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||
// Do we have a message from the mesh?
|
||||
if (fromRadioScratch.which_payload_variant != 0) {
|
||||
// Encapsulate as a FromRadio packet
|
||||
size_t numbytes = pb_encode_to_bytes(buf, FromRadio_size, &FromRadio_msg, &fromRadioScratch);
|
||||
size_t numbytes = pb_encode_to_bytes(buf, meshtastic_FromRadio_size, &meshtastic_FromRadio_msg, &fromRadioScratch);
|
||||
|
||||
LOG_DEBUG("encoding toPhone packet to phone variant=%d, %d bytes\n", fromRadioScratch.which_payload_variant, numbytes);
|
||||
return numbytes;
|
||||
@@ -377,11 +376,12 @@ bool PhoneAPI::available()
|
||||
if (hasPacket)
|
||||
return true;
|
||||
|
||||
if (!xmodemPacketForPhone)
|
||||
if (xmodemPacketForPhone.control == meshtastic_XModem_Control_NUL)
|
||||
xmodemPacketForPhone = xModem.getForPhone();
|
||||
hasPacket = !!packetForPhone;
|
||||
if (hasPacket)
|
||||
if (xmodemPacketForPhone.control != meshtastic_XModem_Control_NUL) {
|
||||
xModem.resetForPhone();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!packetForPhone)
|
||||
packetForPhone = service.getForPhone();
|
||||
@@ -399,7 +399,7 @@ bool PhoneAPI::available()
|
||||
/**
|
||||
* Handle a packet that the phone wants us to send. It is our responsibility to free the packet to the pool
|
||||
*/
|
||||
bool PhoneAPI::handleToRadioPacket(MeshPacket &p)
|
||||
bool PhoneAPI::handleToRadioPacket(meshtastic_MeshPacket &p)
|
||||
{
|
||||
printPacket("PACKET FROM PHONE", &p);
|
||||
service.handleToRadio(p);
|
||||
|
||||
+8
-7
@@ -41,18 +41,19 @@ class PhoneAPI
|
||||
|
||||
/// We temporarily keep the packet here between the call to available and getFromRadio. We will free it after the phone
|
||||
/// downloads it
|
||||
MeshPacket *packetForPhone = NULL;
|
||||
meshtastic_MeshPacket *packetForPhone = NULL;
|
||||
|
||||
// file transfer packets destined for phone. Push it to the queue then free it.
|
||||
XModem *xmodemPacketForPhone = NULL;
|
||||
meshtastic_XModem xmodemPacketForPhone = meshtastic_XModem_init_zero;
|
||||
|
||||
// Keep QueueStatus packet just as packetForPhone
|
||||
QueueStatus *queueStatusPacketForPhone = NULL;
|
||||
meshtastic_QueueStatus *queueStatusPacketForPhone = NULL;
|
||||
|
||||
/// We temporarily keep the nodeInfo here between the call to available and getFromRadio
|
||||
const NodeInfo *nodeInfoForPhone = NULL;
|
||||
const meshtastic_NodeInfo *nodeInfoForPhone = NULL;
|
||||
|
||||
ToRadio toRadioScratch = {0}; // this is a static scratch object, any data must be copied elsewhere before returning
|
||||
meshtastic_ToRadio toRadioScratch = {
|
||||
0}; // this is a static scratch object, any data must be copied elsewhere before returning
|
||||
|
||||
/// Use to ensure that clients don't get confused about old messages from the radio
|
||||
uint32_t config_nonce = 0;
|
||||
@@ -92,7 +93,7 @@ class PhoneAPI
|
||||
|
||||
protected:
|
||||
/// Our fromradio packet while it is being assembled
|
||||
FromRadio fromRadioScratch = {};
|
||||
meshtastic_FromRadio fromRadioScratch = {};
|
||||
|
||||
/** the last msec we heard from the client on the other side of this link */
|
||||
uint32_t lastContactMsec = 0;
|
||||
@@ -128,7 +129,7 @@ class PhoneAPI
|
||||
* Handle a packet that the phone wants us to send. We can write to it but can not keep a reference to it
|
||||
* @return true true if a packet was queued for sending
|
||||
*/
|
||||
bool handleToRadioPacket(MeshPacket &p);
|
||||
bool handleToRadioPacket(meshtastic_MeshPacket &p);
|
||||
|
||||
/// If the mesh service tells us fromNum has changed, tell the phone
|
||||
virtual int onNotify(uint32_t newValue) override;
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
#include "configuration.h"
|
||||
#include "ProtobufModule.h"
|
||||
|
||||
|
||||
#include "configuration.h"
|
||||
|
||||
+10
-12
@@ -16,31 +16,29 @@ template <class T> class ProtobufModule : protected SinglePortModule
|
||||
/** Constructor
|
||||
* name is for debugging output
|
||||
*/
|
||||
ProtobufModule(const char *_name, PortNum _ourPortNum, const pb_msgdesc_t *_fields)
|
||||
ProtobufModule(const char *_name, meshtastic_PortNum _ourPortNum, const pb_msgdesc_t *_fields)
|
||||
: SinglePortModule(_name, _ourPortNum), fields(_fields)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
/**
|
||||
* Handle a received message, the data field in the message is already decoded and is provided
|
||||
*
|
||||
* In general decoded will always be !NULL. But in some special applications (where you have handling packets
|
||||
* for multiple port numbers, decoding will ONLY be attempted for packets where the portnum matches our expected ourPortNum.
|
||||
*/
|
||||
virtual bool handleReceivedProtobuf(const MeshPacket &mp, T *decoded) = 0;
|
||||
virtual bool handleReceivedProtobuf(const meshtastic_MeshPacket &mp, T *decoded) = 0;
|
||||
|
||||
/**
|
||||
* Return a mesh packet which has been preinited with a particular protobuf data payload and port number.
|
||||
* You can then send this packet (after customizing any of the payload fields you might need) with
|
||||
* service.sendToMesh()
|
||||
*/
|
||||
MeshPacket *allocDataProtobuf(const T &payload)
|
||||
meshtastic_MeshPacket *allocDataProtobuf(const T &payload)
|
||||
{
|
||||
// Update our local node info with our position (even if we don't decide to update anyone else)
|
||||
MeshPacket *p = allocDataPacket();
|
||||
meshtastic_MeshPacket *p = allocDataPacket();
|
||||
|
||||
p->decoded.payload.size =
|
||||
pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), fields, &payload);
|
||||
@@ -52,7 +50,7 @@ template <class T> class ProtobufModule : protected SinglePortModule
|
||||
* Gets the short name from the sender of the mesh packet
|
||||
* Returns "???" if unknown sender
|
||||
*/
|
||||
const char *getSenderShortName(const MeshPacket &mp)
|
||||
const char *getSenderShortName(const meshtastic_MeshPacket &mp)
|
||||
{
|
||||
auto node = nodeDB.getNode(getFrom(&mp));
|
||||
const char *sender = (node) ? node->user.short_name : "???";
|
||||
@@ -62,20 +60,20 @@ template <class T> class ProtobufModule : protected SinglePortModule
|
||||
private:
|
||||
/** Called to handle a particular incoming message
|
||||
|
||||
@return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for it
|
||||
@return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for
|
||||
it
|
||||
*/
|
||||
virtual ProcessMessage handleReceived(const MeshPacket &mp) override
|
||||
virtual ProcessMessage handleReceived(const meshtastic_MeshPacket &mp) override
|
||||
{
|
||||
// FIXME - we currently update position data in the DB only if the message was a broadcast or destined to us
|
||||
// it would be better to update even if the message was destined to others.
|
||||
|
||||
auto &p = mp.decoded;
|
||||
LOG_INFO("Received %s from=0x%0x, id=0x%x, portnum=%d, payloadlen=%d\n", name, mp.from, mp.id, p.portnum,
|
||||
p.payload.size);
|
||||
LOG_INFO("Received %s from=0x%0x, id=0x%x, portnum=%d, payloadlen=%d\n", name, mp.from, mp.id, p.portnum, p.payload.size);
|
||||
|
||||
T scratch;
|
||||
T *decoded = NULL;
|
||||
if (mp.which_payload_variant == MeshPacket_decoded_tag && mp.decoded.portnum == ourPortNum) {
|
||||
if (mp.which_payload_variant == meshtastic_MeshPacket_decoded_tag && mp.decoded.portnum == ourPortNum) {
|
||||
memset(&scratch, 0, sizeof(scratch));
|
||||
if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, fields, &scratch)) {
|
||||
decoded = &scratch;
|
||||
|
||||
+14
-15
@@ -1,7 +1,7 @@
|
||||
#include "configuration.h"
|
||||
#include "RF95Interface.h"
|
||||
#include "MeshRadio.h" // kinda yucky, but we need to know which region we are in
|
||||
#include "RadioLibRF95.h"
|
||||
#include "configuration.h"
|
||||
#include "error.h"
|
||||
|
||||
#define MAX_POWER 20
|
||||
@@ -70,9 +70,9 @@ bool RF95Interface::init()
|
||||
int res = lora->begin(getFreq(), bw, sf, cr, syncWord, power, currentLimit, preambleLength);
|
||||
LOG_INFO("RF95 init result %d\n", res);
|
||||
|
||||
LOG_INFO("Frequency set to %f\n", getFreq());
|
||||
LOG_INFO("Bandwidth set to %f\n", bw);
|
||||
LOG_INFO("Power output set to %d\n", power);
|
||||
LOG_INFO("Frequency set to %f\n", getFreq());
|
||||
LOG_INFO("Bandwidth set to %f\n", bw);
|
||||
LOG_INFO("Power output set to %d\n", power);
|
||||
|
||||
// current limit was removed from module' ctor
|
||||
// override default value (60 mA)
|
||||
@@ -104,15 +104,15 @@ bool RF95Interface::reconfigure()
|
||||
// configure publicly accessible settings
|
||||
int err = lora->setSpreadingFactor(sf);
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
|
||||
err = lora->setBandwidth(bw);
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
|
||||
err = lora->setCodingRate(cr);
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
|
||||
err = lora->setSyncWord(syncWord);
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
@@ -125,14 +125,14 @@ bool RF95Interface::reconfigure()
|
||||
|
||||
err = lora->setFrequency(getFreq());
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
|
||||
if (power > MAX_POWER) // This chip has lower power limits than some
|
||||
power = MAX_POWER;
|
||||
|
||||
|
||||
err = lora->setOutputPower(power);
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
|
||||
startReceive(); // restart receiving
|
||||
|
||||
@@ -142,11 +142,10 @@ bool RF95Interface::reconfigure()
|
||||
/**
|
||||
* Add SNR data to received messages
|
||||
*/
|
||||
void RF95Interface::addReceiveMetadata(MeshPacket *mp)
|
||||
void RF95Interface::addReceiveMetadata(meshtastic_MeshPacket *mp)
|
||||
{
|
||||
mp->rx_snr = lora->getSNR();
|
||||
mp->rx_rssi = lround(lora->getRSSI());
|
||||
|
||||
}
|
||||
|
||||
void RF95Interface::setStandby()
|
||||
@@ -186,15 +185,15 @@ bool RF95Interface::isChannelActive()
|
||||
// check if we can detect a LoRa preamble on the current channel
|
||||
int16_t result;
|
||||
setTransmitEnable(false);
|
||||
setStandby(); // needed for smooth transition
|
||||
setStandby(); // needed for smooth transition
|
||||
result = lora->scanChannel();
|
||||
|
||||
|
||||
if (result == RADIOLIB_PREAMBLE_DETECTED) {
|
||||
// LOG_DEBUG("Channel is busy!\n");
|
||||
return true;
|
||||
}
|
||||
assert(result != RADIOLIB_ERR_WRONG_MODEM);
|
||||
|
||||
|
||||
// LOG_DEBUG("Channel is free!\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ class RF95Interface : public RadioLibInterface
|
||||
|
||||
public:
|
||||
RF95Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, SPIClass &spi);
|
||||
|
||||
//TODO: Verify that this irq flag works with RFM95 / SX1276 radios the way it used to
|
||||
|
||||
// TODO: Verify that this irq flag works with RFM95 / SX1276 radios the way it used to
|
||||
bool isIRQPending() override { return lora->getIRQFlags() & RADIOLIB_SX127X_MASK_IRQ_FLAG_VALID_HEADER; }
|
||||
|
||||
/// Initialise the Driver transport hardware and software.
|
||||
@@ -55,7 +55,7 @@ class RF95Interface : public RadioLibInterface
|
||||
/**
|
||||
* Add SNR data to received messages
|
||||
*/
|
||||
virtual void addReceiveMetadata(MeshPacket *mp) override;
|
||||
virtual void addReceiveMetadata(meshtastic_MeshPacket *mp) override;
|
||||
|
||||
virtual void setStandby() override;
|
||||
|
||||
|
||||
+50
-37
@@ -11,10 +11,10 @@
|
||||
#include <pb_decode.h>
|
||||
#include <pb_encode.h>
|
||||
|
||||
#define RDEF(name, freq_start, freq_end, duty_cycle, spacing, power_limit, audio_permitted, frequency_switching, wide_lora) \
|
||||
#define RDEF(name, freq_start, freq_end, duty_cycle, spacing, power_limit, audio_permitted, frequency_switching, wide_lora) \
|
||||
{ \
|
||||
Config_LoRaConfig_RegionCode_##name, freq_start, freq_end, duty_cycle, spacing, power_limit, audio_permitted, \
|
||||
frequency_switching, wide_lora, #name \
|
||||
meshtastic_Config_LoRaConfig_RegionCode_##name, freq_start, freq_end, duty_cycle, spacing, power_limit, audio_permitted, \
|
||||
frequency_switching, wide_lora, #name \
|
||||
}
|
||||
|
||||
const RegionInfo regions[] = {
|
||||
@@ -38,9 +38,9 @@ const RegionInfo regions[] = {
|
||||
|
||||
Special Note:
|
||||
The link above describes LoRaWAN's band plan, stating a power limit of 16 dBm. This is their own suggested specification,
|
||||
we do not need to follow it. The European Union regulations clearly state that the power limit for this frequency range is 500 mW, or 27 dBm.
|
||||
It also states that we can use interference avoidance and spectrum access techniques to avoid a duty cycle.
|
||||
(Please refer to section 4.21 in the following document)
|
||||
we do not need to follow it. The European Union regulations clearly state that the power limit for this frequency range is
|
||||
500 mW, or 27 dBm. It also states that we can use interference avoidance and spectrum access techniques to avoid a duty
|
||||
cycle. (Please refer to section 4.21 in the following document)
|
||||
https://ec.europa.eu/growth/tools-databases/tris/index.cfm/ro/search/?trisaction=search.detail&year=2021&num=528&dLang=EN
|
||||
*/
|
||||
RDEF(EU_868, 869.4f, 869.65f, 10, 0, 27, false, false, false),
|
||||
@@ -94,7 +94,7 @@ const RegionInfo regions[] = {
|
||||
https://lora-alliance.org/wp-content/uploads/2020/11/lorawan_regional_parameters_v1.0.3reva_0.pdf
|
||||
*/
|
||||
RDEF(TH, 920.0f, 925.0f, 100, 0, 16, true, false, false),
|
||||
|
||||
|
||||
/*
|
||||
433,05-434,7 Mhz 10 mW
|
||||
https://nkrzi.gov.ua/images/upload/256/5810/PDF_UUZ_19_01_2016.pdf
|
||||
@@ -127,7 +127,7 @@ static uint8_t bytes[MAX_RHPACKETLEN];
|
||||
void initRegion()
|
||||
{
|
||||
const RegionInfo *r = regions;
|
||||
for (; r->code != Config_LoRaConfig_RegionCode_UNSET && r->code != config.lora.region; r++)
|
||||
for (; r->code != meshtastic_Config_LoRaConfig_RegionCode_UNSET && r->code != config.lora.region; r++)
|
||||
;
|
||||
myRegion = r;
|
||||
LOG_INFO("Wanted region %d, using %s\n", config.lora.region, r->name);
|
||||
@@ -175,29 +175,29 @@ uint32_t RadioInterface::getPacketTime(uint32_t pl)
|
||||
return msecs;
|
||||
}
|
||||
|
||||
uint32_t RadioInterface::getPacketTime(MeshPacket *p)
|
||||
uint32_t RadioInterface::getPacketTime(meshtastic_MeshPacket *p)
|
||||
{
|
||||
uint32_t pl = 0;
|
||||
if(p->which_payload_variant == MeshPacket_encrypted_tag) {
|
||||
if (p->which_payload_variant == meshtastic_MeshPacket_encrypted_tag) {
|
||||
pl = p->encrypted.size + sizeof(PacketHeader);
|
||||
} else {
|
||||
size_t numbytes = pb_encode_to_bytes(bytes, sizeof(bytes), &Data_msg, &p->decoded);
|
||||
size_t numbytes = pb_encode_to_bytes(bytes, sizeof(bytes), &meshtastic_Data_msg, &p->decoded);
|
||||
pl = numbytes + sizeof(PacketHeader);
|
||||
}
|
||||
return getPacketTime(pl);
|
||||
}
|
||||
|
||||
/** The delay to use for retransmitting dropped packets */
|
||||
uint32_t RadioInterface::getRetransmissionMsec(const MeshPacket *p)
|
||||
uint32_t RadioInterface::getRetransmissionMsec(const meshtastic_MeshPacket *p)
|
||||
{
|
||||
size_t numbytes = pb_encode_to_bytes(bytes, sizeof(bytes), &Data_msg, &p->decoded);
|
||||
size_t numbytes = pb_encode_to_bytes(bytes, sizeof(bytes), &meshtastic_Data_msg, &p->decoded);
|
||||
uint32_t packetAirtime = getPacketTime(numbytes + sizeof(PacketHeader));
|
||||
// Make sure enough time has elapsed for this packet to be sent and an ACK is received.
|
||||
// LOG_DEBUG("Waiting for flooding message with airtime %d and slotTime is %d\n", packetAirtime, slotTimeMsec);
|
||||
float channelUtil = airTime->channelUtilizationPercent();
|
||||
uint8_t CWsize = map(channelUtil, 0, 100, CWmin, CWmax);
|
||||
// Assuming we pick max. of CWsize and there will be a receiver with SNR at half the range
|
||||
return 2*packetAirtime + (pow(2, CWsize) + pow(2, int((CWmax+CWmin)/2))) * slotTimeMsec + PROCESSING_TIME_MSEC;
|
||||
return 2 * packetAirtime + (pow(2, CWsize) + pow(2, int((CWmax + CWmin) / 2))) * slotTimeMsec + PROCESSING_TIME_MSEC;
|
||||
}
|
||||
|
||||
/** The delay to use when we want to send something */
|
||||
@@ -226,9 +226,10 @@ uint32_t RadioInterface::getTxDelayMsecWeighted(float snr)
|
||||
uint32_t delay = 0;
|
||||
uint8_t CWsize = map(snr, SNR_MIN, SNR_MAX, CWmin, CWmax);
|
||||
// LOG_DEBUG("rx_snr of %f so setting CWsize to:%d\n", snr, CWsize);
|
||||
if (config.device.role == Config_DeviceConfig_Role_ROUTER ||
|
||||
config.device.role == Config_DeviceConfig_Role_ROUTER_CLIENT) {
|
||||
delay = random(0, 2*CWsize) * slotTimeMsec;
|
||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER ||
|
||||
config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER_CLIENT ||
|
||||
config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER) {
|
||||
delay = random(0, 2 * CWsize) * slotTimeMsec;
|
||||
LOG_DEBUG("rx_snr found in packet. As a router, setting tx delay:%d\n", delay);
|
||||
} else {
|
||||
delay = random(0, pow(2, CWsize)) * slotTimeMsec;
|
||||
@@ -238,11 +239,11 @@ uint32_t RadioInterface::getTxDelayMsecWeighted(float snr)
|
||||
return delay;
|
||||
}
|
||||
|
||||
void printPacket(const char *prefix, const MeshPacket *p)
|
||||
void printPacket(const char *prefix, const meshtastic_MeshPacket *p)
|
||||
{
|
||||
LOG_DEBUG("%s (id=0x%08x fr=0x%02x to=0x%02x, WantAck=%d, HopLim=%d Ch=0x%x", prefix, p->id, p->from & 0xff, p->to & 0xff,
|
||||
p->want_ack, p->hop_limit, p->channel);
|
||||
if (p->which_payload_variant == MeshPacket_decoded_tag) {
|
||||
if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
|
||||
auto &s = p->decoded;
|
||||
|
||||
LOG_DEBUG(" Portnum=%d", s.portnum);
|
||||
@@ -275,7 +276,7 @@ void printPacket(const char *prefix, const MeshPacket *p)
|
||||
LOG_DEBUG(" rxSNR=%g", p->rx_snr);
|
||||
}
|
||||
if (p->rx_rssi != 0) {
|
||||
LOG_DEBUG(" rxRSSI=%g", p->rx_rssi);
|
||||
LOG_DEBUG(" rxRSSI=%i", p->rx_rssi);
|
||||
}
|
||||
if (p->priority != 0)
|
||||
LOG_DEBUG(" priority=%d", p->priority);
|
||||
@@ -372,26 +373,26 @@ void RadioInterface::applyModemConfig()
|
||||
{
|
||||
// Set up default configuration
|
||||
// No Sync Words in LORA mode
|
||||
Config_LoRaConfig &loraConfig = config.lora;
|
||||
meshtastic_Config_LoRaConfig &loraConfig = config.lora;
|
||||
if (loraConfig.use_preset) {
|
||||
|
||||
switch (loraConfig.modem_preset) {
|
||||
case Config_LoRaConfig_ModemPreset_SHORT_FAST:
|
||||
case meshtastic_Config_LoRaConfig_ModemPreset_SHORT_FAST:
|
||||
bw = (myRegion->wideLora) ? 812.5 : 250;
|
||||
cr = 8;
|
||||
sf = 7;
|
||||
break;
|
||||
case Config_LoRaConfig_ModemPreset_SHORT_SLOW:
|
||||
case meshtastic_Config_LoRaConfig_ModemPreset_SHORT_SLOW:
|
||||
bw = (myRegion->wideLora) ? 812.5 : 250;
|
||||
cr = 8;
|
||||
sf = 8;
|
||||
break;
|
||||
case Config_LoRaConfig_ModemPreset_MEDIUM_FAST:
|
||||
case meshtastic_Config_LoRaConfig_ModemPreset_MEDIUM_FAST:
|
||||
bw = (myRegion->wideLora) ? 812.5 : 250;
|
||||
cr = 8;
|
||||
sf = 9;
|
||||
break;
|
||||
case Config_LoRaConfig_ModemPreset_MEDIUM_SLOW:
|
||||
case meshtastic_Config_LoRaConfig_ModemPreset_MEDIUM_SLOW:
|
||||
bw = (myRegion->wideLora) ? 812.5 : 250;
|
||||
cr = 8;
|
||||
sf = 10;
|
||||
@@ -401,13 +402,18 @@ void RadioInterface::applyModemConfig()
|
||||
cr = 8;
|
||||
sf = 11;
|
||||
break;
|
||||
case Config_LoRaConfig_ModemPreset_LONG_SLOW:
|
||||
case meshtastic_Config_LoRaConfig_ModemPreset_LONG_MODERATE:
|
||||
bw = (myRegion->wideLora) ? 406.25 : 125;
|
||||
cr = 8;
|
||||
sf = 11;
|
||||
break;
|
||||
case meshtastic_Config_LoRaConfig_ModemPreset_LONG_SLOW:
|
||||
bw = (myRegion->wideLora) ? 406.25 : 125;
|
||||
cr = 8;
|
||||
sf = 12;
|
||||
break;
|
||||
case Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW:
|
||||
bw = (myRegion->wideLora) ? 203.125 : 31.25;
|
||||
case meshtastic_Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW:
|
||||
bw = (myRegion->wideLora) ? 203.125 : 62.5;
|
||||
cr = 8;
|
||||
sf = 12;
|
||||
break;
|
||||
@@ -453,14 +459,22 @@ void RadioInterface::applyModemConfig()
|
||||
// float freq = myRegion->freqStart + ((((myRegion->freqEnd - myRegion->freqStart) / numChannels) / 2) * channel_num);
|
||||
|
||||
// New frequency selection formula
|
||||
float freq = myRegion->freqStart + (bw / 2000) + ( channel_num * (bw / 1000));
|
||||
float freq = myRegion->freqStart + (bw / 2000) + (channel_num * (bw / 1000));
|
||||
|
||||
// override if we have a verbatim frequency
|
||||
if (loraConfig.override_frequency) {
|
||||
freq = loraConfig.override_frequency;
|
||||
channel_num = -1;
|
||||
}
|
||||
|
||||
saveChannelNum(channel_num);
|
||||
saveFreq(freq + config.lora.frequency_offset);
|
||||
saveFreq(freq + loraConfig.frequency_offset);
|
||||
|
||||
LOG_INFO("Radio freq=%.3f, config.lora.frequency_offset=%.3f\n", freq, config.lora.frequency_offset);
|
||||
LOG_INFO("Set radio: region=%s, name=%s, config=%u, ch=%d, power=%d\n", myRegion->name, channelName, loraConfig.modem_preset, channel_num, power);
|
||||
LOG_INFO("Radio myRegion->freqStart -> myRegion->freqEnd: %f -> %f (%f mhz)\n", myRegion->freqStart, myRegion->freqEnd, myRegion->freqEnd - myRegion->freqStart);
|
||||
LOG_INFO("Radio freq=%.3f, config.lora.frequency_offset=%.3f\n", freq, loraConfig.frequency_offset);
|
||||
LOG_INFO("Set radio: region=%s, name=%s, config=%u, ch=%d, power=%d\n", myRegion->name, channelName, loraConfig.modem_preset,
|
||||
channel_num, power);
|
||||
LOG_INFO("Radio myRegion->freqStart -> myRegion->freqEnd: %f -> %f (%f mhz)\n", myRegion->freqStart, myRegion->freqEnd,
|
||||
myRegion->freqEnd - myRegion->freqStart);
|
||||
LOG_INFO("Radio myRegion->numChannels: %d x %.3fkHz\n", numChannels, bw);
|
||||
LOG_INFO("Radio channel_num: %d\n", channel_num);
|
||||
LOG_INFO("Radio frequency: %f\n", getFreq());
|
||||
@@ -486,8 +500,7 @@ void RadioInterface::limitPower()
|
||||
LOG_INFO("Set radio: final power level=%d\n", power);
|
||||
}
|
||||
|
||||
|
||||
void RadioInterface::deliverToReceiver(MeshPacket *p)
|
||||
void RadioInterface::deliverToReceiver(meshtastic_MeshPacket *p)
|
||||
{
|
||||
if (router)
|
||||
router->enqueueReceivedMessage(p);
|
||||
@@ -496,12 +509,12 @@ void RadioInterface::deliverToReceiver(MeshPacket *p)
|
||||
/***
|
||||
* given a packet set sendingPacket and decode the protobufs into radiobuf. Returns # of payload bytes to send
|
||||
*/
|
||||
size_t RadioInterface::beginSending(MeshPacket *p)
|
||||
size_t RadioInterface::beginSending(meshtastic_MeshPacket *p)
|
||||
{
|
||||
assert(!sendingPacket);
|
||||
|
||||
// LOG_DEBUG("sending queued packet on mesh (txGood=%d,rxGood=%d,rxBad=%d)\n", rf95.txGood(), rf95.rxGood(), rf95.rxBad());
|
||||
assert(p->which_payload_variant == MeshPacket_encrypted_tag); // It should have already been encoded by now
|
||||
assert(p->which_payload_variant == meshtastic_MeshPacket_encrypted_tag); // It should have already been encoded by now
|
||||
|
||||
lastTxStart = millis();
|
||||
|
||||
|
||||
+18
-19
@@ -51,25 +51,25 @@ class RadioInterface
|
||||
CallbackObserver<RadioInterface, void *> notifyDeepSleepObserver =
|
||||
CallbackObserver<RadioInterface, void *>(this, &RadioInterface::notifyDeepSleepCb);
|
||||
|
||||
|
||||
protected:
|
||||
bool disabled = false;
|
||||
|
||||
float bw = 125;
|
||||
uint8_t sf = 9;
|
||||
uint8_t cr = 7;
|
||||
/** Slottime is the minimum time to wait, consisting of:
|
||||
- CAD duration (maximum of SX126x and SX127x);
|
||||
- roundtrip air propagation time (assuming max. 30km between nodes);
|
||||
/** Slottime is the minimum time to wait, consisting of:
|
||||
- CAD duration (maximum of SX126x and SX127x);
|
||||
- roundtrip air propagation time (assuming max. 30km between nodes);
|
||||
- Tx/Rx turnaround time (maximum of SX126x and SX127x);
|
||||
- MAC processing time (measured on T-beam) */
|
||||
uint32_t slotTimeMsec = 8.5 * pow(2, sf)/bw + 0.2 + 0.4 + 7;
|
||||
uint32_t slotTimeMsec = 8.5 * pow(2, sf) / bw + 0.2 + 0.4 + 7;
|
||||
uint16_t preambleLength = 32; // 8 is default, but we use longer to increase the amount of sleep time when receiving
|
||||
const uint32_t PROCESSING_TIME_MSEC = 4500; // time to construct, process and construct a packet again (empirically determined)
|
||||
const uint8_t CWmin = 2; // minimum CWsize
|
||||
const uint8_t CWmax = 8; // maximum CWsize
|
||||
const uint32_t PROCESSING_TIME_MSEC =
|
||||
4500; // time to construct, process and construct a packet again (empirically determined)
|
||||
const uint8_t CWmin = 2; // minimum CWsize
|
||||
const uint8_t CWmax = 8; // maximum CWsize
|
||||
|
||||
MeshPacket *sendingPacket = NULL; // The packet we are currently sending
|
||||
meshtastic_MeshPacket *sendingPacket = NULL; // The packet we are currently sending
|
||||
uint32_t lastTxStart = 0L;
|
||||
|
||||
/**
|
||||
@@ -80,7 +80,7 @@ class RadioInterface
|
||||
/**
|
||||
* Enqueue a received packet for the registered receiver
|
||||
*/
|
||||
void deliverToReceiver(MeshPacket *p);
|
||||
void deliverToReceiver(meshtastic_MeshPacket *p);
|
||||
|
||||
public:
|
||||
/** pool is the pool we will alloc our rx packets from
|
||||
@@ -113,11 +113,12 @@ class RadioInterface
|
||||
* later free() the packet to pool. This routine is not allowed to stall.
|
||||
* If the txmit queue is full it might return an error
|
||||
*/
|
||||
virtual ErrorCode send(MeshPacket *p) = 0;
|
||||
virtual ErrorCode send(meshtastic_MeshPacket *p) = 0;
|
||||
|
||||
/** Return TX queue status */
|
||||
virtual QueueStatus getQueueStatus() {
|
||||
QueueStatus qs;
|
||||
virtual meshtastic_QueueStatus getQueueStatus()
|
||||
{
|
||||
meshtastic_QueueStatus qs;
|
||||
qs.res = qs.mesh_packet_id = qs.free = qs.maxlen = 0;
|
||||
return qs;
|
||||
}
|
||||
@@ -138,7 +139,7 @@ class RadioInterface
|
||||
virtual bool reconfigure();
|
||||
|
||||
/** The delay to use for retransmitting dropped packets */
|
||||
uint32_t getRetransmissionMsec(const MeshPacket *p);
|
||||
uint32_t getRetransmissionMsec(const meshtastic_MeshPacket *p);
|
||||
|
||||
/** The delay to use when we want to send something */
|
||||
uint32_t getTxDelayMsec();
|
||||
@@ -146,7 +147,6 @@ class RadioInterface
|
||||
/** The delay to use when we want to flood a message. Use a weighted scale based on SNR */
|
||||
uint32_t getTxDelayMsecWeighted(float snr);
|
||||
|
||||
|
||||
/**
|
||||
* Calculate airtime per
|
||||
* https://www.rs-online.com/designspark/rel-assets/ds-assets/uploads/knowledge-items/application-notes-for-the-internet-of-things/LoRa%20Design%20Guide.pdf
|
||||
@@ -154,7 +154,7 @@ class RadioInterface
|
||||
*
|
||||
* @return num msecs for the packet
|
||||
*/
|
||||
uint32_t getPacketTime(MeshPacket *p);
|
||||
uint32_t getPacketTime(meshtastic_MeshPacket *p);
|
||||
uint32_t getPacketTime(uint32_t totalPacketLen);
|
||||
|
||||
/**
|
||||
@@ -182,7 +182,7 @@ class RadioInterface
|
||||
*
|
||||
* Used as the first step of
|
||||
*/
|
||||
size_t beginSending(MeshPacket *p);
|
||||
size_t beginSending(meshtastic_MeshPacket *p);
|
||||
|
||||
/**
|
||||
* Some regulatory regions limit xmit power.
|
||||
@@ -220,6 +220,5 @@ class RadioInterface
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// Debug printing for packets
|
||||
void printPacket(const char *prefix, const MeshPacket *p);
|
||||
void printPacket(const char *prefix, const meshtastic_MeshPacket *p);
|
||||
|
||||
+248
-247
@@ -3,8 +3,8 @@
|
||||
#include "NodeDB.h"
|
||||
#include "SPILock.h"
|
||||
#include "configuration.h"
|
||||
#include "main.h"
|
||||
#include "error.h"
|
||||
#include "main.h"
|
||||
#include "mesh-pb-constants.h"
|
||||
#include <pb_decode.h>
|
||||
#include <pb_encode.h>
|
||||
@@ -87,7 +87,7 @@ bool RadioLibInterface::canSendImmediately()
|
||||
// TX IRQ from the radio, the radio is probably broken.
|
||||
if (busyTx && (millis() - lastTxStart > 60000)) {
|
||||
LOG_ERROR("Hardware Failure! busyTx for more than 60s\n");
|
||||
RECORD_CRITICALERROR(CriticalErrorCode_TRANSMIT_FAILED);
|
||||
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_TRANSMIT_FAILED);
|
||||
// reboot in 5 seconds when this condition occurs.
|
||||
rebootAtMsec = lastTxStart + 65000;
|
||||
}
|
||||
@@ -101,27 +101,22 @@ bool RadioLibInterface::canSendImmediately()
|
||||
/// Send a packet (possibly by enquing in a private fifo). This routine will
|
||||
/// later free() the packet to pool. This routine is not allowed to stall because it is called from
|
||||
/// bluetooth comms code. If the txmit queue is empty it might return an error
|
||||
ErrorCode RadioLibInterface::send(MeshPacket *p)
|
||||
ErrorCode RadioLibInterface::send(meshtastic_MeshPacket *p)
|
||||
{
|
||||
|
||||
#ifndef DISABLE_WELCOME_UNSET
|
||||
|
||||
if (config.lora.region != Config_LoRaConfig_RegionCode_UNSET) {
|
||||
if (config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_UNSET) {
|
||||
if (disabled || !config.lora.tx_enabled) {
|
||||
|
||||
if (config.lora.region != Config_LoRaConfig_RegionCode_UNSET) {
|
||||
if (disabled || !config.lora.tx_enabled) {
|
||||
LOG_WARN("send - !config.lora.tx_enabled\n");
|
||||
packetPool.release(p);
|
||||
return ERRNO_DISABLED;
|
||||
}
|
||||
|
||||
} else {
|
||||
LOG_WARN("send - lora tx disable because RegionCode_Unset\n");
|
||||
packetPool.release(p);
|
||||
return ERRNO_DISABLED;
|
||||
}
|
||||
LOG_WARN("send - !config.lora.tx_enabled\n");
|
||||
packetPool.release(p);
|
||||
return ERRNO_DISABLED;
|
||||
}
|
||||
|
||||
} else {
|
||||
LOG_WARN("send - lora tx disable because RegionCode_Unset\n");
|
||||
packetPool.release(p);
|
||||
return ERRNO_DISABLED;
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -134,33 +129,33 @@ ErrorCode RadioLibInterface::send(MeshPacket *p)
|
||||
|
||||
#endif
|
||||
|
||||
// Sometimes when testing it is useful to be able to never turn on the xmitter
|
||||
// Sometimes when testing it is useful to be able to never turn on the xmitter
|
||||
#ifndef LORA_DISABLE_SENDING
|
||||
printPacket("enqueuing for send", p);
|
||||
printPacket("enqueuing for send", p);
|
||||
|
||||
LOG_DEBUG("txGood=%d,rxGood=%d,rxBad=%d\n", txGood, rxGood, rxBad);
|
||||
ErrorCode res = txQueue.enqueue(p) ? ERRNO_OK : ERRNO_UNKNOWN;
|
||||
|
||||
if (res != ERRNO_OK) { // we weren't able to queue it, so we must drop it to prevent leaks
|
||||
packetPool.release(p);
|
||||
return res;
|
||||
}
|
||||
|
||||
// set (random) transmit delay to let others reconfigure their radio,
|
||||
// to avoid collisions and implement timing-based flooding
|
||||
// LOG_DEBUG("Set random delay before transmitting.\n");
|
||||
setTransmitDelay();
|
||||
LOG_DEBUG("txGood=%d,rxGood=%d,rxBad=%d\n", txGood, rxGood, rxBad);
|
||||
ErrorCode res = txQueue.enqueue(p) ? ERRNO_OK : ERRNO_UNKNOWN;
|
||||
|
||||
if (res != ERRNO_OK) { // we weren't able to queue it, so we must drop it to prevent leaks
|
||||
packetPool.release(p);
|
||||
return res;
|
||||
}
|
||||
|
||||
// set (random) transmit delay to let others reconfigure their radio,
|
||||
// to avoid collisions and implement timing-based flooding
|
||||
// LOG_DEBUG("Set random delay before transmitting.\n");
|
||||
setTransmitDelay();
|
||||
|
||||
return res;
|
||||
#else
|
||||
packetPool.release(p);
|
||||
return ERRNO_DISABLED;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
QueueStatus RadioLibInterface::getQueueStatus()
|
||||
meshtastic_QueueStatus RadioLibInterface::getQueueStatus()
|
||||
{
|
||||
QueueStatus qs;
|
||||
meshtastic_QueueStatus qs;
|
||||
|
||||
qs.res = qs.mesh_packet_id = 0;
|
||||
qs.free = txQueue.getFree();
|
||||
@@ -169,242 +164,248 @@ QueueStatus RadioLibInterface::getQueueStatus()
|
||||
return qs;
|
||||
}
|
||||
|
||||
bool RadioLibInterface::canSleep()
|
||||
{
|
||||
bool res = txQueue.empty();
|
||||
if (!res) // only print debug messages if we are vetoing sleep
|
||||
LOG_DEBUG("radio wait to sleep, txEmpty=%d\n", res);
|
||||
bool RadioLibInterface::canSleep()
|
||||
{
|
||||
bool res = txQueue.empty();
|
||||
if (!res) // only print debug messages if we are vetoing sleep
|
||||
LOG_DEBUG("radio wait to sleep, txEmpty=%d\n", res);
|
||||
|
||||
return res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/** Attempt to cancel a previously sent packet. Returns true if a packet was found we could cancel */
|
||||
bool RadioLibInterface::cancelSending(NodeNum from, PacketId id)
|
||||
{
|
||||
auto p = txQueue.remove(from, id);
|
||||
if (p)
|
||||
packetPool.release(p); // free the packet we just removed
|
||||
/** Attempt to cancel a previously sent packet. Returns true if a packet was found we could cancel */
|
||||
bool RadioLibInterface::cancelSending(NodeNum from, PacketId id)
|
||||
{
|
||||
auto p = txQueue.remove(from, id);
|
||||
if (p)
|
||||
packetPool.release(p); // free the packet we just removed
|
||||
|
||||
bool result = (p != NULL);
|
||||
LOG_DEBUG("cancelSending id=0x%x, removed=%d\n", id, result);
|
||||
return result;
|
||||
}
|
||||
bool result = (p != NULL);
|
||||
LOG_DEBUG("cancelSending id=0x%x, removed=%d\n", id, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/** radio helper thread callback.
|
||||
We never immediately transmit after any operation (either Rx or Tx). Instead we should wait a random multiple of
|
||||
'slotTimes' (see definition in RadioInterface.h) taken from a contention window (CW) to lower the chance of collision.
|
||||
The CW size is determined by setTransmitDelay() and depends either on the current channel utilization or SNR in case
|
||||
of a flooding message. After this, we perform channel activity detection (CAD) and reset the transmit delay if it is
|
||||
currently active.
|
||||
*/
|
||||
void RadioLibInterface::onNotify(uint32_t notification)
|
||||
{
|
||||
switch (notification) {
|
||||
case ISR_TX:
|
||||
handleTransmitInterrupt();
|
||||
startReceive();
|
||||
// LOG_DEBUG("tx complete - starting timer\n");
|
||||
startTransmitTimer();
|
||||
break;
|
||||
case ISR_RX:
|
||||
handleReceiveInterrupt();
|
||||
startReceive();
|
||||
// LOG_DEBUG("rx complete - starting timer\n");
|
||||
startTransmitTimer();
|
||||
break;
|
||||
case TRANSMIT_DELAY_COMPLETED:
|
||||
// LOG_DEBUG("delay done\n");
|
||||
/** radio helper thread callback.
|
||||
We never immediately transmit after any operation (either Rx or Tx). Instead we should wait a random multiple of
|
||||
'slotTimes' (see definition in RadioInterface.h) taken from a contention window (CW) to lower the chance of collision.
|
||||
The CW size is determined by setTransmitDelay() and depends either on the current channel utilization or SNR in case
|
||||
of a flooding message. After this, we perform channel activity detection (CAD) and reset the transmit delay if it is
|
||||
currently active.
|
||||
*/
|
||||
void RadioLibInterface::onNotify(uint32_t notification)
|
||||
{
|
||||
switch (notification) {
|
||||
case ISR_TX:
|
||||
handleTransmitInterrupt();
|
||||
startReceive();
|
||||
// LOG_DEBUG("tx complete - starting timer\n");
|
||||
startTransmitTimer();
|
||||
break;
|
||||
case ISR_RX:
|
||||
handleReceiveInterrupt();
|
||||
startReceive();
|
||||
// LOG_DEBUG("rx complete - starting timer\n");
|
||||
startTransmitTimer();
|
||||
break;
|
||||
case TRANSMIT_DELAY_COMPLETED:
|
||||
// LOG_DEBUG("delay done\n");
|
||||
|
||||
// If we are not currently in receive mode, then restart the random delay (this can happen if the main thread
|
||||
// has placed the unit into standby) FIXME, how will this work if the chipset is in sleep mode?
|
||||
if (!txQueue.empty()) {
|
||||
if (!canSendImmediately()) {
|
||||
// LOG_DEBUG("Currently Rx/Tx-ing: set random delay\n");
|
||||
setTransmitDelay(); // currently Rx/Tx-ing: reset random delay
|
||||
// If we are not currently in receive mode, then restart the random delay (this can happen if the main thread
|
||||
// has placed the unit into standby) FIXME, how will this work if the chipset is in sleep mode?
|
||||
if (!txQueue.empty()) {
|
||||
if (!canSendImmediately()) {
|
||||
// LOG_DEBUG("Currently Rx/Tx-ing: set random delay\n");
|
||||
setTransmitDelay(); // currently Rx/Tx-ing: reset random delay
|
||||
} else {
|
||||
if (isChannelActive()) { // check if there is currently a LoRa packet on the channel
|
||||
// LOG_DEBUG("Channel is active: set random delay\n");
|
||||
setTransmitDelay(); // reset random delay
|
||||
} else {
|
||||
if (isChannelActive()) { // check if there is currently a LoRa packet on the channel
|
||||
// LOG_DEBUG("Channel is active: set random delay\n");
|
||||
setTransmitDelay(); // reset random delay
|
||||
} else {
|
||||
// Send any outgoing packets we have ready
|
||||
MeshPacket *txp = txQueue.dequeue();
|
||||
assert(txp);
|
||||
startSend(txp);
|
||||
// Send any outgoing packets we have ready
|
||||
meshtastic_MeshPacket *txp = txQueue.dequeue();
|
||||
assert(txp);
|
||||
startSend(txp);
|
||||
|
||||
// Packet has been sent, count it toward our TX airtime utilization.
|
||||
uint32_t xmitMsec = getPacketTime(txp);
|
||||
airTime->logAirtime(TX_LOG, xmitMsec);
|
||||
}
|
||||
// Packet has been sent, count it toward our TX airtime utilization.
|
||||
uint32_t xmitMsec = getPacketTime(txp);
|
||||
airTime->logAirtime(TX_LOG, xmitMsec);
|
||||
}
|
||||
} else {
|
||||
// LOG_DEBUG("done with txqueue\n");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(0); // We expected to receive a valid notification from the ISR
|
||||
}
|
||||
}
|
||||
|
||||
void RadioLibInterface::setTransmitDelay()
|
||||
{
|
||||
MeshPacket *p = txQueue.getFront();
|
||||
// We want all sending/receiving to be done by our daemon thread.
|
||||
// We use a delay here because this packet might have been sent in response to a packet we just received.
|
||||
// So we want to make sure the other side has had a chance to reconfigure its radio.
|
||||
|
||||
/* We assume if rx_snr = 0 and rx_rssi = 0, the packet was generated locally.
|
||||
* This assumption is valid because of the offset generated by the radio to account for the noise
|
||||
* floor.
|
||||
*/
|
||||
if (p->rx_snr == 0 && p->rx_rssi == 0) {
|
||||
startTransmitTimer(true);
|
||||
} else {
|
||||
// If there is a SNR, start a timer scaled based on that SNR.
|
||||
LOG_DEBUG("rx_snr found. hop_limit:%d rx_snr:%f\n", p->hop_limit, p->rx_snr);
|
||||
startTransmitTimerSNR(p->rx_snr);
|
||||
// LOG_DEBUG("done with txqueue\n");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(0); // We expected to receive a valid notification from the ISR
|
||||
}
|
||||
}
|
||||
|
||||
void RadioLibInterface::setTransmitDelay()
|
||||
{
|
||||
meshtastic_MeshPacket *p = txQueue.getFront();
|
||||
// We want all sending/receiving to be done by our daemon thread.
|
||||
// We use a delay here because this packet might have been sent in response to a packet we just received.
|
||||
// So we want to make sure the other side has had a chance to reconfigure its radio.
|
||||
|
||||
/* We assume if rx_snr = 0 and rx_rssi = 0, the packet was generated locally.
|
||||
* This assumption is valid because of the offset generated by the radio to account for the noise
|
||||
* floor.
|
||||
*/
|
||||
if (p->rx_snr == 0 && p->rx_rssi == 0) {
|
||||
startTransmitTimer(true);
|
||||
} else {
|
||||
// If there is a SNR, start a timer scaled based on that SNR.
|
||||
LOG_DEBUG("rx_snr found. hop_limit:%d rx_snr:%f\n", p->hop_limit, p->rx_snr);
|
||||
startTransmitTimerSNR(p->rx_snr);
|
||||
}
|
||||
}
|
||||
|
||||
void RadioLibInterface::startTransmitTimer(bool withDelay)
|
||||
{
|
||||
// If we have work to do and the timer wasn't already scheduled, schedule it now
|
||||
if (!txQueue.empty()) {
|
||||
uint32_t delay = !withDelay ? 1 : getTxDelayMsec();
|
||||
// LOG_DEBUG("xmit timer %d\n", delay);
|
||||
notifyLater(delay, TRANSMIT_DELAY_COMPLETED, false); // This will implicitly enable
|
||||
}
|
||||
}
|
||||
|
||||
void RadioLibInterface::startTransmitTimerSNR(float snr)
|
||||
{
|
||||
// If we have work to do and the timer wasn't already scheduled, schedule it now
|
||||
if (!txQueue.empty()) {
|
||||
uint32_t delay = getTxDelayMsecWeighted(snr);
|
||||
// LOG_DEBUG("xmit timer %d\n", delay);
|
||||
notifyLater(delay, TRANSMIT_DELAY_COMPLETED, false); // This will implicitly enable
|
||||
}
|
||||
}
|
||||
|
||||
void RadioLibInterface::handleTransmitInterrupt()
|
||||
{
|
||||
// LOG_DEBUG("handling lora TX interrupt\n");
|
||||
// This can be null if we forced the device to enter standby mode. In that case
|
||||
// ignore the transmit interrupt
|
||||
if (sendingPacket)
|
||||
completeSending();
|
||||
}
|
||||
|
||||
void RadioLibInterface::completeSending()
|
||||
{
|
||||
// We are careful to clear sending packet before calling printPacket because
|
||||
// that can take a long time
|
||||
auto p = sendingPacket;
|
||||
sendingPacket = NULL;
|
||||
|
||||
if (p) {
|
||||
txGood++;
|
||||
printPacket("Completed sending", p);
|
||||
|
||||
// We are done sending that packet, release it
|
||||
packetPool.release(p);
|
||||
// LOG_DEBUG("Done with send\n");
|
||||
}
|
||||
}
|
||||
|
||||
void RadioLibInterface::handleReceiveInterrupt()
|
||||
{
|
||||
uint32_t xmitMsec;
|
||||
|
||||
// when this is called, we should be in receive mode - if we are not, just jump out instead of bombing. Possible Race
|
||||
// Condition?
|
||||
if (!isReceiving) {
|
||||
LOG_DEBUG("*** WAS_ASSERT *** handleReceiveInterrupt called when not in receive mode\n");
|
||||
return;
|
||||
}
|
||||
|
||||
void RadioLibInterface::startTransmitTimer(bool withDelay)
|
||||
{
|
||||
// If we have work to do and the timer wasn't already scheduled, schedule it now
|
||||
if (!txQueue.empty()) {
|
||||
uint32_t delay = !withDelay ? 1 : getTxDelayMsec();
|
||||
// LOG_DEBUG("xmit timer %d\n", delay);
|
||||
notifyLater(delay, TRANSMIT_DELAY_COMPLETED, false); // This will implicitly enable
|
||||
}
|
||||
}
|
||||
isReceiving = false;
|
||||
|
||||
void RadioLibInterface::startTransmitTimerSNR(float snr)
|
||||
{
|
||||
// If we have work to do and the timer wasn't already scheduled, schedule it now
|
||||
if (!txQueue.empty()) {
|
||||
uint32_t delay = getTxDelayMsecWeighted(snr);
|
||||
// LOG_DEBUG("xmit timer %d\n", delay);
|
||||
notifyLater(delay, TRANSMIT_DELAY_COMPLETED, false); // This will implicitly enable
|
||||
}
|
||||
}
|
||||
// read the number of actually received bytes
|
||||
size_t length = iface->getPacketLength();
|
||||
|
||||
void RadioLibInterface::handleTransmitInterrupt()
|
||||
{
|
||||
// LOG_DEBUG("handling lora TX interrupt\n");
|
||||
// This can be null if we forced the device to enter standby mode. In that case
|
||||
// ignore the transmit interrupt
|
||||
if (sendingPacket)
|
||||
completeSending();
|
||||
}
|
||||
xmitMsec = getPacketTime(length);
|
||||
|
||||
void RadioLibInterface::completeSending()
|
||||
{
|
||||
// We are careful to clear sending packet before calling printPacket because
|
||||
// that can take a long time
|
||||
auto p = sendingPacket;
|
||||
sendingPacket = NULL;
|
||||
int state = iface->readData(radiobuf, length);
|
||||
if (state != RADIOLIB_ERR_NONE) {
|
||||
LOG_ERROR("ignoring received packet due to error=%d\n", state);
|
||||
rxBad++;
|
||||
|
||||
if (p) {
|
||||
txGood++;
|
||||
printPacket("Completed sending", p);
|
||||
airTime->logAirtime(RX_ALL_LOG, xmitMsec);
|
||||
|
||||
// We are done sending that packet, release it
|
||||
packetPool.release(p);
|
||||
// LOG_DEBUG("Done with send\n");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Skip the 4 headers that are at the beginning of the rxBuf
|
||||
int32_t payloadLen = length - sizeof(PacketHeader);
|
||||
const uint8_t *payload = radiobuf + sizeof(PacketHeader);
|
||||
|
||||
void RadioLibInterface::handleReceiveInterrupt()
|
||||
{
|
||||
uint32_t xmitMsec;
|
||||
|
||||
// when this is called, we should be in receive mode - if we are not, just jump out instead of bombing. Possible Race Condition?
|
||||
if (!isReceiving) {
|
||||
LOG_DEBUG("*** WAS_ASSERT *** handleReceiveInterrupt called when not in receive mode\n");
|
||||
return;
|
||||
}
|
||||
|
||||
isReceiving = false;
|
||||
|
||||
// read the number of actually received bytes
|
||||
size_t length = iface->getPacketLength();
|
||||
|
||||
xmitMsec = getPacketTime(length);
|
||||
|
||||
int state = iface->readData(radiobuf, length);
|
||||
if (state != RADIOLIB_ERR_NONE) {
|
||||
LOG_ERROR("ignoring received packet due to error=%d\n", state);
|
||||
// check for short packets
|
||||
if (payloadLen < 0) {
|
||||
LOG_WARN("ignoring received packet too short\n");
|
||||
rxBad++;
|
||||
|
||||
airTime->logAirtime(RX_ALL_LOG, xmitMsec);
|
||||
|
||||
} else {
|
||||
// Skip the 4 headers that are at the beginning of the rxBuf
|
||||
int32_t payloadLen = length - sizeof(PacketHeader);
|
||||
const uint8_t *payload = radiobuf + sizeof(PacketHeader);
|
||||
|
||||
// check for short packets
|
||||
if (payloadLen < 0) {
|
||||
LOG_WARN("ignoring received packet too short\n");
|
||||
rxBad++;
|
||||
airTime->logAirtime(RX_ALL_LOG, xmitMsec);
|
||||
} else {
|
||||
const PacketHeader *h = (PacketHeader *)radiobuf;
|
||||
|
||||
rxGood++;
|
||||
|
||||
// Note: we deliver _all_ packets to our router (i.e. our interface is intentionally promiscuous).
|
||||
// This allows the router and other apps on our node to sniff packets (usually routing) between other
|
||||
// nodes.
|
||||
MeshPacket *mp = packetPool.allocZeroed();
|
||||
|
||||
mp->from = h->from;
|
||||
mp->to = h->to;
|
||||
mp->id = h->id;
|
||||
mp->channel = h->channel;
|
||||
assert(HOP_MAX <= PACKET_FLAGS_HOP_MASK); // If hopmax changes, carefully check this code
|
||||
mp->hop_limit = h->flags & PACKET_FLAGS_HOP_MASK;
|
||||
mp->want_ack = !!(h->flags & PACKET_FLAGS_WANT_ACK_MASK);
|
||||
|
||||
addReceiveMetadata(mp);
|
||||
|
||||
mp->which_payload_variant = MeshPacket_encrypted_tag; // Mark that the payload is still encrypted at this point
|
||||
assert(((uint32_t)payloadLen) <= sizeof(mp->encrypted.bytes));
|
||||
memcpy(mp->encrypted.bytes, payload, payloadLen);
|
||||
mp->encrypted.size = payloadLen;
|
||||
|
||||
printPacket("Lora RX", mp);
|
||||
|
||||
airTime->logAirtime(RX_LOG, xmitMsec);
|
||||
|
||||
deliverToReceiver(mp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** start an immediate transmit */
|
||||
void RadioLibInterface::startSend(MeshPacket * txp)
|
||||
{
|
||||
printPacket("Starting low level send", txp);
|
||||
if (disabled || !config.lora.tx_enabled) {
|
||||
LOG_WARN("startSend is dropping tx packet because we are disabled\n");
|
||||
packetPool.release(txp);
|
||||
} else {
|
||||
setStandby(); // Cancel any already in process receives
|
||||
|
||||
configHardwareForSend(); // must be after setStandby
|
||||
|
||||
size_t numbytes = beginSending(txp);
|
||||
|
||||
int res = iface->startTransmit(radiobuf, numbytes);
|
||||
if (res != RADIOLIB_ERR_NONE) {
|
||||
LOG_ERROR("startTransmit failed, error=%d\n", res);
|
||||
RECORD_CRITICALERROR(CriticalErrorCode_RADIO_SPI_BUG);
|
||||
|
||||
// This send failed, but make sure to 'complete' it properly
|
||||
completeSending();
|
||||
startReceive(); // Restart receive mode (because startTransmit failed to put us in xmit mode)
|
||||
const PacketHeader *h = (PacketHeader *)radiobuf;
|
||||
rxGood++;
|
||||
// altered packet with "from == 0" can do Remote Node Administration without permission
|
||||
if (h->from == 0) {
|
||||
LOG_WARN("ignoring received packet without sender\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Must be done AFTER, starting transmit, because startTransmit clears (possibly stale) interrupt pending register
|
||||
// bits
|
||||
enableInterrupt(isrTxLevel0);
|
||||
// Note: we deliver _all_ packets to our router (i.e. our interface is intentionally promiscuous).
|
||||
// This allows the router and other apps on our node to sniff packets (usually routing) between other
|
||||
// nodes.
|
||||
meshtastic_MeshPacket *mp = packetPool.allocZeroed();
|
||||
|
||||
mp->from = h->from;
|
||||
mp->to = h->to;
|
||||
mp->id = h->id;
|
||||
mp->channel = h->channel;
|
||||
assert(HOP_MAX <= PACKET_FLAGS_HOP_MASK); // If hopmax changes, carefully check this code
|
||||
mp->hop_limit = h->flags & PACKET_FLAGS_HOP_MASK;
|
||||
mp->want_ack = !!(h->flags & PACKET_FLAGS_WANT_ACK_MASK);
|
||||
|
||||
addReceiveMetadata(mp);
|
||||
|
||||
mp->which_payload_variant =
|
||||
meshtastic_MeshPacket_encrypted_tag; // Mark that the payload is still encrypted at this point
|
||||
assert(((uint32_t)payloadLen) <= sizeof(mp->encrypted.bytes));
|
||||
memcpy(mp->encrypted.bytes, payload, payloadLen);
|
||||
mp->encrypted.size = payloadLen;
|
||||
|
||||
printPacket("Lora RX", mp);
|
||||
|
||||
airTime->logAirtime(RX_LOG, xmitMsec);
|
||||
|
||||
deliverToReceiver(mp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** start an immediate transmit */
|
||||
void RadioLibInterface::startSend(meshtastic_MeshPacket *txp)
|
||||
{
|
||||
printPacket("Starting low level send", txp);
|
||||
if (disabled || !config.lora.tx_enabled) {
|
||||
LOG_WARN("startSend is dropping tx packet because we are disabled\n");
|
||||
packetPool.release(txp);
|
||||
} else {
|
||||
setStandby(); // Cancel any already in process receives
|
||||
|
||||
configHardwareForSend(); // must be after setStandby
|
||||
|
||||
size_t numbytes = beginSending(txp);
|
||||
|
||||
int res = iface->startTransmit(radiobuf, numbytes);
|
||||
if (res != RADIOLIB_ERR_NONE) {
|
||||
LOG_ERROR("startTransmit failed, error=%d\n", res);
|
||||
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_RADIO_SPI_BUG);
|
||||
|
||||
// This send failed, but make sure to 'complete' it properly
|
||||
completeSending();
|
||||
startReceive(); // Restart receive mode (because startTransmit failed to put us in xmit mode)
|
||||
}
|
||||
|
||||
// Must be done AFTER, starting transmit, because startTransmit clears (possibly stale) interrupt pending register
|
||||
// bits
|
||||
enableInterrupt(isrTxLevel0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "concurrency/NotifiedWorkerThread.h"
|
||||
#include "RadioInterface.h"
|
||||
#include "MeshPacketQueue.h"
|
||||
#include "RadioInterface.h"
|
||||
#include "concurrency/NotifiedWorkerThread.h"
|
||||
|
||||
#include <RadioLib.h>
|
||||
|
||||
@@ -39,7 +39,7 @@ class LockingModule : public Module
|
||||
: Module(cs, irq, rst, gpio, spi, spiSettings)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void SPIbeginTransaction() override;
|
||||
void SPIendTransaction() override;
|
||||
};
|
||||
@@ -62,17 +62,16 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified
|
||||
MeshPacketQueue txQueue = MeshPacketQueue(MAX_TX_QUEUE);
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* We use a meshtastic sync word, but hashed with the Channel name. For releases before 1.2 we used 0x12 (or for very old loads 0x14)
|
||||
* Note: do not use 0x34 - that is reserved for lorawan
|
||||
*
|
||||
* We now use 0x2b (so that someday we can possibly use NOT 2b - because that would be funny pun). We will be staying with this code
|
||||
* for a long time.
|
||||
* We use a meshtastic sync word, but hashed with the Channel name. For releases before 1.2 we used 0x12 (or for very old
|
||||
* loads 0x14) Note: do not use 0x34 - that is reserved for lorawan
|
||||
*
|
||||
* We now use 0x2b (so that someday we can possibly use NOT 2b - because that would be funny pun). We will be staying with
|
||||
* this code for a long time.
|
||||
*/
|
||||
const uint8_t syncWord = 0x2b;
|
||||
|
||||
float currentLimit = 100; // 100mA OCP - Should be acceptable for RFM95/SX127x chipset.
|
||||
|
||||
float currentLimit = 100; // 100mA OCP - Should be acceptable for RFM95/SX127x chipset.
|
||||
|
||||
LockingModule module; // The HW interface to the radio
|
||||
|
||||
@@ -103,7 +102,7 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified
|
||||
RadioLibInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi,
|
||||
PhysicalLayer *iface = NULL);
|
||||
|
||||
virtual ErrorCode send(MeshPacket *p) override;
|
||||
virtual ErrorCode send(meshtastic_MeshPacket *p) override;
|
||||
|
||||
/**
|
||||
* Return true if we think the board can go to sleep (i.e. our tx queue is empty, we are not sending or receiving)
|
||||
@@ -131,8 +130,8 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified
|
||||
virtual bool cancelSending(NodeNum from, PacketId id) override;
|
||||
|
||||
private:
|
||||
/** if we have something waiting to send, start a short (random) timer so we can come check for collision before actually doing
|
||||
* the transmit */
|
||||
/** if we have something waiting to send, start a short (random) timer so we can come check for collision before actually
|
||||
* doing the transmit */
|
||||
void setTransmitDelay();
|
||||
|
||||
/** random timer with certain min. and max. settings */
|
||||
@@ -151,12 +150,11 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified
|
||||
/** start an immediate transmit
|
||||
* This method is virtual so subclasses can hook as needed, subclasses should not call directly
|
||||
*/
|
||||
virtual void startSend(MeshPacket *txp);
|
||||
virtual void startSend(meshtastic_MeshPacket *txp);
|
||||
|
||||
QueueStatus getQueueStatus();
|
||||
meshtastic_QueueStatus getQueueStatus();
|
||||
|
||||
protected:
|
||||
|
||||
/** Do any hardware setup needed on entry into send configuration for the radio. Subclasses can customize */
|
||||
virtual void configHardwareForSend() {}
|
||||
|
||||
@@ -175,7 +173,7 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified
|
||||
/**
|
||||
* Add SNR data to received messages
|
||||
*/
|
||||
virtual void addReceiveMetadata(MeshPacket *mp) = 0;
|
||||
virtual void addReceiveMetadata(meshtastic_MeshPacket *mp) = 0;
|
||||
|
||||
virtual void setStandby() = 0;
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "configuration.h"
|
||||
#include "RadioLibRF95.h"
|
||||
#include "configuration.h"
|
||||
|
||||
#define RF95_CHIP_VERSION 0x12
|
||||
#define RF95_ALT_VERSION 0x11 // Supposedly some versions of the chip have id 0x11
|
||||
@@ -7,11 +7,10 @@
|
||||
// From datasheet but radiolib doesn't know anything about this
|
||||
#define SX127X_REG_TCXO 0x4B
|
||||
|
||||
|
||||
RadioLibRF95::RadioLibRF95(Module *mod) : SX1278(mod) {}
|
||||
|
||||
int16_t RadioLibRF95::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t power,
|
||||
uint16_t preambleLength, uint8_t gain)
|
||||
int16_t RadioLibRF95::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t power, uint16_t preambleLength,
|
||||
uint8_t gain)
|
||||
{
|
||||
// execute common part
|
||||
int16_t state = SX127x::begin(RF95_CHIP_VERSION, syncWord, preambleLength);
|
||||
|
||||
+12
-11
@@ -6,9 +6,9 @@
|
||||
|
||||
\brief Derived class for %RFM95 modules. Overrides some methods from SX1278 due to different parameter ranges.
|
||||
*/
|
||||
class RadioLibRF95: public SX1278 {
|
||||
class RadioLibRF95 : public SX1278
|
||||
{
|
||||
public:
|
||||
|
||||
// constructor
|
||||
|
||||
/*!
|
||||
@@ -16,7 +16,7 @@ class RadioLibRF95: public SX1278 {
|
||||
|
||||
\param mod Instance of Module that will be used to communicate with the %LoRa chip.
|
||||
*/
|
||||
explicit RadioLibRF95(Module* mod);
|
||||
explicit RadioLibRF95(Module *mod);
|
||||
|
||||
// basic methods
|
||||
|
||||
@@ -31,19 +31,21 @@ class RadioLibRF95: public SX1278 {
|
||||
|
||||
\param cr %LoRa link coding rate denominator. Allowed values range from 5 to 8.
|
||||
|
||||
\param syncWord %LoRa sync word. Can be used to distinguish different networks. Note that value 0x34 is reserved for LoRaWAN networks.
|
||||
\param syncWord %LoRa sync word. Can be used to distinguish different networks. Note that value 0x34 is reserved for LoRaWAN
|
||||
networks.
|
||||
|
||||
\param power Transmission output power in dBm. Allowed values range from 2 to 17 dBm.
|
||||
|
||||
\param preambleLength Length of %LoRa transmission preamble in symbols. The actual preamble length is 4.25 symbols longer than the set number.
|
||||
Allowed values range from 6 to 65535.
|
||||
\param preambleLength Length of %LoRa transmission preamble in symbols. The actual preamble length is 4.25 symbols longer
|
||||
than the set number. Allowed values range from 6 to 65535.
|
||||
|
||||
\param gain Gain of receiver LNA (low-noise amplifier). Can be set to any integer in range 1 to 6 where 1 is the highest gain.
|
||||
Set to 0 to enable automatic gain control (recommended).
|
||||
\param gain Gain of receiver LNA (low-noise amplifier). Can be set to any integer in range 1 to 6 where 1 is the highest
|
||||
gain. Set to 0 to enable automatic gain control (recommended).
|
||||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t begin(float freq = 915.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = RADIOLIB_SX127X_SYNC_WORD, int8_t power = 17, uint16_t preambleLength = 8, uint8_t gain = 0);
|
||||
int16_t begin(float freq = 915.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7,
|
||||
uint8_t syncWord = RADIOLIB_SX127X_SYNC_WORD, int8_t power = 17, uint16_t preambleLength = 8, uint8_t gain = 0);
|
||||
|
||||
// configuration methods
|
||||
|
||||
@@ -60,11 +62,10 @@ class RadioLibRF95: public SX1278 {
|
||||
bool isReceiving();
|
||||
|
||||
/// For debugging
|
||||
uint8_t readReg(uint8_t addr);
|
||||
uint8_t readReg(uint8_t addr);
|
||||
|
||||
protected:
|
||||
// since default current limit for SX126x/127x in updated RadioLib is 60mA
|
||||
// use the previous value
|
||||
float currentLimit = 100;
|
||||
};
|
||||
|
||||
|
||||
+18
-19
@@ -10,7 +10,7 @@
|
||||
* If the message is want_ack, then add it to a list of packets to retransmit.
|
||||
* If we run out of retransmissions, send a nak packet towards the original client to indicate failure.
|
||||
*/
|
||||
ErrorCode ReliableRouter::send(MeshPacket *p)
|
||||
ErrorCode ReliableRouter::send(meshtastic_MeshPacket *p)
|
||||
{
|
||||
if (p->want_ack) {
|
||||
// If someone asks for acks on broadcast, we need the hop limit to be at least one, so that first node that receives our
|
||||
@@ -27,7 +27,7 @@ ErrorCode ReliableRouter::send(MeshPacket *p)
|
||||
return FloodingRouter::send(p);
|
||||
}
|
||||
|
||||
bool ReliableRouter::shouldFilterReceived(const MeshPacket *p)
|
||||
bool ReliableRouter::shouldFilterReceived(const meshtastic_MeshPacket *p)
|
||||
{
|
||||
// Note: do not use getFrom() here, because we want to ignore messages sent from phone
|
||||
if (p->from == getNodeNum()) {
|
||||
@@ -38,14 +38,14 @@ bool ReliableRouter::shouldFilterReceived(const MeshPacket *p)
|
||||
// the original sending process.
|
||||
|
||||
// This "optimization", does save lots of airtime. For DMs, you also get a real ACK back
|
||||
// from the intended recipient.
|
||||
// from the intended recipient.
|
||||
auto key = GlobalPacketId(getFrom(p), p->id);
|
||||
auto old = findPendingPacket(key);
|
||||
if (old) {
|
||||
LOG_DEBUG("generating implicit ack\n");
|
||||
// NOTE: we do NOT check p->wantAck here because p is the INCOMING rebroadcast and that packet is not expected to be
|
||||
// marked as wantAck
|
||||
sendAckNak(Routing_Error_NONE, getFrom(p), p->id, old->packet->channel);
|
||||
sendAckNak(meshtastic_Routing_Error_NONE, getFrom(p), p->id, old->packet->channel);
|
||||
|
||||
stopRetransmission(key);
|
||||
} else {
|
||||
@@ -54,13 +54,13 @@ bool ReliableRouter::shouldFilterReceived(const MeshPacket *p)
|
||||
}
|
||||
|
||||
/* Resend implicit ACKs for repeated packets (assuming the original packet was sent with HOP_RELIABLE)
|
||||
* this way if an implicit ACK is dropped and a packet is resent we'll rebroadcast again.
|
||||
* Resending real ACKs is omitted, as you might receive a packet multiple times due to flooding and
|
||||
* flooding this ACK back to the original sender already adds redundancy. */
|
||||
* this way if an implicit ACK is dropped and a packet is resent we'll rebroadcast again.
|
||||
* Resending real ACKs is omitted, as you might receive a packet multiple times due to flooding and
|
||||
* flooding this ACK back to the original sender already adds redundancy. */
|
||||
if (wasSeenRecently(p, false) && p->hop_limit == HOP_RELIABLE && !MeshModule::currentReply && p->to != nodeDB.getNodeNum()) {
|
||||
// retransmission on broadcast has hop_limit still equal to HOP_RELIABLE
|
||||
LOG_DEBUG("Resending implicit ack for a repeated floodmsg\n");
|
||||
MeshPacket *tosend = packetPool.allocCopy(*p);
|
||||
meshtastic_MeshPacket *tosend = packetPool.allocCopy(*p);
|
||||
tosend->hop_limit--; // bump down the hop count
|
||||
Router::send(tosend);
|
||||
}
|
||||
@@ -80,7 +80,7 @@ bool ReliableRouter::shouldFilterReceived(const MeshPacket *p)
|
||||
*
|
||||
* Otherwise, let superclass handle it.
|
||||
*/
|
||||
void ReliableRouter::sniffReceived(const MeshPacket *p, const Routing *c)
|
||||
void ReliableRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtastic_Routing *c)
|
||||
{
|
||||
NodeNum ourNode = getNodeNum();
|
||||
|
||||
@@ -88,19 +88,18 @@ void ReliableRouter::sniffReceived(const MeshPacket *p, const Routing *c)
|
||||
if (p->want_ack) {
|
||||
if (MeshModule::currentReply)
|
||||
LOG_DEBUG("Some other module has replied to this message, no need for a 2nd ack\n");
|
||||
else if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag)
|
||||
sendAckNak(meshtastic_Routing_Error_NONE, getFrom(p), p->id, p->channel);
|
||||
else
|
||||
if (p->which_payload_variant == MeshPacket_decoded_tag)
|
||||
sendAckNak(Routing_Error_NONE, getFrom(p), p->id, p->channel);
|
||||
else
|
||||
// Send a 'NO_CHANNEL' error on the primary channel if want_ack packet destined for us cannot be decoded
|
||||
sendAckNak(Routing_Error_NO_CHANNEL, getFrom(p), p->id, channels.getPrimaryIndex());
|
||||
// Send a 'NO_CHANNEL' error on the primary channel if want_ack packet destined for us cannot be decoded
|
||||
sendAckNak(meshtastic_Routing_Error_NO_CHANNEL, getFrom(p), p->id, channels.getPrimaryIndex());
|
||||
}
|
||||
|
||||
// We consider an ack to be either a !routing packet with a request ID or a routing packet with !error
|
||||
PacketId ackId = ((c && c->error_reason == Routing_Error_NONE) || !c) ? p->decoded.request_id : 0;
|
||||
PacketId ackId = ((c && c->error_reason == meshtastic_Routing_Error_NONE) || !c) ? p->decoded.request_id : 0;
|
||||
|
||||
// A nak is a routing packt that has an error code
|
||||
PacketId nakId = (c && c->error_reason != Routing_Error_NONE) ? p->decoded.request_id : 0;
|
||||
PacketId nakId = (c && c->error_reason != meshtastic_Routing_Error_NONE) ? p->decoded.request_id : 0;
|
||||
|
||||
// We intentionally don't check wasSeenRecently, because it is harmless to delete non existent retransmission records
|
||||
if (ackId || nakId) {
|
||||
@@ -120,7 +119,7 @@ void ReliableRouter::sniffReceived(const MeshPacket *p, const Routing *c)
|
||||
|
||||
#define NUM_RETRANSMISSIONS 3
|
||||
|
||||
PendingPacket::PendingPacket(MeshPacket *p)
|
||||
PendingPacket::PendingPacket(meshtastic_MeshPacket *p)
|
||||
{
|
||||
packet = p;
|
||||
numRetransmissions = NUM_RETRANSMISSIONS - 1; // We subtract one, because we assume the user just did the first send
|
||||
@@ -158,7 +157,7 @@ bool ReliableRouter::stopRetransmission(GlobalPacketId key)
|
||||
/**
|
||||
* Add p to the list of packets to retransmit occasionally. We will free it once we stop retransmitting.
|
||||
*/
|
||||
PendingPacket *ReliableRouter::startRetransmission(MeshPacket *p)
|
||||
PendingPacket *ReliableRouter::startRetransmission(meshtastic_MeshPacket *p)
|
||||
{
|
||||
auto id = GlobalPacketId(p);
|
||||
auto rec = PendingPacket(p);
|
||||
@@ -192,7 +191,7 @@ int32_t ReliableRouter::doRetransmissions()
|
||||
if (p.numRetransmissions == 0) {
|
||||
LOG_DEBUG("Reliable send failed, returning a nak for fr=0x%x,to=0x%x,id=0x%x\n", p.packet->from, p.packet->to,
|
||||
p.packet->id);
|
||||
sendAckNak(Routing_Error_MAX_RETRANSMIT, getFrom(p.packet), p.packet->id, p.packet->channel);
|
||||
sendAckNak(meshtastic_Routing_Error_MAX_RETRANSMIT, getFrom(p.packet), p.packet->id, p.packet->channel);
|
||||
// Note: we don't stop retransmission here, instead the Nak packet gets processed in sniffReceived
|
||||
stopRetransmission(it->first);
|
||||
stillValid = false; // just deleted it
|
||||
|
||||
@@ -13,7 +13,7 @@ struct GlobalPacketId {
|
||||
|
||||
bool operator==(const GlobalPacketId &p) const { return node == p.node && id == p.id; }
|
||||
|
||||
explicit GlobalPacketId(const MeshPacket *p)
|
||||
explicit GlobalPacketId(const meshtastic_MeshPacket *p)
|
||||
{
|
||||
node = getFrom(p);
|
||||
id = p->id;
|
||||
@@ -30,7 +30,7 @@ struct GlobalPacketId {
|
||||
* A packet queued for retransmission
|
||||
*/
|
||||
struct PendingPacket {
|
||||
MeshPacket *packet;
|
||||
meshtastic_MeshPacket *packet;
|
||||
|
||||
/** The next time we should try to retransmit this packet */
|
||||
uint32_t nextTxMsec = 0;
|
||||
@@ -39,7 +39,7 @@ struct PendingPacket {
|
||||
uint8_t numRetransmissions = 0;
|
||||
|
||||
PendingPacket() {}
|
||||
explicit PendingPacket(MeshPacket *p);
|
||||
explicit PendingPacket(meshtastic_MeshPacket *p);
|
||||
};
|
||||
|
||||
class GlobalPacketIdHashFunction
|
||||
@@ -68,7 +68,7 @@ class ReliableRouter : public FloodingRouter
|
||||
* later free() the packet to pool. This routine is not allowed to stall.
|
||||
* If the txmit queue is full it might return an error
|
||||
*/
|
||||
virtual ErrorCode send(MeshPacket *p) override;
|
||||
virtual ErrorCode send(meshtastic_MeshPacket *p) override;
|
||||
|
||||
/** Do our retransmission handling */
|
||||
virtual int32_t runOnce() override
|
||||
@@ -85,7 +85,7 @@ class ReliableRouter : public FloodingRouter
|
||||
/**
|
||||
* Look for acks/naks or someone retransmitting us
|
||||
*/
|
||||
virtual void sniffReceived(const MeshPacket *p, const Routing *c) override;
|
||||
virtual void sniffReceived(const meshtastic_MeshPacket *p, const meshtastic_Routing *c) override;
|
||||
|
||||
/**
|
||||
* Try to find the pending packet record for this ID (or NULL if not found)
|
||||
@@ -96,12 +96,12 @@ class ReliableRouter : public FloodingRouter
|
||||
/**
|
||||
* We hook this method so we can see packets before FloodingRouter says they should be discarded
|
||||
*/
|
||||
virtual bool shouldFilterReceived(const MeshPacket *p) override;
|
||||
virtual bool shouldFilterReceived(const meshtastic_MeshPacket *p) override;
|
||||
|
||||
/**
|
||||
* Add p to the list of packets to retransmit occasionally. We will free it once we stop retransmitting.
|
||||
*/
|
||||
PendingPacket *startRetransmission(MeshPacket *p);
|
||||
PendingPacket *startRetransmission(meshtastic_MeshPacket *p);
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
+59
-59
@@ -1,8 +1,8 @@
|
||||
#include "Router.h"
|
||||
#include "Channels.h"
|
||||
#include "CryptoEngine.h"
|
||||
#include "NodeDB.h"
|
||||
#include "MeshRadio.h"
|
||||
#include "NodeDB.h"
|
||||
#include "RTC.h"
|
||||
#include "configuration.h"
|
||||
#include "main.h"
|
||||
@@ -35,9 +35,9 @@ extern "C" {
|
||||
2) // max number of packets which can be in flight (either queued from reception or queued for sending)
|
||||
|
||||
// static MemoryPool<MeshPacket> staticPool(MAX_PACKETS);
|
||||
static MemoryDynamic<MeshPacket> staticPool;
|
||||
static MemoryDynamic<meshtastic_MeshPacket> staticPool;
|
||||
|
||||
Allocator<MeshPacket> &packetPool = staticPool;
|
||||
Allocator<meshtastic_MeshPacket> &packetPool = staticPool;
|
||||
|
||||
static uint8_t bytes[MAX_RHPACKETLEN];
|
||||
|
||||
@@ -63,7 +63,7 @@ Router::Router() : concurrency::OSThread("Router"), fromRadioQueue(MAX_RX_FROMRA
|
||||
*/
|
||||
int32_t Router::runOnce()
|
||||
{
|
||||
MeshPacket *mp;
|
||||
meshtastic_MeshPacket *mp;
|
||||
while ((mp = fromRadioQueue.dequeuePtr(0)) != NULL) {
|
||||
// printPacket("handle fromRadioQ", mp);
|
||||
perhapsHandleReceived(mp);
|
||||
@@ -77,7 +77,7 @@ int32_t Router::runOnce()
|
||||
* RadioInterface calls this to queue up packets that have been received from the radio. The router is now responsible for
|
||||
* freeing the packet
|
||||
*/
|
||||
void Router::enqueueReceivedMessage(MeshPacket *p)
|
||||
void Router::enqueueReceivedMessage(meshtastic_MeshPacket *p)
|
||||
{
|
||||
if (fromRadioQueue.enqueue(p, 0)) { // NOWAIT - fixme, if queue is full, delete older messages
|
||||
|
||||
@@ -112,11 +112,11 @@ PacketId generatePacketId()
|
||||
return id;
|
||||
}
|
||||
|
||||
MeshPacket *Router::allocForSending()
|
||||
meshtastic_MeshPacket *Router::allocForSending()
|
||||
{
|
||||
MeshPacket *p = packetPool.allocZeroed();
|
||||
meshtastic_MeshPacket *p = packetPool.allocZeroed();
|
||||
|
||||
p->which_payload_variant = MeshPacket_decoded_tag; // Assume payload is decoded at start.
|
||||
p->which_payload_variant = meshtastic_MeshPacket_decoded_tag; // Assume payload is decoded at start.
|
||||
p->from = nodeDB.getNodeNum();
|
||||
p->to = NODENUM_BROADCAST;
|
||||
p->hop_limit = (config.lora.hop_limit >= HOP_MAX) ? HOP_MAX : config.lora.hop_limit;
|
||||
@@ -130,12 +130,12 @@ MeshPacket *Router::allocForSending()
|
||||
/**
|
||||
* Send an ack or a nak packet back towards whoever sent idFrom
|
||||
*/
|
||||
void Router::sendAckNak(Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex)
|
||||
void Router::sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex)
|
||||
{
|
||||
routingModule->sendAckNak(err, to, idFrom, chIndex);
|
||||
}
|
||||
|
||||
void Router::abortSendAndNak(Routing_Error err, MeshPacket *p)
|
||||
void Router::abortSendAndNak(meshtastic_Routing_Error err, meshtastic_MeshPacket *p)
|
||||
{
|
||||
LOG_ERROR("Error=%d, returning NAK and dropping packet.\n", err);
|
||||
sendAckNak(err, getFrom(p), p->id, p->channel);
|
||||
@@ -149,12 +149,12 @@ void Router::setReceivedMessage()
|
||||
runASAP = true;
|
||||
}
|
||||
|
||||
QueueStatus Router::getQueueStatus()
|
||||
meshtastic_QueueStatus Router::getQueueStatus()
|
||||
{
|
||||
return iface->getQueueStatus();
|
||||
}
|
||||
|
||||
ErrorCode Router::sendLocal(MeshPacket *p, RxSource src)
|
||||
ErrorCode Router::sendLocal(meshtastic_MeshPacket *p, RxSource src)
|
||||
{
|
||||
// No need to deliver externally if the destination is the local node
|
||||
if (p->to == nodeDB.getNodeNum()) {
|
||||
@@ -163,7 +163,7 @@ ErrorCode Router::sendLocal(MeshPacket *p, RxSource src)
|
||||
return ERRNO_OK;
|
||||
} else if (!iface) {
|
||||
// We must be sending to remote nodes also, fail if no interface found
|
||||
abortSendAndNak(Routing_Error_NO_INTERFACE, p);
|
||||
abortSendAndNak(meshtastic_Routing_Error_NO_INTERFACE, p);
|
||||
|
||||
return ERRNO_NO_INTERFACES;
|
||||
} else {
|
||||
@@ -190,22 +190,22 @@ void printBytes(const char *label, const uint8_t *p, size_t numbytes)
|
||||
* later free() the packet to pool. This routine is not allowed to stall.
|
||||
* If the txmit queue is full it might return an error.
|
||||
*/
|
||||
ErrorCode Router::send(MeshPacket *p)
|
||||
ErrorCode Router::send(meshtastic_MeshPacket *p)
|
||||
{
|
||||
if (p->to == nodeDB.getNodeNum()) {
|
||||
LOG_ERROR("BUG! send() called with packet destined for local node!\n");
|
||||
packetPool.release(p);
|
||||
return Routing_Error_BAD_REQUEST;
|
||||
return meshtastic_Routing_Error_BAD_REQUEST;
|
||||
} // should have already been handled by sendLocal
|
||||
|
||||
// Abort sending if we are violating the duty cycle
|
||||
if (!config.lora.override_duty_cycle && myRegion->dutyCycle < 100) {
|
||||
float hourlyTxPercent = airTime->utilizationTXPercent();
|
||||
if (hourlyTxPercent > myRegion->dutyCycle) {
|
||||
uint8_t silentMinutes = airTime->getSilentMinutes(hourlyTxPercent, myRegion->dutyCycle);
|
||||
uint8_t silentMinutes = airTime->getSilentMinutes(hourlyTxPercent, myRegion->dutyCycle);
|
||||
LOG_WARN("Duty cycle limit exceeded. Aborting send for now, you can send again in %d minutes.\n", silentMinutes);
|
||||
Routing_Error err = Routing_Error_DUTY_CYCLE_LIMIT;
|
||||
if (getFrom(p) == nodeDB.getNodeNum()) { // only send NAK to API, not to the mesh
|
||||
meshtastic_Routing_Error err = meshtastic_Routing_Error_DUTY_CYCLE_LIMIT;
|
||||
if (getFrom(p) == nodeDB.getNodeNum()) { // only send NAK to API, not to the mesh
|
||||
abortSendAndNak(err, p);
|
||||
} else {
|
||||
packetPool.release(p);
|
||||
@@ -228,28 +228,28 @@ ErrorCode Router::send(MeshPacket *p)
|
||||
|
||||
// If the packet hasn't yet been encrypted, do so now (it might already be encrypted if we are just forwarding it)
|
||||
|
||||
assert(p->which_payload_variant == MeshPacket_encrypted_tag ||
|
||||
p->which_payload_variant == MeshPacket_decoded_tag); // I _think_ all packets should have a payload by now
|
||||
assert(p->which_payload_variant == meshtastic_MeshPacket_encrypted_tag ||
|
||||
p->which_payload_variant == meshtastic_MeshPacket_decoded_tag); // I _think_ all packets should have a payload by now
|
||||
|
||||
// If the packet is not yet encrypted, do so now
|
||||
if (p->which_payload_variant == MeshPacket_decoded_tag) {
|
||||
if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
|
||||
ChannelIndex chIndex = p->channel; // keep as a local because we are about to change it
|
||||
|
||||
bool shouldActuallyEncrypt = true;
|
||||
bool shouldActuallyEncrypt = true;
|
||||
|
||||
#if HAS_WIFI || HAS_ETHERNET
|
||||
if(moduleConfig.mqtt.enabled) {
|
||||
if (moduleConfig.mqtt.enabled) {
|
||||
// check if we should send decrypted packets to mqtt
|
||||
|
||||
// truth table:
|
||||
/* mqtt_server mqtt_encryption_enabled should_encrypt
|
||||
* not set 0 1
|
||||
* not set 1 1
|
||||
* set 0 0
|
||||
* set 1 1
|
||||
*
|
||||
* => so we only decrypt mqtt if they have a custom mqtt server AND mqtt_encryption_enabled is FALSE
|
||||
*/
|
||||
* not set 0 1
|
||||
* not set 1 1
|
||||
* set 0 0
|
||||
* set 1 1
|
||||
*
|
||||
* => so we only decrypt mqtt if they have a custom mqtt server AND mqtt_encryption_enabled is FALSE
|
||||
*/
|
||||
|
||||
if (*moduleConfig.mqtt.address && !moduleConfig.mqtt.encryption_enabled) {
|
||||
shouldActuallyEncrypt = false;
|
||||
@@ -264,7 +264,7 @@ ErrorCode Router::send(MeshPacket *p)
|
||||
#endif
|
||||
|
||||
auto encodeResult = perhapsEncode(p);
|
||||
if (encodeResult != Routing_Error_NONE) {
|
||||
if (encodeResult != meshtastic_Routing_Error_NONE) {
|
||||
abortSendAndNak(encodeResult, p);
|
||||
return encodeResult; // FIXME - this isn't a valid ErrorCode
|
||||
}
|
||||
@@ -293,17 +293,18 @@ bool Router::cancelSending(NodeNum from, PacketId id)
|
||||
* Every (non duplicate) packet this node receives will be passed through this method. This allows subclasses to
|
||||
* update routing tables etc... based on what we overhear (even for messages not destined to our node)
|
||||
*/
|
||||
void Router::sniffReceived(const MeshPacket *p, const Routing *c)
|
||||
void Router::sniffReceived(const meshtastic_MeshPacket *p, const meshtastic_Routing *c)
|
||||
{
|
||||
// FIXME, update nodedb here for any packet that passes through us
|
||||
}
|
||||
|
||||
bool perhapsDecode(MeshPacket *p)
|
||||
bool perhapsDecode(meshtastic_MeshPacket *p)
|
||||
{
|
||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER &&
|
||||
config.device.rebroadcast_mode == meshtastic_Config_DeviceConfig_RebroadcastMode_ALL_SKIP_DECODING)
|
||||
return false;
|
||||
|
||||
// LOG_DEBUG("\n\n** perhapsDecode payloadVariant - %d\n\n", p->which_payloadVariant);
|
||||
|
||||
if (p->which_payload_variant == MeshPacket_decoded_tag)
|
||||
if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag)
|
||||
return true; // If packet was already decoded just return
|
||||
|
||||
// assert(p->which_payloadVariant == MeshPacket_encrypted_tag);
|
||||
@@ -323,20 +324,20 @@ bool perhapsDecode(MeshPacket *p)
|
||||
|
||||
// Take those raw bytes and convert them back into a well structured protobuf we can understand
|
||||
memset(&p->decoded, 0, sizeof(p->decoded));
|
||||
if (!pb_decode_from_bytes(bytes, rawSize, &Data_msg, &p->decoded)) {
|
||||
if (!pb_decode_from_bytes(bytes, rawSize, &meshtastic_Data_msg, &p->decoded)) {
|
||||
LOG_ERROR("Invalid protobufs in received mesh packet (bad psk?)!\n");
|
||||
} else if (p->decoded.portnum == PortNum_UNKNOWN_APP) {
|
||||
} else if (p->decoded.portnum == meshtastic_PortNum_UNKNOWN_APP) {
|
||||
LOG_ERROR("Invalid portnum (bad psk?)!\n");
|
||||
} else {
|
||||
// parsing was successful
|
||||
p->which_payload_variant = MeshPacket_decoded_tag; // change type to decoded
|
||||
p->channel = chIndex; // change to store the index instead of the hash
|
||||
p->which_payload_variant = meshtastic_MeshPacket_decoded_tag; // change type to decoded
|
||||
p->channel = chIndex; // change to store the index instead of the hash
|
||||
|
||||
// Decompress if needed. jm
|
||||
if (p->decoded.portnum == PortNum_TEXT_MESSAGE_COMPRESSED_APP) {
|
||||
if (p->decoded.portnum == meshtastic_PortNum_TEXT_MESSAGE_COMPRESSED_APP) {
|
||||
// Decompress the payload
|
||||
char compressed_in[Constants_DATA_PAYLOAD_LEN] = {};
|
||||
char decompressed_out[Constants_DATA_PAYLOAD_LEN] = {};
|
||||
char compressed_in[meshtastic_Constants_DATA_PAYLOAD_LEN] = {};
|
||||
char decompressed_out[meshtastic_Constants_DATA_PAYLOAD_LEN] = {};
|
||||
int decompressed_len;
|
||||
|
||||
memcpy(compressed_in, p->decoded.payload.bytes, p->decoded.payload.size);
|
||||
@@ -348,7 +349,7 @@ bool perhapsDecode(MeshPacket *p)
|
||||
memcpy(p->decoded.payload.bytes, decompressed_out, decompressed_len);
|
||||
|
||||
// Switch the port from PortNum_TEXT_MESSAGE_COMPRESSED_APP to PortNum_TEXT_MESSAGE_APP
|
||||
p->decoded.portnum = PortNum_TEXT_MESSAGE_APP;
|
||||
p->decoded.portnum = meshtastic_PortNum_TEXT_MESSAGE_APP;
|
||||
}
|
||||
|
||||
printPacket("decoded message", p);
|
||||
@@ -363,21 +364,20 @@ bool perhapsDecode(MeshPacket *p)
|
||||
|
||||
/** Return 0 for success or a Routing_Errror code for failure
|
||||
*/
|
||||
Routing_Error perhapsEncode(MeshPacket *p)
|
||||
meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p)
|
||||
{
|
||||
// If the packet is not yet encrypted, do so now
|
||||
if (p->which_payload_variant == MeshPacket_decoded_tag) {
|
||||
|
||||
size_t numbytes = pb_encode_to_bytes(bytes, sizeof(bytes), &Data_msg, &p->decoded);
|
||||
if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
|
||||
size_t numbytes = pb_encode_to_bytes(bytes, sizeof(bytes), &meshtastic_Data_msg, &p->decoded);
|
||||
|
||||
// Only allow encryption on the text message app.
|
||||
// TODO: Allow modules to opt into compression.
|
||||
if (p->decoded.portnum == PortNum_TEXT_MESSAGE_APP) {
|
||||
if (p->decoded.portnum == meshtastic_PortNum_TEXT_MESSAGE_APP) {
|
||||
|
||||
char original_payload[Constants_DATA_PAYLOAD_LEN];
|
||||
char original_payload[meshtastic_Constants_DATA_PAYLOAD_LEN];
|
||||
memcpy(original_payload, p->decoded.payload.bytes, p->decoded.payload.size);
|
||||
|
||||
char compressed_out[Constants_DATA_PAYLOAD_LEN] = {0};
|
||||
char compressed_out[meshtastic_Constants_DATA_PAYLOAD_LEN] = {0};
|
||||
|
||||
int compressed_len;
|
||||
compressed_len = unishox2_compress_simple(original_payload, p->decoded.payload.size, compressed_out);
|
||||
@@ -401,12 +401,12 @@ Routing_Error perhapsEncode(MeshPacket *p)
|
||||
p->decoded.payload.size = compressed_len;
|
||||
memcpy(p->decoded.payload.bytes, compressed_out, compressed_len);
|
||||
|
||||
p->decoded.portnum = PortNum_TEXT_MESSAGE_COMPRESSED_APP;
|
||||
p->decoded.portnum = meshtastic_PortNum_TEXT_MESSAGE_COMPRESSED_APP;
|
||||
}
|
||||
}
|
||||
|
||||
if (numbytes > MAX_RHPACKETLEN)
|
||||
return Routing_Error_TOO_LARGE;
|
||||
return meshtastic_Routing_Error_TOO_LARGE;
|
||||
|
||||
// printBytes("plaintext", bytes, numbytes);
|
||||
|
||||
@@ -414,7 +414,7 @@ Routing_Error perhapsEncode(MeshPacket *p)
|
||||
auto hash = channels.setActiveByIndex(chIndex);
|
||||
if (hash < 0)
|
||||
// No suitable channel could be found for sending
|
||||
return Routing_Error_NO_CHANNEL;
|
||||
return meshtastic_Routing_Error_NO_CHANNEL;
|
||||
|
||||
// Now that we are encrypting the packet channel should be the hash (no longer the index)
|
||||
p->channel = hash;
|
||||
@@ -423,10 +423,10 @@ Routing_Error perhapsEncode(MeshPacket *p)
|
||||
// Copy back into the packet and set the variant type
|
||||
memcpy(p->encrypted.bytes, bytes, numbytes);
|
||||
p->encrypted.size = numbytes;
|
||||
p->which_payload_variant = MeshPacket_encrypted_tag;
|
||||
p->which_payload_variant = meshtastic_MeshPacket_encrypted_tag;
|
||||
}
|
||||
|
||||
return Routing_Error_NONE;
|
||||
return meshtastic_Routing_Error_NONE;
|
||||
}
|
||||
|
||||
NodeNum Router::getNodeNum()
|
||||
@@ -438,7 +438,7 @@ NodeNum Router::getNodeNum()
|
||||
* Handle any packet that is received by an interface on this node.
|
||||
* Note: some packets may merely being passed through this node and will be forwarded elsewhere.
|
||||
*/
|
||||
void Router::handleReceived(MeshPacket *p, RxSource src)
|
||||
void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src)
|
||||
{
|
||||
// Also, we should set the time from the ISR and it should have msec level resolution
|
||||
p->rx_time = getValidTime(RTCQualityFromNet); // store the arrival timestamp for the phone
|
||||
@@ -454,14 +454,14 @@ void Router::handleReceived(MeshPacket *p, RxSource src)
|
||||
else
|
||||
printPacket("handleReceived(REMOTE)", p);
|
||||
} else {
|
||||
printPacket("packet decoding failed (no PSK?)", p);
|
||||
printPacket("packet decoding failed or skipped (no PSK?)", p);
|
||||
}
|
||||
|
||||
// call modules here
|
||||
MeshModule::callPlugins(*p, src);
|
||||
}
|
||||
|
||||
void Router::perhapsHandleReceived(MeshPacket *p)
|
||||
void Router::perhapsHandleReceived(meshtastic_MeshPacket *p)
|
||||
{
|
||||
// assert(radioConfig.has_preferences);
|
||||
bool ignore = is_in_repeated(config.lora.ignore_incoming, p->from);
|
||||
|
||||
+17
-17
@@ -16,7 +16,7 @@ class Router : protected concurrency::OSThread
|
||||
private:
|
||||
/// Packets which have just arrived from the radio, ready to be processed by this service and possibly
|
||||
/// forwarded to the phone.
|
||||
PointerQueue<MeshPacket> fromRadioQueue;
|
||||
PointerQueue<meshtastic_MeshPacket> fromRadioQueue;
|
||||
|
||||
protected:
|
||||
RadioInterface *iface = NULL;
|
||||
@@ -45,7 +45,7 @@ class Router : protected concurrency::OSThread
|
||||
*
|
||||
* NOTE: This method will free the provided packet (even if we return an error code)
|
||||
*/
|
||||
ErrorCode sendLocal(MeshPacket *p, RxSource src = RX_SRC_RADIO);
|
||||
ErrorCode sendLocal(meshtastic_MeshPacket *p, RxSource src = RX_SRC_RADIO);
|
||||
|
||||
/** Attempt to cancel a previously sent packet. Returns true if a packet was found we could cancel */
|
||||
bool cancelSending(NodeNum from, PacketId id);
|
||||
@@ -53,10 +53,10 @@ class Router : protected concurrency::OSThread
|
||||
/** Allocate and return a meshpacket which defaults as send to broadcast from the current node.
|
||||
* The returned packet is guaranteed to have a unique packet ID already assigned
|
||||
*/
|
||||
MeshPacket *allocForSending();
|
||||
meshtastic_MeshPacket *allocForSending();
|
||||
|
||||
/** Return Underlying interface's TX queue status */
|
||||
QueueStatus getQueueStatus();
|
||||
meshtastic_QueueStatus getQueueStatus();
|
||||
|
||||
/**
|
||||
* @return our local nodenum */
|
||||
@@ -71,10 +71,7 @@ class Router : protected concurrency::OSThread
|
||||
* RadioInterface calls this to queue up packets that have been received from the radio. The router is now responsible for
|
||||
* freeing the packet
|
||||
*/
|
||||
void enqueueReceivedMessage(MeshPacket *p);
|
||||
|
||||
protected:
|
||||
friend class RoutingModule;
|
||||
void enqueueReceivedMessage(meshtastic_MeshPacket *p);
|
||||
|
||||
/**
|
||||
* Send a packet on a suitable interface. This routine will
|
||||
@@ -83,7 +80,10 @@ class Router : protected concurrency::OSThread
|
||||
*
|
||||
* NOTE: This method will free the provided packet (even if we return an error code)
|
||||
*/
|
||||
virtual ErrorCode send(MeshPacket *p);
|
||||
virtual ErrorCode send(meshtastic_MeshPacket *p);
|
||||
|
||||
protected:
|
||||
friend class RoutingModule;
|
||||
|
||||
/**
|
||||
* Should this incoming filter be dropped?
|
||||
@@ -93,18 +93,18 @@ class Router : protected concurrency::OSThread
|
||||
* Called immedately on receiption, before any further processing.
|
||||
* @return true to abandon the packet
|
||||
*/
|
||||
virtual bool shouldFilterReceived(const MeshPacket *p) { return false; }
|
||||
virtual bool shouldFilterReceived(const meshtastic_MeshPacket *p) { return false; }
|
||||
|
||||
/**
|
||||
* Every (non duplicate) packet this node receives will be passed through this method. This allows subclasses to
|
||||
* update routing tables etc... based on what we overhear (even for messages not destined to our node)
|
||||
*/
|
||||
virtual void sniffReceived(const MeshPacket *p, const Routing *c);
|
||||
virtual void sniffReceived(const meshtastic_MeshPacket *p, const meshtastic_Routing *c);
|
||||
|
||||
/**
|
||||
* Send an ack or a nak packet back towards whoever sent idFrom
|
||||
*/
|
||||
void sendAckNak(Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex);
|
||||
void sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex);
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -115,7 +115,7 @@ class Router : protected concurrency::OSThread
|
||||
* Note: this packet will never be called for messages sent/generated by this node.
|
||||
* Note: this method will free the provided packet.
|
||||
*/
|
||||
void perhapsHandleReceived(MeshPacket *p);
|
||||
void perhapsHandleReceived(meshtastic_MeshPacket *p);
|
||||
|
||||
/**
|
||||
* Called from perhapsHandleReceived() - allows subclass message delivery behavior.
|
||||
@@ -125,10 +125,10 @@ class Router : protected concurrency::OSThread
|
||||
* Note: this packet will never be called for messages sent/generated by this node.
|
||||
* Note: this method will free the provided packet.
|
||||
*/
|
||||
void handleReceived(MeshPacket *p, RxSource src = RX_SRC_RADIO);
|
||||
void handleReceived(meshtastic_MeshPacket *p, RxSource src = RX_SRC_RADIO);
|
||||
|
||||
/** Frees the provided packet, and generates a NAK indicating the speicifed error while sending */
|
||||
void abortSendAndNak(Routing_Error err, MeshPacket *p);
|
||||
void abortSendAndNak(meshtastic_Routing_Error err, meshtastic_MeshPacket *p);
|
||||
};
|
||||
|
||||
/** FIXME - move this into a mesh packet class
|
||||
@@ -136,11 +136,11 @@ class Router : protected concurrency::OSThread
|
||||
*
|
||||
* @return true for success, false for corrupt packet.
|
||||
*/
|
||||
bool perhapsDecode(MeshPacket *p);
|
||||
bool perhapsDecode(meshtastic_MeshPacket *p);
|
||||
|
||||
/** Return 0 for success or a Routing_Errror code for failure
|
||||
*/
|
||||
Routing_Error perhapsEncode(MeshPacket *p);
|
||||
meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p);
|
||||
|
||||
extern Router *router;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "configuration.h"
|
||||
#include "SX1262Interface.h"
|
||||
#include "configuration.h"
|
||||
#include "error.h"
|
||||
|
||||
SX1262Interface::SX1262Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "configuration.h"
|
||||
#include "SX1268Interface.h"
|
||||
#include "configuration.h"
|
||||
#include "error.h"
|
||||
|
||||
SX1268Interface::SX1268Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy,
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
#include "configuration.h"
|
||||
#include "SX126xInterface.h"
|
||||
#include "configuration.h"
|
||||
#include "error.h"
|
||||
#include "mesh/NodeDB.h"
|
||||
|
||||
// Particular boards might define a different max power based on what their hardware can do
|
||||
#ifndef SX126X_MAX_POWER
|
||||
#define SX126X_MAX_POWER 22
|
||||
#endif
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
SX126xInterface<T>::SX126xInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy,
|
||||
SPIClass &spi)
|
||||
SPIClass &spi)
|
||||
: RadioLibInterface(cs, irq, rst, busy, spi, &lora), lora(&module)
|
||||
{
|
||||
LOG_WARN("SX126xInterface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy);
|
||||
@@ -18,23 +19,13 @@ SX126xInterface<T>::SX126xInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq,
|
||||
/// Initialise the Driver transport hardware and software.
|
||||
/// Make sure the Driver is properly configured before calling init().
|
||||
/// \return true if initialisation succeeded.
|
||||
template<typename T>
|
||||
bool SX126xInterface<T>::init()
|
||||
template <typename T> bool SX126xInterface<T>::init()
|
||||
{
|
||||
#ifdef SX126X_POWER_EN
|
||||
digitalWrite(SX126X_POWER_EN, HIGH);
|
||||
pinMode(SX126X_POWER_EN, OUTPUT);
|
||||
#endif
|
||||
|
||||
#if defined(SX126X_RXEN) && (SX126X_RXEN != RADIOLIB_NC) // set not rx or tx mode
|
||||
digitalWrite(SX126X_RXEN, LOW); // Set low before becoming an output
|
||||
pinMode(SX126X_RXEN, OUTPUT);
|
||||
#endif
|
||||
#if defined(SX126X_TXEN) && (SX126X_TXEN != RADIOLIB_NC)
|
||||
digitalWrite(SX126X_TXEN, LOW);
|
||||
pinMode(SX126X_TXEN, OUTPUT);
|
||||
#endif
|
||||
|
||||
#ifndef SX126X_E22
|
||||
float tcxoVoltage = 0; // None - we use an XTAL
|
||||
#else
|
||||
@@ -67,12 +58,29 @@ bool SX126xInterface<T>::init()
|
||||
LOG_DEBUG("Current limit set to %f\n", currentLimit);
|
||||
LOG_DEBUG("Current limit set result %d\n", res);
|
||||
|
||||
#if defined(SX126X_TXEN) && (SX126X_TXEN != RADIOLIB_NC)
|
||||
// lora.begin sets Dio2 as RF switch control, which is not true if we are manually controlling RX and TX
|
||||
#ifdef SX126X_E22
|
||||
// E22 Emulation explicitly requires DIO2 as RF switch, so set it to TRUE again for good measure. In case somebody defines
|
||||
// SX126X_TX for an E22 Module
|
||||
if (res == RADIOLIB_ERR_NONE)
|
||||
res = lora.setDio2AsRfSwitch(true);
|
||||
#endif
|
||||
|
||||
#if defined(SX126X_TXEN) && (SX126X_TXEN != RADIOLIB_NC)
|
||||
// lora.begin sets Dio2 as RF switch control, which is not true if we are manually controlling RX and TX
|
||||
if (res == RADIOLIB_ERR_NONE) {
|
||||
res = lora.setDio2AsRfSwitch(false);
|
||||
lora.setRfSwitchPins(SX126X_RXEN, SX126X_TXEN);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (config.lora.sx126x_rx_boosted_gain) {
|
||||
uint16_t result = lora.setRxBoostedGainMode(true);
|
||||
LOG_INFO("Set Rx Boosted Gain mode; result: %d\n", result);
|
||||
} else {
|
||||
uint16_t result = lora.setRxBoostedGainMode(false);
|
||||
LOG_INFO("Set Rx Power Saving Gain mode; result: %d\n", result);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Read/write a register we are not using (only used for FSK mode) to test SPI comms
|
||||
uint8_t crcLSB = 0;
|
||||
@@ -106,8 +114,7 @@ bool SX126xInterface<T>::init()
|
||||
return res == RADIOLIB_ERR_NONE;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool SX126xInterface<T>::reconfigure()
|
||||
template <typename T> bool SX126xInterface<T>::reconfigure()
|
||||
{
|
||||
RadioLibInterface::reconfigure();
|
||||
|
||||
@@ -117,15 +124,15 @@ bool SX126xInterface<T>::reconfigure()
|
||||
// configure publicly accessible settings
|
||||
int err = lora.setSpreadingFactor(sf);
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
|
||||
err = lora.setBandwidth(bw);
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
|
||||
err = lora.setCodingRate(cr);
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
|
||||
// Hmm - seems to lower SNR when the signal levels are high. Leaving off for now...
|
||||
// TODO: Confirm gain registers are okay now
|
||||
@@ -143,7 +150,7 @@ bool SX126xInterface<T>::reconfigure()
|
||||
|
||||
err = lora.setFrequency(getFreq());
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
|
||||
if (power > SX126X_MAX_POWER) // This chip has lower power limits than some
|
||||
power = SX126X_MAX_POWER;
|
||||
@@ -156,14 +163,12 @@ bool SX126xInterface<T>::reconfigure()
|
||||
return RADIOLIB_ERR_NONE;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void INTERRUPT_ATTR SX126xInterface<T>::disableInterrupt()
|
||||
template <typename T> void INTERRUPT_ATTR SX126xInterface<T>::disableInterrupt()
|
||||
{
|
||||
lora.clearDio1Action();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SX126xInterface<T>::setStandby()
|
||||
template <typename T> void SX126xInterface<T>::setStandby()
|
||||
{
|
||||
checkNotification(); // handle any pending interrupts before we force standby
|
||||
|
||||
@@ -174,13 +179,6 @@ void SX126xInterface<T>::setStandby()
|
||||
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
|
||||
#if defined(SX126X_RXEN) && (SX126X_RXEN != RADIOLIB_NC) // we have RXEN/TXEN control - turn off RX and TX power
|
||||
digitalWrite(SX126X_RXEN, LOW);
|
||||
#endif
|
||||
#if defined(SX126X_TXEN) && (SX126X_TXEN != RADIOLIB_NC)
|
||||
digitalWrite(SX126X_TXEN, LOW);
|
||||
#endif
|
||||
|
||||
isReceiving = false; // If we were receiving, not any more
|
||||
disableInterrupt();
|
||||
completeSending(); // If we were sending, not anymore
|
||||
@@ -189,8 +187,7 @@ void SX126xInterface<T>::setStandby()
|
||||
/**
|
||||
* Add SNR data to received messages
|
||||
*/
|
||||
template<typename T>
|
||||
void SX126xInterface<T>::addReceiveMetadata(MeshPacket *mp)
|
||||
template <typename T> void SX126xInterface<T>::addReceiveMetadata(meshtastic_MeshPacket *mp)
|
||||
{
|
||||
// LOG_DEBUG("PacketStatus %x\n", lora.getPacketStatus());
|
||||
mp->rx_snr = lora.getSNR();
|
||||
@@ -199,24 +196,15 @@ void SX126xInterface<T>::addReceiveMetadata(MeshPacket *mp)
|
||||
|
||||
/** We override to turn on transmitter power as needed.
|
||||
*/
|
||||
template<typename T>
|
||||
void SX126xInterface<T>::configHardwareForSend()
|
||||
template <typename T> void SX126xInterface<T>::configHardwareForSend()
|
||||
{
|
||||
#if defined(SX126X_TXEN) && (SX126X_TXEN != RADIOLIB_NC) // we have RXEN/TXEN control - turn on TX power / off RX power
|
||||
digitalWrite(SX126X_TXEN, HIGH);
|
||||
#endif
|
||||
#if defined(SX126X_RXEN) && (SX126X_RXEN != RADIOLIB_NC)
|
||||
digitalWrite(SX126X_RXEN, LOW);
|
||||
#endif
|
||||
|
||||
RadioLibInterface::configHardwareForSend();
|
||||
}
|
||||
|
||||
// For power draw measurements, helpful to force radio to stay sleeping
|
||||
// #define SLEEP_ONLY
|
||||
|
||||
template<typename T>
|
||||
void SX126xInterface<T>::startReceive()
|
||||
template <typename T> void SX126xInterface<T>::startReceive()
|
||||
{
|
||||
#ifdef SLEEP_ONLY
|
||||
sleep();
|
||||
@@ -224,13 +212,6 @@ void SX126xInterface<T>::startReceive()
|
||||
|
||||
setStandby();
|
||||
|
||||
#if defined(SX126X_RXEN) && (SX126X_RXEN != RADIOLIB_NC) // we have RXEN/TXEN control - turn on RX power / off TX power
|
||||
digitalWrite(SX126X_RXEN, HIGH);
|
||||
#endif
|
||||
#if defined(SX126X_TXEN) && (SX126X_TXEN != RADIOLIB_NC)
|
||||
digitalWrite(SX126X_TXEN, LOW);
|
||||
#endif
|
||||
|
||||
// int err = lora.startReceive();
|
||||
int err = lora.startReceiveDutyCycleAuto(); // We use a 32 bit preamble so this should save some power by letting radio sit in
|
||||
// standby mostly.
|
||||
@@ -244,8 +225,7 @@ void SX126xInterface<T>::startReceive()
|
||||
}
|
||||
|
||||
/** Could we send right now (i.e. either not actively receving or transmitting)? */
|
||||
template<typename T>
|
||||
bool SX126xInterface<T>::isChannelActive()
|
||||
template <typename T> bool SX126xInterface<T>::isChannelActive()
|
||||
{
|
||||
// check if we can detect a LoRa preamble on the current channel
|
||||
int16_t result;
|
||||
@@ -261,8 +241,7 @@ bool SX126xInterface<T>::isChannelActive()
|
||||
}
|
||||
|
||||
/** Could we send right now (i.e. either not actively receving or transmitting)? */
|
||||
template<typename T>
|
||||
bool SX126xInterface<T>::isActivelyReceiving()
|
||||
template <typename T> bool SX126xInterface<T>::isActivelyReceiving()
|
||||
{
|
||||
// The IRQ status will be cleared when we start our read operation. Check if we've started a header, but haven't yet
|
||||
// received and handled the interrupt for reading the packet/handling errors.
|
||||
@@ -279,8 +258,7 @@ bool SX126xInterface<T>::isActivelyReceiving()
|
||||
return hasPreamble;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool SX126xInterface<T>::sleep()
|
||||
template <typename T> bool SX126xInterface<T>::sleep()
|
||||
{
|
||||
// Not keeping config is busted - next time nrf52 board boots lora sending fails tcxo related? - see datasheet
|
||||
// \todo Display actual typename of the adapter, not just `SX126x`
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
* \brief Adapter for SX126x radio family. Implements common logic for child classes.
|
||||
* \tparam T RadioLib module type for SX126x: SX1262, SX1268.
|
||||
*/
|
||||
template<class T>
|
||||
class SX126xInterface : public RadioLibInterface
|
||||
template <class T> class SX126xInterface : public RadioLibInterface
|
||||
{
|
||||
public:
|
||||
SX126xInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi);
|
||||
@@ -28,11 +27,10 @@ class SX126xInterface : public RadioLibInterface
|
||||
bool isIRQPending() override { return lora.getIrqStatus() != 0; }
|
||||
|
||||
protected:
|
||||
|
||||
float currentLimit = 140; // Higher OCP limit for SX126x PA
|
||||
|
||||
/**
|
||||
* Specific module instance
|
||||
* Specific module instance
|
||||
*/
|
||||
T lora;
|
||||
|
||||
@@ -65,7 +63,7 @@ class SX126xInterface : public RadioLibInterface
|
||||
/**
|
||||
* Add SNR data to received messages
|
||||
*/
|
||||
virtual void addReceiveMetadata(MeshPacket *mp) override;
|
||||
virtual void addReceiveMetadata(meshtastic_MeshPacket *mp) override;
|
||||
|
||||
virtual void setStandby() override;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "configuration.h"
|
||||
#include "SX1280Interface.h"
|
||||
#include "configuration.h"
|
||||
#include "error.h"
|
||||
|
||||
SX1280Interface::SX1280Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy,
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
* Our adapter for SX1280 radios
|
||||
*/
|
||||
|
||||
|
||||
class SX1280Interface : public SX128xInterface<SX1280>
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
#include "configuration.h"
|
||||
#include "SX128xInterface.h"
|
||||
#include "mesh/NodeDB.h"
|
||||
#include "configuration.h"
|
||||
#include "error.h"
|
||||
#include "mesh/NodeDB.h"
|
||||
|
||||
// Particular boards might define a different max power based on what their hardware can do
|
||||
#ifndef SX128X_MAX_POWER
|
||||
#define SX128X_MAX_POWER 13
|
||||
#endif
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
SX128xInterface<T>::SX128xInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy,
|
||||
SPIClass &spi)
|
||||
SPIClass &spi)
|
||||
: RadioLibInterface(cs, irq, rst, busy, spi, &lora), lora(&module)
|
||||
{
|
||||
}
|
||||
@@ -18,21 +18,20 @@ SX128xInterface<T>::SX128xInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq,
|
||||
/// Initialise the Driver transport hardware and software.
|
||||
/// Make sure the Driver is properly configured before calling init().
|
||||
/// \return true if initialisation succeeded.
|
||||
template<typename T>
|
||||
bool SX128xInterface<T>::init()
|
||||
template <typename T> bool SX128xInterface<T>::init()
|
||||
{
|
||||
#ifdef SX128X_POWER_EN
|
||||
digitalWrite(SX128X_POWER_EN, HIGH);
|
||||
pinMode(SX128X_POWER_EN, OUTPUT);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef RF95_FAN_EN
|
||||
pinMode(RF95_FAN_EN, OUTPUT);
|
||||
digitalWrite(RF95_FAN_EN, 1);
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(SX128X_RXEN) && (SX128X_RXEN != RADIOLIB_NC) // set not rx or tx mode
|
||||
digitalWrite(SX128X_RXEN, LOW); // Set low before becoming an output
|
||||
digitalWrite(SX128X_RXEN, LOW); // Set low before becoming an output
|
||||
pinMode(SX128X_RXEN, OUTPUT);
|
||||
#endif
|
||||
#if defined(SX128X_TXEN) && (SX128X_TXEN != RADIOLIB_NC)
|
||||
@@ -56,9 +55,9 @@ bool SX128xInterface<T>::init()
|
||||
// \todo Display actual typename of the adapter, not just `SX128x`
|
||||
LOG_INFO("SX128x init result %d\n", res);
|
||||
|
||||
if((config.lora.region != Config_LoRaConfig_RegionCode_LORA_24) && (res == RADIOLIB_ERR_INVALID_FREQUENCY)) {
|
||||
if ((config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_LORA_24) && (res == RADIOLIB_ERR_INVALID_FREQUENCY)) {
|
||||
LOG_WARN("Radio chip only supports 2.4GHz LoRa. Adjusting Region and rebooting.\n");
|
||||
config.lora.region = Config_LoRaConfig_RegionCode_LORA_24;
|
||||
config.lora.region = meshtastic_Config_LoRaConfig_RegionCode_LORA_24;
|
||||
nodeDB.saveToDisk(SEGMENT_CONFIG);
|
||||
delay(2000);
|
||||
#if defined(ARCH_ESP32)
|
||||
@@ -70,9 +69,9 @@ bool SX128xInterface<T>::init()
|
||||
#endif
|
||||
}
|
||||
|
||||
LOG_INFO("Frequency set to %f\n", getFreq());
|
||||
LOG_INFO("Bandwidth set to %f\n", bw);
|
||||
LOG_INFO("Power output set to %d\n", power);
|
||||
LOG_INFO("Frequency set to %f\n", getFreq());
|
||||
LOG_INFO("Bandwidth set to %f\n", bw);
|
||||
LOG_INFO("Power output set to %d\n", power);
|
||||
|
||||
if (res == RADIOLIB_ERR_NONE)
|
||||
res = lora.setCRC(2);
|
||||
@@ -83,8 +82,7 @@ bool SX128xInterface<T>::init()
|
||||
return res == RADIOLIB_ERR_NONE;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool SX128xInterface<T>::reconfigure()
|
||||
template <typename T> bool SX128xInterface<T>::reconfigure()
|
||||
{
|
||||
RadioLibInterface::reconfigure();
|
||||
|
||||
@@ -94,15 +92,15 @@ bool SX128xInterface<T>::reconfigure()
|
||||
// configure publicly accessible settings
|
||||
int err = lora.setSpreadingFactor(sf);
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
|
||||
err = lora.setBandwidth(bw);
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
|
||||
err = lora.setCodingRate(cr);
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
|
||||
// Hmm - seems to lower SNR when the signal levels are high. Leaving off for now...
|
||||
// TODO: Confirm gain registers are okay now
|
||||
@@ -117,7 +115,7 @@ bool SX128xInterface<T>::reconfigure()
|
||||
|
||||
err = lora.setFrequency(getFreq());
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
|
||||
if (power > SX128X_MAX_POWER) // This chip has lower power limits than some
|
||||
power = SX128X_MAX_POWER;
|
||||
@@ -130,23 +128,20 @@ bool SX128xInterface<T>::reconfigure()
|
||||
return RADIOLIB_ERR_NONE;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void INTERRUPT_ATTR SX128xInterface<T>::disableInterrupt()
|
||||
template <typename T> void INTERRUPT_ATTR SX128xInterface<T>::disableInterrupt()
|
||||
{
|
||||
lora.clearDio1Action();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool SX128xInterface<T>::wideLora()
|
||||
template <typename T> bool SX128xInterface<T>::wideLora()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SX128xInterface<T>::setStandby()
|
||||
template <typename T> void SX128xInterface<T>::setStandby()
|
||||
{
|
||||
checkNotification(); // handle any pending interrupts before we force standby
|
||||
|
||||
|
||||
int err = lora.standby();
|
||||
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
@@ -169,8 +164,7 @@ void SX128xInterface<T>::setStandby()
|
||||
/**
|
||||
* Add SNR data to received messages
|
||||
*/
|
||||
template<typename T>
|
||||
void SX128xInterface<T>::addReceiveMetadata(MeshPacket *mp)
|
||||
template <typename T> void SX128xInterface<T>::addReceiveMetadata(meshtastic_MeshPacket *mp)
|
||||
{
|
||||
// LOG_DEBUG("PacketStatus %x\n", lora.getPacketStatus());
|
||||
mp->rx_snr = lora.getSNR();
|
||||
@@ -179,8 +173,7 @@ void SX128xInterface<T>::addReceiveMetadata(MeshPacket *mp)
|
||||
|
||||
/** We override to turn on transmitter power as needed.
|
||||
*/
|
||||
template<typename T>
|
||||
void SX128xInterface<T>::configHardwareForSend()
|
||||
template <typename T> void SX128xInterface<T>::configHardwareForSend()
|
||||
{
|
||||
#if defined(SX128X_TXEN) && (SX128X_TXEN != RADIOLIB_NC) // we have RXEN/TXEN control - turn on TX power / off RX power
|
||||
digitalWrite(SX128X_TXEN, HIGH);
|
||||
@@ -195,8 +188,7 @@ void SX128xInterface<T>::configHardwareForSend()
|
||||
// For power draw measurements, helpful to force radio to stay sleeping
|
||||
// #define SLEEP_ONLY
|
||||
|
||||
template<typename T>
|
||||
void SX128xInterface<T>::startReceive()
|
||||
template <typename T> void SX128xInterface<T>::startReceive()
|
||||
{
|
||||
#ifdef SLEEP_ONLY
|
||||
sleep();
|
||||
@@ -210,7 +202,7 @@ void SX128xInterface<T>::startReceive()
|
||||
#if defined(SX128X_TXEN) && (SX128X_TXEN != RADIOLIB_NC)
|
||||
digitalWrite(SX128X_TXEN, LOW);
|
||||
#endif
|
||||
|
||||
|
||||
int err = lora.startReceive();
|
||||
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
@@ -223,33 +215,30 @@ void SX128xInterface<T>::startReceive()
|
||||
}
|
||||
|
||||
/** Could we send right now (i.e. either not actively receving or transmitting)? */
|
||||
template<typename T>
|
||||
bool SX128xInterface<T>::isChannelActive()
|
||||
template <typename T> bool SX128xInterface<T>::isChannelActive()
|
||||
{
|
||||
// check if we can detect a LoRa preamble on the current channel
|
||||
int16_t result;
|
||||
|
||||
setStandby();
|
||||
setStandby();
|
||||
result = lora.scanChannel();
|
||||
if (result == RADIOLIB_PREAMBLE_DETECTED)
|
||||
if (result == RADIOLIB_PREAMBLE_DETECTED)
|
||||
return true;
|
||||
|
||||
|
||||
assert(result != RADIOLIB_ERR_WRONG_MODEM);
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Could we send right now (i.e. either not actively receving or transmitting)? */
|
||||
template<typename T>
|
||||
bool SX128xInterface<T>::isActivelyReceiving()
|
||||
template <typename T> bool SX128xInterface<T>::isActivelyReceiving()
|
||||
{
|
||||
uint16_t irq = lora.getIrqStatus();
|
||||
bool hasPreamble = (irq & RADIOLIB_SX128X_IRQ_HEADER_VALID);
|
||||
return hasPreamble;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool SX128xInterface<T>::sleep()
|
||||
template <typename T> bool SX128xInterface<T>::sleep()
|
||||
{
|
||||
// Not keeping config is busted - next time nrf52 board boots lora sending fails tcxo related? - see datasheet
|
||||
// \todo Display actual typename of the adapter, not just `SX128x`
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
* \brief Adapter for SX128x radio family. Implements common logic for child classes.
|
||||
* \tparam T RadioLib module type for SX128x: SX1280.
|
||||
*/
|
||||
template<class T>
|
||||
class SX128xInterface : public RadioLibInterface
|
||||
template <class T> class SX128xInterface : public RadioLibInterface
|
||||
{
|
||||
public:
|
||||
SX128xInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi);
|
||||
@@ -30,9 +29,8 @@ class SX128xInterface : public RadioLibInterface
|
||||
bool isIRQPending() override { return lora.getIrqStatus() != 0; }
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* Specific module instance
|
||||
* Specific module instance
|
||||
*/
|
||||
T lora;
|
||||
|
||||
@@ -65,7 +63,7 @@ class SX128xInterface : public RadioLibInterface
|
||||
/**
|
||||
* Add SNR data to received messages
|
||||
*/
|
||||
virtual void addReceiveMetadata(MeshPacket *mp) override;
|
||||
virtual void addReceiveMetadata(meshtastic_MeshPacket *mp) override;
|
||||
|
||||
virtual void setStandby() override;
|
||||
|
||||
|
||||
@@ -9,29 +9,29 @@
|
||||
class SinglePortModule : public MeshModule
|
||||
{
|
||||
protected:
|
||||
PortNum ourPortNum;
|
||||
meshtastic_PortNum ourPortNum;
|
||||
|
||||
public:
|
||||
/** Constructor
|
||||
* name is for debugging output
|
||||
*/
|
||||
SinglePortModule(const char *_name, PortNum _ourPortNum) : MeshModule(_name), ourPortNum(_ourPortNum) {}
|
||||
SinglePortModule(const char *_name, meshtastic_PortNum _ourPortNum) : MeshModule(_name), ourPortNum(_ourPortNum) {}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @return true if you want to receive the specified portnum
|
||||
*/
|
||||
virtual bool wantPacket(const MeshPacket *p) override { return p->decoded.portnum == ourPortNum; }
|
||||
virtual bool wantPacket(const meshtastic_MeshPacket *p) override { return p->decoded.portnum == ourPortNum; }
|
||||
|
||||
/**
|
||||
* Return a mesh packet which has been preinited as a data packet with a particular port number.
|
||||
* You can then send this packet (after customizing any of the payload fields you might need) with
|
||||
* service.sendToMesh()
|
||||
*/
|
||||
MeshPacket *allocDataPacket()
|
||||
meshtastic_MeshPacket *allocDataPacket()
|
||||
{
|
||||
// Update our local node info with our position (even if we don't decide to update anyone else)
|
||||
MeshPacket *p = router->allocForSending();
|
||||
meshtastic_MeshPacket *p = router->allocForSending();
|
||||
p->decoded.portnum = ourPortNum;
|
||||
|
||||
return p;
|
||||
|
||||
@@ -27,15 +27,16 @@ int32_t StreamAPI::readStream()
|
||||
} else {
|
||||
while (stream->available()) { // Currently we never want to block
|
||||
int cInt = stream->read();
|
||||
if(cInt < 0)
|
||||
break; // We ran out of characters (even though available said otherwise) - this can happen on rf52 adafruit arduino
|
||||
if (cInt < 0)
|
||||
break; // We ran out of characters (even though available said otherwise) - this can happen on rf52 adafruit
|
||||
// arduino
|
||||
|
||||
uint8_t c = (uint8_t) cInt;
|
||||
uint8_t c = (uint8_t)cInt;
|
||||
|
||||
// Use the read pointer for a little state machine, first look for framing, then length bytes, then payload
|
||||
size_t ptr = rxPtr;
|
||||
|
||||
rxPtr++; // assume we will probably advance the rxPtr
|
||||
rxPtr++; // assume we will probably advance the rxPtr
|
||||
rxBuf[ptr] = c; // store all bytes (including framing)
|
||||
|
||||
// console->printf("rxPtr %d ptr=%d c=0x%x\n", rxPtr, ptr, c);
|
||||
@@ -58,9 +59,9 @@ int32_t StreamAPI::readStream()
|
||||
rxPtr = 0; // length is bogus, restart search for framing
|
||||
}
|
||||
|
||||
if (rxPtr != 0) // Is packet still considered 'good'?
|
||||
if (rxPtr != 0) // Is packet still considered 'good'?
|
||||
if (ptr + 1 >= len + HEADER_LEN) { // have we received all of the payload?
|
||||
rxPtr = 0; // start over again on the next packet
|
||||
rxPtr = 0; // start over again on the next packet
|
||||
|
||||
// If we didn't just fail the packet and we now have the right # of bytes, parse it
|
||||
handleToRadio(rxBuf + HEADER_LEN, len);
|
||||
@@ -111,11 +112,11 @@ void StreamAPI::emitRebooted()
|
||||
{
|
||||
// In case we send a FromRadio packet
|
||||
memset(&fromRadioScratch, 0, sizeof(fromRadioScratch));
|
||||
fromRadioScratch.which_payload_variant = FromRadio_rebooted_tag;
|
||||
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_rebooted_tag;
|
||||
fromRadioScratch.rebooted = true;
|
||||
|
||||
// LOG_DEBUG("Emitting reboot packet for serial shell\n");
|
||||
emitTxBuffer(pb_encode_to_bytes(txBuf + HEADER_LEN, FromRadio_size, &FromRadio_msg, &fromRadioScratch));
|
||||
emitTxBuffer(pb_encode_to_bytes(txBuf + HEADER_LEN, meshtastic_FromRadio_size, &meshtastic_FromRadio_msg, &fromRadioScratch));
|
||||
}
|
||||
|
||||
/// Hookable to find out when connection changes
|
||||
|
||||
@@ -19,10 +19,7 @@ template <class T> class TypedQueue
|
||||
concurrency::OSThread *reader = NULL;
|
||||
|
||||
public:
|
||||
explicit TypedQueue(int maxElements) : h(xQueueCreate(maxElements, sizeof(T)))
|
||||
{
|
||||
assert(h);
|
||||
}
|
||||
explicit TypedQueue(int maxElements) : h(xQueueCreate(maxElements, sizeof(T))) { assert(h); }
|
||||
|
||||
~TypedQueue() { vQueueDelete(h); }
|
||||
|
||||
|
||||
@@ -2,34 +2,30 @@
|
||||
#include "configuration.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
ServerAPI<T>::ServerAPI(T &_client) : StreamAPI(&client), concurrency::OSThread("ServerAPI"), client(_client)
|
||||
{
|
||||
LOG_INFO("Incoming wifi connection\n");
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
ServerAPI<T>::~ServerAPI()
|
||||
template <typename T> ServerAPI<T>::~ServerAPI()
|
||||
{
|
||||
client.stop();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void ServerAPI<T>::close()
|
||||
template <typename T> void ServerAPI<T>::close()
|
||||
{
|
||||
client.stop(); // drop tcp connection
|
||||
StreamAPI::close();
|
||||
}
|
||||
|
||||
/// Check the current underlying physical link to see if the client is currently connected
|
||||
template<typename T>
|
||||
bool ServerAPI<T>::checkIsConnected()
|
||||
template <typename T> bool ServerAPI<T>::checkIsConnected()
|
||||
{
|
||||
return client.connected();
|
||||
}
|
||||
|
||||
template<class T>
|
||||
int32_t ServerAPI<T>::runOnce()
|
||||
template <class T> int32_t ServerAPI<T>::runOnce()
|
||||
{
|
||||
if (client.connected()) {
|
||||
return StreamAPI::runOncePart();
|
||||
@@ -40,17 +36,14 @@ int32_t ServerAPI<T>::runOnce()
|
||||
}
|
||||
}
|
||||
|
||||
template<class T, class U>
|
||||
APIServerPort<T, U>::APIServerPort(int port) : U(port), concurrency::OSThread("ApiServer") {}
|
||||
template <class T, class U> APIServerPort<T, U>::APIServerPort(int port) : U(port), concurrency::OSThread("ApiServer") {}
|
||||
|
||||
template<class T, class U>
|
||||
void APIServerPort<T, U>::init()
|
||||
template <class T, class U> void APIServerPort<T, U>::init()
|
||||
{
|
||||
U::begin();
|
||||
}
|
||||
|
||||
template<class T, class U>
|
||||
int32_t APIServerPort<T, U>::runOnce()
|
||||
template <class T, class U> int32_t APIServerPort<T, U>::runOnce()
|
||||
{
|
||||
auto client = U::available();
|
||||
if (client) {
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
* Provides both debug printing and, if the client starts sending protobufs to us, switches to send/receive protobufs
|
||||
* (and starts dropping debug printing - FIXME, eventually those prints should be encapsulated in protobufs).
|
||||
*/
|
||||
template<class T>
|
||||
class ServerAPI : public StreamAPI, private concurrency::OSThread
|
||||
template <class T> class ServerAPI : public StreamAPI, private concurrency::OSThread
|
||||
{
|
||||
private:
|
||||
T client;
|
||||
@@ -34,8 +33,7 @@ class ServerAPI : public StreamAPI, private concurrency::OSThread
|
||||
/**
|
||||
* Listens for incoming connections and does accepts and creates instances of WiFiServerAPI as needed
|
||||
*/
|
||||
template<class T, class U>
|
||||
class APIServerPort : public U, private concurrency::OSThread
|
||||
template <class T, class U> class APIServerPort : public U, private concurrency::OSThread
|
||||
{
|
||||
/** The currently open port
|
||||
*
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
*/
|
||||
class WiFiServerAPI : public ServerAPI<WiFiClient>
|
||||
{
|
||||
public:
|
||||
explicit WiFiServerAPI(WiFiClient &_client);
|
||||
public:
|
||||
explicit WiFiServerAPI(WiFiClient &_client);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -18,8 +18,8 @@ class WiFiServerAPI : public ServerAPI<WiFiClient>
|
||||
*/
|
||||
class WiFiServerPort : public APIServerPort<WiFiServerAPI, WiFiServer>
|
||||
{
|
||||
public:
|
||||
explicit WiFiServerPort(int port);
|
||||
public:
|
||||
explicit WiFiServerPort(int port);
|
||||
};
|
||||
|
||||
void initApiServer(int port=4403);
|
||||
void initApiServer(int port = 4403);
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
*/
|
||||
class ethServerAPI : public ServerAPI<EthernetClient>
|
||||
{
|
||||
public:
|
||||
explicit ethServerAPI(EthernetClient &_client);
|
||||
public:
|
||||
explicit ethServerAPI(EthernetClient &_client);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -18,8 +18,8 @@ class ethServerAPI : public ServerAPI<EthernetClient>
|
||||
*/
|
||||
class ethServerPort : public APIServerPort<ethServerAPI, EthernetServer>
|
||||
{
|
||||
public:
|
||||
explicit ethServerPort(int port);
|
||||
public:
|
||||
explicit ethServerPort(int port);
|
||||
};
|
||||
|
||||
void initApiServer(int port=4403);
|
||||
void initApiServer(int port = 4403);
|
||||
|
||||
+1114
-1058
File diff suppressed because it is too large
Load Diff
+177
-66
@@ -30,7 +30,7 @@
|
||||
#ifndef unishox2
|
||||
#define unishox2
|
||||
|
||||
#define UNISHOX_VERSION "2.0" ///< Unicode spec version
|
||||
#define UNISHOX_VERSION "2.0" ///< Unicode spec version
|
||||
|
||||
/**
|
||||
* Macro switch to enable/disable output buffer length parameter in low level api \n
|
||||
@@ -45,104 +45,217 @@
|
||||
* The simple api, i.e. unishox2_(de)compress_simple will always omit the buffer length
|
||||
*/
|
||||
#ifndef UNISHOX_API_WITH_OUTPUT_LEN
|
||||
# define UNISHOX_API_WITH_OUTPUT_LEN 0
|
||||
#define UNISHOX_API_WITH_OUTPUT_LEN 0
|
||||
#endif
|
||||
|
||||
/// Upto 8 bits of initial magic bit sequence can be included. Bit count can be specified with UNISHOX_MAGIC_BIT_LEN
|
||||
#ifndef UNISHOX_MAGIC_BITS
|
||||
# define UNISHOX_MAGIC_BITS 0xFF
|
||||
#define UNISHOX_MAGIC_BITS 0xFF
|
||||
#endif
|
||||
|
||||
/// Desired length of Magic bits defined by UNISHOX_MAGIC_BITS
|
||||
#ifdef UNISHOX_MAGIC_BIT_LEN
|
||||
# if UNISHOX_MAGIC_BIT_LEN < 0 || 9 <= UNISHOX_MAGIC_BIT_LEN
|
||||
# error "UNISHOX_MAGIC_BIT_LEN need between [0, 8)"
|
||||
# endif
|
||||
#if UNISHOX_MAGIC_BIT_LEN < 0 || 9 <= UNISHOX_MAGIC_BIT_LEN
|
||||
#error "UNISHOX_MAGIC_BIT_LEN need between [0, 8)"
|
||||
#endif
|
||||
#else
|
||||
# define UNISHOX_MAGIC_BIT_LEN 1
|
||||
#define UNISHOX_MAGIC_BIT_LEN 1
|
||||
#endif
|
||||
|
||||
//enum {USX_ALPHA = 0, USX_SYM, USX_NUM, USX_DICT, USX_DELTA};
|
||||
// enum {USX_ALPHA = 0, USX_SYM, USX_NUM, USX_DICT, USX_DELTA};
|
||||
|
||||
/// Default Horizontal codes. When composition of text is know beforehand, the other hcodes in this section can be used to achieve more compression.
|
||||
#define USX_HCODES_DFLT (const unsigned char[]) {0x00, 0x40, 0x80, 0xC0, 0xE0}
|
||||
/// Default Horizontal codes. When composition of text is know beforehand, the other hcodes in this section can be used to achieve
|
||||
/// more compression.
|
||||
#define USX_HCODES_DFLT \
|
||||
(const unsigned char[]) \
|
||||
{ \
|
||||
0x00, 0x40, 0x80, 0xC0, 0xE0 \
|
||||
}
|
||||
/// Length of each default hcode
|
||||
#define USX_HCODE_LENS_DFLT (const unsigned char[]) {2, 2, 2, 3, 3}
|
||||
#define USX_HCODE_LENS_DFLT \
|
||||
(const unsigned char[]) \
|
||||
{ \
|
||||
2, 2, 2, 3, 3 \
|
||||
}
|
||||
|
||||
/// Horizontal codes preset for English Alphabet content only
|
||||
#define USX_HCODES_ALPHA_ONLY (const unsigned char[]) {0x00, 0x00, 0x00, 0x00, 0x00}
|
||||
#define USX_HCODES_ALPHA_ONLY \
|
||||
(const unsigned char[]) \
|
||||
{ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00 \
|
||||
}
|
||||
/// Length of each Alpha only hcode
|
||||
#define USX_HCODE_LENS_ALPHA_ONLY (const unsigned char[]) {0, 0, 0, 0, 0}
|
||||
#define USX_HCODE_LENS_ALPHA_ONLY \
|
||||
(const unsigned char[]) \
|
||||
{ \
|
||||
0, 0, 0, 0, 0 \
|
||||
}
|
||||
|
||||
/// Horizontal codes preset for Alpha Numeric content only
|
||||
#define USX_HCODES_ALPHA_NUM_ONLY (const unsigned char[]) {0x00, 0x00, 0x80, 0x00, 0x00}
|
||||
#define USX_HCODES_ALPHA_NUM_ONLY \
|
||||
(const unsigned char[]) \
|
||||
{ \
|
||||
0x00, 0x00, 0x80, 0x00, 0x00 \
|
||||
}
|
||||
/// Length of each Alpha numeric hcode
|
||||
#define USX_HCODE_LENS_ALPHA_NUM_ONLY (const unsigned char[]) {1, 0, 1, 0, 0}
|
||||
#define USX_HCODE_LENS_ALPHA_NUM_ONLY \
|
||||
(const unsigned char[]) \
|
||||
{ \
|
||||
1, 0, 1, 0, 0 \
|
||||
}
|
||||
|
||||
/// Horizontal codes preset for Alpha Numeric and Symbol content only
|
||||
#define USX_HCODES_ALPHA_NUM_SYM_ONLY (const unsigned char[]) {0x00, 0x80, 0xC0, 0x00, 0x00}
|
||||
#define USX_HCODES_ALPHA_NUM_SYM_ONLY \
|
||||
(const unsigned char[]) \
|
||||
{ \
|
||||
0x00, 0x80, 0xC0, 0x00, 0x00 \
|
||||
}
|
||||
/// Length of each Alpha numeric and symbol hcodes
|
||||
#define USX_HCODE_LENS_ALPHA_NUM_SYM_ONLY (const unsigned char[]) {1, 2, 2, 0, 0}
|
||||
#define USX_HCODE_LENS_ALPHA_NUM_SYM_ONLY \
|
||||
(const unsigned char[]) \
|
||||
{ \
|
||||
1, 2, 2, 0, 0 \
|
||||
}
|
||||
|
||||
/// Horizontal codes preset favouring Alphabet content
|
||||
#define USX_HCODES_FAVOR_ALPHA (const unsigned char[]) {0x00, 0x80, 0xA0, 0xC0, 0xE0}
|
||||
#define USX_HCODES_FAVOR_ALPHA \
|
||||
(const unsigned char[]) \
|
||||
{ \
|
||||
0x00, 0x80, 0xA0, 0xC0, 0xE0 \
|
||||
}
|
||||
/// Length of each hcode favouring Alpha content
|
||||
#define USX_HCODE_LENS_FAVOR_ALPHA (const unsigned char[]) {1, 3, 3, 3, 3}
|
||||
#define USX_HCODE_LENS_FAVOR_ALPHA \
|
||||
(const unsigned char[]) \
|
||||
{ \
|
||||
1, 3, 3, 3, 3 \
|
||||
}
|
||||
|
||||
/// Horizontal codes preset favouring repeating sequences
|
||||
#define USX_HCODES_FAVOR_DICT (const unsigned char[]) {0x00, 0x40, 0xC0, 0x80, 0xE0}
|
||||
#define USX_HCODES_FAVOR_DICT \
|
||||
(const unsigned char[]) \
|
||||
{ \
|
||||
0x00, 0x40, 0xC0, 0x80, 0xE0 \
|
||||
}
|
||||
/// Length of each hcode favouring repeating sequences
|
||||
#define USX_HCODE_LENS_FAVOR_DICT (const unsigned char[]) {2, 2, 3, 2, 3}
|
||||
#define USX_HCODE_LENS_FAVOR_DICT \
|
||||
(const unsigned char[]) \
|
||||
{ \
|
||||
2, 2, 3, 2, 3 \
|
||||
}
|
||||
|
||||
/// Horizontal codes preset favouring symbols
|
||||
#define USX_HCODES_FAVOR_SYM (const unsigned char[]) {0x80, 0x00, 0xA0, 0xC0, 0xE0}
|
||||
#define USX_HCODES_FAVOR_SYM \
|
||||
(const unsigned char[]) \
|
||||
{ \
|
||||
0x80, 0x00, 0xA0, 0xC0, 0xE0 \
|
||||
}
|
||||
/// Length of each hcode favouring symbols
|
||||
#define USX_HCODE_LENS_FAVOR_SYM (const unsigned char[]) {3, 1, 3, 3, 3}
|
||||
#define USX_HCODE_LENS_FAVOR_SYM \
|
||||
(const unsigned char[]) \
|
||||
{ \
|
||||
3, 1, 3, 3, 3 \
|
||||
}
|
||||
|
||||
//#define USX_HCODES_FAVOR_UMLAUT {0x00, 0x40, 0xE0, 0xC0, 0x80}
|
||||
//#define USX_HCODE_LENS_FAVOR_UMLAUT {2, 2, 3, 3, 2}
|
||||
|
||||
/// Horizontal codes preset favouring umlaut letters
|
||||
#define USX_HCODES_FAVOR_UMLAUT (const unsigned char[]) {0x80, 0xA0, 0xC0, 0xE0, 0x00}
|
||||
#define USX_HCODES_FAVOR_UMLAUT \
|
||||
(const unsigned char[]) \
|
||||
{ \
|
||||
0x80, 0xA0, 0xC0, 0xE0, 0x00 \
|
||||
}
|
||||
/// Length of each hcode favouring umlaut letters
|
||||
#define USX_HCODE_LENS_FAVOR_UMLAUT (const unsigned char[]) {3, 3, 3, 3, 1}
|
||||
#define USX_HCODE_LENS_FAVOR_UMLAUT \
|
||||
(const unsigned char[]) \
|
||||
{ \
|
||||
3, 3, 3, 3, 1 \
|
||||
}
|
||||
|
||||
/// Horizontal codes preset for no repeating sequences
|
||||
#define USX_HCODES_NO_DICT (const unsigned char[]) {0x00, 0x40, 0x80, 0x00, 0xC0}
|
||||
#define USX_HCODES_NO_DICT \
|
||||
(const unsigned char[]) \
|
||||
{ \
|
||||
0x00, 0x40, 0x80, 0x00, 0xC0 \
|
||||
}
|
||||
/// Length of each hcode for no repeating sequences
|
||||
#define USX_HCODE_LENS_NO_DICT (const unsigned char[]) {2, 2, 2, 0, 2}
|
||||
#define USX_HCODE_LENS_NO_DICT \
|
||||
(const unsigned char[]) \
|
||||
{ \
|
||||
2, 2, 2, 0, 2 \
|
||||
}
|
||||
|
||||
/// Horizontal codes preset for no Unicode characters
|
||||
#define USX_HCODES_NO_UNI (const unsigned char[]) {0x00, 0x40, 0x80, 0xC0, 0x00}
|
||||
#define USX_HCODES_NO_UNI \
|
||||
(const unsigned char[]) \
|
||||
{ \
|
||||
0x00, 0x40, 0x80, 0xC0, 0x00 \
|
||||
}
|
||||
/// Length of each hcode for no Unicode characters
|
||||
#define USX_HCODE_LENS_NO_UNI (const unsigned char[]) {2, 2, 2, 2, 0}
|
||||
#define USX_HCODE_LENS_NO_UNI \
|
||||
(const unsigned char[]) \
|
||||
{ \
|
||||
2, 2, 2, 2, 0 \
|
||||
}
|
||||
|
||||
/// Default frequently occuring sequences. When composition of text is know beforehand, the other sequences in this section can be used to achieve more compression.
|
||||
#define USX_FREQ_SEQ_DFLT (const char *[]) {"\": \"", "\": ", "</", "=\"", "\":\"", "://"}
|
||||
/// Default frequently occuring sequences. When composition of text is know beforehand, the other sequences in this section can be
|
||||
/// used to achieve more compression.
|
||||
#define USX_FREQ_SEQ_DFLT \
|
||||
(const char *[]) \
|
||||
{ \
|
||||
"\": \"", "\": ", "</", "=\"", "\":\"", "://" \
|
||||
}
|
||||
/// Frequently occuring sequences in text content
|
||||
#define USX_FREQ_SEQ_TXT (const char *[]) {" the ", " and ", "tion", " with", "ing", "ment"}
|
||||
#define USX_FREQ_SEQ_TXT \
|
||||
(const char *[]) \
|
||||
{ \
|
||||
" the ", " and ", "tion", " with", "ing", "ment" \
|
||||
}
|
||||
/// Frequently occuring sequences in URL content
|
||||
#define USX_FREQ_SEQ_URL (const char *[]) {"https://", "www.", ".com", "http://", ".org", ".net"}
|
||||
#define USX_FREQ_SEQ_URL \
|
||||
(const char *[]) \
|
||||
{ \
|
||||
"https://", "www.", ".com", "http://", ".org", ".net" \
|
||||
}
|
||||
/// Frequently occuring sequences in JSON content
|
||||
#define USX_FREQ_SEQ_JSON (const char *[]) {"\": \"", "\": ", "\",", "}}}", "\":\"", "}}"}
|
||||
#define USX_FREQ_SEQ_JSON \
|
||||
(const char *[]) \
|
||||
{ \
|
||||
"\": \"", "\": ", "\",", "}}}", "\":\"", "}}" \
|
||||
}
|
||||
/// Frequently occuring sequences in HTML content
|
||||
#define USX_FREQ_SEQ_HTML (const char *[]) {"</", "=\"", "div", "href", "class", "<p>"}
|
||||
#define USX_FREQ_SEQ_HTML \
|
||||
(const char *[]) \
|
||||
{ \
|
||||
"</", "=\"", "div", "href", "class", "<p>" \
|
||||
}
|
||||
/// Frequently occuring sequences in XML content
|
||||
#define USX_FREQ_SEQ_XML (const char *[]) {"</", "=\"", "\">", "<?xml version=\"1.0\"", "xmlns:", "://"}
|
||||
#define USX_FREQ_SEQ_XML \
|
||||
(const char *[]) \
|
||||
{ \
|
||||
"</", "=\"", "\">", "<?xml version=\"1.0\"", "xmlns:", "://" \
|
||||
}
|
||||
|
||||
/// Commonly occuring templates (ISO Date/Time, ISO Date, US Phone number, ISO Time, Unused)
|
||||
#define USX_TEMPLATES (const char *[]) {"tfff-of-tfTtf:rf:rf.fffZ", "tfff-of-tf", "(fff) fff-ffff", "tf:rf:rf", 0}
|
||||
#define USX_TEMPLATES \
|
||||
(const char *[]) \
|
||||
{ \
|
||||
"tfff-of-tfTtf:rf:rf.fffZ", "tfff-of-tf", "(fff) fff-ffff", "tf:rf:rf", 0 \
|
||||
}
|
||||
|
||||
/// Default preset parameter set. When composition of text is know beforehand, the other parameter sets in this section can be used to achieve more compression.
|
||||
/// Default preset parameter set. When composition of text is know beforehand, the other parameter sets in this section can be
|
||||
/// used to achieve more compression.
|
||||
#define USX_PSET_DFLT USX_HCODES_DFLT, USX_HCODE_LENS_DFLT, USX_FREQ_SEQ_DFLT, USX_TEMPLATES
|
||||
/// Preset parameter set for English Alphabet only content
|
||||
#define USX_PSET_ALPHA_ONLY USX_HCODES_ALPHA_ONLY, USX_HCODE_LENS_ALPHA_ONLY, USX_FREQ_SEQ_TXT, USX_TEMPLATES
|
||||
/// Preset parameter set for Alpha numeric content
|
||||
#define USX_PSET_ALPHA_NUM_ONLY USX_HCODES_ALPHA_NUM_ONLY, USX_HCODE_LENS_ALPHA_NUM_ONLY, USX_FREQ_SEQ_TXT, USX_TEMPLATES
|
||||
/// Preset parameter set for Alpha numeric and symbol content
|
||||
#define USX_PSET_ALPHA_NUM_SYM_ONLY USX_HCODES_ALPHA_NUM_SYM_ONLY, USX_HCODE_LENS_ALPHA_NUM_SYM_ONLY, USX_FREQ_SEQ_DFLT, USX_TEMPLATES
|
||||
#define USX_PSET_ALPHA_NUM_SYM_ONLY \
|
||||
USX_HCODES_ALPHA_NUM_SYM_ONLY, USX_HCODE_LENS_ALPHA_NUM_SYM_ONLY, USX_FREQ_SEQ_DFLT, USX_TEMPLATES
|
||||
/// Preset parameter set for Alpha numeric symbol content having predominantly text
|
||||
#define USX_PSET_ALPHA_NUM_SYM_ONLY_TXT USX_HCODES_ALPHA_NUM_SYM_ONLY, USX_HCODE_LENS_ALPHA_NUM_SYM_ONLY, USX_FREQ_SEQ_DFLT, USX_TEMPLATES
|
||||
#define USX_PSET_ALPHA_NUM_SYM_ONLY_TXT \
|
||||
USX_HCODES_ALPHA_NUM_SYM_ONLY, USX_HCODE_LENS_ALPHA_NUM_SYM_ONLY, USX_FREQ_SEQ_DFLT, USX_TEMPLATES
|
||||
/// Preset parameter set favouring Alphabet content
|
||||
#define USX_PSET_FAVOR_ALPHA USX_HCODES_FAVOR_ALPHA, USX_HCODE_LENS_FAVOR_ALPHA, USX_FREQ_SEQ_TXT, USX_TEMPLATES
|
||||
/// Preset parameter set favouring repeating sequences
|
||||
@@ -173,8 +286,8 @@
|
||||
* This is passed as a parameter to the unishox2_decompress_lines() function
|
||||
*/
|
||||
struct us_lnk_lst {
|
||||
char *data;
|
||||
struct us_lnk_lst *previous;
|
||||
char *data;
|
||||
struct us_lnk_lst *previous;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -188,32 +301,32 @@ struct us_lnk_lst {
|
||||
* for output length is not performed at each step
|
||||
*/
|
||||
#if defined(UNISHOX_API_WITH_OUTPUT_LEN) && UNISHOX_API_WITH_OUTPUT_LEN != 0
|
||||
# define UNISHOX_API_OUT_AND_LEN(out, olen) out, olen
|
||||
#define UNISHOX_API_OUT_AND_LEN(out, olen) out, olen
|
||||
#else
|
||||
# define UNISHOX_API_OUT_AND_LEN(out, olen) out
|
||||
#define UNISHOX_API_OUT_AND_LEN(out, olen) out
|
||||
#endif
|
||||
|
||||
/**
|
||||
/**
|
||||
* Simple API for compressing a string
|
||||
* @param[in] in Input ASCII / UTF-8 string
|
||||
* @param[in] len length in bytes
|
||||
* @param[out] out output buffer - should be large enough to hold compressed output
|
||||
*/
|
||||
extern int unishox2_compress_simple(const char *in, int len, char *out);
|
||||
/**
|
||||
/**
|
||||
* Simple API for decompressing a string
|
||||
* @param[in] in Input compressed bytes (output of unishox2_compress functions)
|
||||
* @param[in] len length of 'in' in bytes
|
||||
* @param[out] out output buffer for ASCII / UTF-8 string - should be large enough
|
||||
*/
|
||||
extern int unishox2_decompress_simple(const char *in, int len, char *out);
|
||||
/**
|
||||
/**
|
||||
* Comprehensive API for compressing a string
|
||||
*
|
||||
*
|
||||
* Presets are available for the last four parameters so they can be passed as single parameter. \n
|
||||
* See USX_PSET_* macros. Example call: \n
|
||||
* unishox2_compress(in, len, out, olen, USX_PSET_ALPHA_ONLY);
|
||||
*
|
||||
*
|
||||
* @param[in] in Input ASCII / UTF-8 string
|
||||
* @param[in] len length in bytes
|
||||
* @param[out] out output buffer - should be large enough to hold compressed output
|
||||
@@ -224,15 +337,15 @@ extern int unishox2_decompress_simple(const char *in, int len, char *out);
|
||||
* @param[in] usx_templates Templates of frequently occuring patterns. See USX_TEMPLATES macro.
|
||||
*/
|
||||
extern int unishox2_compress(const char *in, int len, UNISHOX_API_OUT_AND_LEN(char *out, int olen),
|
||||
const unsigned char usx_hcodes[], const unsigned char usx_hcode_lens[],
|
||||
const char *usx_freq_seq[], const char *usx_templates[]);
|
||||
/**
|
||||
const unsigned char usx_hcodes[], const unsigned char usx_hcode_lens[], const char *usx_freq_seq[],
|
||||
const char *usx_templates[]);
|
||||
/**
|
||||
* Comprehensive API for de-compressing a string
|
||||
*
|
||||
*
|
||||
* Presets are available for the last four parameters so they can be passed as single parameter. \n
|
||||
* See USX_PSET_* macros. Example call: \n
|
||||
* unishox2_decompress(in, len, out, olen, USX_PSET_ALPHA_ONLY);
|
||||
*
|
||||
*
|
||||
* @param[in] in Input compressed bytes (output of unishox2_compress functions)
|
||||
* @param[in] len length of 'in' in bytes
|
||||
* @param[out] out output buffer - should be large enough to hold de-compressed output
|
||||
@@ -243,11 +356,11 @@ extern int unishox2_compress(const char *in, int len, UNISHOX_API_OUT_AND_LEN(ch
|
||||
* @param[in] usx_templates Templates of frequently occuring patterns. See USX_TEMPLATES macro.
|
||||
*/
|
||||
extern int unishox2_decompress(const char *in, int len, UNISHOX_API_OUT_AND_LEN(char *out, int olen),
|
||||
const unsigned char usx_hcodes[], const unsigned char usx_hcode_lens[],
|
||||
const char *usx_freq_seq[], const char *usx_templates[]);
|
||||
/**
|
||||
const unsigned char usx_hcodes[], const unsigned char usx_hcode_lens[], const char *usx_freq_seq[],
|
||||
const char *usx_templates[]);
|
||||
/**
|
||||
* More Comprehensive API for compressing array of strings
|
||||
*
|
||||
*
|
||||
* See unishox2_compress() function for parameter definitions. \n
|
||||
* This function takes an additional parameter, i.e. 'prev_lines' - the usx_lnk_lst structure \n
|
||||
* See -g parameter in test_unishox2.c to find out how this can be used. \n
|
||||
@@ -256,13 +369,12 @@ extern int unishox2_decompress(const char *in, int len, UNISHOX_API_OUT_AND_LEN(
|
||||
* where each element of the array can be decompressed and used at runtime.
|
||||
*/
|
||||
extern int unishox2_compress_lines(const char *in, int len, UNISHOX_API_OUT_AND_LEN(char *out, int olen),
|
||||
const unsigned char usx_hcodes[], const unsigned char usx_hcode_lens[],
|
||||
const char *usx_freq_seq[], const char *usx_templates[],
|
||||
struct us_lnk_lst *prev_lines);
|
||||
/**
|
||||
const unsigned char usx_hcodes[], const unsigned char usx_hcode_lens[],
|
||||
const char *usx_freq_seq[], const char *usx_templates[], struct us_lnk_lst *prev_lines);
|
||||
/**
|
||||
* More Comprehensive API for de-compressing array of strings \n
|
||||
* This function is not be used in conjuction with unishox2_compress_lines()
|
||||
*
|
||||
*
|
||||
* See unishox2_decompress() function for parameter definitions. \n
|
||||
* Typically an array is compressed using unishox2_compress_lines() and \n
|
||||
* a header (.h) file is generated using the resultant compressed array. \n
|
||||
@@ -271,8 +383,7 @@ extern int unishox2_compress_lines(const char *in, int len, UNISHOX_API_OUT_AND_
|
||||
* decompressed.
|
||||
*/
|
||||
extern int unishox2_decompress_lines(const char *in, int len, UNISHOX_API_OUT_AND_LEN(char *out, int olen),
|
||||
const unsigned char usx_hcodes[], const unsigned char usx_hcode_lens[],
|
||||
const char *usx_freq_seq[], const char *usx_templates[],
|
||||
struct us_lnk_lst *prev_lines);
|
||||
const unsigned char usx_hcodes[], const unsigned char usx_hcode_lens[],
|
||||
const char *usx_freq_seq[], const char *usx_templates[], struct us_lnk_lst *prev_lines);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -120,10 +120,10 @@ bool initEthernet()
|
||||
getMacAddr(mac); // FIXME use the BLE MAC for now...
|
||||
mac[0] &= 0xfe; // Make sure this is not a multicast MAC
|
||||
|
||||
if (config.network.address_mode == Config_NetworkConfig_AddressMode_DHCP) {
|
||||
if (config.network.address_mode == meshtastic_Config_NetworkConfig_AddressMode_DHCP) {
|
||||
LOG_INFO("starting Ethernet DHCP\n");
|
||||
status = Ethernet.begin(mac);
|
||||
} else if (config.network.address_mode == Config_NetworkConfig_AddressMode_STATIC) {
|
||||
} else if (config.network.address_mode == meshtastic_Config_NetworkConfig_AddressMode_STATIC) {
|
||||
LOG_INFO("starting Ethernet Static\n");
|
||||
Ethernet.begin(mac, config.network.ipv4_config.ip, config.network.ipv4_config.dns, config.network.ipv4_config.subnet);
|
||||
} else {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.4.7 */
|
||||
|
||||
#include "./admin.pb.h"
|
||||
#include "meshtastic/admin.pb.h"
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
PB_BIND(AdminMessage, AdminMessage, 2)
|
||||
PB_BIND(meshtastic_AdminMessage, meshtastic_AdminMessage, 2)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
#ifndef PB_MESHTASTIC_MESHTASTIC_ADMIN_PB_H_INCLUDED
|
||||
#define PB_MESHTASTIC_MESHTASTIC_ADMIN_PB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
#include "./channel.pb.h"
|
||||
#include "./config.pb.h"
|
||||
#include "./device_metadata.pb.h"
|
||||
#include "./mesh.pb.h"
|
||||
#include "./module_config.pb.h"
|
||||
#include "meshtastic/channel.pb.h"
|
||||
#include "meshtastic/config.pb.h"
|
||||
#include "meshtastic/device_metadata.pb.h"
|
||||
#include "meshtastic/mesh.pb.h"
|
||||
#include "meshtastic/module_config.pb.h"
|
||||
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
@@ -16,69 +16,69 @@
|
||||
|
||||
/* Enum definitions */
|
||||
/* TODO: REPLACE */
|
||||
typedef enum _AdminMessage_ConfigType {
|
||||
typedef enum _meshtastic_AdminMessage_ConfigType {
|
||||
/* TODO: REPLACE */
|
||||
AdminMessage_ConfigType_DEVICE_CONFIG = 0,
|
||||
meshtastic_AdminMessage_ConfigType_DEVICE_CONFIG = 0,
|
||||
/* TODO: REPLACE */
|
||||
AdminMessage_ConfigType_POSITION_CONFIG = 1,
|
||||
meshtastic_AdminMessage_ConfigType_POSITION_CONFIG = 1,
|
||||
/* TODO: REPLACE */
|
||||
AdminMessage_ConfigType_POWER_CONFIG = 2,
|
||||
meshtastic_AdminMessage_ConfigType_POWER_CONFIG = 2,
|
||||
/* TODO: REPLACE */
|
||||
AdminMessage_ConfigType_NETWORK_CONFIG = 3,
|
||||
meshtastic_AdminMessage_ConfigType_NETWORK_CONFIG = 3,
|
||||
/* TODO: REPLACE */
|
||||
AdminMessage_ConfigType_DISPLAY_CONFIG = 4,
|
||||
meshtastic_AdminMessage_ConfigType_DISPLAY_CONFIG = 4,
|
||||
/* TODO: REPLACE */
|
||||
AdminMessage_ConfigType_LORA_CONFIG = 5,
|
||||
meshtastic_AdminMessage_ConfigType_LORA_CONFIG = 5,
|
||||
/* TODO: REPLACE */
|
||||
AdminMessage_ConfigType_BLUETOOTH_CONFIG = 6
|
||||
} AdminMessage_ConfigType;
|
||||
meshtastic_AdminMessage_ConfigType_BLUETOOTH_CONFIG = 6
|
||||
} meshtastic_AdminMessage_ConfigType;
|
||||
|
||||
/* TODO: REPLACE */
|
||||
typedef enum _AdminMessage_ModuleConfigType {
|
||||
typedef enum _meshtastic_AdminMessage_ModuleConfigType {
|
||||
/* TODO: REPLACE */
|
||||
AdminMessage_ModuleConfigType_MQTT_CONFIG = 0,
|
||||
meshtastic_AdminMessage_ModuleConfigType_MQTT_CONFIG = 0,
|
||||
/* TODO: REPLACE */
|
||||
AdminMessage_ModuleConfigType_SERIAL_CONFIG = 1,
|
||||
meshtastic_AdminMessage_ModuleConfigType_SERIAL_CONFIG = 1,
|
||||
/* TODO: REPLACE */
|
||||
AdminMessage_ModuleConfigType_EXTNOTIF_CONFIG = 2,
|
||||
meshtastic_AdminMessage_ModuleConfigType_EXTNOTIF_CONFIG = 2,
|
||||
/* TODO: REPLACE */
|
||||
AdminMessage_ModuleConfigType_STOREFORWARD_CONFIG = 3,
|
||||
meshtastic_AdminMessage_ModuleConfigType_STOREFORWARD_CONFIG = 3,
|
||||
/* TODO: REPLACE */
|
||||
AdminMessage_ModuleConfigType_RANGETEST_CONFIG = 4,
|
||||
meshtastic_AdminMessage_ModuleConfigType_RANGETEST_CONFIG = 4,
|
||||
/* TODO: REPLACE */
|
||||
AdminMessage_ModuleConfigType_TELEMETRY_CONFIG = 5,
|
||||
meshtastic_AdminMessage_ModuleConfigType_TELEMETRY_CONFIG = 5,
|
||||
/* TODO: REPLACE */
|
||||
AdminMessage_ModuleConfigType_CANNEDMSG_CONFIG = 6,
|
||||
meshtastic_AdminMessage_ModuleConfigType_CANNEDMSG_CONFIG = 6,
|
||||
/* TODO: REPLACE */
|
||||
AdminMessage_ModuleConfigType_AUDIO_CONFIG = 7,
|
||||
meshtastic_AdminMessage_ModuleConfigType_AUDIO_CONFIG = 7,
|
||||
/* TODO: REPLACE */
|
||||
AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG = 8
|
||||
} AdminMessage_ModuleConfigType;
|
||||
meshtastic_AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG = 8
|
||||
} meshtastic_AdminMessage_ModuleConfigType;
|
||||
|
||||
/* Struct definitions */
|
||||
/* 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 {
|
||||
typedef struct _meshtastic_AdminMessage {
|
||||
pb_size_t which_payload_variant;
|
||||
union {
|
||||
/* Send the specified channel in the response to this message
|
||||
NOTE: This field is sent with the channel index + 1 (to ensure we never try to send 'zero' - which protobufs treats as not present) */
|
||||
uint32_t get_channel_request;
|
||||
/* TODO: REPLACE */
|
||||
Channel get_channel_response;
|
||||
meshtastic_Channel get_channel_response;
|
||||
/* Send the current owner data in the response to this message. */
|
||||
bool get_owner_request;
|
||||
/* TODO: REPLACE */
|
||||
User get_owner_response;
|
||||
meshtastic_User get_owner_response;
|
||||
/* Ask for the following config data to be sent */
|
||||
AdminMessage_ConfigType get_config_request;
|
||||
meshtastic_AdminMessage_ConfigType get_config_request;
|
||||
/* Send the current Config in the response to this message. */
|
||||
Config get_config_response;
|
||||
meshtastic_Config get_config_response;
|
||||
/* Ask for the following config data to be sent */
|
||||
AdminMessage_ModuleConfigType get_module_config_request;
|
||||
meshtastic_AdminMessage_ModuleConfigType get_module_config_request;
|
||||
/* Send the current Config in the response to this message. */
|
||||
ModuleConfig get_module_config_response;
|
||||
meshtastic_ModuleConfig get_module_config_response;
|
||||
/* Get the Canned Message Module messages in the response to this message. */
|
||||
bool get_canned_message_module_messages_request;
|
||||
/* Get the Canned Message Module messages in the response to this message. */
|
||||
@@ -86,23 +86,23 @@ typedef struct _AdminMessage {
|
||||
/* Request the node to send device metadata (firmware, protobuf version, etc) */
|
||||
bool get_device_metadata_request;
|
||||
/* Device metadata response */
|
||||
DeviceMetadata get_device_metadata_response;
|
||||
meshtastic_DeviceMetadata get_device_metadata_response;
|
||||
/* Get the Ringtone in the response to this message. */
|
||||
bool get_ringtone_request;
|
||||
/* Get the Ringtone in the response to this message. */
|
||||
char get_ringtone_response[231];
|
||||
/* Set the owner for this node */
|
||||
User set_owner;
|
||||
meshtastic_User set_owner;
|
||||
/* Set channels (using the new API).
|
||||
A special channel is the "primary channel".
|
||||
The other records are secondary channels.
|
||||
Note: only one channel can be marked as primary.
|
||||
If the client sets a particular channel to be primary, the previous channel will be set to SECONDARY automatically. */
|
||||
Channel set_channel;
|
||||
meshtastic_Channel set_channel;
|
||||
/* Set the current Config */
|
||||
Config set_config;
|
||||
meshtastic_Config set_config;
|
||||
/* Set the current Config */
|
||||
ModuleConfig set_module_config;
|
||||
meshtastic_ModuleConfig set_module_config;
|
||||
/* Set the Canned Message Module messages text. */
|
||||
char set_canned_message_module_messages[201];
|
||||
/* Set the ringtone for ExternalNotification. */
|
||||
@@ -112,13 +112,6 @@ typedef struct _AdminMessage {
|
||||
bool begin_edit_settings;
|
||||
/* Commits an open transaction for any edits made to config, module config, owner, and channel settings */
|
||||
bool commit_edit_settings;
|
||||
/* Setting channels/radio config remotely carries the risk that you might send an invalid config and the radio never talks to your mesh again.
|
||||
Therefore if setting either of these properties remotely, you must send a confirm_xxx message within 10 minutes.
|
||||
If you fail to do so, the radio will assume loss of comms and revert your changes.
|
||||
These messages are optional when changing the local node. */
|
||||
bool confirm_set_channel;
|
||||
/* TODO: REPLACE */
|
||||
bool confirm_set_radio;
|
||||
/* Tell the node to reboot into the OTA Firmware in this many seconds (or <0 to cancel reboot)
|
||||
Only Implemented for ESP32 Devices. This needs to be issued to send a new main firmware via bluetooth. */
|
||||
int32_t reboot_ota_seconds;
|
||||
@@ -134,7 +127,7 @@ typedef struct _AdminMessage {
|
||||
/* Tell the node to reset the nodedb. */
|
||||
int32_t nodedb_reset;
|
||||
};
|
||||
} AdminMessage;
|
||||
} meshtastic_AdminMessage;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -142,56 +135,54 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Helper constants for enums */
|
||||
#define _AdminMessage_ConfigType_MIN AdminMessage_ConfigType_DEVICE_CONFIG
|
||||
#define _AdminMessage_ConfigType_MAX AdminMessage_ConfigType_BLUETOOTH_CONFIG
|
||||
#define _AdminMessage_ConfigType_ARRAYSIZE ((AdminMessage_ConfigType)(AdminMessage_ConfigType_BLUETOOTH_CONFIG+1))
|
||||
#define _meshtastic_AdminMessage_ConfigType_MIN meshtastic_AdminMessage_ConfigType_DEVICE_CONFIG
|
||||
#define _meshtastic_AdminMessage_ConfigType_MAX meshtastic_AdminMessage_ConfigType_BLUETOOTH_CONFIG
|
||||
#define _meshtastic_AdminMessage_ConfigType_ARRAYSIZE ((meshtastic_AdminMessage_ConfigType)(meshtastic_AdminMessage_ConfigType_BLUETOOTH_CONFIG+1))
|
||||
|
||||
#define _AdminMessage_ModuleConfigType_MIN AdminMessage_ModuleConfigType_MQTT_CONFIG
|
||||
#define _AdminMessage_ModuleConfigType_MAX AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG
|
||||
#define _AdminMessage_ModuleConfigType_ARRAYSIZE ((AdminMessage_ModuleConfigType)(AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG+1))
|
||||
#define _meshtastic_AdminMessage_ModuleConfigType_MIN meshtastic_AdminMessage_ModuleConfigType_MQTT_CONFIG
|
||||
#define _meshtastic_AdminMessage_ModuleConfigType_MAX meshtastic_AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG
|
||||
#define _meshtastic_AdminMessage_ModuleConfigType_ARRAYSIZE ((meshtastic_AdminMessage_ModuleConfigType)(meshtastic_AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG+1))
|
||||
|
||||
#define AdminMessage_payload_variant_get_config_request_ENUMTYPE AdminMessage_ConfigType
|
||||
#define AdminMessage_payload_variant_get_module_config_request_ENUMTYPE AdminMessage_ModuleConfigType
|
||||
#define meshtastic_AdminMessage_payload_variant_get_config_request_ENUMTYPE meshtastic_AdminMessage_ConfigType
|
||||
#define meshtastic_AdminMessage_payload_variant_get_module_config_request_ENUMTYPE meshtastic_AdminMessage_ModuleConfigType
|
||||
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define AdminMessage_init_default {0, {0}}
|
||||
#define AdminMessage_init_zero {0, {0}}
|
||||
#define meshtastic_AdminMessage_init_default {0, {0}}
|
||||
#define meshtastic_AdminMessage_init_zero {0, {0}}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define AdminMessage_get_channel_request_tag 1
|
||||
#define AdminMessage_get_channel_response_tag 2
|
||||
#define AdminMessage_get_owner_request_tag 3
|
||||
#define AdminMessage_get_owner_response_tag 4
|
||||
#define AdminMessage_get_config_request_tag 5
|
||||
#define AdminMessage_get_config_response_tag 6
|
||||
#define AdminMessage_get_module_config_request_tag 7
|
||||
#define AdminMessage_get_module_config_response_tag 8
|
||||
#define AdminMessage_get_canned_message_module_messages_request_tag 10
|
||||
#define AdminMessage_get_canned_message_module_messages_response_tag 11
|
||||
#define AdminMessage_get_device_metadata_request_tag 12
|
||||
#define AdminMessage_get_device_metadata_response_tag 13
|
||||
#define AdminMessage_get_ringtone_request_tag 14
|
||||
#define AdminMessage_get_ringtone_response_tag 15
|
||||
#define AdminMessage_set_owner_tag 32
|
||||
#define AdminMessage_set_channel_tag 33
|
||||
#define AdminMessage_set_config_tag 34
|
||||
#define AdminMessage_set_module_config_tag 35
|
||||
#define AdminMessage_set_canned_message_module_messages_tag 36
|
||||
#define AdminMessage_set_ringtone_message_tag 37
|
||||
#define AdminMessage_begin_edit_settings_tag 64
|
||||
#define AdminMessage_commit_edit_settings_tag 65
|
||||
#define AdminMessage_confirm_set_channel_tag 66
|
||||
#define AdminMessage_confirm_set_radio_tag 67
|
||||
#define AdminMessage_reboot_ota_seconds_tag 95
|
||||
#define AdminMessage_exit_simulator_tag 96
|
||||
#define AdminMessage_reboot_seconds_tag 97
|
||||
#define AdminMessage_shutdown_seconds_tag 98
|
||||
#define AdminMessage_factory_reset_tag 99
|
||||
#define AdminMessage_nodedb_reset_tag 100
|
||||
#define meshtastic_AdminMessage_get_channel_request_tag 1
|
||||
#define meshtastic_AdminMessage_get_channel_response_tag 2
|
||||
#define meshtastic_AdminMessage_get_owner_request_tag 3
|
||||
#define meshtastic_AdminMessage_get_owner_response_tag 4
|
||||
#define meshtastic_AdminMessage_get_config_request_tag 5
|
||||
#define meshtastic_AdminMessage_get_config_response_tag 6
|
||||
#define meshtastic_AdminMessage_get_module_config_request_tag 7
|
||||
#define meshtastic_AdminMessage_get_module_config_response_tag 8
|
||||
#define meshtastic_AdminMessage_get_canned_message_module_messages_request_tag 10
|
||||
#define meshtastic_AdminMessage_get_canned_message_module_messages_response_tag 11
|
||||
#define meshtastic_AdminMessage_get_device_metadata_request_tag 12
|
||||
#define meshtastic_AdminMessage_get_device_metadata_response_tag 13
|
||||
#define meshtastic_AdminMessage_get_ringtone_request_tag 14
|
||||
#define meshtastic_AdminMessage_get_ringtone_response_tag 15
|
||||
#define meshtastic_AdminMessage_set_owner_tag 32
|
||||
#define meshtastic_AdminMessage_set_channel_tag 33
|
||||
#define meshtastic_AdminMessage_set_config_tag 34
|
||||
#define meshtastic_AdminMessage_set_module_config_tag 35
|
||||
#define meshtastic_AdminMessage_set_canned_message_module_messages_tag 36
|
||||
#define meshtastic_AdminMessage_set_ringtone_message_tag 37
|
||||
#define meshtastic_AdminMessage_begin_edit_settings_tag 64
|
||||
#define meshtastic_AdminMessage_commit_edit_settings_tag 65
|
||||
#define meshtastic_AdminMessage_reboot_ota_seconds_tag 95
|
||||
#define meshtastic_AdminMessage_exit_simulator_tag 96
|
||||
#define meshtastic_AdminMessage_reboot_seconds_tag 97
|
||||
#define meshtastic_AdminMessage_shutdown_seconds_tag 98
|
||||
#define meshtastic_AdminMessage_factory_reset_tag 99
|
||||
#define meshtastic_AdminMessage_nodedb_reset_tag 100
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define AdminMessage_FIELDLIST(X, a) \
|
||||
#define meshtastic_AdminMessage_FIELDLIST(X, a) \
|
||||
X(a, STATIC, ONEOF, UINT32, (payload_variant,get_channel_request,get_channel_request), 1) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,get_channel_response,get_channel_response), 2) \
|
||||
X(a, STATIC, ONEOF, BOOL, (payload_variant,get_owner_request,get_owner_request), 3) \
|
||||
@@ -214,33 +205,31 @@ X(a, STATIC, ONEOF, STRING, (payload_variant,set_canned_message_module_me
|
||||
X(a, STATIC, ONEOF, STRING, (payload_variant,set_ringtone_message,set_ringtone_message), 37) \
|
||||
X(a, STATIC, ONEOF, BOOL, (payload_variant,begin_edit_settings,begin_edit_settings), 64) \
|
||||
X(a, STATIC, ONEOF, BOOL, (payload_variant,commit_edit_settings,commit_edit_settings), 65) \
|
||||
X(a, STATIC, ONEOF, BOOL, (payload_variant,confirm_set_channel,confirm_set_channel), 66) \
|
||||
X(a, STATIC, ONEOF, BOOL, (payload_variant,confirm_set_radio,confirm_set_radio), 67) \
|
||||
X(a, STATIC, ONEOF, INT32, (payload_variant,reboot_ota_seconds,reboot_ota_seconds), 95) \
|
||||
X(a, STATIC, ONEOF, BOOL, (payload_variant,exit_simulator,exit_simulator), 96) \
|
||||
X(a, STATIC, ONEOF, INT32, (payload_variant,reboot_seconds,reboot_seconds), 97) \
|
||||
X(a, STATIC, ONEOF, INT32, (payload_variant,shutdown_seconds,shutdown_seconds), 98) \
|
||||
X(a, STATIC, ONEOF, INT32, (payload_variant,factory_reset,factory_reset), 99) \
|
||||
X(a, STATIC, ONEOF, INT32, (payload_variant,nodedb_reset,nodedb_reset), 100)
|
||||
#define AdminMessage_CALLBACK NULL
|
||||
#define AdminMessage_DEFAULT NULL
|
||||
#define AdminMessage_payload_variant_get_channel_response_MSGTYPE Channel
|
||||
#define AdminMessage_payload_variant_get_owner_response_MSGTYPE User
|
||||
#define AdminMessage_payload_variant_get_config_response_MSGTYPE Config
|
||||
#define AdminMessage_payload_variant_get_module_config_response_MSGTYPE ModuleConfig
|
||||
#define AdminMessage_payload_variant_get_device_metadata_response_MSGTYPE DeviceMetadata
|
||||
#define AdminMessage_payload_variant_set_owner_MSGTYPE User
|
||||
#define AdminMessage_payload_variant_set_channel_MSGTYPE Channel
|
||||
#define AdminMessage_payload_variant_set_config_MSGTYPE Config
|
||||
#define AdminMessage_payload_variant_set_module_config_MSGTYPE ModuleConfig
|
||||
#define meshtastic_AdminMessage_CALLBACK NULL
|
||||
#define meshtastic_AdminMessage_DEFAULT NULL
|
||||
#define meshtastic_AdminMessage_payload_variant_get_channel_response_MSGTYPE meshtastic_Channel
|
||||
#define meshtastic_AdminMessage_payload_variant_get_owner_response_MSGTYPE meshtastic_User
|
||||
#define meshtastic_AdminMessage_payload_variant_get_config_response_MSGTYPE meshtastic_Config
|
||||
#define meshtastic_AdminMessage_payload_variant_get_module_config_response_MSGTYPE meshtastic_ModuleConfig
|
||||
#define meshtastic_AdminMessage_payload_variant_get_device_metadata_response_MSGTYPE meshtastic_DeviceMetadata
|
||||
#define meshtastic_AdminMessage_payload_variant_set_owner_MSGTYPE meshtastic_User
|
||||
#define meshtastic_AdminMessage_payload_variant_set_channel_MSGTYPE meshtastic_Channel
|
||||
#define meshtastic_AdminMessage_payload_variant_set_config_MSGTYPE meshtastic_Config
|
||||
#define meshtastic_AdminMessage_payload_variant_set_module_config_MSGTYPE meshtastic_ModuleConfig
|
||||
|
||||
extern const pb_msgdesc_t AdminMessage_msg;
|
||||
extern const pb_msgdesc_t meshtastic_AdminMessage_msg;
|
||||
|
||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||
#define AdminMessage_fields &AdminMessage_msg
|
||||
#define meshtastic_AdminMessage_fields &meshtastic_AdminMessage_msg
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define AdminMessage_size 234
|
||||
#define meshtastic_AdminMessage_size 234
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.4.7 */
|
||||
|
||||
#include "./apponly.pb.h"
|
||||
#include "meshtastic/apponly.pb.h"
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
PB_BIND(ChannelSet, ChannelSet, 2)
|
||||
PB_BIND(meshtastic_ChannelSet, meshtastic_ChannelSet, 2)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#ifndef PB_MESHTASTIC_MESHTASTIC_APPONLY_PB_H_INCLUDED
|
||||
#define PB_MESHTASTIC_MESHTASTIC_APPONLY_PB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
#include "./channel.pb.h"
|
||||
#include "./config.pb.h"
|
||||
#include "meshtastic/channel.pb.h"
|
||||
#include "meshtastic/config.pb.h"
|
||||
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
@@ -17,14 +17,14 @@
|
||||
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 {
|
||||
typedef struct _meshtastic_ChannelSet {
|
||||
/* Channel list with settings */
|
||||
pb_size_t settings_count;
|
||||
ChannelSettings settings[8];
|
||||
meshtastic_ChannelSettings settings[8];
|
||||
/* LoRa config */
|
||||
bool has_lora_config;
|
||||
Config_LoRaConfig lora_config;
|
||||
} ChannelSet;
|
||||
meshtastic_Config_LoRaConfig lora_config;
|
||||
} meshtastic_ChannelSet;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -32,29 +32,29 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define ChannelSet_init_default {0, {ChannelSettings_init_default, ChannelSettings_init_default, ChannelSettings_init_default, ChannelSettings_init_default, ChannelSettings_init_default, ChannelSettings_init_default, ChannelSettings_init_default, ChannelSettings_init_default}, false, Config_LoRaConfig_init_default}
|
||||
#define ChannelSet_init_zero {0, {ChannelSettings_init_zero, ChannelSettings_init_zero, ChannelSettings_init_zero, ChannelSettings_init_zero, ChannelSettings_init_zero, ChannelSettings_init_zero, ChannelSettings_init_zero, ChannelSettings_init_zero}, false, Config_LoRaConfig_init_zero}
|
||||
#define meshtastic_ChannelSet_init_default {0, {meshtastic_ChannelSettings_init_default, meshtastic_ChannelSettings_init_default, meshtastic_ChannelSettings_init_default, meshtastic_ChannelSettings_init_default, meshtastic_ChannelSettings_init_default, meshtastic_ChannelSettings_init_default, meshtastic_ChannelSettings_init_default, meshtastic_ChannelSettings_init_default}, false, meshtastic_Config_LoRaConfig_init_default}
|
||||
#define meshtastic_ChannelSet_init_zero {0, {meshtastic_ChannelSettings_init_zero, meshtastic_ChannelSettings_init_zero, meshtastic_ChannelSettings_init_zero, meshtastic_ChannelSettings_init_zero, meshtastic_ChannelSettings_init_zero, meshtastic_ChannelSettings_init_zero, meshtastic_ChannelSettings_init_zero, meshtastic_ChannelSettings_init_zero}, false, meshtastic_Config_LoRaConfig_init_zero}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define ChannelSet_settings_tag 1
|
||||
#define ChannelSet_lora_config_tag 2
|
||||
#define meshtastic_ChannelSet_settings_tag 1
|
||||
#define meshtastic_ChannelSet_lora_config_tag 2
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define ChannelSet_FIELDLIST(X, a) \
|
||||
#define meshtastic_ChannelSet_FIELDLIST(X, a) \
|
||||
X(a, STATIC, REPEATED, MESSAGE, settings, 1) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, lora_config, 2)
|
||||
#define ChannelSet_CALLBACK NULL
|
||||
#define ChannelSet_DEFAULT NULL
|
||||
#define ChannelSet_settings_MSGTYPE ChannelSettings
|
||||
#define ChannelSet_lora_config_MSGTYPE Config_LoRaConfig
|
||||
#define meshtastic_ChannelSet_CALLBACK NULL
|
||||
#define meshtastic_ChannelSet_DEFAULT NULL
|
||||
#define meshtastic_ChannelSet_settings_MSGTYPE meshtastic_ChannelSettings
|
||||
#define meshtastic_ChannelSet_lora_config_MSGTYPE meshtastic_Config_LoRaConfig
|
||||
|
||||
extern const pb_msgdesc_t ChannelSet_msg;
|
||||
extern const pb_msgdesc_t meshtastic_ChannelSet_msg;
|
||||
|
||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||
#define ChannelSet_fields &ChannelSet_msg
|
||||
#define meshtastic_ChannelSet_fields &meshtastic_ChannelSet_msg
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define ChannelSet_size 584
|
||||
#define meshtastic_ChannelSet_size 591
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.4.7 */
|
||||
|
||||
#include "./cannedmessages.pb.h"
|
||||
#include "meshtastic/cannedmessages.pb.h"
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
PB_BIND(CannedMessageModuleConfig, CannedMessageModuleConfig, AUTO)
|
||||
PB_BIND(meshtastic_CannedMessageModuleConfig, meshtastic_CannedMessageModuleConfig, AUTO)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
|
||||
/* Struct definitions */
|
||||
/* Canned message module configuration. */
|
||||
typedef struct _CannedMessageModuleConfig {
|
||||
typedef struct _meshtastic_CannedMessageModuleConfig {
|
||||
/* Predefined messages for canned message module separated by '|' characters. */
|
||||
char messages[201];
|
||||
} CannedMessageModuleConfig;
|
||||
} meshtastic_CannedMessageModuleConfig;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -22,25 +22,25 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define CannedMessageModuleConfig_init_default {""}
|
||||
#define CannedMessageModuleConfig_init_zero {""}
|
||||
#define meshtastic_CannedMessageModuleConfig_init_default {""}
|
||||
#define meshtastic_CannedMessageModuleConfig_init_zero {""}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define CannedMessageModuleConfig_messages_tag 1
|
||||
#define meshtastic_CannedMessageModuleConfig_messages_tag 1
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define CannedMessageModuleConfig_FIELDLIST(X, a) \
|
||||
#define meshtastic_CannedMessageModuleConfig_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, STRING, messages, 1)
|
||||
#define CannedMessageModuleConfig_CALLBACK NULL
|
||||
#define CannedMessageModuleConfig_DEFAULT NULL
|
||||
#define meshtastic_CannedMessageModuleConfig_CALLBACK NULL
|
||||
#define meshtastic_CannedMessageModuleConfig_DEFAULT NULL
|
||||
|
||||
extern const pb_msgdesc_t CannedMessageModuleConfig_msg;
|
||||
extern const pb_msgdesc_t meshtastic_CannedMessageModuleConfig_msg;
|
||||
|
||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||
#define CannedMessageModuleConfig_fields &CannedMessageModuleConfig_msg
|
||||
#define meshtastic_CannedMessageModuleConfig_fields &meshtastic_CannedMessageModuleConfig_msg
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define CannedMessageModuleConfig_size 203
|
||||
#define meshtastic_CannedMessageModuleConfig_size 203
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.4.7 */
|
||||
|
||||
#include "./channel.pb.h"
|
||||
#include "meshtastic/channel.pb.h"
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
PB_BIND(ChannelSettings, ChannelSettings, AUTO)
|
||||
PB_BIND(meshtastic_ChannelSettings, meshtastic_ChannelSettings, AUTO)
|
||||
|
||||
|
||||
PB_BIND(Channel, Channel, AUTO)
|
||||
PB_BIND(meshtastic_Channel, meshtastic_Channel, AUTO)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -19,18 +19,18 @@
|
||||
cross band routing as needed.
|
||||
If a device has only a single radio (the common case) only one channel can be PRIMARY at a time
|
||||
(but any number of SECONDARY channels can't be sent received on that common frequency) */
|
||||
typedef enum _Channel_Role {
|
||||
typedef enum _meshtastic_Channel_Role {
|
||||
/* This channel is not in use right now */
|
||||
Channel_Role_DISABLED = 0,
|
||||
meshtastic_Channel_Role_DISABLED = 0,
|
||||
/* This channel is used to set the frequency for the radio - all other enabled channels must be SECONDARY */
|
||||
Channel_Role_PRIMARY = 1,
|
||||
meshtastic_Channel_Role_PRIMARY = 1,
|
||||
/* Secondary channels are only used for encryption/decryption/authentication purposes.
|
||||
Their radio settings (freq etc) are ignored, only psk is used. */
|
||||
Channel_Role_SECONDARY = 2
|
||||
} Channel_Role;
|
||||
meshtastic_Channel_Role_SECONDARY = 2
|
||||
} meshtastic_Channel_Role;
|
||||
|
||||
/* Struct definitions */
|
||||
typedef PB_BYTES_ARRAY_T(32) ChannelSettings_psk_t;
|
||||
typedef PB_BYTES_ARRAY_T(32) meshtastic_ChannelSettings_psk_t;
|
||||
/* 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
|
||||
@@ -50,7 +50,7 @@ typedef PB_BYTES_ARRAY_T(32) ChannelSettings_psk_t;
|
||||
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 {
|
||||
typedef struct _meshtastic_ChannelSettings {
|
||||
/* Deprecated in favor of LoraConfig.channel_num */
|
||||
uint32_t channel_num;
|
||||
/* A simple pre-shared key for now for crypto.
|
||||
@@ -63,7 +63,7 @@ typedef struct _ChannelSettings {
|
||||
`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 */
|
||||
ChannelSettings_psk_t psk;
|
||||
meshtastic_ChannelSettings_psk_t psk;
|
||||
/* A SHORT name that will be packed into the URL.
|
||||
Less than 12 bytes.
|
||||
Something for end users to call the channel
|
||||
@@ -89,20 +89,20 @@ typedef struct _ChannelSettings {
|
||||
bool uplink_enabled;
|
||||
/* If true, messages seen on the internet will be forwarded to the local mesh. */
|
||||
bool downlink_enabled;
|
||||
} ChannelSettings;
|
||||
} meshtastic_ChannelSettings;
|
||||
|
||||
/* A pair of a channel number, mode and the (sharable) settings for that channel */
|
||||
typedef struct _Channel {
|
||||
typedef struct _meshtastic_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;
|
||||
meshtastic_ChannelSettings settings;
|
||||
/* TODO: REPLACE */
|
||||
Channel_Role role;
|
||||
} Channel;
|
||||
meshtastic_Channel_Role role;
|
||||
} meshtastic_Channel;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -110,60 +110,60 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Helper constants for enums */
|
||||
#define _Channel_Role_MIN Channel_Role_DISABLED
|
||||
#define _Channel_Role_MAX Channel_Role_SECONDARY
|
||||
#define _Channel_Role_ARRAYSIZE ((Channel_Role)(Channel_Role_SECONDARY+1))
|
||||
#define _meshtastic_Channel_Role_MIN meshtastic_Channel_Role_DISABLED
|
||||
#define _meshtastic_Channel_Role_MAX meshtastic_Channel_Role_SECONDARY
|
||||
#define _meshtastic_Channel_Role_ARRAYSIZE ((meshtastic_Channel_Role)(meshtastic_Channel_Role_SECONDARY+1))
|
||||
|
||||
|
||||
#define Channel_role_ENUMTYPE Channel_Role
|
||||
#define meshtastic_Channel_role_ENUMTYPE meshtastic_Channel_Role
|
||||
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define ChannelSettings_init_default {0, {0, {0}}, "", 0, 0, 0}
|
||||
#define Channel_init_default {0, false, ChannelSettings_init_default, _Channel_Role_MIN}
|
||||
#define ChannelSettings_init_zero {0, {0, {0}}, "", 0, 0, 0}
|
||||
#define Channel_init_zero {0, false, ChannelSettings_init_zero, _Channel_Role_MIN}
|
||||
#define meshtastic_ChannelSettings_init_default {0, {0, {0}}, "", 0, 0, 0}
|
||||
#define meshtastic_Channel_init_default {0, false, meshtastic_ChannelSettings_init_default, _meshtastic_Channel_Role_MIN}
|
||||
#define meshtastic_ChannelSettings_init_zero {0, {0, {0}}, "", 0, 0, 0}
|
||||
#define meshtastic_Channel_init_zero {0, false, meshtastic_ChannelSettings_init_zero, _meshtastic_Channel_Role_MIN}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define ChannelSettings_channel_num_tag 1
|
||||
#define ChannelSettings_psk_tag 2
|
||||
#define ChannelSettings_name_tag 3
|
||||
#define ChannelSettings_id_tag 4
|
||||
#define ChannelSettings_uplink_enabled_tag 5
|
||||
#define ChannelSettings_downlink_enabled_tag 6
|
||||
#define Channel_index_tag 1
|
||||
#define Channel_settings_tag 2
|
||||
#define Channel_role_tag 3
|
||||
#define meshtastic_ChannelSettings_channel_num_tag 1
|
||||
#define meshtastic_ChannelSettings_psk_tag 2
|
||||
#define meshtastic_ChannelSettings_name_tag 3
|
||||
#define meshtastic_ChannelSettings_id_tag 4
|
||||
#define meshtastic_ChannelSettings_uplink_enabled_tag 5
|
||||
#define meshtastic_ChannelSettings_downlink_enabled_tag 6
|
||||
#define meshtastic_Channel_index_tag 1
|
||||
#define meshtastic_Channel_settings_tag 2
|
||||
#define meshtastic_Channel_role_tag 3
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define ChannelSettings_FIELDLIST(X, a) \
|
||||
#define meshtastic_ChannelSettings_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, channel_num, 1) \
|
||||
X(a, STATIC, SINGULAR, BYTES, psk, 2) \
|
||||
X(a, STATIC, SINGULAR, STRING, name, 3) \
|
||||
X(a, STATIC, SINGULAR, FIXED32, id, 4) \
|
||||
X(a, STATIC, SINGULAR, BOOL, uplink_enabled, 5) \
|
||||
X(a, STATIC, SINGULAR, BOOL, downlink_enabled, 6)
|
||||
#define ChannelSettings_CALLBACK NULL
|
||||
#define ChannelSettings_DEFAULT NULL
|
||||
#define meshtastic_ChannelSettings_CALLBACK NULL
|
||||
#define meshtastic_ChannelSettings_DEFAULT NULL
|
||||
|
||||
#define Channel_FIELDLIST(X, a) \
|
||||
#define meshtastic_Channel_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, INT32, index, 1) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, settings, 2) \
|
||||
X(a, STATIC, SINGULAR, UENUM, role, 3)
|
||||
#define Channel_CALLBACK NULL
|
||||
#define Channel_DEFAULT NULL
|
||||
#define Channel_settings_MSGTYPE ChannelSettings
|
||||
#define meshtastic_Channel_CALLBACK NULL
|
||||
#define meshtastic_Channel_DEFAULT NULL
|
||||
#define meshtastic_Channel_settings_MSGTYPE meshtastic_ChannelSettings
|
||||
|
||||
extern const pb_msgdesc_t ChannelSettings_msg;
|
||||
extern const pb_msgdesc_t Channel_msg;
|
||||
extern const pb_msgdesc_t meshtastic_ChannelSettings_msg;
|
||||
extern const pb_msgdesc_t meshtastic_Channel_msg;
|
||||
|
||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||
#define ChannelSettings_fields &ChannelSettings_msg
|
||||
#define Channel_fields &Channel_msg
|
||||
#define meshtastic_ChannelSettings_fields &meshtastic_ChannelSettings_msg
|
||||
#define meshtastic_Channel_fields &meshtastic_Channel_msg
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define ChannelSettings_size 62
|
||||
#define Channel_size 77
|
||||
#define meshtastic_ChannelSettings_size 62
|
||||
#define meshtastic_Channel_size 77
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
@@ -1,36 +1,37 @@
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.4.7 */
|
||||
|
||||
#include "./config.pb.h"
|
||||
#include "meshtastic/config.pb.h"
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
PB_BIND(Config, Config, AUTO)
|
||||
PB_BIND(meshtastic_Config, meshtastic_Config, AUTO)
|
||||
|
||||
|
||||
PB_BIND(Config_DeviceConfig, Config_DeviceConfig, AUTO)
|
||||
PB_BIND(meshtastic_Config_DeviceConfig, meshtastic_Config_DeviceConfig, AUTO)
|
||||
|
||||
|
||||
PB_BIND(Config_PositionConfig, Config_PositionConfig, AUTO)
|
||||
PB_BIND(meshtastic_Config_PositionConfig, meshtastic_Config_PositionConfig, AUTO)
|
||||
|
||||
|
||||
PB_BIND(Config_PowerConfig, Config_PowerConfig, AUTO)
|
||||
PB_BIND(meshtastic_Config_PowerConfig, meshtastic_Config_PowerConfig, AUTO)
|
||||
|
||||
|
||||
PB_BIND(Config_NetworkConfig, Config_NetworkConfig, AUTO)
|
||||
PB_BIND(meshtastic_Config_NetworkConfig, meshtastic_Config_NetworkConfig, AUTO)
|
||||
|
||||
|
||||
PB_BIND(Config_NetworkConfig_IpV4Config, Config_NetworkConfig_IpV4Config, AUTO)
|
||||
PB_BIND(meshtastic_Config_NetworkConfig_IpV4Config, meshtastic_Config_NetworkConfig_IpV4Config, AUTO)
|
||||
|
||||
|
||||
PB_BIND(Config_DisplayConfig, Config_DisplayConfig, AUTO)
|
||||
PB_BIND(meshtastic_Config_DisplayConfig, meshtastic_Config_DisplayConfig, AUTO)
|
||||
|
||||
|
||||
PB_BIND(Config_LoRaConfig, Config_LoRaConfig, 2)
|
||||
PB_BIND(meshtastic_Config_LoRaConfig, meshtastic_Config_LoRaConfig, 2)
|
||||
|
||||
|
||||
PB_BIND(Config_BluetoothConfig, Config_BluetoothConfig, AUTO)
|
||||
PB_BIND(meshtastic_Config_BluetoothConfig, meshtastic_Config_BluetoothConfig, AUTO)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -11,182 +11,207 @@
|
||||
|
||||
/* Enum definitions */
|
||||
/* Defines the device's role on the Mesh network */
|
||||
typedef enum _Config_DeviceConfig_Role {
|
||||
typedef enum _meshtastic_Config_DeviceConfig_Role {
|
||||
/* Client device role */
|
||||
Config_DeviceConfig_Role_CLIENT = 0,
|
||||
meshtastic_Config_DeviceConfig_Role_CLIENT = 0,
|
||||
/* Client Mute device role
|
||||
Same as a client except packets will not hop over this node, does not contribute to routing packets for mesh. */
|
||||
Config_DeviceConfig_Role_CLIENT_MUTE = 1,
|
||||
meshtastic_Config_DeviceConfig_Role_CLIENT_MUTE = 1,
|
||||
/* Router device role.
|
||||
Mesh packets will prefer to be routed over this node. This node will not be used by client apps.
|
||||
The wifi/ble radios and the oled screen will be put to sleep. */
|
||||
Config_DeviceConfig_Role_ROUTER = 2,
|
||||
The wifi/ble radios and the oled screen will be put to sleep.
|
||||
This mode may still potentially have higher power usage due to it's preference in message rebroadcasting on the mesh. */
|
||||
meshtastic_Config_DeviceConfig_Role_ROUTER = 2,
|
||||
/* Router Client device role
|
||||
Mesh packets will prefer to be routed over this node. The Router Client can be used as both a Router and an app connected Client. */
|
||||
Config_DeviceConfig_Role_ROUTER_CLIENT = 3
|
||||
} Config_DeviceConfig_Role;
|
||||
meshtastic_Config_DeviceConfig_Role_ROUTER_CLIENT = 3,
|
||||
/* Repeater device role
|
||||
Mesh packets will simply be rebroadcasted over this node. Nodes configured with this role will not originate NodeInfo, Position, Telemetry
|
||||
or any other packet type. They will simply rebroadcast any mesh packets on the same frequency, channel num, spread factor, and coding rate. */
|
||||
meshtastic_Config_DeviceConfig_Role_REPEATER = 4,
|
||||
/* Tracker device role
|
||||
Position Mesh packets will be prioritized higher and sent more frequently by default. */
|
||||
meshtastic_Config_DeviceConfig_Role_TRACKER = 5
|
||||
} meshtastic_Config_DeviceConfig_Role;
|
||||
|
||||
/* Defines the device's behavior for how messages are rebroadcast */
|
||||
typedef enum _meshtastic_Config_DeviceConfig_RebroadcastMode {
|
||||
/* Default behavior.
|
||||
Rebroadcast any observed message, if it was on our private channel or from another mesh with the same lora params. */
|
||||
meshtastic_Config_DeviceConfig_RebroadcastMode_ALL = 0,
|
||||
/* Same as behavior as ALL but skips packet decoding and simply rebroadcasts them.
|
||||
Only available in Repeater role. Setting this on any other roles will result in ALL behavior. */
|
||||
meshtastic_Config_DeviceConfig_RebroadcastMode_ALL_SKIP_DECODING = 1,
|
||||
/* Ignores observed messages from foreign meshes that are open or those which it cannot decrypt.
|
||||
Only rebroadcasts message on the nodes local primary / secondary channels. */
|
||||
meshtastic_Config_DeviceConfig_RebroadcastMode_LOCAL_ONLY = 2
|
||||
} meshtastic_Config_DeviceConfig_RebroadcastMode;
|
||||
|
||||
/* 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 _Config_PositionConfig_PositionFlags {
|
||||
typedef enum _meshtastic_Config_PositionConfig_PositionFlags {
|
||||
/* Required for compilation */
|
||||
Config_PositionConfig_PositionFlags_UNSET = 0,
|
||||
meshtastic_Config_PositionConfig_PositionFlags_UNSET = 0,
|
||||
/* Include an altitude value (if available) */
|
||||
Config_PositionConfig_PositionFlags_ALTITUDE = 1,
|
||||
meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE = 1,
|
||||
/* Altitude value is MSL */
|
||||
Config_PositionConfig_PositionFlags_ALTITUDE_MSL = 2,
|
||||
meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE_MSL = 2,
|
||||
/* Include geoidal separation */
|
||||
Config_PositionConfig_PositionFlags_GEOIDAL_SEPARATION = 4,
|
||||
meshtastic_Config_PositionConfig_PositionFlags_GEOIDAL_SEPARATION = 4,
|
||||
/* Include the DOP value ; PDOP used by default, see below */
|
||||
Config_PositionConfig_PositionFlags_DOP = 8,
|
||||
meshtastic_Config_PositionConfig_PositionFlags_DOP = 8,
|
||||
/* If POS_DOP set, send separate HDOP / VDOP values instead of PDOP */
|
||||
Config_PositionConfig_PositionFlags_HVDOP = 16,
|
||||
meshtastic_Config_PositionConfig_PositionFlags_HVDOP = 16,
|
||||
/* Include number of "satellites in view" */
|
||||
Config_PositionConfig_PositionFlags_SATINVIEW = 32,
|
||||
meshtastic_Config_PositionConfig_PositionFlags_SATINVIEW = 32,
|
||||
/* Include a sequence number incremented per packet */
|
||||
Config_PositionConfig_PositionFlags_SEQ_NO = 64,
|
||||
meshtastic_Config_PositionConfig_PositionFlags_SEQ_NO = 64,
|
||||
/* Include positional timestamp (from GPS solution) */
|
||||
Config_PositionConfig_PositionFlags_TIMESTAMP = 128,
|
||||
meshtastic_Config_PositionConfig_PositionFlags_TIMESTAMP = 128,
|
||||
/* Include positional heading
|
||||
Intended for use with vehicle not walking speeds
|
||||
walking speeds are likely to be error prone like the compass */
|
||||
Config_PositionConfig_PositionFlags_HEADING = 256,
|
||||
meshtastic_Config_PositionConfig_PositionFlags_HEADING = 256,
|
||||
/* Include positional speed
|
||||
Intended for use with vehicle not walking speeds
|
||||
walking speeds are likely to be error prone like the compass */
|
||||
Config_PositionConfig_PositionFlags_SPEED = 512
|
||||
} Config_PositionConfig_PositionFlags;
|
||||
meshtastic_Config_PositionConfig_PositionFlags_SPEED = 512
|
||||
} meshtastic_Config_PositionConfig_PositionFlags;
|
||||
|
||||
typedef enum _Config_NetworkConfig_AddressMode {
|
||||
typedef enum _meshtastic_Config_NetworkConfig_AddressMode {
|
||||
/* obtain ip address via DHCP */
|
||||
Config_NetworkConfig_AddressMode_DHCP = 0,
|
||||
meshtastic_Config_NetworkConfig_AddressMode_DHCP = 0,
|
||||
/* use static ip address */
|
||||
Config_NetworkConfig_AddressMode_STATIC = 1
|
||||
} Config_NetworkConfig_AddressMode;
|
||||
meshtastic_Config_NetworkConfig_AddressMode_STATIC = 1
|
||||
} meshtastic_Config_NetworkConfig_AddressMode;
|
||||
|
||||
/* How the GPS coordinates are displayed on the OLED screen. */
|
||||
typedef enum _Config_DisplayConfig_GpsCoordinateFormat {
|
||||
typedef enum _meshtastic_Config_DisplayConfig_GpsCoordinateFormat {
|
||||
/* GPS coordinates are displayed in the normal decimal degrees format:
|
||||
DD.DDDDDD DDD.DDDDDD */
|
||||
Config_DisplayConfig_GpsCoordinateFormat_DEC = 0,
|
||||
meshtastic_Config_DisplayConfig_GpsCoordinateFormat_DEC = 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 */
|
||||
Config_DisplayConfig_GpsCoordinateFormat_DMS = 1,
|
||||
meshtastic_Config_DisplayConfig_GpsCoordinateFormat_DMS = 1,
|
||||
/* Universal Transverse Mercator format:
|
||||
ZZB EEEEEE NNNNNNN, where Z is zone, B is band, E is easting, N is northing */
|
||||
Config_DisplayConfig_GpsCoordinateFormat_UTM = 2,
|
||||
meshtastic_Config_DisplayConfig_GpsCoordinateFormat_UTM = 2,
|
||||
/* 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 */
|
||||
Config_DisplayConfig_GpsCoordinateFormat_MGRS = 3,
|
||||
meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MGRS = 3,
|
||||
/* Open Location Code (aka Plus Codes). */
|
||||
Config_DisplayConfig_GpsCoordinateFormat_OLC = 4,
|
||||
meshtastic_Config_DisplayConfig_GpsCoordinateFormat_OLC = 4,
|
||||
/* 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 */
|
||||
Config_DisplayConfig_GpsCoordinateFormat_OSGR = 5
|
||||
} Config_DisplayConfig_GpsCoordinateFormat;
|
||||
meshtastic_Config_DisplayConfig_GpsCoordinateFormat_OSGR = 5
|
||||
} meshtastic_Config_DisplayConfig_GpsCoordinateFormat;
|
||||
|
||||
/* Unit display preference */
|
||||
typedef enum _Config_DisplayConfig_DisplayUnits {
|
||||
typedef enum _meshtastic_Config_DisplayConfig_DisplayUnits {
|
||||
/* Metric (Default) */
|
||||
Config_DisplayConfig_DisplayUnits_METRIC = 0,
|
||||
meshtastic_Config_DisplayConfig_DisplayUnits_METRIC = 0,
|
||||
/* Imperial */
|
||||
Config_DisplayConfig_DisplayUnits_IMPERIAL = 1
|
||||
} Config_DisplayConfig_DisplayUnits;
|
||||
meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL = 1
|
||||
} meshtastic_Config_DisplayConfig_DisplayUnits;
|
||||
|
||||
/* Override OLED outo detect with this if it fails. */
|
||||
typedef enum _Config_DisplayConfig_OledType {
|
||||
typedef enum _meshtastic_Config_DisplayConfig_OledType {
|
||||
/* Default / Auto */
|
||||
Config_DisplayConfig_OledType_OLED_AUTO = 0,
|
||||
meshtastic_Config_DisplayConfig_OledType_OLED_AUTO = 0,
|
||||
/* Default / Auto */
|
||||
Config_DisplayConfig_OledType_OLED_SSD1306 = 1,
|
||||
meshtastic_Config_DisplayConfig_OledType_OLED_SSD1306 = 1,
|
||||
/* Default / Auto */
|
||||
Config_DisplayConfig_OledType_OLED_SH1106 = 2
|
||||
} Config_DisplayConfig_OledType;
|
||||
meshtastic_Config_DisplayConfig_OledType_OLED_SH1106 = 2,
|
||||
/* Can not be auto detected but set by proto. Used for 128x128 screens */
|
||||
meshtastic_Config_DisplayConfig_OledType_OLED_SH1107 = 3
|
||||
} meshtastic_Config_DisplayConfig_OledType;
|
||||
|
||||
typedef enum _Config_DisplayConfig_DisplayMode {
|
||||
typedef enum _meshtastic_Config_DisplayConfig_DisplayMode {
|
||||
/* Default. The old style for the 128x64 OLED screen */
|
||||
Config_DisplayConfig_DisplayMode_DEFAULT = 0,
|
||||
meshtastic_Config_DisplayConfig_DisplayMode_DEFAULT = 0,
|
||||
/* Rearrange display elements to cater for bicolor OLED displays */
|
||||
Config_DisplayConfig_DisplayMode_TWOCOLOR = 1,
|
||||
meshtastic_Config_DisplayConfig_DisplayMode_TWOCOLOR = 1,
|
||||
/* Same as TwoColor, but with inverted top bar. Not so good for Epaper displays */
|
||||
Config_DisplayConfig_DisplayMode_INVERTED = 2,
|
||||
meshtastic_Config_DisplayConfig_DisplayMode_INVERTED = 2,
|
||||
/* TFT Full Color Displays (not implemented yet) */
|
||||
Config_DisplayConfig_DisplayMode_COLOR = 3
|
||||
} Config_DisplayConfig_DisplayMode;
|
||||
meshtastic_Config_DisplayConfig_DisplayMode_COLOR = 3
|
||||
} meshtastic_Config_DisplayConfig_DisplayMode;
|
||||
|
||||
typedef enum _Config_LoRaConfig_RegionCode {
|
||||
typedef enum _meshtastic_Config_LoRaConfig_RegionCode {
|
||||
/* Region is not set */
|
||||
Config_LoRaConfig_RegionCode_UNSET = 0,
|
||||
meshtastic_Config_LoRaConfig_RegionCode_UNSET = 0,
|
||||
/* United States */
|
||||
Config_LoRaConfig_RegionCode_US = 1,
|
||||
meshtastic_Config_LoRaConfig_RegionCode_US = 1,
|
||||
/* European Union 433mhz */
|
||||
Config_LoRaConfig_RegionCode_EU_433 = 2,
|
||||
meshtastic_Config_LoRaConfig_RegionCode_EU_433 = 2,
|
||||
/* European Union 433mhz */
|
||||
Config_LoRaConfig_RegionCode_EU_868 = 3,
|
||||
meshtastic_Config_LoRaConfig_RegionCode_EU_868 = 3,
|
||||
/* China */
|
||||
Config_LoRaConfig_RegionCode_CN = 4,
|
||||
meshtastic_Config_LoRaConfig_RegionCode_CN = 4,
|
||||
/* Japan */
|
||||
Config_LoRaConfig_RegionCode_JP = 5,
|
||||
meshtastic_Config_LoRaConfig_RegionCode_JP = 5,
|
||||
/* Australia / New Zealand */
|
||||
Config_LoRaConfig_RegionCode_ANZ = 6,
|
||||
meshtastic_Config_LoRaConfig_RegionCode_ANZ = 6,
|
||||
/* Korea */
|
||||
Config_LoRaConfig_RegionCode_KR = 7,
|
||||
meshtastic_Config_LoRaConfig_RegionCode_KR = 7,
|
||||
/* Taiwan */
|
||||
Config_LoRaConfig_RegionCode_TW = 8,
|
||||
meshtastic_Config_LoRaConfig_RegionCode_TW = 8,
|
||||
/* Russia */
|
||||
Config_LoRaConfig_RegionCode_RU = 9,
|
||||
meshtastic_Config_LoRaConfig_RegionCode_RU = 9,
|
||||
/* India */
|
||||
Config_LoRaConfig_RegionCode_IN = 10,
|
||||
meshtastic_Config_LoRaConfig_RegionCode_IN = 10,
|
||||
/* New Zealand 865mhz */
|
||||
Config_LoRaConfig_RegionCode_NZ_865 = 11,
|
||||
meshtastic_Config_LoRaConfig_RegionCode_NZ_865 = 11,
|
||||
/* Thailand */
|
||||
Config_LoRaConfig_RegionCode_TH = 12,
|
||||
meshtastic_Config_LoRaConfig_RegionCode_TH = 12,
|
||||
/* WLAN Band */
|
||||
Config_LoRaConfig_RegionCode_LORA_24 = 13,
|
||||
meshtastic_Config_LoRaConfig_RegionCode_LORA_24 = 13,
|
||||
/* Ukraine 433mhz */
|
||||
Config_LoRaConfig_RegionCode_UA_433 = 14,
|
||||
meshtastic_Config_LoRaConfig_RegionCode_UA_433 = 14,
|
||||
/* Ukraine 868mhz */
|
||||
Config_LoRaConfig_RegionCode_UA_868 = 15
|
||||
} Config_LoRaConfig_RegionCode;
|
||||
meshtastic_Config_LoRaConfig_RegionCode_UA_868 = 15
|
||||
} meshtastic_Config_LoRaConfig_RegionCode;
|
||||
|
||||
/* Standard predefined channel settings
|
||||
Note: these mappings must match ModemPreset Choice in the device code. */
|
||||
typedef enum _Config_LoRaConfig_ModemPreset {
|
||||
typedef enum _meshtastic_Config_LoRaConfig_ModemPreset {
|
||||
/* Long Range - Fast */
|
||||
Config_LoRaConfig_ModemPreset_LONG_FAST = 0,
|
||||
meshtastic_Config_LoRaConfig_ModemPreset_LONG_FAST = 0,
|
||||
/* Long Range - Slow */
|
||||
Config_LoRaConfig_ModemPreset_LONG_SLOW = 1,
|
||||
meshtastic_Config_LoRaConfig_ModemPreset_LONG_SLOW = 1,
|
||||
/* Very Long Range - Slow */
|
||||
Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW = 2,
|
||||
meshtastic_Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW = 2,
|
||||
/* Medium Range - Slow */
|
||||
Config_LoRaConfig_ModemPreset_MEDIUM_SLOW = 3,
|
||||
meshtastic_Config_LoRaConfig_ModemPreset_MEDIUM_SLOW = 3,
|
||||
/* Medium Range - Fast */
|
||||
Config_LoRaConfig_ModemPreset_MEDIUM_FAST = 4,
|
||||
meshtastic_Config_LoRaConfig_ModemPreset_MEDIUM_FAST = 4,
|
||||
/* Short Range - Slow */
|
||||
Config_LoRaConfig_ModemPreset_SHORT_SLOW = 5,
|
||||
meshtastic_Config_LoRaConfig_ModemPreset_SHORT_SLOW = 5,
|
||||
/* Short Range - Fast */
|
||||
Config_LoRaConfig_ModemPreset_SHORT_FAST = 6
|
||||
} Config_LoRaConfig_ModemPreset;
|
||||
meshtastic_Config_LoRaConfig_ModemPreset_SHORT_FAST = 6,
|
||||
/* Long Range - Moderately Fast */
|
||||
meshtastic_Config_LoRaConfig_ModemPreset_LONG_MODERATE = 7
|
||||
} meshtastic_Config_LoRaConfig_ModemPreset;
|
||||
|
||||
typedef enum _Config_BluetoothConfig_PairingMode {
|
||||
typedef enum _meshtastic_Config_BluetoothConfig_PairingMode {
|
||||
/* Device generates a random pin that will be shown on the screen of the device for pairing */
|
||||
Config_BluetoothConfig_PairingMode_RANDOM_PIN = 0,
|
||||
meshtastic_Config_BluetoothConfig_PairingMode_RANDOM_PIN = 0,
|
||||
/* Device requires a specified fixed pin for pairing */
|
||||
Config_BluetoothConfig_PairingMode_FIXED_PIN = 1,
|
||||
meshtastic_Config_BluetoothConfig_PairingMode_FIXED_PIN = 1,
|
||||
/* Device requires no pin for pairing */
|
||||
Config_BluetoothConfig_PairingMode_NO_PIN = 2
|
||||
} Config_BluetoothConfig_PairingMode;
|
||||
meshtastic_Config_BluetoothConfig_PairingMode_NO_PIN = 2
|
||||
} meshtastic_Config_BluetoothConfig_PairingMode;
|
||||
|
||||
/* Struct definitions */
|
||||
/* Configuration */
|
||||
typedef struct _Config_DeviceConfig {
|
||||
typedef struct _meshtastic_Config_DeviceConfig {
|
||||
/* Sets the role of node */
|
||||
Config_DeviceConfig_Role role;
|
||||
meshtastic_Config_DeviceConfig_Role role;
|
||||
/* Disabling this will disable the SerialConsole by not initilizing the StreamAPI */
|
||||
bool serial_enabled;
|
||||
/* By default we turn off logging as soon as an API client connects (to keep shared serial link quiet).
|
||||
@@ -198,10 +223,12 @@ typedef struct _Config_DeviceConfig {
|
||||
/* For boards without a PWM buzzer, this is the pin number that will be used
|
||||
Defaults to PIN_BUZZER if defined. */
|
||||
uint32_t buzzer_gpio;
|
||||
} Config_DeviceConfig;
|
||||
/* Sets the role of node */
|
||||
meshtastic_Config_DeviceConfig_RebroadcastMode rebroadcast_mode;
|
||||
} meshtastic_Config_DeviceConfig;
|
||||
|
||||
/* Position Config */
|
||||
typedef struct _Config_PositionConfig {
|
||||
typedef struct _meshtastic_Config_PositionConfig {
|
||||
/* We should send our position this often (but only if it has changed significantly)
|
||||
Defaults to 15 minutes */
|
||||
uint32_t position_broadcast_secs;
|
||||
@@ -229,11 +256,11 @@ typedef struct _Config_PositionConfig {
|
||||
uint32_t rx_gpio;
|
||||
/* (Re)define GPS_TX_PIN for your board. */
|
||||
uint32_t tx_gpio;
|
||||
} Config_PositionConfig;
|
||||
} meshtastic_Config_PositionConfig;
|
||||
|
||||
/* Power Config\
|
||||
See [Power Config](/docs/settings/config/power) for additional power config details. */
|
||||
typedef struct _Config_PowerConfig {
|
||||
typedef struct _meshtastic_Config_PowerConfig {
|
||||
/* 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'VE set is_router (it is implied in that case).
|
||||
@@ -269,9 +296,9 @@ typedef struct _Config_PowerConfig {
|
||||
While in light sleep when we receive packets on the LoRa radio we will wake and handle them and stay awake in no BLE mode for this value
|
||||
0 for default of 10 seconds */
|
||||
uint32_t min_wake_secs;
|
||||
} Config_PowerConfig;
|
||||
} meshtastic_Config_PowerConfig;
|
||||
|
||||
typedef struct _Config_NetworkConfig_IpV4Config {
|
||||
typedef struct _meshtastic_Config_NetworkConfig_IpV4Config {
|
||||
/* Static IP address */
|
||||
uint32_t ip;
|
||||
/* Static gateway address */
|
||||
@@ -280,10 +307,10 @@ typedef struct _Config_NetworkConfig_IpV4Config {
|
||||
uint32_t subnet;
|
||||
/* Static DNS server address */
|
||||
uint32_t dns;
|
||||
} Config_NetworkConfig_IpV4Config;
|
||||
} meshtastic_Config_NetworkConfig_IpV4Config;
|
||||
|
||||
/* Network Config */
|
||||
typedef struct _Config_NetworkConfig {
|
||||
typedef struct _meshtastic_Config_NetworkConfig {
|
||||
/* Enable WiFi (disables Bluetooth) */
|
||||
bool wifi_enabled;
|
||||
/* If set, this node will try to join the specified wifi network and
|
||||
@@ -296,21 +323,21 @@ typedef struct _Config_NetworkConfig {
|
||||
/* Enable Ethernet */
|
||||
bool eth_enabled;
|
||||
/* acquire an address via DHCP or assign static */
|
||||
Config_NetworkConfig_AddressMode address_mode;
|
||||
meshtastic_Config_NetworkConfig_AddressMode address_mode;
|
||||
/* struct to keep static address */
|
||||
bool has_ipv4_config;
|
||||
Config_NetworkConfig_IpV4Config ipv4_config;
|
||||
meshtastic_Config_NetworkConfig_IpV4Config ipv4_config;
|
||||
/* rsyslog Server and Port */
|
||||
char rsyslog_server[33];
|
||||
} Config_NetworkConfig;
|
||||
} meshtastic_Config_NetworkConfig;
|
||||
|
||||
/* Display Config */
|
||||
typedef struct _Config_DisplayConfig {
|
||||
typedef struct _meshtastic_Config_DisplayConfig {
|
||||
/* Number of seconds the screen stays on after pressing the user button or receiving a message
|
||||
0 for default of one minute MAXUINT for always on */
|
||||
uint32_t screen_on_secs;
|
||||
/* How the GPS coordinates are formatted on the OLED screen. */
|
||||
Config_DisplayConfig_GpsCoordinateFormat gps_format;
|
||||
meshtastic_Config_DisplayConfig_GpsCoordinateFormat gps_format;
|
||||
/* Automatically toggles to the next page on the screen like a carousel, based the specified interval in seconds.
|
||||
Potentially useful for devices without user buttons. */
|
||||
uint32_t auto_screen_carousel_secs;
|
||||
@@ -320,17 +347,17 @@ typedef struct _Config_DisplayConfig {
|
||||
/* Flip screen vertically, for cases that mount the screen upside down */
|
||||
bool flip_screen;
|
||||
/* Perferred display units */
|
||||
Config_DisplayConfig_DisplayUnits units;
|
||||
meshtastic_Config_DisplayConfig_DisplayUnits units;
|
||||
/* Override auto-detect in screen */
|
||||
Config_DisplayConfig_OledType oled;
|
||||
meshtastic_Config_DisplayConfig_OledType oled;
|
||||
/* Display Mode */
|
||||
Config_DisplayConfig_DisplayMode displaymode;
|
||||
meshtastic_Config_DisplayConfig_DisplayMode displaymode;
|
||||
/* Print first line in pseudo-bold? FALSE is original style, TRUE is bold */
|
||||
bool heading_bold;
|
||||
} Config_DisplayConfig;
|
||||
} meshtastic_Config_DisplayConfig;
|
||||
|
||||
/* Lora Config */
|
||||
typedef struct _Config_LoRaConfig {
|
||||
typedef struct _meshtastic_Config_LoRaConfig {
|
||||
/* When enabled, the `modem_preset` fields will be adheared to, else the `bandwidth`/`spread_factor`/`coding_rate`
|
||||
will be taked from their respective manually defined fields */
|
||||
bool use_preset;
|
||||
@@ -339,7 +366,7 @@ typedef struct _Config_LoRaConfig {
|
||||
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. */
|
||||
Config_LoRaConfig_ModemPreset modem_preset;
|
||||
meshtastic_Config_LoRaConfig_ModemPreset modem_preset;
|
||||
/* Bandwidth in MHz
|
||||
Certain bandwidth numbers are 'special' and will be converted to the
|
||||
appropriate floating point value: 31 -> 31.25MHz */
|
||||
@@ -355,7 +382,7 @@ typedef struct _Config_LoRaConfig {
|
||||
Used to correct for crystal calibration errors. */
|
||||
float frequency_offset;
|
||||
/* The region code for the radio (US, CN, EU433, etc...) */
|
||||
Config_LoRaConfig_RegionCode region;
|
||||
meshtastic_Config_LoRaConfig_RegionCode region;
|
||||
/* Maximum number of hops. This can't be greater than 7.
|
||||
Default of 3 */
|
||||
uint32_t hop_limit;
|
||||
@@ -379,34 +406,42 @@ typedef struct _Config_LoRaConfig {
|
||||
the local regulations if you're not a HAM.
|
||||
Has no effect if the duty cycle of the used region is 100%. */
|
||||
bool override_duty_cycle;
|
||||
/* If true, sets RX boosted gain mode on SX126X based radios */
|
||||
bool sx126x_rx_boosted_gain;
|
||||
/* This parameter is for advanced users and licensed HAM radio operators.
|
||||
Ignore Channel Calculation and use this frequency instead. The frequency_offset
|
||||
will still be applied. This will allow you to use out-of-band frequencies.
|
||||
Please respect your local laws and regulations. If you are a HAM, make sure you
|
||||
enable HAM mode and turn off encryption. */
|
||||
float override_frequency;
|
||||
/* 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) */
|
||||
pb_size_t ignore_incoming_count;
|
||||
uint32_t ignore_incoming[3];
|
||||
} Config_LoRaConfig;
|
||||
} meshtastic_Config_LoRaConfig;
|
||||
|
||||
typedef struct _Config_BluetoothConfig {
|
||||
typedef struct _meshtastic_Config_BluetoothConfig {
|
||||
/* Enable Bluetooth on the device */
|
||||
bool enabled;
|
||||
/* Determines the pairing strategy for the device */
|
||||
Config_BluetoothConfig_PairingMode mode;
|
||||
meshtastic_Config_BluetoothConfig_PairingMode mode;
|
||||
/* Specified pin for PairingMode.FixedPin */
|
||||
uint32_t fixed_pin;
|
||||
} Config_BluetoothConfig;
|
||||
} meshtastic_Config_BluetoothConfig;
|
||||
|
||||
typedef struct _Config {
|
||||
typedef struct _meshtastic_Config {
|
||||
pb_size_t which_payload_variant;
|
||||
union {
|
||||
Config_DeviceConfig device;
|
||||
Config_PositionConfig position;
|
||||
Config_PowerConfig power;
|
||||
Config_NetworkConfig network;
|
||||
Config_DisplayConfig display;
|
||||
Config_LoRaConfig lora;
|
||||
Config_BluetoothConfig bluetooth;
|
||||
meshtastic_Config_DeviceConfig device;
|
||||
meshtastic_Config_PositionConfig position;
|
||||
meshtastic_Config_PowerConfig power;
|
||||
meshtastic_Config_NetworkConfig network;
|
||||
meshtastic_Config_DisplayConfig display;
|
||||
meshtastic_Config_LoRaConfig lora;
|
||||
meshtastic_Config_BluetoothConfig bluetooth;
|
||||
} payload_variant;
|
||||
} Config;
|
||||
} meshtastic_Config;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -414,155 +449,163 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Helper constants for enums */
|
||||
#define _Config_DeviceConfig_Role_MIN Config_DeviceConfig_Role_CLIENT
|
||||
#define _Config_DeviceConfig_Role_MAX Config_DeviceConfig_Role_ROUTER_CLIENT
|
||||
#define _Config_DeviceConfig_Role_ARRAYSIZE ((Config_DeviceConfig_Role)(Config_DeviceConfig_Role_ROUTER_CLIENT+1))
|
||||
#define _meshtastic_Config_DeviceConfig_Role_MIN meshtastic_Config_DeviceConfig_Role_CLIENT
|
||||
#define _meshtastic_Config_DeviceConfig_Role_MAX meshtastic_Config_DeviceConfig_Role_TRACKER
|
||||
#define _meshtastic_Config_DeviceConfig_Role_ARRAYSIZE ((meshtastic_Config_DeviceConfig_Role)(meshtastic_Config_DeviceConfig_Role_TRACKER+1))
|
||||
|
||||
#define _Config_PositionConfig_PositionFlags_MIN Config_PositionConfig_PositionFlags_UNSET
|
||||
#define _Config_PositionConfig_PositionFlags_MAX Config_PositionConfig_PositionFlags_SPEED
|
||||
#define _Config_PositionConfig_PositionFlags_ARRAYSIZE ((Config_PositionConfig_PositionFlags)(Config_PositionConfig_PositionFlags_SPEED+1))
|
||||
#define _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN meshtastic_Config_DeviceConfig_RebroadcastMode_ALL
|
||||
#define _meshtastic_Config_DeviceConfig_RebroadcastMode_MAX meshtastic_Config_DeviceConfig_RebroadcastMode_LOCAL_ONLY
|
||||
#define _meshtastic_Config_DeviceConfig_RebroadcastMode_ARRAYSIZE ((meshtastic_Config_DeviceConfig_RebroadcastMode)(meshtastic_Config_DeviceConfig_RebroadcastMode_LOCAL_ONLY+1))
|
||||
|
||||
#define _Config_NetworkConfig_AddressMode_MIN Config_NetworkConfig_AddressMode_DHCP
|
||||
#define _Config_NetworkConfig_AddressMode_MAX Config_NetworkConfig_AddressMode_STATIC
|
||||
#define _Config_NetworkConfig_AddressMode_ARRAYSIZE ((Config_NetworkConfig_AddressMode)(Config_NetworkConfig_AddressMode_STATIC+1))
|
||||
#define _meshtastic_Config_PositionConfig_PositionFlags_MIN meshtastic_Config_PositionConfig_PositionFlags_UNSET
|
||||
#define _meshtastic_Config_PositionConfig_PositionFlags_MAX meshtastic_Config_PositionConfig_PositionFlags_SPEED
|
||||
#define _meshtastic_Config_PositionConfig_PositionFlags_ARRAYSIZE ((meshtastic_Config_PositionConfig_PositionFlags)(meshtastic_Config_PositionConfig_PositionFlags_SPEED+1))
|
||||
|
||||
#define _Config_DisplayConfig_GpsCoordinateFormat_MIN Config_DisplayConfig_GpsCoordinateFormat_DEC
|
||||
#define _Config_DisplayConfig_GpsCoordinateFormat_MAX Config_DisplayConfig_GpsCoordinateFormat_OSGR
|
||||
#define _Config_DisplayConfig_GpsCoordinateFormat_ARRAYSIZE ((Config_DisplayConfig_GpsCoordinateFormat)(Config_DisplayConfig_GpsCoordinateFormat_OSGR+1))
|
||||
#define _meshtastic_Config_NetworkConfig_AddressMode_MIN meshtastic_Config_NetworkConfig_AddressMode_DHCP
|
||||
#define _meshtastic_Config_NetworkConfig_AddressMode_MAX meshtastic_Config_NetworkConfig_AddressMode_STATIC
|
||||
#define _meshtastic_Config_NetworkConfig_AddressMode_ARRAYSIZE ((meshtastic_Config_NetworkConfig_AddressMode)(meshtastic_Config_NetworkConfig_AddressMode_STATIC+1))
|
||||
|
||||
#define _Config_DisplayConfig_DisplayUnits_MIN Config_DisplayConfig_DisplayUnits_METRIC
|
||||
#define _Config_DisplayConfig_DisplayUnits_MAX Config_DisplayConfig_DisplayUnits_IMPERIAL
|
||||
#define _Config_DisplayConfig_DisplayUnits_ARRAYSIZE ((Config_DisplayConfig_DisplayUnits)(Config_DisplayConfig_DisplayUnits_IMPERIAL+1))
|
||||
#define _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN meshtastic_Config_DisplayConfig_GpsCoordinateFormat_DEC
|
||||
#define _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MAX meshtastic_Config_DisplayConfig_GpsCoordinateFormat_OSGR
|
||||
#define _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_ARRAYSIZE ((meshtastic_Config_DisplayConfig_GpsCoordinateFormat)(meshtastic_Config_DisplayConfig_GpsCoordinateFormat_OSGR+1))
|
||||
|
||||
#define _Config_DisplayConfig_OledType_MIN Config_DisplayConfig_OledType_OLED_AUTO
|
||||
#define _Config_DisplayConfig_OledType_MAX Config_DisplayConfig_OledType_OLED_SH1106
|
||||
#define _Config_DisplayConfig_OledType_ARRAYSIZE ((Config_DisplayConfig_OledType)(Config_DisplayConfig_OledType_OLED_SH1106+1))
|
||||
#define _meshtastic_Config_DisplayConfig_DisplayUnits_MIN meshtastic_Config_DisplayConfig_DisplayUnits_METRIC
|
||||
#define _meshtastic_Config_DisplayConfig_DisplayUnits_MAX meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL
|
||||
#define _meshtastic_Config_DisplayConfig_DisplayUnits_ARRAYSIZE ((meshtastic_Config_DisplayConfig_DisplayUnits)(meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL+1))
|
||||
|
||||
#define _Config_DisplayConfig_DisplayMode_MIN Config_DisplayConfig_DisplayMode_DEFAULT
|
||||
#define _Config_DisplayConfig_DisplayMode_MAX Config_DisplayConfig_DisplayMode_COLOR
|
||||
#define _Config_DisplayConfig_DisplayMode_ARRAYSIZE ((Config_DisplayConfig_DisplayMode)(Config_DisplayConfig_DisplayMode_COLOR+1))
|
||||
#define _meshtastic_Config_DisplayConfig_OledType_MIN meshtastic_Config_DisplayConfig_OledType_OLED_AUTO
|
||||
#define _meshtastic_Config_DisplayConfig_OledType_MAX meshtastic_Config_DisplayConfig_OledType_OLED_SH1107
|
||||
#define _meshtastic_Config_DisplayConfig_OledType_ARRAYSIZE ((meshtastic_Config_DisplayConfig_OledType)(meshtastic_Config_DisplayConfig_OledType_OLED_SH1107+1))
|
||||
|
||||
#define _Config_LoRaConfig_RegionCode_MIN Config_LoRaConfig_RegionCode_UNSET
|
||||
#define _Config_LoRaConfig_RegionCode_MAX Config_LoRaConfig_RegionCode_UA_868
|
||||
#define _Config_LoRaConfig_RegionCode_ARRAYSIZE ((Config_LoRaConfig_RegionCode)(Config_LoRaConfig_RegionCode_UA_868+1))
|
||||
#define _meshtastic_Config_DisplayConfig_DisplayMode_MIN meshtastic_Config_DisplayConfig_DisplayMode_DEFAULT
|
||||
#define _meshtastic_Config_DisplayConfig_DisplayMode_MAX meshtastic_Config_DisplayConfig_DisplayMode_COLOR
|
||||
#define _meshtastic_Config_DisplayConfig_DisplayMode_ARRAYSIZE ((meshtastic_Config_DisplayConfig_DisplayMode)(meshtastic_Config_DisplayConfig_DisplayMode_COLOR+1))
|
||||
|
||||
#define _Config_LoRaConfig_ModemPreset_MIN Config_LoRaConfig_ModemPreset_LONG_FAST
|
||||
#define _Config_LoRaConfig_ModemPreset_MAX Config_LoRaConfig_ModemPreset_SHORT_FAST
|
||||
#define _Config_LoRaConfig_ModemPreset_ARRAYSIZE ((Config_LoRaConfig_ModemPreset)(Config_LoRaConfig_ModemPreset_SHORT_FAST+1))
|
||||
#define _meshtastic_Config_LoRaConfig_RegionCode_MIN meshtastic_Config_LoRaConfig_RegionCode_UNSET
|
||||
#define _meshtastic_Config_LoRaConfig_RegionCode_MAX meshtastic_Config_LoRaConfig_RegionCode_UA_868
|
||||
#define _meshtastic_Config_LoRaConfig_RegionCode_ARRAYSIZE ((meshtastic_Config_LoRaConfig_RegionCode)(meshtastic_Config_LoRaConfig_RegionCode_UA_868+1))
|
||||
|
||||
#define _Config_BluetoothConfig_PairingMode_MIN Config_BluetoothConfig_PairingMode_RANDOM_PIN
|
||||
#define _Config_BluetoothConfig_PairingMode_MAX Config_BluetoothConfig_PairingMode_NO_PIN
|
||||
#define _Config_BluetoothConfig_PairingMode_ARRAYSIZE ((Config_BluetoothConfig_PairingMode)(Config_BluetoothConfig_PairingMode_NO_PIN+1))
|
||||
#define _meshtastic_Config_LoRaConfig_ModemPreset_MIN meshtastic_Config_LoRaConfig_ModemPreset_LONG_FAST
|
||||
#define _meshtastic_Config_LoRaConfig_ModemPreset_MAX meshtastic_Config_LoRaConfig_ModemPreset_LONG_MODERATE
|
||||
#define _meshtastic_Config_LoRaConfig_ModemPreset_ARRAYSIZE ((meshtastic_Config_LoRaConfig_ModemPreset)(meshtastic_Config_LoRaConfig_ModemPreset_LONG_MODERATE+1))
|
||||
|
||||
#define _meshtastic_Config_BluetoothConfig_PairingMode_MIN meshtastic_Config_BluetoothConfig_PairingMode_RANDOM_PIN
|
||||
#define _meshtastic_Config_BluetoothConfig_PairingMode_MAX meshtastic_Config_BluetoothConfig_PairingMode_NO_PIN
|
||||
#define _meshtastic_Config_BluetoothConfig_PairingMode_ARRAYSIZE ((meshtastic_Config_BluetoothConfig_PairingMode)(meshtastic_Config_BluetoothConfig_PairingMode_NO_PIN+1))
|
||||
|
||||
|
||||
#define Config_DeviceConfig_role_ENUMTYPE Config_DeviceConfig_Role
|
||||
#define meshtastic_Config_DeviceConfig_role_ENUMTYPE meshtastic_Config_DeviceConfig_Role
|
||||
#define meshtastic_Config_DeviceConfig_rebroadcast_mode_ENUMTYPE meshtastic_Config_DeviceConfig_RebroadcastMode
|
||||
|
||||
|
||||
|
||||
#define Config_NetworkConfig_address_mode_ENUMTYPE Config_NetworkConfig_AddressMode
|
||||
#define meshtastic_Config_NetworkConfig_address_mode_ENUMTYPE meshtastic_Config_NetworkConfig_AddressMode
|
||||
|
||||
|
||||
#define Config_DisplayConfig_gps_format_ENUMTYPE Config_DisplayConfig_GpsCoordinateFormat
|
||||
#define Config_DisplayConfig_units_ENUMTYPE Config_DisplayConfig_DisplayUnits
|
||||
#define Config_DisplayConfig_oled_ENUMTYPE Config_DisplayConfig_OledType
|
||||
#define Config_DisplayConfig_displaymode_ENUMTYPE Config_DisplayConfig_DisplayMode
|
||||
#define meshtastic_Config_DisplayConfig_gps_format_ENUMTYPE meshtastic_Config_DisplayConfig_GpsCoordinateFormat
|
||||
#define meshtastic_Config_DisplayConfig_units_ENUMTYPE meshtastic_Config_DisplayConfig_DisplayUnits
|
||||
#define meshtastic_Config_DisplayConfig_oled_ENUMTYPE meshtastic_Config_DisplayConfig_OledType
|
||||
#define meshtastic_Config_DisplayConfig_displaymode_ENUMTYPE meshtastic_Config_DisplayConfig_DisplayMode
|
||||
|
||||
#define Config_LoRaConfig_modem_preset_ENUMTYPE Config_LoRaConfig_ModemPreset
|
||||
#define Config_LoRaConfig_region_ENUMTYPE Config_LoRaConfig_RegionCode
|
||||
#define meshtastic_Config_LoRaConfig_modem_preset_ENUMTYPE meshtastic_Config_LoRaConfig_ModemPreset
|
||||
#define meshtastic_Config_LoRaConfig_region_ENUMTYPE meshtastic_Config_LoRaConfig_RegionCode
|
||||
|
||||
#define Config_BluetoothConfig_mode_ENUMTYPE Config_BluetoothConfig_PairingMode
|
||||
#define meshtastic_Config_BluetoothConfig_mode_ENUMTYPE meshtastic_Config_BluetoothConfig_PairingMode
|
||||
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define Config_init_default {0, {Config_DeviceConfig_init_default}}
|
||||
#define Config_DeviceConfig_init_default {_Config_DeviceConfig_Role_MIN, 0, 0, 0, 0}
|
||||
#define Config_PositionConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
#define Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0}
|
||||
#define Config_NetworkConfig_init_default {0, "", "", "", 0, _Config_NetworkConfig_AddressMode_MIN, false, Config_NetworkConfig_IpV4Config_init_default, ""}
|
||||
#define Config_NetworkConfig_IpV4Config_init_default {0, 0, 0, 0}
|
||||
#define Config_DisplayConfig_init_default {0, _Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _Config_DisplayConfig_DisplayUnits_MIN, _Config_DisplayConfig_OledType_MIN, _Config_DisplayConfig_DisplayMode_MIN, 0}
|
||||
#define Config_LoRaConfig_init_default {0, _Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, {0, 0, 0}}
|
||||
#define Config_BluetoothConfig_init_default {0, _Config_BluetoothConfig_PairingMode_MIN, 0}
|
||||
#define Config_init_zero {0, {Config_DeviceConfig_init_zero}}
|
||||
#define Config_DeviceConfig_init_zero {_Config_DeviceConfig_Role_MIN, 0, 0, 0, 0}
|
||||
#define Config_PositionConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
#define Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0}
|
||||
#define Config_NetworkConfig_init_zero {0, "", "", "", 0, _Config_NetworkConfig_AddressMode_MIN, false, Config_NetworkConfig_IpV4Config_init_zero, ""}
|
||||
#define Config_NetworkConfig_IpV4Config_init_zero {0, 0, 0, 0}
|
||||
#define Config_DisplayConfig_init_zero {0, _Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _Config_DisplayConfig_DisplayUnits_MIN, _Config_DisplayConfig_OledType_MIN, _Config_DisplayConfig_DisplayMode_MIN, 0}
|
||||
#define Config_LoRaConfig_init_zero {0, _Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, {0, 0, 0}}
|
||||
#define Config_BluetoothConfig_init_zero {0, _Config_BluetoothConfig_PairingMode_MIN, 0}
|
||||
#define meshtastic_Config_init_default {0, {meshtastic_Config_DeviceConfig_init_default}}
|
||||
#define meshtastic_Config_DeviceConfig_init_default {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN}
|
||||
#define meshtastic_Config_PositionConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
#define meshtastic_Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0}
|
||||
#define meshtastic_Config_NetworkConfig_init_default {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_default, ""}
|
||||
#define meshtastic_Config_NetworkConfig_IpV4Config_init_default {0, 0, 0, 0}
|
||||
#define meshtastic_Config_DisplayConfig_init_default {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0}
|
||||
#define meshtastic_Config_LoRaConfig_init_default {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}}
|
||||
#define meshtastic_Config_BluetoothConfig_init_default {0, _meshtastic_Config_BluetoothConfig_PairingMode_MIN, 0}
|
||||
#define meshtastic_Config_init_zero {0, {meshtastic_Config_DeviceConfig_init_zero}}
|
||||
#define meshtastic_Config_DeviceConfig_init_zero {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN}
|
||||
#define meshtastic_Config_PositionConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
#define meshtastic_Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0}
|
||||
#define meshtastic_Config_NetworkConfig_init_zero {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_zero, ""}
|
||||
#define meshtastic_Config_NetworkConfig_IpV4Config_init_zero {0, 0, 0, 0}
|
||||
#define meshtastic_Config_DisplayConfig_init_zero {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0}
|
||||
#define meshtastic_Config_LoRaConfig_init_zero {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}}
|
||||
#define meshtastic_Config_BluetoothConfig_init_zero {0, _meshtastic_Config_BluetoothConfig_PairingMode_MIN, 0}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define Config_DeviceConfig_role_tag 1
|
||||
#define Config_DeviceConfig_serial_enabled_tag 2
|
||||
#define Config_DeviceConfig_debug_log_enabled_tag 3
|
||||
#define Config_DeviceConfig_button_gpio_tag 4
|
||||
#define Config_DeviceConfig_buzzer_gpio_tag 5
|
||||
#define Config_PositionConfig_position_broadcast_secs_tag 1
|
||||
#define Config_PositionConfig_position_broadcast_smart_enabled_tag 2
|
||||
#define Config_PositionConfig_fixed_position_tag 3
|
||||
#define Config_PositionConfig_gps_enabled_tag 4
|
||||
#define Config_PositionConfig_gps_update_interval_tag 5
|
||||
#define Config_PositionConfig_gps_attempt_time_tag 6
|
||||
#define Config_PositionConfig_position_flags_tag 7
|
||||
#define Config_PositionConfig_rx_gpio_tag 8
|
||||
#define Config_PositionConfig_tx_gpio_tag 9
|
||||
#define Config_PowerConfig_is_power_saving_tag 1
|
||||
#define Config_PowerConfig_on_battery_shutdown_after_secs_tag 2
|
||||
#define Config_PowerConfig_adc_multiplier_override_tag 3
|
||||
#define Config_PowerConfig_wait_bluetooth_secs_tag 4
|
||||
#define Config_PowerConfig_mesh_sds_timeout_secs_tag 5
|
||||
#define Config_PowerConfig_sds_secs_tag 6
|
||||
#define Config_PowerConfig_ls_secs_tag 7
|
||||
#define Config_PowerConfig_min_wake_secs_tag 8
|
||||
#define Config_NetworkConfig_IpV4Config_ip_tag 1
|
||||
#define Config_NetworkConfig_IpV4Config_gateway_tag 2
|
||||
#define Config_NetworkConfig_IpV4Config_subnet_tag 3
|
||||
#define Config_NetworkConfig_IpV4Config_dns_tag 4
|
||||
#define Config_NetworkConfig_wifi_enabled_tag 1
|
||||
#define Config_NetworkConfig_wifi_ssid_tag 3
|
||||
#define Config_NetworkConfig_wifi_psk_tag 4
|
||||
#define Config_NetworkConfig_ntp_server_tag 5
|
||||
#define Config_NetworkConfig_eth_enabled_tag 6
|
||||
#define Config_NetworkConfig_address_mode_tag 7
|
||||
#define Config_NetworkConfig_ipv4_config_tag 8
|
||||
#define Config_NetworkConfig_rsyslog_server_tag 9
|
||||
#define Config_DisplayConfig_screen_on_secs_tag 1
|
||||
#define Config_DisplayConfig_gps_format_tag 2
|
||||
#define Config_DisplayConfig_auto_screen_carousel_secs_tag 3
|
||||
#define Config_DisplayConfig_compass_north_top_tag 4
|
||||
#define Config_DisplayConfig_flip_screen_tag 5
|
||||
#define Config_DisplayConfig_units_tag 6
|
||||
#define Config_DisplayConfig_oled_tag 7
|
||||
#define Config_DisplayConfig_displaymode_tag 8
|
||||
#define Config_DisplayConfig_heading_bold_tag 9
|
||||
#define Config_LoRaConfig_use_preset_tag 1
|
||||
#define Config_LoRaConfig_modem_preset_tag 2
|
||||
#define Config_LoRaConfig_bandwidth_tag 3
|
||||
#define Config_LoRaConfig_spread_factor_tag 4
|
||||
#define Config_LoRaConfig_coding_rate_tag 5
|
||||
#define Config_LoRaConfig_frequency_offset_tag 6
|
||||
#define Config_LoRaConfig_region_tag 7
|
||||
#define Config_LoRaConfig_hop_limit_tag 8
|
||||
#define Config_LoRaConfig_tx_enabled_tag 9
|
||||
#define Config_LoRaConfig_tx_power_tag 10
|
||||
#define Config_LoRaConfig_channel_num_tag 11
|
||||
#define Config_LoRaConfig_override_duty_cycle_tag 12
|
||||
#define Config_LoRaConfig_ignore_incoming_tag 103
|
||||
#define Config_BluetoothConfig_enabled_tag 1
|
||||
#define Config_BluetoothConfig_mode_tag 2
|
||||
#define Config_BluetoothConfig_fixed_pin_tag 3
|
||||
#define Config_device_tag 1
|
||||
#define Config_position_tag 2
|
||||
#define Config_power_tag 3
|
||||
#define Config_network_tag 4
|
||||
#define Config_display_tag 5
|
||||
#define Config_lora_tag 6
|
||||
#define Config_bluetooth_tag 7
|
||||
#define meshtastic_Config_DeviceConfig_role_tag 1
|
||||
#define meshtastic_Config_DeviceConfig_serial_enabled_tag 2
|
||||
#define meshtastic_Config_DeviceConfig_debug_log_enabled_tag 3
|
||||
#define meshtastic_Config_DeviceConfig_button_gpio_tag 4
|
||||
#define meshtastic_Config_DeviceConfig_buzzer_gpio_tag 5
|
||||
#define meshtastic_Config_DeviceConfig_rebroadcast_mode_tag 6
|
||||
#define meshtastic_Config_PositionConfig_position_broadcast_secs_tag 1
|
||||
#define meshtastic_Config_PositionConfig_position_broadcast_smart_enabled_tag 2
|
||||
#define meshtastic_Config_PositionConfig_fixed_position_tag 3
|
||||
#define meshtastic_Config_PositionConfig_gps_enabled_tag 4
|
||||
#define meshtastic_Config_PositionConfig_gps_update_interval_tag 5
|
||||
#define meshtastic_Config_PositionConfig_gps_attempt_time_tag 6
|
||||
#define meshtastic_Config_PositionConfig_position_flags_tag 7
|
||||
#define meshtastic_Config_PositionConfig_rx_gpio_tag 8
|
||||
#define meshtastic_Config_PositionConfig_tx_gpio_tag 9
|
||||
#define meshtastic_Config_PowerConfig_is_power_saving_tag 1
|
||||
#define meshtastic_Config_PowerConfig_on_battery_shutdown_after_secs_tag 2
|
||||
#define meshtastic_Config_PowerConfig_adc_multiplier_override_tag 3
|
||||
#define meshtastic_Config_PowerConfig_wait_bluetooth_secs_tag 4
|
||||
#define meshtastic_Config_PowerConfig_mesh_sds_timeout_secs_tag 5
|
||||
#define meshtastic_Config_PowerConfig_sds_secs_tag 6
|
||||
#define meshtastic_Config_PowerConfig_ls_secs_tag 7
|
||||
#define meshtastic_Config_PowerConfig_min_wake_secs_tag 8
|
||||
#define meshtastic_Config_NetworkConfig_IpV4Config_ip_tag 1
|
||||
#define meshtastic_Config_NetworkConfig_IpV4Config_gateway_tag 2
|
||||
#define meshtastic_Config_NetworkConfig_IpV4Config_subnet_tag 3
|
||||
#define meshtastic_Config_NetworkConfig_IpV4Config_dns_tag 4
|
||||
#define meshtastic_Config_NetworkConfig_wifi_enabled_tag 1
|
||||
#define meshtastic_Config_NetworkConfig_wifi_ssid_tag 3
|
||||
#define meshtastic_Config_NetworkConfig_wifi_psk_tag 4
|
||||
#define meshtastic_Config_NetworkConfig_ntp_server_tag 5
|
||||
#define meshtastic_Config_NetworkConfig_eth_enabled_tag 6
|
||||
#define meshtastic_Config_NetworkConfig_address_mode_tag 7
|
||||
#define meshtastic_Config_NetworkConfig_ipv4_config_tag 8
|
||||
#define meshtastic_Config_NetworkConfig_rsyslog_server_tag 9
|
||||
#define meshtastic_Config_DisplayConfig_screen_on_secs_tag 1
|
||||
#define meshtastic_Config_DisplayConfig_gps_format_tag 2
|
||||
#define meshtastic_Config_DisplayConfig_auto_screen_carousel_secs_tag 3
|
||||
#define meshtastic_Config_DisplayConfig_compass_north_top_tag 4
|
||||
#define meshtastic_Config_DisplayConfig_flip_screen_tag 5
|
||||
#define meshtastic_Config_DisplayConfig_units_tag 6
|
||||
#define meshtastic_Config_DisplayConfig_oled_tag 7
|
||||
#define meshtastic_Config_DisplayConfig_displaymode_tag 8
|
||||
#define meshtastic_Config_DisplayConfig_heading_bold_tag 9
|
||||
#define meshtastic_Config_LoRaConfig_use_preset_tag 1
|
||||
#define meshtastic_Config_LoRaConfig_modem_preset_tag 2
|
||||
#define meshtastic_Config_LoRaConfig_bandwidth_tag 3
|
||||
#define meshtastic_Config_LoRaConfig_spread_factor_tag 4
|
||||
#define meshtastic_Config_LoRaConfig_coding_rate_tag 5
|
||||
#define meshtastic_Config_LoRaConfig_frequency_offset_tag 6
|
||||
#define meshtastic_Config_LoRaConfig_region_tag 7
|
||||
#define meshtastic_Config_LoRaConfig_hop_limit_tag 8
|
||||
#define meshtastic_Config_LoRaConfig_tx_enabled_tag 9
|
||||
#define meshtastic_Config_LoRaConfig_tx_power_tag 10
|
||||
#define meshtastic_Config_LoRaConfig_channel_num_tag 11
|
||||
#define meshtastic_Config_LoRaConfig_override_duty_cycle_tag 12
|
||||
#define meshtastic_Config_LoRaConfig_sx126x_rx_boosted_gain_tag 13
|
||||
#define meshtastic_Config_LoRaConfig_override_frequency_tag 14
|
||||
#define meshtastic_Config_LoRaConfig_ignore_incoming_tag 103
|
||||
#define meshtastic_Config_BluetoothConfig_enabled_tag 1
|
||||
#define meshtastic_Config_BluetoothConfig_mode_tag 2
|
||||
#define meshtastic_Config_BluetoothConfig_fixed_pin_tag 3
|
||||
#define meshtastic_Config_device_tag 1
|
||||
#define meshtastic_Config_position_tag 2
|
||||
#define meshtastic_Config_power_tag 3
|
||||
#define meshtastic_Config_network_tag 4
|
||||
#define meshtastic_Config_display_tag 5
|
||||
#define meshtastic_Config_lora_tag 6
|
||||
#define meshtastic_Config_bluetooth_tag 7
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define Config_FIELDLIST(X, a) \
|
||||
#define meshtastic_Config_FIELDLIST(X, a) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,device,payload_variant.device), 1) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,position,payload_variant.position), 2) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,power,payload_variant.power), 3) \
|
||||
@@ -570,26 +613,27 @@ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,network,payload_variant.netw
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,display,payload_variant.display), 5) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,lora,payload_variant.lora), 6) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,bluetooth,payload_variant.bluetooth), 7)
|
||||
#define Config_CALLBACK NULL
|
||||
#define Config_DEFAULT NULL
|
||||
#define Config_payload_variant_device_MSGTYPE Config_DeviceConfig
|
||||
#define Config_payload_variant_position_MSGTYPE Config_PositionConfig
|
||||
#define Config_payload_variant_power_MSGTYPE Config_PowerConfig
|
||||
#define Config_payload_variant_network_MSGTYPE Config_NetworkConfig
|
||||
#define Config_payload_variant_display_MSGTYPE Config_DisplayConfig
|
||||
#define Config_payload_variant_lora_MSGTYPE Config_LoRaConfig
|
||||
#define Config_payload_variant_bluetooth_MSGTYPE Config_BluetoothConfig
|
||||
#define meshtastic_Config_CALLBACK NULL
|
||||
#define meshtastic_Config_DEFAULT NULL
|
||||
#define meshtastic_Config_payload_variant_device_MSGTYPE meshtastic_Config_DeviceConfig
|
||||
#define meshtastic_Config_payload_variant_position_MSGTYPE meshtastic_Config_PositionConfig
|
||||
#define meshtastic_Config_payload_variant_power_MSGTYPE meshtastic_Config_PowerConfig
|
||||
#define meshtastic_Config_payload_variant_network_MSGTYPE meshtastic_Config_NetworkConfig
|
||||
#define meshtastic_Config_payload_variant_display_MSGTYPE meshtastic_Config_DisplayConfig
|
||||
#define meshtastic_Config_payload_variant_lora_MSGTYPE meshtastic_Config_LoRaConfig
|
||||
#define meshtastic_Config_payload_variant_bluetooth_MSGTYPE meshtastic_Config_BluetoothConfig
|
||||
|
||||
#define Config_DeviceConfig_FIELDLIST(X, a) \
|
||||
#define meshtastic_Config_DeviceConfig_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UENUM, role, 1) \
|
||||
X(a, STATIC, SINGULAR, BOOL, serial_enabled, 2) \
|
||||
X(a, STATIC, SINGULAR, BOOL, debug_log_enabled, 3) \
|
||||
X(a, STATIC, SINGULAR, UINT32, button_gpio, 4) \
|
||||
X(a, STATIC, SINGULAR, UINT32, buzzer_gpio, 5)
|
||||
#define Config_DeviceConfig_CALLBACK NULL
|
||||
#define Config_DeviceConfig_DEFAULT NULL
|
||||
X(a, STATIC, SINGULAR, UINT32, buzzer_gpio, 5) \
|
||||
X(a, STATIC, SINGULAR, UENUM, rebroadcast_mode, 6)
|
||||
#define meshtastic_Config_DeviceConfig_CALLBACK NULL
|
||||
#define meshtastic_Config_DeviceConfig_DEFAULT NULL
|
||||
|
||||
#define Config_PositionConfig_FIELDLIST(X, a) \
|
||||
#define meshtastic_Config_PositionConfig_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, position_broadcast_secs, 1) \
|
||||
X(a, STATIC, SINGULAR, BOOL, position_broadcast_smart_enabled, 2) \
|
||||
X(a, STATIC, SINGULAR, BOOL, fixed_position, 3) \
|
||||
@@ -599,10 +643,10 @@ X(a, STATIC, SINGULAR, UINT32, gps_attempt_time, 6) \
|
||||
X(a, STATIC, SINGULAR, UINT32, position_flags, 7) \
|
||||
X(a, STATIC, SINGULAR, UINT32, rx_gpio, 8) \
|
||||
X(a, STATIC, SINGULAR, UINT32, tx_gpio, 9)
|
||||
#define Config_PositionConfig_CALLBACK NULL
|
||||
#define Config_PositionConfig_DEFAULT NULL
|
||||
#define meshtastic_Config_PositionConfig_CALLBACK NULL
|
||||
#define meshtastic_Config_PositionConfig_DEFAULT NULL
|
||||
|
||||
#define Config_PowerConfig_FIELDLIST(X, a) \
|
||||
#define meshtastic_Config_PowerConfig_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, BOOL, is_power_saving, 1) \
|
||||
X(a, STATIC, SINGULAR, UINT32, on_battery_shutdown_after_secs, 2) \
|
||||
X(a, STATIC, SINGULAR, FLOAT, adc_multiplier_override, 3) \
|
||||
@@ -611,10 +655,10 @@ X(a, STATIC, SINGULAR, UINT32, mesh_sds_timeout_secs, 5) \
|
||||
X(a, STATIC, SINGULAR, UINT32, sds_secs, 6) \
|
||||
X(a, STATIC, SINGULAR, UINT32, ls_secs, 7) \
|
||||
X(a, STATIC, SINGULAR, UINT32, min_wake_secs, 8)
|
||||
#define Config_PowerConfig_CALLBACK NULL
|
||||
#define Config_PowerConfig_DEFAULT NULL
|
||||
#define meshtastic_Config_PowerConfig_CALLBACK NULL
|
||||
#define meshtastic_Config_PowerConfig_DEFAULT NULL
|
||||
|
||||
#define Config_NetworkConfig_FIELDLIST(X, a) \
|
||||
#define meshtastic_Config_NetworkConfig_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, BOOL, wifi_enabled, 1) \
|
||||
X(a, STATIC, SINGULAR, STRING, wifi_ssid, 3) \
|
||||
X(a, STATIC, SINGULAR, STRING, wifi_psk, 4) \
|
||||
@@ -623,19 +667,19 @@ X(a, STATIC, SINGULAR, BOOL, eth_enabled, 6) \
|
||||
X(a, STATIC, SINGULAR, UENUM, address_mode, 7) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, ipv4_config, 8) \
|
||||
X(a, STATIC, SINGULAR, STRING, rsyslog_server, 9)
|
||||
#define Config_NetworkConfig_CALLBACK NULL
|
||||
#define Config_NetworkConfig_DEFAULT NULL
|
||||
#define Config_NetworkConfig_ipv4_config_MSGTYPE Config_NetworkConfig_IpV4Config
|
||||
#define meshtastic_Config_NetworkConfig_CALLBACK NULL
|
||||
#define meshtastic_Config_NetworkConfig_DEFAULT NULL
|
||||
#define meshtastic_Config_NetworkConfig_ipv4_config_MSGTYPE meshtastic_Config_NetworkConfig_IpV4Config
|
||||
|
||||
#define Config_NetworkConfig_IpV4Config_FIELDLIST(X, a) \
|
||||
#define meshtastic_Config_NetworkConfig_IpV4Config_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, FIXED32, ip, 1) \
|
||||
X(a, STATIC, SINGULAR, FIXED32, gateway, 2) \
|
||||
X(a, STATIC, SINGULAR, FIXED32, subnet, 3) \
|
||||
X(a, STATIC, SINGULAR, FIXED32, dns, 4)
|
||||
#define Config_NetworkConfig_IpV4Config_CALLBACK NULL
|
||||
#define Config_NetworkConfig_IpV4Config_DEFAULT NULL
|
||||
#define meshtastic_Config_NetworkConfig_IpV4Config_CALLBACK NULL
|
||||
#define meshtastic_Config_NetworkConfig_IpV4Config_DEFAULT NULL
|
||||
|
||||
#define Config_DisplayConfig_FIELDLIST(X, a) \
|
||||
#define meshtastic_Config_DisplayConfig_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, screen_on_secs, 1) \
|
||||
X(a, STATIC, SINGULAR, UENUM, gps_format, 2) \
|
||||
X(a, STATIC, SINGULAR, UINT32, auto_screen_carousel_secs, 3) \
|
||||
@@ -645,10 +689,10 @@ X(a, STATIC, SINGULAR, UENUM, units, 6) \
|
||||
X(a, STATIC, SINGULAR, UENUM, oled, 7) \
|
||||
X(a, STATIC, SINGULAR, UENUM, displaymode, 8) \
|
||||
X(a, STATIC, SINGULAR, BOOL, heading_bold, 9)
|
||||
#define Config_DisplayConfig_CALLBACK NULL
|
||||
#define Config_DisplayConfig_DEFAULT NULL
|
||||
#define meshtastic_Config_DisplayConfig_CALLBACK NULL
|
||||
#define meshtastic_Config_DisplayConfig_DEFAULT NULL
|
||||
|
||||
#define Config_LoRaConfig_FIELDLIST(X, a) \
|
||||
#define meshtastic_Config_LoRaConfig_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, BOOL, use_preset, 1) \
|
||||
X(a, STATIC, SINGULAR, UENUM, modem_preset, 2) \
|
||||
X(a, STATIC, SINGULAR, UINT32, bandwidth, 3) \
|
||||
@@ -661,48 +705,50 @@ X(a, STATIC, SINGULAR, BOOL, tx_enabled, 9) \
|
||||
X(a, STATIC, SINGULAR, INT32, tx_power, 10) \
|
||||
X(a, STATIC, SINGULAR, UINT32, channel_num, 11) \
|
||||
X(a, STATIC, SINGULAR, BOOL, override_duty_cycle, 12) \
|
||||
X(a, STATIC, SINGULAR, BOOL, sx126x_rx_boosted_gain, 13) \
|
||||
X(a, STATIC, SINGULAR, FLOAT, override_frequency, 14) \
|
||||
X(a, STATIC, REPEATED, UINT32, ignore_incoming, 103)
|
||||
#define Config_LoRaConfig_CALLBACK NULL
|
||||
#define Config_LoRaConfig_DEFAULT NULL
|
||||
#define meshtastic_Config_LoRaConfig_CALLBACK NULL
|
||||
#define meshtastic_Config_LoRaConfig_DEFAULT NULL
|
||||
|
||||
#define Config_BluetoothConfig_FIELDLIST(X, a) \
|
||||
#define meshtastic_Config_BluetoothConfig_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, BOOL, enabled, 1) \
|
||||
X(a, STATIC, SINGULAR, UENUM, mode, 2) \
|
||||
X(a, STATIC, SINGULAR, UINT32, fixed_pin, 3)
|
||||
#define Config_BluetoothConfig_CALLBACK NULL
|
||||
#define Config_BluetoothConfig_DEFAULT NULL
|
||||
#define meshtastic_Config_BluetoothConfig_CALLBACK NULL
|
||||
#define meshtastic_Config_BluetoothConfig_DEFAULT NULL
|
||||
|
||||
extern const pb_msgdesc_t Config_msg;
|
||||
extern const pb_msgdesc_t Config_DeviceConfig_msg;
|
||||
extern const pb_msgdesc_t Config_PositionConfig_msg;
|
||||
extern const pb_msgdesc_t Config_PowerConfig_msg;
|
||||
extern const pb_msgdesc_t Config_NetworkConfig_msg;
|
||||
extern const pb_msgdesc_t Config_NetworkConfig_IpV4Config_msg;
|
||||
extern const pb_msgdesc_t Config_DisplayConfig_msg;
|
||||
extern const pb_msgdesc_t Config_LoRaConfig_msg;
|
||||
extern const pb_msgdesc_t Config_BluetoothConfig_msg;
|
||||
extern const pb_msgdesc_t meshtastic_Config_msg;
|
||||
extern const pb_msgdesc_t meshtastic_Config_DeviceConfig_msg;
|
||||
extern const pb_msgdesc_t meshtastic_Config_PositionConfig_msg;
|
||||
extern const pb_msgdesc_t meshtastic_Config_PowerConfig_msg;
|
||||
extern const pb_msgdesc_t meshtastic_Config_NetworkConfig_msg;
|
||||
extern const pb_msgdesc_t meshtastic_Config_NetworkConfig_IpV4Config_msg;
|
||||
extern const pb_msgdesc_t meshtastic_Config_DisplayConfig_msg;
|
||||
extern const pb_msgdesc_t meshtastic_Config_LoRaConfig_msg;
|
||||
extern const pb_msgdesc_t meshtastic_Config_BluetoothConfig_msg;
|
||||
|
||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||
#define Config_fields &Config_msg
|
||||
#define Config_DeviceConfig_fields &Config_DeviceConfig_msg
|
||||
#define Config_PositionConfig_fields &Config_PositionConfig_msg
|
||||
#define Config_PowerConfig_fields &Config_PowerConfig_msg
|
||||
#define Config_NetworkConfig_fields &Config_NetworkConfig_msg
|
||||
#define Config_NetworkConfig_IpV4Config_fields &Config_NetworkConfig_IpV4Config_msg
|
||||
#define Config_DisplayConfig_fields &Config_DisplayConfig_msg
|
||||
#define Config_LoRaConfig_fields &Config_LoRaConfig_msg
|
||||
#define Config_BluetoothConfig_fields &Config_BluetoothConfig_msg
|
||||
#define meshtastic_Config_fields &meshtastic_Config_msg
|
||||
#define meshtastic_Config_DeviceConfig_fields &meshtastic_Config_DeviceConfig_msg
|
||||
#define meshtastic_Config_PositionConfig_fields &meshtastic_Config_PositionConfig_msg
|
||||
#define meshtastic_Config_PowerConfig_fields &meshtastic_Config_PowerConfig_msg
|
||||
#define meshtastic_Config_NetworkConfig_fields &meshtastic_Config_NetworkConfig_msg
|
||||
#define meshtastic_Config_NetworkConfig_IpV4Config_fields &meshtastic_Config_NetworkConfig_IpV4Config_msg
|
||||
#define meshtastic_Config_DisplayConfig_fields &meshtastic_Config_DisplayConfig_msg
|
||||
#define meshtastic_Config_LoRaConfig_fields &meshtastic_Config_LoRaConfig_msg
|
||||
#define meshtastic_Config_BluetoothConfig_fields &meshtastic_Config_BluetoothConfig_msg
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define Config_BluetoothConfig_size 10
|
||||
#define Config_DeviceConfig_size 18
|
||||
#define Config_DisplayConfig_size 26
|
||||
#define Config_LoRaConfig_size 70
|
||||
#define Config_NetworkConfig_IpV4Config_size 20
|
||||
#define Config_NetworkConfig_size 195
|
||||
#define Config_PositionConfig_size 42
|
||||
#define Config_PowerConfig_size 43
|
||||
#define Config_size 198
|
||||
#define meshtastic_Config_BluetoothConfig_size 10
|
||||
#define meshtastic_Config_DeviceConfig_size 20
|
||||
#define meshtastic_Config_DisplayConfig_size 26
|
||||
#define meshtastic_Config_LoRaConfig_size 77
|
||||
#define meshtastic_Config_NetworkConfig_IpV4Config_size 20
|
||||
#define meshtastic_Config_NetworkConfig_size 195
|
||||
#define meshtastic_Config_PositionConfig_size 42
|
||||
#define meshtastic_Config_PowerConfig_size 43
|
||||
#define meshtastic_Config_size 198
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.4.7 */
|
||||
|
||||
#include "./device_metadata.pb.h"
|
||||
#include "meshtastic/device_metadata.pb.h"
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
PB_BIND(DeviceMetadata, DeviceMetadata, AUTO)
|
||||
PB_BIND(meshtastic_DeviceMetadata, meshtastic_DeviceMetadata, AUTO)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#ifndef PB_MESHTASTIC_MESHTASTIC_DEVICE_METADATA_PB_H_INCLUDED
|
||||
#define PB_MESHTASTIC_MESHTASTIC_DEVICE_METADATA_PB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
#include "./config.pb.h"
|
||||
#include "meshtastic/config.pb.h"
|
||||
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
/* Struct definitions */
|
||||
/* Device metadata response */
|
||||
typedef struct _DeviceMetadata {
|
||||
typedef struct _meshtastic_DeviceMetadata {
|
||||
/* Device firmware version string */
|
||||
char firmware_version[18];
|
||||
/* Device state version */
|
||||
@@ -26,10 +26,10 @@ typedef struct _DeviceMetadata {
|
||||
/* Indicates that the device has an ethernet peripheral */
|
||||
bool hasEthernet;
|
||||
/* Indicates that the device's role in the mesh */
|
||||
Config_DeviceConfig_Role role;
|
||||
meshtastic_Config_DeviceConfig_Role role;
|
||||
/* Indicates the device's current enabled position flags */
|
||||
uint32_t position_flags;
|
||||
} DeviceMetadata;
|
||||
} meshtastic_DeviceMetadata;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -37,21 +37,21 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define DeviceMetadata_init_default {"", 0, 0, 0, 0, 0, _Config_DeviceConfig_Role_MIN, 0}
|
||||
#define DeviceMetadata_init_zero {"", 0, 0, 0, 0, 0, _Config_DeviceConfig_Role_MIN, 0}
|
||||
#define meshtastic_DeviceMetadata_init_default {"", 0, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_Role_MIN, 0}
|
||||
#define meshtastic_DeviceMetadata_init_zero {"", 0, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_Role_MIN, 0}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define DeviceMetadata_firmware_version_tag 1
|
||||
#define DeviceMetadata_device_state_version_tag 2
|
||||
#define DeviceMetadata_canShutdown_tag 3
|
||||
#define DeviceMetadata_hasWifi_tag 4
|
||||
#define DeviceMetadata_hasBluetooth_tag 5
|
||||
#define DeviceMetadata_hasEthernet_tag 6
|
||||
#define DeviceMetadata_role_tag 7
|
||||
#define DeviceMetadata_position_flags_tag 8
|
||||
#define meshtastic_DeviceMetadata_firmware_version_tag 1
|
||||
#define meshtastic_DeviceMetadata_device_state_version_tag 2
|
||||
#define meshtastic_DeviceMetadata_canShutdown_tag 3
|
||||
#define meshtastic_DeviceMetadata_hasWifi_tag 4
|
||||
#define meshtastic_DeviceMetadata_hasBluetooth_tag 5
|
||||
#define meshtastic_DeviceMetadata_hasEthernet_tag 6
|
||||
#define meshtastic_DeviceMetadata_role_tag 7
|
||||
#define meshtastic_DeviceMetadata_position_flags_tag 8
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define DeviceMetadata_FIELDLIST(X, a) \
|
||||
#define meshtastic_DeviceMetadata_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, STRING, firmware_version, 1) \
|
||||
X(a, STATIC, SINGULAR, UINT32, device_state_version, 2) \
|
||||
X(a, STATIC, SINGULAR, BOOL, canShutdown, 3) \
|
||||
@@ -60,16 +60,16 @@ X(a, STATIC, SINGULAR, BOOL, hasBluetooth, 5) \
|
||||
X(a, STATIC, SINGULAR, BOOL, hasEthernet, 6) \
|
||||
X(a, STATIC, SINGULAR, UENUM, role, 7) \
|
||||
X(a, STATIC, SINGULAR, UINT32, position_flags, 8)
|
||||
#define DeviceMetadata_CALLBACK NULL
|
||||
#define DeviceMetadata_DEFAULT NULL
|
||||
#define meshtastic_DeviceMetadata_CALLBACK NULL
|
||||
#define meshtastic_DeviceMetadata_DEFAULT NULL
|
||||
|
||||
extern const pb_msgdesc_t DeviceMetadata_msg;
|
||||
extern const pb_msgdesc_t meshtastic_DeviceMetadata_msg;
|
||||
|
||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||
#define DeviceMetadata_fields &DeviceMetadata_msg
|
||||
#define meshtastic_DeviceMetadata_fields &meshtastic_DeviceMetadata_msg
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define DeviceMetadata_size 41
|
||||
#define meshtastic_DeviceMetadata_size 41
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.4.7 */
|
||||
|
||||
#include "./deviceonly.pb.h"
|
||||
#include "meshtastic/deviceonly.pb.h"
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
PB_BIND(DeviceState, DeviceState, 4)
|
||||
PB_BIND(meshtastic_DeviceState, meshtastic_DeviceState, 4)
|
||||
|
||||
|
||||
PB_BIND(ChannelFile, ChannelFile, 2)
|
||||
PB_BIND(meshtastic_ChannelFile, meshtastic_ChannelFile, 2)
|
||||
|
||||
|
||||
PB_BIND(OEMStore, OEMStore, 2)
|
||||
PB_BIND(meshtastic_OEMStore, meshtastic_OEMStore, 2)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#ifndef PB_MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_INCLUDED
|
||||
#define PB_MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
#include "./channel.pb.h"
|
||||
#include "./mesh.pb.h"
|
||||
#include "meshtastic/channel.pb.h"
|
||||
#include "meshtastic/mesh.pb.h"
|
||||
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
@@ -13,14 +13,14 @@
|
||||
|
||||
/* Enum definitions */
|
||||
/* TODO: REPLACE */
|
||||
typedef enum _ScreenFonts {
|
||||
typedef enum _meshtastic_ScreenFonts {
|
||||
/* TODO: REPLACE */
|
||||
ScreenFonts_FONT_SMALL = 0,
|
||||
meshtastic_ScreenFonts_FONT_SMALL = 0,
|
||||
/* TODO: REPLACE */
|
||||
ScreenFonts_FONT_MEDIUM = 1,
|
||||
meshtastic_ScreenFonts_FONT_MEDIUM = 1,
|
||||
/* TODO: REPLACE */
|
||||
ScreenFonts_FONT_LARGE = 2
|
||||
} ScreenFonts;
|
||||
meshtastic_ScreenFonts_FONT_LARGE = 2
|
||||
} meshtastic_ScreenFonts;
|
||||
|
||||
/* Struct definitions */
|
||||
/* This message is never sent over the wire, but it is used for serializing DB
|
||||
@@ -28,24 +28,24 @@ typedef enum _ScreenFonts {
|
||||
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 */
|
||||
typedef struct _DeviceState {
|
||||
typedef struct _meshtastic_DeviceState {
|
||||
/* Read only settings/info about this node */
|
||||
bool has_my_node;
|
||||
MyNodeInfo my_node;
|
||||
meshtastic_MyNodeInfo my_node;
|
||||
/* My owner info */
|
||||
bool has_owner;
|
||||
User owner;
|
||||
meshtastic_User owner;
|
||||
/* TODO: REPLACE */
|
||||
pb_size_t node_db_count;
|
||||
NodeInfo node_db[80];
|
||||
meshtastic_NodeInfo node_db[80];
|
||||
/* Received packets saved for delivery to the phone */
|
||||
pb_size_t receive_queue_count;
|
||||
MeshPacket receive_queue[1];
|
||||
meshtastic_MeshPacket receive_queue[1];
|
||||
/* We keep the last received text message (only) stored in the device flash,
|
||||
so we can show it on the screen.
|
||||
Might be null */
|
||||
bool has_rx_text_message;
|
||||
MeshPacket rx_text_message;
|
||||
meshtastic_MeshPacket rx_text_message;
|
||||
/* 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. */
|
||||
@@ -55,37 +55,37 @@ typedef struct _DeviceState {
|
||||
bool no_save;
|
||||
/* Some GPSes seem to have bogus settings from the factory, so we always do one factory reset. */
|
||||
bool did_gps_reset;
|
||||
} DeviceState;
|
||||
} meshtastic_DeviceState;
|
||||
|
||||
/* The on-disk saved channels */
|
||||
typedef struct _ChannelFile {
|
||||
typedef struct _meshtastic_ChannelFile {
|
||||
/* The channels our node knows about */
|
||||
pb_size_t channels_count;
|
||||
Channel channels[8];
|
||||
meshtastic_Channel channels[8];
|
||||
/* 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_t version;
|
||||
} ChannelFile;
|
||||
} meshtastic_ChannelFile;
|
||||
|
||||
typedef PB_BYTES_ARRAY_T(2048) OEMStore_oem_icon_bits_t;
|
||||
typedef PB_BYTES_ARRAY_T(32) OEMStore_oem_aes_key_t;
|
||||
typedef PB_BYTES_ARRAY_T(2048) meshtastic_OEMStore_oem_icon_bits_t;
|
||||
typedef PB_BYTES_ARRAY_T(32) meshtastic_OEMStore_oem_aes_key_t;
|
||||
/* This can be used for customizing the firmware distribution. If populated,
|
||||
show a secondary bootup screen with cuatom logo and text for 2.5 seconds. */
|
||||
typedef struct _OEMStore {
|
||||
typedef struct _meshtastic_OEMStore {
|
||||
/* The Logo width in Px */
|
||||
uint32_t oem_icon_width;
|
||||
/* The Logo height in Px */
|
||||
uint32_t oem_icon_height;
|
||||
/* The Logo in xbm bytechar format */
|
||||
OEMStore_oem_icon_bits_t oem_icon_bits;
|
||||
meshtastic_OEMStore_oem_icon_bits_t oem_icon_bits;
|
||||
/* Use this font for the OEM text. */
|
||||
ScreenFonts oem_font;
|
||||
meshtastic_ScreenFonts oem_font;
|
||||
/* Use this font for the OEM text. */
|
||||
char oem_text[40];
|
||||
/* The default device encryption key, 16 or 32 byte */
|
||||
OEMStore_oem_aes_key_t oem_aes_key;
|
||||
} OEMStore;
|
||||
meshtastic_OEMStore_oem_aes_key_t oem_aes_key;
|
||||
} meshtastic_OEMStore;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -93,43 +93,43 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Helper constants for enums */
|
||||
#define _ScreenFonts_MIN ScreenFonts_FONT_SMALL
|
||||
#define _ScreenFonts_MAX ScreenFonts_FONT_LARGE
|
||||
#define _ScreenFonts_ARRAYSIZE ((ScreenFonts)(ScreenFonts_FONT_LARGE+1))
|
||||
#define _meshtastic_ScreenFonts_MIN meshtastic_ScreenFonts_FONT_SMALL
|
||||
#define _meshtastic_ScreenFonts_MAX meshtastic_ScreenFonts_FONT_LARGE
|
||||
#define _meshtastic_ScreenFonts_ARRAYSIZE ((meshtastic_ScreenFonts)(meshtastic_ScreenFonts_FONT_LARGE+1))
|
||||
|
||||
|
||||
|
||||
#define OEMStore_oem_font_ENUMTYPE ScreenFonts
|
||||
#define meshtastic_OEMStore_oem_font_ENUMTYPE meshtastic_ScreenFonts
|
||||
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define DeviceState_init_default {false, MyNodeInfo_init_default, false, User_init_default, 0, {NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default}, 0, {MeshPacket_init_default}, false, MeshPacket_init_default, 0, 0, 0}
|
||||
#define ChannelFile_init_default {0, {Channel_init_default, Channel_init_default, Channel_init_default, Channel_init_default, Channel_init_default, Channel_init_default, Channel_init_default, Channel_init_default}, 0}
|
||||
#define OEMStore_init_default {0, 0, {0, {0}}, _ScreenFonts_MIN, "", {0, {0}}}
|
||||
#define DeviceState_init_zero {false, MyNodeInfo_init_zero, false, User_init_zero, 0, {NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero}, 0, {MeshPacket_init_zero}, false, MeshPacket_init_zero, 0, 0, 0}
|
||||
#define ChannelFile_init_zero {0, {Channel_init_zero, Channel_init_zero, Channel_init_zero, Channel_init_zero, Channel_init_zero, Channel_init_zero, Channel_init_zero, Channel_init_zero}, 0}
|
||||
#define OEMStore_init_zero {0, 0, {0, {0}}, _ScreenFonts_MIN, "", {0, {0}}}
|
||||
#define meshtastic_DeviceState_init_default {false, meshtastic_MyNodeInfo_init_default, false, meshtastic_User_init_default, 0, {meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default}, 0, {meshtastic_MeshPacket_init_default}, false, meshtastic_MeshPacket_init_default, 0, 0, 0}
|
||||
#define meshtastic_ChannelFile_init_default {0, {meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default}, 0}
|
||||
#define meshtastic_OEMStore_init_default {0, 0, {0, {0}}, _meshtastic_ScreenFonts_MIN, "", {0, {0}}}
|
||||
#define meshtastic_DeviceState_init_zero {false, meshtastic_MyNodeInfo_init_zero, false, meshtastic_User_init_zero, 0, {meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero}, 0, {meshtastic_MeshPacket_init_zero}, false, meshtastic_MeshPacket_init_zero, 0, 0, 0}
|
||||
#define meshtastic_ChannelFile_init_zero {0, {meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero}, 0}
|
||||
#define meshtastic_OEMStore_init_zero {0, 0, {0, {0}}, _meshtastic_ScreenFonts_MIN, "", {0, {0}}}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define DeviceState_my_node_tag 2
|
||||
#define DeviceState_owner_tag 3
|
||||
#define DeviceState_node_db_tag 4
|
||||
#define DeviceState_receive_queue_tag 5
|
||||
#define DeviceState_rx_text_message_tag 7
|
||||
#define DeviceState_version_tag 8
|
||||
#define DeviceState_no_save_tag 9
|
||||
#define DeviceState_did_gps_reset_tag 11
|
||||
#define ChannelFile_channels_tag 1
|
||||
#define ChannelFile_version_tag 2
|
||||
#define OEMStore_oem_icon_width_tag 1
|
||||
#define OEMStore_oem_icon_height_tag 2
|
||||
#define OEMStore_oem_icon_bits_tag 3
|
||||
#define OEMStore_oem_font_tag 4
|
||||
#define OEMStore_oem_text_tag 5
|
||||
#define OEMStore_oem_aes_key_tag 6
|
||||
#define meshtastic_DeviceState_my_node_tag 2
|
||||
#define meshtastic_DeviceState_owner_tag 3
|
||||
#define meshtastic_DeviceState_node_db_tag 4
|
||||
#define meshtastic_DeviceState_receive_queue_tag 5
|
||||
#define meshtastic_DeviceState_rx_text_message_tag 7
|
||||
#define meshtastic_DeviceState_version_tag 8
|
||||
#define meshtastic_DeviceState_no_save_tag 9
|
||||
#define meshtastic_DeviceState_did_gps_reset_tag 11
|
||||
#define meshtastic_ChannelFile_channels_tag 1
|
||||
#define meshtastic_ChannelFile_version_tag 2
|
||||
#define meshtastic_OEMStore_oem_icon_width_tag 1
|
||||
#define meshtastic_OEMStore_oem_icon_height_tag 2
|
||||
#define meshtastic_OEMStore_oem_icon_bits_tag 3
|
||||
#define meshtastic_OEMStore_oem_font_tag 4
|
||||
#define meshtastic_OEMStore_oem_text_tag 5
|
||||
#define meshtastic_OEMStore_oem_aes_key_tag 6
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define DeviceState_FIELDLIST(X, a) \
|
||||
#define meshtastic_DeviceState_FIELDLIST(X, a) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, my_node, 2) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, owner, 3) \
|
||||
X(a, STATIC, REPEATED, MESSAGE, node_db, 4) \
|
||||
@@ -138,44 +138,44 @@ X(a, STATIC, OPTIONAL, MESSAGE, rx_text_message, 7) \
|
||||
X(a, STATIC, SINGULAR, UINT32, version, 8) \
|
||||
X(a, STATIC, SINGULAR, BOOL, no_save, 9) \
|
||||
X(a, STATIC, SINGULAR, BOOL, did_gps_reset, 11)
|
||||
#define DeviceState_CALLBACK NULL
|
||||
#define DeviceState_DEFAULT NULL
|
||||
#define DeviceState_my_node_MSGTYPE MyNodeInfo
|
||||
#define DeviceState_owner_MSGTYPE User
|
||||
#define DeviceState_node_db_MSGTYPE NodeInfo
|
||||
#define DeviceState_receive_queue_MSGTYPE MeshPacket
|
||||
#define DeviceState_rx_text_message_MSGTYPE MeshPacket
|
||||
#define meshtastic_DeviceState_CALLBACK NULL
|
||||
#define meshtastic_DeviceState_DEFAULT NULL
|
||||
#define meshtastic_DeviceState_my_node_MSGTYPE meshtastic_MyNodeInfo
|
||||
#define meshtastic_DeviceState_owner_MSGTYPE meshtastic_User
|
||||
#define meshtastic_DeviceState_node_db_MSGTYPE meshtastic_NodeInfo
|
||||
#define meshtastic_DeviceState_receive_queue_MSGTYPE meshtastic_MeshPacket
|
||||
#define meshtastic_DeviceState_rx_text_message_MSGTYPE meshtastic_MeshPacket
|
||||
|
||||
#define ChannelFile_FIELDLIST(X, a) \
|
||||
#define meshtastic_ChannelFile_FIELDLIST(X, a) \
|
||||
X(a, STATIC, REPEATED, MESSAGE, channels, 1) \
|
||||
X(a, STATIC, SINGULAR, UINT32, version, 2)
|
||||
#define ChannelFile_CALLBACK NULL
|
||||
#define ChannelFile_DEFAULT NULL
|
||||
#define ChannelFile_channels_MSGTYPE Channel
|
||||
#define meshtastic_ChannelFile_CALLBACK NULL
|
||||
#define meshtastic_ChannelFile_DEFAULT NULL
|
||||
#define meshtastic_ChannelFile_channels_MSGTYPE meshtastic_Channel
|
||||
|
||||
#define OEMStore_FIELDLIST(X, a) \
|
||||
#define meshtastic_OEMStore_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, oem_icon_width, 1) \
|
||||
X(a, STATIC, SINGULAR, UINT32, oem_icon_height, 2) \
|
||||
X(a, STATIC, SINGULAR, BYTES, oem_icon_bits, 3) \
|
||||
X(a, STATIC, SINGULAR, UENUM, oem_font, 4) \
|
||||
X(a, STATIC, SINGULAR, STRING, oem_text, 5) \
|
||||
X(a, STATIC, SINGULAR, BYTES, oem_aes_key, 6)
|
||||
#define OEMStore_CALLBACK NULL
|
||||
#define OEMStore_DEFAULT NULL
|
||||
#define meshtastic_OEMStore_CALLBACK NULL
|
||||
#define meshtastic_OEMStore_DEFAULT NULL
|
||||
|
||||
extern const pb_msgdesc_t DeviceState_msg;
|
||||
extern const pb_msgdesc_t ChannelFile_msg;
|
||||
extern const pb_msgdesc_t OEMStore_msg;
|
||||
extern const pb_msgdesc_t meshtastic_DeviceState_msg;
|
||||
extern const pb_msgdesc_t meshtastic_ChannelFile_msg;
|
||||
extern const pb_msgdesc_t meshtastic_OEMStore_msg;
|
||||
|
||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||
#define DeviceState_fields &DeviceState_msg
|
||||
#define ChannelFile_fields &ChannelFile_msg
|
||||
#define OEMStore_fields &OEMStore_msg
|
||||
#define meshtastic_DeviceState_fields &meshtastic_DeviceState_msg
|
||||
#define meshtastic_ChannelFile_fields &meshtastic_ChannelFile_msg
|
||||
#define meshtastic_OEMStore_fields &meshtastic_OEMStore_msg
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define ChannelFile_size 638
|
||||
#define DeviceState_size 21800
|
||||
#define OEMStore_size 2140
|
||||
#define meshtastic_ChannelFile_size 638
|
||||
#define meshtastic_DeviceState_size 21800
|
||||
#define meshtastic_OEMStore_size 2140
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.4.7 */
|
||||
|
||||
#include "./localonly.pb.h"
|
||||
#include "meshtastic/localonly.pb.h"
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
PB_BIND(LocalConfig, LocalConfig, 2)
|
||||
PB_BIND(meshtastic_LocalConfig, meshtastic_LocalConfig, 2)
|
||||
|
||||
|
||||
PB_BIND(LocalModuleConfig, LocalModuleConfig, 2)
|
||||
PB_BIND(meshtastic_LocalModuleConfig, meshtastic_LocalModuleConfig, 2)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,75 +4,75 @@
|
||||
#ifndef PB_MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_INCLUDED
|
||||
#define PB_MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
#include "./config.pb.h"
|
||||
#include "./module_config.pb.h"
|
||||
#include "meshtastic/config.pb.h"
|
||||
#include "meshtastic/module_config.pb.h"
|
||||
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
/* Struct definitions */
|
||||
typedef struct _LocalConfig {
|
||||
typedef struct _meshtastic_LocalConfig {
|
||||
/* The part of the config that is specific to the Device */
|
||||
bool has_device;
|
||||
Config_DeviceConfig device;
|
||||
meshtastic_Config_DeviceConfig device;
|
||||
/* The part of the config that is specific to the GPS Position */
|
||||
bool has_position;
|
||||
Config_PositionConfig position;
|
||||
meshtastic_Config_PositionConfig position;
|
||||
/* The part of the config that is specific to the Power settings */
|
||||
bool has_power;
|
||||
Config_PowerConfig power;
|
||||
meshtastic_Config_PowerConfig power;
|
||||
/* The part of the config that is specific to the Wifi Settings */
|
||||
bool has_network;
|
||||
Config_NetworkConfig network;
|
||||
meshtastic_Config_NetworkConfig network;
|
||||
/* The part of the config that is specific to the Display */
|
||||
bool has_display;
|
||||
Config_DisplayConfig display;
|
||||
meshtastic_Config_DisplayConfig display;
|
||||
/* The part of the config that is specific to the Lora Radio */
|
||||
bool has_lora;
|
||||
Config_LoRaConfig lora;
|
||||
meshtastic_Config_LoRaConfig lora;
|
||||
/* The part of the config that is specific to the Bluetooth settings */
|
||||
bool has_bluetooth;
|
||||
Config_BluetoothConfig bluetooth;
|
||||
meshtastic_Config_BluetoothConfig bluetooth;
|
||||
/* 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_t version;
|
||||
} LocalConfig;
|
||||
} meshtastic_LocalConfig;
|
||||
|
||||
typedef struct _LocalModuleConfig {
|
||||
typedef struct _meshtastic_LocalModuleConfig {
|
||||
/* The part of the config that is specific to the MQTT module */
|
||||
bool has_mqtt;
|
||||
ModuleConfig_MQTTConfig mqtt;
|
||||
meshtastic_ModuleConfig_MQTTConfig mqtt;
|
||||
/* The part of the config that is specific to the Serial module */
|
||||
bool has_serial;
|
||||
ModuleConfig_SerialConfig serial;
|
||||
meshtastic_ModuleConfig_SerialConfig serial;
|
||||
/* The part of the config that is specific to the ExternalNotification module */
|
||||
bool has_external_notification;
|
||||
ModuleConfig_ExternalNotificationConfig external_notification;
|
||||
meshtastic_ModuleConfig_ExternalNotificationConfig external_notification;
|
||||
/* The part of the config that is specific to the Store & Forward module */
|
||||
bool has_store_forward;
|
||||
ModuleConfig_StoreForwardConfig store_forward;
|
||||
meshtastic_ModuleConfig_StoreForwardConfig store_forward;
|
||||
/* The part of the config that is specific to the RangeTest module */
|
||||
bool has_range_test;
|
||||
ModuleConfig_RangeTestConfig range_test;
|
||||
meshtastic_ModuleConfig_RangeTestConfig range_test;
|
||||
/* The part of the config that is specific to the Telemetry module */
|
||||
bool has_telemetry;
|
||||
ModuleConfig_TelemetryConfig telemetry;
|
||||
meshtastic_ModuleConfig_TelemetryConfig telemetry;
|
||||
/* The part of the config that is specific to the Canned Message module */
|
||||
bool has_canned_message;
|
||||
ModuleConfig_CannedMessageConfig canned_message;
|
||||
meshtastic_ModuleConfig_CannedMessageConfig canned_message;
|
||||
/* 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_t version;
|
||||
/* The part of the config that is specific to the Audio module */
|
||||
bool has_audio;
|
||||
ModuleConfig_AudioConfig audio;
|
||||
meshtastic_ModuleConfig_AudioConfig audio;
|
||||
/* The part of the config that is specific to the Remote Hardware module */
|
||||
bool has_remote_hardware;
|
||||
ModuleConfig_RemoteHardwareConfig remote_hardware;
|
||||
} LocalModuleConfig;
|
||||
meshtastic_ModuleConfig_RemoteHardwareConfig remote_hardware;
|
||||
} meshtastic_LocalModuleConfig;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -80,33 +80,33 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define LocalConfig_init_default {false, Config_DeviceConfig_init_default, false, Config_PositionConfig_init_default, false, Config_PowerConfig_init_default, false, Config_NetworkConfig_init_default, false, Config_DisplayConfig_init_default, false, Config_LoRaConfig_init_default, false, Config_BluetoothConfig_init_default, 0}
|
||||
#define LocalModuleConfig_init_default {false, ModuleConfig_MQTTConfig_init_default, false, ModuleConfig_SerialConfig_init_default, false, ModuleConfig_ExternalNotificationConfig_init_default, false, ModuleConfig_StoreForwardConfig_init_default, false, ModuleConfig_RangeTestConfig_init_default, false, ModuleConfig_TelemetryConfig_init_default, false, ModuleConfig_CannedMessageConfig_init_default, 0, false, ModuleConfig_AudioConfig_init_default, false, ModuleConfig_RemoteHardwareConfig_init_default}
|
||||
#define LocalConfig_init_zero {false, Config_DeviceConfig_init_zero, false, Config_PositionConfig_init_zero, false, Config_PowerConfig_init_zero, false, Config_NetworkConfig_init_zero, false, Config_DisplayConfig_init_zero, false, Config_LoRaConfig_init_zero, false, Config_BluetoothConfig_init_zero, 0}
|
||||
#define LocalModuleConfig_init_zero {false, ModuleConfig_MQTTConfig_init_zero, false, ModuleConfig_SerialConfig_init_zero, false, ModuleConfig_ExternalNotificationConfig_init_zero, false, ModuleConfig_StoreForwardConfig_init_zero, false, ModuleConfig_RangeTestConfig_init_zero, false, ModuleConfig_TelemetryConfig_init_zero, false, ModuleConfig_CannedMessageConfig_init_zero, 0, false, ModuleConfig_AudioConfig_init_zero, false, ModuleConfig_RemoteHardwareConfig_init_zero}
|
||||
#define meshtastic_LocalConfig_init_default {false, meshtastic_Config_DeviceConfig_init_default, false, meshtastic_Config_PositionConfig_init_default, false, meshtastic_Config_PowerConfig_init_default, false, meshtastic_Config_NetworkConfig_init_default, false, meshtastic_Config_DisplayConfig_init_default, false, meshtastic_Config_LoRaConfig_init_default, false, meshtastic_Config_BluetoothConfig_init_default, 0}
|
||||
#define meshtastic_LocalModuleConfig_init_default {false, meshtastic_ModuleConfig_MQTTConfig_init_default, false, meshtastic_ModuleConfig_SerialConfig_init_default, false, meshtastic_ModuleConfig_ExternalNotificationConfig_init_default, false, meshtastic_ModuleConfig_StoreForwardConfig_init_default, false, meshtastic_ModuleConfig_RangeTestConfig_init_default, false, meshtastic_ModuleConfig_TelemetryConfig_init_default, false, meshtastic_ModuleConfig_CannedMessageConfig_init_default, 0, false, meshtastic_ModuleConfig_AudioConfig_init_default, false, meshtastic_ModuleConfig_RemoteHardwareConfig_init_default}
|
||||
#define meshtastic_LocalConfig_init_zero {false, meshtastic_Config_DeviceConfig_init_zero, false, meshtastic_Config_PositionConfig_init_zero, false, meshtastic_Config_PowerConfig_init_zero, false, meshtastic_Config_NetworkConfig_init_zero, false, meshtastic_Config_DisplayConfig_init_zero, false, meshtastic_Config_LoRaConfig_init_zero, false, meshtastic_Config_BluetoothConfig_init_zero, 0}
|
||||
#define meshtastic_LocalModuleConfig_init_zero {false, meshtastic_ModuleConfig_MQTTConfig_init_zero, false, meshtastic_ModuleConfig_SerialConfig_init_zero, false, meshtastic_ModuleConfig_ExternalNotificationConfig_init_zero, false, meshtastic_ModuleConfig_StoreForwardConfig_init_zero, false, meshtastic_ModuleConfig_RangeTestConfig_init_zero, false, meshtastic_ModuleConfig_TelemetryConfig_init_zero, false, meshtastic_ModuleConfig_CannedMessageConfig_init_zero, 0, false, meshtastic_ModuleConfig_AudioConfig_init_zero, false, meshtastic_ModuleConfig_RemoteHardwareConfig_init_zero}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define LocalConfig_device_tag 1
|
||||
#define LocalConfig_position_tag 2
|
||||
#define LocalConfig_power_tag 3
|
||||
#define LocalConfig_network_tag 4
|
||||
#define LocalConfig_display_tag 5
|
||||
#define LocalConfig_lora_tag 6
|
||||
#define LocalConfig_bluetooth_tag 7
|
||||
#define LocalConfig_version_tag 8
|
||||
#define LocalModuleConfig_mqtt_tag 1
|
||||
#define LocalModuleConfig_serial_tag 2
|
||||
#define LocalModuleConfig_external_notification_tag 3
|
||||
#define LocalModuleConfig_store_forward_tag 4
|
||||
#define LocalModuleConfig_range_test_tag 5
|
||||
#define LocalModuleConfig_telemetry_tag 6
|
||||
#define LocalModuleConfig_canned_message_tag 7
|
||||
#define LocalModuleConfig_version_tag 8
|
||||
#define LocalModuleConfig_audio_tag 9
|
||||
#define LocalModuleConfig_remote_hardware_tag 10
|
||||
#define meshtastic_LocalConfig_device_tag 1
|
||||
#define meshtastic_LocalConfig_position_tag 2
|
||||
#define meshtastic_LocalConfig_power_tag 3
|
||||
#define meshtastic_LocalConfig_network_tag 4
|
||||
#define meshtastic_LocalConfig_display_tag 5
|
||||
#define meshtastic_LocalConfig_lora_tag 6
|
||||
#define meshtastic_LocalConfig_bluetooth_tag 7
|
||||
#define meshtastic_LocalConfig_version_tag 8
|
||||
#define meshtastic_LocalModuleConfig_mqtt_tag 1
|
||||
#define meshtastic_LocalModuleConfig_serial_tag 2
|
||||
#define meshtastic_LocalModuleConfig_external_notification_tag 3
|
||||
#define meshtastic_LocalModuleConfig_store_forward_tag 4
|
||||
#define meshtastic_LocalModuleConfig_range_test_tag 5
|
||||
#define meshtastic_LocalModuleConfig_telemetry_tag 6
|
||||
#define meshtastic_LocalModuleConfig_canned_message_tag 7
|
||||
#define meshtastic_LocalModuleConfig_version_tag 8
|
||||
#define meshtastic_LocalModuleConfig_audio_tag 9
|
||||
#define meshtastic_LocalModuleConfig_remote_hardware_tag 10
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define LocalConfig_FIELDLIST(X, a) \
|
||||
#define meshtastic_LocalConfig_FIELDLIST(X, a) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, device, 1) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, position, 2) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, power, 3) \
|
||||
@@ -115,17 +115,17 @@ X(a, STATIC, OPTIONAL, MESSAGE, display, 5) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, lora, 6) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, bluetooth, 7) \
|
||||
X(a, STATIC, SINGULAR, UINT32, version, 8)
|
||||
#define LocalConfig_CALLBACK NULL
|
||||
#define LocalConfig_DEFAULT NULL
|
||||
#define LocalConfig_device_MSGTYPE Config_DeviceConfig
|
||||
#define LocalConfig_position_MSGTYPE Config_PositionConfig
|
||||
#define LocalConfig_power_MSGTYPE Config_PowerConfig
|
||||
#define LocalConfig_network_MSGTYPE Config_NetworkConfig
|
||||
#define LocalConfig_display_MSGTYPE Config_DisplayConfig
|
||||
#define LocalConfig_lora_MSGTYPE Config_LoRaConfig
|
||||
#define LocalConfig_bluetooth_MSGTYPE Config_BluetoothConfig
|
||||
#define meshtastic_LocalConfig_CALLBACK NULL
|
||||
#define meshtastic_LocalConfig_DEFAULT NULL
|
||||
#define meshtastic_LocalConfig_device_MSGTYPE meshtastic_Config_DeviceConfig
|
||||
#define meshtastic_LocalConfig_position_MSGTYPE meshtastic_Config_PositionConfig
|
||||
#define meshtastic_LocalConfig_power_MSGTYPE meshtastic_Config_PowerConfig
|
||||
#define meshtastic_LocalConfig_network_MSGTYPE meshtastic_Config_NetworkConfig
|
||||
#define meshtastic_LocalConfig_display_MSGTYPE meshtastic_Config_DisplayConfig
|
||||
#define meshtastic_LocalConfig_lora_MSGTYPE meshtastic_Config_LoRaConfig
|
||||
#define meshtastic_LocalConfig_bluetooth_MSGTYPE meshtastic_Config_BluetoothConfig
|
||||
|
||||
#define LocalModuleConfig_FIELDLIST(X, a) \
|
||||
#define meshtastic_LocalModuleConfig_FIELDLIST(X, a) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, mqtt, 1) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, serial, 2) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, external_notification, 3) \
|
||||
@@ -136,28 +136,28 @@ X(a, STATIC, OPTIONAL, MESSAGE, canned_message, 7) \
|
||||
X(a, STATIC, SINGULAR, UINT32, version, 8) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, audio, 9) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, remote_hardware, 10)
|
||||
#define LocalModuleConfig_CALLBACK NULL
|
||||
#define LocalModuleConfig_DEFAULT NULL
|
||||
#define LocalModuleConfig_mqtt_MSGTYPE ModuleConfig_MQTTConfig
|
||||
#define LocalModuleConfig_serial_MSGTYPE ModuleConfig_SerialConfig
|
||||
#define LocalModuleConfig_external_notification_MSGTYPE ModuleConfig_ExternalNotificationConfig
|
||||
#define LocalModuleConfig_store_forward_MSGTYPE ModuleConfig_StoreForwardConfig
|
||||
#define LocalModuleConfig_range_test_MSGTYPE ModuleConfig_RangeTestConfig
|
||||
#define LocalModuleConfig_telemetry_MSGTYPE ModuleConfig_TelemetryConfig
|
||||
#define LocalModuleConfig_canned_message_MSGTYPE ModuleConfig_CannedMessageConfig
|
||||
#define LocalModuleConfig_audio_MSGTYPE ModuleConfig_AudioConfig
|
||||
#define LocalModuleConfig_remote_hardware_MSGTYPE ModuleConfig_RemoteHardwareConfig
|
||||
#define meshtastic_LocalModuleConfig_CALLBACK NULL
|
||||
#define meshtastic_LocalModuleConfig_DEFAULT NULL
|
||||
#define meshtastic_LocalModuleConfig_mqtt_MSGTYPE meshtastic_ModuleConfig_MQTTConfig
|
||||
#define meshtastic_LocalModuleConfig_serial_MSGTYPE meshtastic_ModuleConfig_SerialConfig
|
||||
#define meshtastic_LocalModuleConfig_external_notification_MSGTYPE meshtastic_ModuleConfig_ExternalNotificationConfig
|
||||
#define meshtastic_LocalModuleConfig_store_forward_MSGTYPE meshtastic_ModuleConfig_StoreForwardConfig
|
||||
#define meshtastic_LocalModuleConfig_range_test_MSGTYPE meshtastic_ModuleConfig_RangeTestConfig
|
||||
#define meshtastic_LocalModuleConfig_telemetry_MSGTYPE meshtastic_ModuleConfig_TelemetryConfig
|
||||
#define meshtastic_LocalModuleConfig_canned_message_MSGTYPE meshtastic_ModuleConfig_CannedMessageConfig
|
||||
#define meshtastic_LocalModuleConfig_audio_MSGTYPE meshtastic_ModuleConfig_AudioConfig
|
||||
#define meshtastic_LocalModuleConfig_remote_hardware_MSGTYPE meshtastic_ModuleConfig_RemoteHardwareConfig
|
||||
|
||||
extern const pb_msgdesc_t LocalConfig_msg;
|
||||
extern const pb_msgdesc_t LocalModuleConfig_msg;
|
||||
extern const pb_msgdesc_t meshtastic_LocalConfig_msg;
|
||||
extern const pb_msgdesc_t meshtastic_LocalModuleConfig_msg;
|
||||
|
||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||
#define LocalConfig_fields &LocalConfig_msg
|
||||
#define LocalModuleConfig_fields &LocalModuleConfig_msg
|
||||
#define meshtastic_LocalConfig_fields &meshtastic_LocalConfig_msg
|
||||
#define meshtastic_LocalModuleConfig_fields &meshtastic_LocalModuleConfig_msg
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define LocalConfig_size 425
|
||||
#define LocalModuleConfig_size 412
|
||||
#define meshtastic_LocalConfig_size 434
|
||||
#define meshtastic_LocalModuleConfig_size 412
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
@@ -1,51 +1,51 @@
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.4.7 */
|
||||
|
||||
#include "./mesh.pb.h"
|
||||
#include "meshtastic/mesh.pb.h"
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
PB_BIND(Position, Position, AUTO)
|
||||
PB_BIND(meshtastic_Position, meshtastic_Position, AUTO)
|
||||
|
||||
|
||||
PB_BIND(User, User, AUTO)
|
||||
PB_BIND(meshtastic_User, meshtastic_User, AUTO)
|
||||
|
||||
|
||||
PB_BIND(RouteDiscovery, RouteDiscovery, AUTO)
|
||||
PB_BIND(meshtastic_RouteDiscovery, meshtastic_RouteDiscovery, AUTO)
|
||||
|
||||
|
||||
PB_BIND(Routing, Routing, AUTO)
|
||||
PB_BIND(meshtastic_Routing, meshtastic_Routing, AUTO)
|
||||
|
||||
|
||||
PB_BIND(Data, Data, 2)
|
||||
PB_BIND(meshtastic_Data, meshtastic_Data, 2)
|
||||
|
||||
|
||||
PB_BIND(Waypoint, Waypoint, AUTO)
|
||||
PB_BIND(meshtastic_Waypoint, meshtastic_Waypoint, AUTO)
|
||||
|
||||
|
||||
PB_BIND(MeshPacket, MeshPacket, 2)
|
||||
PB_BIND(meshtastic_MeshPacket, meshtastic_MeshPacket, 2)
|
||||
|
||||
|
||||
PB_BIND(NodeInfo, NodeInfo, AUTO)
|
||||
PB_BIND(meshtastic_NodeInfo, meshtastic_NodeInfo, AUTO)
|
||||
|
||||
|
||||
PB_BIND(MyNodeInfo, MyNodeInfo, AUTO)
|
||||
PB_BIND(meshtastic_MyNodeInfo, meshtastic_MyNodeInfo, AUTO)
|
||||
|
||||
|
||||
PB_BIND(LogRecord, LogRecord, AUTO)
|
||||
PB_BIND(meshtastic_LogRecord, meshtastic_LogRecord, AUTO)
|
||||
|
||||
|
||||
PB_BIND(QueueStatus, QueueStatus, AUTO)
|
||||
PB_BIND(meshtastic_QueueStatus, meshtastic_QueueStatus, AUTO)
|
||||
|
||||
|
||||
PB_BIND(FromRadio, FromRadio, 2)
|
||||
PB_BIND(meshtastic_FromRadio, meshtastic_FromRadio, 2)
|
||||
|
||||
|
||||
PB_BIND(ToRadio, ToRadio, 2)
|
||||
PB_BIND(meshtastic_ToRadio, meshtastic_ToRadio, 2)
|
||||
|
||||
|
||||
PB_BIND(Compressed, Compressed, AUTO)
|
||||
PB_BIND(meshtastic_Compressed, meshtastic_Compressed, AUTO)
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,39 +1,39 @@
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.4.7 */
|
||||
|
||||
#include "./module_config.pb.h"
|
||||
#include "meshtastic/module_config.pb.h"
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
PB_BIND(ModuleConfig, ModuleConfig, AUTO)
|
||||
PB_BIND(meshtastic_ModuleConfig, meshtastic_ModuleConfig, AUTO)
|
||||
|
||||
|
||||
PB_BIND(ModuleConfig_MQTTConfig, ModuleConfig_MQTTConfig, AUTO)
|
||||
PB_BIND(meshtastic_ModuleConfig_MQTTConfig, meshtastic_ModuleConfig_MQTTConfig, AUTO)
|
||||
|
||||
|
||||
PB_BIND(ModuleConfig_RemoteHardwareConfig, ModuleConfig_RemoteHardwareConfig, AUTO)
|
||||
PB_BIND(meshtastic_ModuleConfig_RemoteHardwareConfig, meshtastic_ModuleConfig_RemoteHardwareConfig, AUTO)
|
||||
|
||||
|
||||
PB_BIND(ModuleConfig_AudioConfig, ModuleConfig_AudioConfig, AUTO)
|
||||
PB_BIND(meshtastic_ModuleConfig_AudioConfig, meshtastic_ModuleConfig_AudioConfig, AUTO)
|
||||
|
||||
|
||||
PB_BIND(ModuleConfig_SerialConfig, ModuleConfig_SerialConfig, AUTO)
|
||||
PB_BIND(meshtastic_ModuleConfig_SerialConfig, meshtastic_ModuleConfig_SerialConfig, AUTO)
|
||||
|
||||
|
||||
PB_BIND(ModuleConfig_ExternalNotificationConfig, ModuleConfig_ExternalNotificationConfig, AUTO)
|
||||
PB_BIND(meshtastic_ModuleConfig_ExternalNotificationConfig, meshtastic_ModuleConfig_ExternalNotificationConfig, AUTO)
|
||||
|
||||
|
||||
PB_BIND(ModuleConfig_StoreForwardConfig, ModuleConfig_StoreForwardConfig, AUTO)
|
||||
PB_BIND(meshtastic_ModuleConfig_StoreForwardConfig, meshtastic_ModuleConfig_StoreForwardConfig, AUTO)
|
||||
|
||||
|
||||
PB_BIND(ModuleConfig_RangeTestConfig, ModuleConfig_RangeTestConfig, AUTO)
|
||||
PB_BIND(meshtastic_ModuleConfig_RangeTestConfig, meshtastic_ModuleConfig_RangeTestConfig, AUTO)
|
||||
|
||||
|
||||
PB_BIND(ModuleConfig_TelemetryConfig, ModuleConfig_TelemetryConfig, AUTO)
|
||||
PB_BIND(meshtastic_ModuleConfig_TelemetryConfig, meshtastic_ModuleConfig_TelemetryConfig, AUTO)
|
||||
|
||||
|
||||
PB_BIND(ModuleConfig_CannedMessageConfig, ModuleConfig_CannedMessageConfig, AUTO)
|
||||
PB_BIND(meshtastic_ModuleConfig_CannedMessageConfig, meshtastic_ModuleConfig_CannedMessageConfig, AUTO)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -11,70 +11,70 @@
|
||||
|
||||
/* Enum definitions */
|
||||
/* Baudrate for codec2 voice */
|
||||
typedef enum _ModuleConfig_AudioConfig_Audio_Baud {
|
||||
ModuleConfig_AudioConfig_Audio_Baud_CODEC2_DEFAULT = 0,
|
||||
ModuleConfig_AudioConfig_Audio_Baud_CODEC2_3200 = 1,
|
||||
ModuleConfig_AudioConfig_Audio_Baud_CODEC2_2400 = 2,
|
||||
ModuleConfig_AudioConfig_Audio_Baud_CODEC2_1600 = 3,
|
||||
ModuleConfig_AudioConfig_Audio_Baud_CODEC2_1400 = 4,
|
||||
ModuleConfig_AudioConfig_Audio_Baud_CODEC2_1300 = 5,
|
||||
ModuleConfig_AudioConfig_Audio_Baud_CODEC2_1200 = 6,
|
||||
ModuleConfig_AudioConfig_Audio_Baud_CODEC2_700 = 7,
|
||||
ModuleConfig_AudioConfig_Audio_Baud_CODEC2_700B = 8
|
||||
} ModuleConfig_AudioConfig_Audio_Baud;
|
||||
typedef enum _meshtastic_ModuleConfig_AudioConfig_Audio_Baud {
|
||||
meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_DEFAULT = 0,
|
||||
meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_3200 = 1,
|
||||
meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_2400 = 2,
|
||||
meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_1600 = 3,
|
||||
meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_1400 = 4,
|
||||
meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_1300 = 5,
|
||||
meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_1200 = 6,
|
||||
meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_700 = 7,
|
||||
meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_700B = 8
|
||||
} meshtastic_ModuleConfig_AudioConfig_Audio_Baud;
|
||||
|
||||
/* TODO: REPLACE */
|
||||
typedef enum _ModuleConfig_SerialConfig_Serial_Baud {
|
||||
ModuleConfig_SerialConfig_Serial_Baud_BAUD_DEFAULT = 0,
|
||||
ModuleConfig_SerialConfig_Serial_Baud_BAUD_110 = 1,
|
||||
ModuleConfig_SerialConfig_Serial_Baud_BAUD_300 = 2,
|
||||
ModuleConfig_SerialConfig_Serial_Baud_BAUD_600 = 3,
|
||||
ModuleConfig_SerialConfig_Serial_Baud_BAUD_1200 = 4,
|
||||
ModuleConfig_SerialConfig_Serial_Baud_BAUD_2400 = 5,
|
||||
ModuleConfig_SerialConfig_Serial_Baud_BAUD_4800 = 6,
|
||||
ModuleConfig_SerialConfig_Serial_Baud_BAUD_9600 = 7,
|
||||
ModuleConfig_SerialConfig_Serial_Baud_BAUD_19200 = 8,
|
||||
ModuleConfig_SerialConfig_Serial_Baud_BAUD_38400 = 9,
|
||||
ModuleConfig_SerialConfig_Serial_Baud_BAUD_57600 = 10,
|
||||
ModuleConfig_SerialConfig_Serial_Baud_BAUD_115200 = 11,
|
||||
ModuleConfig_SerialConfig_Serial_Baud_BAUD_230400 = 12,
|
||||
ModuleConfig_SerialConfig_Serial_Baud_BAUD_460800 = 13,
|
||||
ModuleConfig_SerialConfig_Serial_Baud_BAUD_576000 = 14,
|
||||
ModuleConfig_SerialConfig_Serial_Baud_BAUD_921600 = 15
|
||||
} ModuleConfig_SerialConfig_Serial_Baud;
|
||||
typedef enum _meshtastic_ModuleConfig_SerialConfig_Serial_Baud {
|
||||
meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_DEFAULT = 0,
|
||||
meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_110 = 1,
|
||||
meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_300 = 2,
|
||||
meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_600 = 3,
|
||||
meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_1200 = 4,
|
||||
meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_2400 = 5,
|
||||
meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_4800 = 6,
|
||||
meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_9600 = 7,
|
||||
meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_19200 = 8,
|
||||
meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_38400 = 9,
|
||||
meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_57600 = 10,
|
||||
meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_115200 = 11,
|
||||
meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_230400 = 12,
|
||||
meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_460800 = 13,
|
||||
meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_576000 = 14,
|
||||
meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_921600 = 15
|
||||
} meshtastic_ModuleConfig_SerialConfig_Serial_Baud;
|
||||
|
||||
/* TODO: REPLACE */
|
||||
typedef enum _ModuleConfig_SerialConfig_Serial_Mode {
|
||||
ModuleConfig_SerialConfig_Serial_Mode_DEFAULT = 0,
|
||||
ModuleConfig_SerialConfig_Serial_Mode_SIMPLE = 1,
|
||||
ModuleConfig_SerialConfig_Serial_Mode_PROTO = 2,
|
||||
ModuleConfig_SerialConfig_Serial_Mode_TEXTMSG = 3,
|
||||
ModuleConfig_SerialConfig_Serial_Mode_NMEA = 4
|
||||
} ModuleConfig_SerialConfig_Serial_Mode;
|
||||
typedef enum _meshtastic_ModuleConfig_SerialConfig_Serial_Mode {
|
||||
meshtastic_ModuleConfig_SerialConfig_Serial_Mode_DEFAULT = 0,
|
||||
meshtastic_ModuleConfig_SerialConfig_Serial_Mode_SIMPLE = 1,
|
||||
meshtastic_ModuleConfig_SerialConfig_Serial_Mode_PROTO = 2,
|
||||
meshtastic_ModuleConfig_SerialConfig_Serial_Mode_TEXTMSG = 3,
|
||||
meshtastic_ModuleConfig_SerialConfig_Serial_Mode_NMEA = 4
|
||||
} meshtastic_ModuleConfig_SerialConfig_Serial_Mode;
|
||||
|
||||
/* TODO: REPLACE */
|
||||
typedef enum _ModuleConfig_CannedMessageConfig_InputEventChar {
|
||||
typedef enum _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar {
|
||||
/* TODO: REPLACE */
|
||||
ModuleConfig_CannedMessageConfig_InputEventChar_NONE = 0,
|
||||
meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE = 0,
|
||||
/* TODO: REPLACE */
|
||||
ModuleConfig_CannedMessageConfig_InputEventChar_UP = 17,
|
||||
meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_UP = 17,
|
||||
/* TODO: REPLACE */
|
||||
ModuleConfig_CannedMessageConfig_InputEventChar_DOWN = 18,
|
||||
meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_DOWN = 18,
|
||||
/* TODO: REPLACE */
|
||||
ModuleConfig_CannedMessageConfig_InputEventChar_LEFT = 19,
|
||||
meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT = 19,
|
||||
/* TODO: REPLACE */
|
||||
ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT = 20,
|
||||
meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT = 20,
|
||||
/* '\n' */
|
||||
ModuleConfig_CannedMessageConfig_InputEventChar_SELECT = 10,
|
||||
meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_SELECT = 10,
|
||||
/* TODO: REPLACE */
|
||||
ModuleConfig_CannedMessageConfig_InputEventChar_BACK = 27,
|
||||
meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_BACK = 27,
|
||||
/* TODO: REPLACE */
|
||||
ModuleConfig_CannedMessageConfig_InputEventChar_CANCEL = 24
|
||||
} ModuleConfig_CannedMessageConfig_InputEventChar;
|
||||
meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_CANCEL = 24
|
||||
} meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar;
|
||||
|
||||
/* Struct definitions */
|
||||
/* MQTT Client Config */
|
||||
typedef struct _ModuleConfig_MQTTConfig {
|
||||
typedef struct _meshtastic_ModuleConfig_MQTTConfig {
|
||||
/* If a meshtastic node is able to reach the internet it will normally attempt to gateway any channels that are marked as
|
||||
is_uplink_enabled or is_downlink_enabled. */
|
||||
bool enabled;
|
||||
@@ -96,22 +96,22 @@ typedef struct _ModuleConfig_MQTTConfig {
|
||||
bool encryption_enabled;
|
||||
/* Whether to send / consume json packets on MQTT */
|
||||
bool json_enabled;
|
||||
} ModuleConfig_MQTTConfig;
|
||||
} meshtastic_ModuleConfig_MQTTConfig;
|
||||
|
||||
/* RemoteHardwareModule Config */
|
||||
typedef struct _ModuleConfig_RemoteHardwareConfig {
|
||||
typedef struct _meshtastic_ModuleConfig_RemoteHardwareConfig {
|
||||
/* Whether the Module is enabled */
|
||||
bool enabled;
|
||||
} ModuleConfig_RemoteHardwareConfig;
|
||||
} meshtastic_ModuleConfig_RemoteHardwareConfig;
|
||||
|
||||
/* Audio Config for codec2 voice */
|
||||
typedef struct _ModuleConfig_AudioConfig {
|
||||
typedef struct _meshtastic_ModuleConfig_AudioConfig {
|
||||
/* Whether Audio is enabled */
|
||||
bool codec2_enabled;
|
||||
/* PTT Pin */
|
||||
uint8_t ptt_pin;
|
||||
/* The audio sample rate to use for codec2 */
|
||||
ModuleConfig_AudioConfig_Audio_Baud bitrate;
|
||||
meshtastic_ModuleConfig_AudioConfig_Audio_Baud bitrate;
|
||||
/* I2S Word Select */
|
||||
uint8_t i2s_ws;
|
||||
/* I2S Data IN */
|
||||
@@ -120,10 +120,10 @@ typedef struct _ModuleConfig_AudioConfig {
|
||||
uint8_t i2s_din;
|
||||
/* I2S Clock */
|
||||
uint8_t i2s_sck;
|
||||
} ModuleConfig_AudioConfig;
|
||||
} meshtastic_ModuleConfig_AudioConfig;
|
||||
|
||||
/* Serial Config */
|
||||
typedef struct _ModuleConfig_SerialConfig {
|
||||
typedef struct _meshtastic_ModuleConfig_SerialConfig {
|
||||
/* Preferences for the SerialModule
|
||||
FIXME - Move this out of UserPreferences and into a section for module configuration. */
|
||||
bool enabled;
|
||||
@@ -134,15 +134,15 @@ typedef struct _ModuleConfig_SerialConfig {
|
||||
/* TODO: REPLACE */
|
||||
uint32_t txd;
|
||||
/* TODO: REPLACE */
|
||||
ModuleConfig_SerialConfig_Serial_Baud baud;
|
||||
meshtastic_ModuleConfig_SerialConfig_Serial_Baud baud;
|
||||
/* TODO: REPLACE */
|
||||
uint32_t timeout;
|
||||
/* TODO: REPLACE */
|
||||
ModuleConfig_SerialConfig_Serial_Mode mode;
|
||||
} ModuleConfig_SerialConfig;
|
||||
meshtastic_ModuleConfig_SerialConfig_Serial_Mode mode;
|
||||
} meshtastic_ModuleConfig_SerialConfig;
|
||||
|
||||
/* External Notifications Config */
|
||||
typedef struct _ModuleConfig_ExternalNotificationConfig {
|
||||
typedef struct _meshtastic_ModuleConfig_ExternalNotificationConfig {
|
||||
/* Enable the ExternalNotificationModule */
|
||||
bool enabled;
|
||||
/* When using in On/Off mode, keep the output on for this many
|
||||
@@ -181,10 +181,10 @@ typedef struct _ModuleConfig_ExternalNotificationConfig {
|
||||
Default is 0 which means don't repeat at all. 60 would mean blink
|
||||
and/or beep for 60 seconds */
|
||||
uint16_t nag_timeout;
|
||||
} ModuleConfig_ExternalNotificationConfig;
|
||||
} meshtastic_ModuleConfig_ExternalNotificationConfig;
|
||||
|
||||
/* Store and Forward Module Config */
|
||||
typedef struct _ModuleConfig_StoreForwardConfig {
|
||||
typedef struct _meshtastic_ModuleConfig_StoreForwardConfig {
|
||||
/* Enable the Store and Forward Module */
|
||||
bool enabled;
|
||||
/* TODO: REPLACE */
|
||||
@@ -195,10 +195,10 @@ typedef struct _ModuleConfig_StoreForwardConfig {
|
||||
uint32_t history_return_max;
|
||||
/* TODO: REPLACE */
|
||||
uint32_t history_return_window;
|
||||
} ModuleConfig_StoreForwardConfig;
|
||||
} meshtastic_ModuleConfig_StoreForwardConfig;
|
||||
|
||||
/* Preferences for the RangeTestModule */
|
||||
typedef struct _ModuleConfig_RangeTestConfig {
|
||||
typedef struct _meshtastic_ModuleConfig_RangeTestConfig {
|
||||
/* Enable the Range Test Module */
|
||||
bool enabled;
|
||||
/* Send out range test messages from this node */
|
||||
@@ -206,10 +206,10 @@ typedef struct _ModuleConfig_RangeTestConfig {
|
||||
/* Bool value indicating that this node should save a RangeTest.csv file.
|
||||
ESP32 Only */
|
||||
bool save;
|
||||
} ModuleConfig_RangeTestConfig;
|
||||
} meshtastic_ModuleConfig_RangeTestConfig;
|
||||
|
||||
/* Configuration for both device and environment metrics */
|
||||
typedef struct _ModuleConfig_TelemetryConfig {
|
||||
typedef struct _meshtastic_ModuleConfig_TelemetryConfig {
|
||||
/* Interval in seconds of how often we should try to send our
|
||||
device metrics to the mesh */
|
||||
uint32_t device_update_interval;
|
||||
@@ -222,10 +222,10 @@ typedef struct _ModuleConfig_TelemetryConfig {
|
||||
/* We'll always read the sensor in Celsius, but sometimes we might want to
|
||||
display the results in Fahrenheit as a "user preference". */
|
||||
bool environment_display_fahrenheit;
|
||||
} ModuleConfig_TelemetryConfig;
|
||||
} meshtastic_ModuleConfig_TelemetryConfig;
|
||||
|
||||
/* TODO: REPLACE */
|
||||
typedef struct _ModuleConfig_CannedMessageConfig {
|
||||
typedef struct _meshtastic_ModuleConfig_CannedMessageConfig {
|
||||
/* Enable the rotary encoder #1. This is a 'dumb' encoder sending pulses on both A and B pins while rotating. */
|
||||
bool rotary1_enabled;
|
||||
/* GPIO pin for rotary encoder A port. */
|
||||
@@ -235,11 +235,11 @@ typedef struct _ModuleConfig_CannedMessageConfig {
|
||||
/* GPIO pin for rotary encoder Press port. */
|
||||
uint32_t inputbroker_pin_press;
|
||||
/* Generate input event on CW of this kind. */
|
||||
ModuleConfig_CannedMessageConfig_InputEventChar inputbroker_event_cw;
|
||||
meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar inputbroker_event_cw;
|
||||
/* Generate input event on CCW of this kind. */
|
||||
ModuleConfig_CannedMessageConfig_InputEventChar inputbroker_event_ccw;
|
||||
meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar inputbroker_event_ccw;
|
||||
/* Generate input event on Press of this kind. */
|
||||
ModuleConfig_CannedMessageConfig_InputEventChar inputbroker_event_press;
|
||||
meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar inputbroker_event_press;
|
||||
/* Enable the Up/Down/Select input device. Can be RAK rotary encoder or 3 buttons. Uses the a/b/press definitions from inputbroker. */
|
||||
bool updown1_enabled;
|
||||
/* Enable/disable CannedMessageModule. */
|
||||
@@ -250,32 +250,32 @@ typedef struct _ModuleConfig_CannedMessageConfig {
|
||||
/* CannedMessageModule also sends a bell character with the messages.
|
||||
ExternalNotificationModule can benefit from this feature. */
|
||||
bool send_bell;
|
||||
} ModuleConfig_CannedMessageConfig;
|
||||
} meshtastic_ModuleConfig_CannedMessageConfig;
|
||||
|
||||
/* Module Config */
|
||||
typedef struct _ModuleConfig {
|
||||
typedef struct _meshtastic_ModuleConfig {
|
||||
pb_size_t which_payload_variant;
|
||||
union {
|
||||
/* TODO: REPLACE */
|
||||
ModuleConfig_MQTTConfig mqtt;
|
||||
meshtastic_ModuleConfig_MQTTConfig mqtt;
|
||||
/* TODO: REPLACE */
|
||||
ModuleConfig_SerialConfig serial;
|
||||
meshtastic_ModuleConfig_SerialConfig serial;
|
||||
/* TODO: REPLACE */
|
||||
ModuleConfig_ExternalNotificationConfig external_notification;
|
||||
meshtastic_ModuleConfig_ExternalNotificationConfig external_notification;
|
||||
/* TODO: REPLACE */
|
||||
ModuleConfig_StoreForwardConfig store_forward;
|
||||
meshtastic_ModuleConfig_StoreForwardConfig store_forward;
|
||||
/* TODO: REPLACE */
|
||||
ModuleConfig_RangeTestConfig range_test;
|
||||
meshtastic_ModuleConfig_RangeTestConfig range_test;
|
||||
/* TODO: REPLACE */
|
||||
ModuleConfig_TelemetryConfig telemetry;
|
||||
meshtastic_ModuleConfig_TelemetryConfig telemetry;
|
||||
/* TODO: REPLACE */
|
||||
ModuleConfig_CannedMessageConfig canned_message;
|
||||
meshtastic_ModuleConfig_CannedMessageConfig canned_message;
|
||||
/* TODO: REPLACE */
|
||||
ModuleConfig_AudioConfig audio;
|
||||
meshtastic_ModuleConfig_AudioConfig audio;
|
||||
/* TODO: REPLACE */
|
||||
ModuleConfig_RemoteHardwareConfig remote_hardware;
|
||||
meshtastic_ModuleConfig_RemoteHardwareConfig remote_hardware;
|
||||
} payload_variant;
|
||||
} ModuleConfig;
|
||||
} meshtastic_ModuleConfig;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -283,133 +283,133 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Helper constants for enums */
|
||||
#define _ModuleConfig_AudioConfig_Audio_Baud_MIN ModuleConfig_AudioConfig_Audio_Baud_CODEC2_DEFAULT
|
||||
#define _ModuleConfig_AudioConfig_Audio_Baud_MAX ModuleConfig_AudioConfig_Audio_Baud_CODEC2_700B
|
||||
#define _ModuleConfig_AudioConfig_Audio_Baud_ARRAYSIZE ((ModuleConfig_AudioConfig_Audio_Baud)(ModuleConfig_AudioConfig_Audio_Baud_CODEC2_700B+1))
|
||||
#define _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_MIN meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_DEFAULT
|
||||
#define _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_MAX meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_700B
|
||||
#define _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_ARRAYSIZE ((meshtastic_ModuleConfig_AudioConfig_Audio_Baud)(meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_700B+1))
|
||||
|
||||
#define _ModuleConfig_SerialConfig_Serial_Baud_MIN ModuleConfig_SerialConfig_Serial_Baud_BAUD_DEFAULT
|
||||
#define _ModuleConfig_SerialConfig_Serial_Baud_MAX ModuleConfig_SerialConfig_Serial_Baud_BAUD_921600
|
||||
#define _ModuleConfig_SerialConfig_Serial_Baud_ARRAYSIZE ((ModuleConfig_SerialConfig_Serial_Baud)(ModuleConfig_SerialConfig_Serial_Baud_BAUD_921600+1))
|
||||
#define _meshtastic_ModuleConfig_SerialConfig_Serial_Baud_MIN meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_DEFAULT
|
||||
#define _meshtastic_ModuleConfig_SerialConfig_Serial_Baud_MAX meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_921600
|
||||
#define _meshtastic_ModuleConfig_SerialConfig_Serial_Baud_ARRAYSIZE ((meshtastic_ModuleConfig_SerialConfig_Serial_Baud)(meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_921600+1))
|
||||
|
||||
#define _ModuleConfig_SerialConfig_Serial_Mode_MIN ModuleConfig_SerialConfig_Serial_Mode_DEFAULT
|
||||
#define _ModuleConfig_SerialConfig_Serial_Mode_MAX ModuleConfig_SerialConfig_Serial_Mode_NMEA
|
||||
#define _ModuleConfig_SerialConfig_Serial_Mode_ARRAYSIZE ((ModuleConfig_SerialConfig_Serial_Mode)(ModuleConfig_SerialConfig_Serial_Mode_NMEA+1))
|
||||
#define _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MIN meshtastic_ModuleConfig_SerialConfig_Serial_Mode_DEFAULT
|
||||
#define _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MAX meshtastic_ModuleConfig_SerialConfig_Serial_Mode_NMEA
|
||||
#define _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_ARRAYSIZE ((meshtastic_ModuleConfig_SerialConfig_Serial_Mode)(meshtastic_ModuleConfig_SerialConfig_Serial_Mode_NMEA+1))
|
||||
|
||||
#define _ModuleConfig_CannedMessageConfig_InputEventChar_MIN ModuleConfig_CannedMessageConfig_InputEventChar_NONE
|
||||
#define _ModuleConfig_CannedMessageConfig_InputEventChar_MAX ModuleConfig_CannedMessageConfig_InputEventChar_BACK
|
||||
#define _ModuleConfig_CannedMessageConfig_InputEventChar_ARRAYSIZE ((ModuleConfig_CannedMessageConfig_InputEventChar)(ModuleConfig_CannedMessageConfig_InputEventChar_BACK+1))
|
||||
#define _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE
|
||||
#define _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MAX meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_BACK
|
||||
#define _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_ARRAYSIZE ((meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar)(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_BACK+1))
|
||||
|
||||
|
||||
|
||||
|
||||
#define ModuleConfig_AudioConfig_bitrate_ENUMTYPE ModuleConfig_AudioConfig_Audio_Baud
|
||||
#define meshtastic_ModuleConfig_AudioConfig_bitrate_ENUMTYPE meshtastic_ModuleConfig_AudioConfig_Audio_Baud
|
||||
|
||||
#define ModuleConfig_SerialConfig_baud_ENUMTYPE ModuleConfig_SerialConfig_Serial_Baud
|
||||
#define ModuleConfig_SerialConfig_mode_ENUMTYPE ModuleConfig_SerialConfig_Serial_Mode
|
||||
#define meshtastic_ModuleConfig_SerialConfig_baud_ENUMTYPE meshtastic_ModuleConfig_SerialConfig_Serial_Baud
|
||||
#define meshtastic_ModuleConfig_SerialConfig_mode_ENUMTYPE meshtastic_ModuleConfig_SerialConfig_Serial_Mode
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define ModuleConfig_CannedMessageConfig_inputbroker_event_cw_ENUMTYPE ModuleConfig_CannedMessageConfig_InputEventChar
|
||||
#define ModuleConfig_CannedMessageConfig_inputbroker_event_ccw_ENUMTYPE ModuleConfig_CannedMessageConfig_InputEventChar
|
||||
#define ModuleConfig_CannedMessageConfig_inputbroker_event_press_ENUMTYPE ModuleConfig_CannedMessageConfig_InputEventChar
|
||||
#define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_event_cw_ENUMTYPE meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar
|
||||
#define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_event_ccw_ENUMTYPE meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar
|
||||
#define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_event_press_ENUMTYPE meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar
|
||||
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define ModuleConfig_init_default {0, {ModuleConfig_MQTTConfig_init_default}}
|
||||
#define ModuleConfig_MQTTConfig_init_default {0, "", "", "", 0, 0}
|
||||
#define ModuleConfig_RemoteHardwareConfig_init_default {0}
|
||||
#define ModuleConfig_AudioConfig_init_default {0, 0, _ModuleConfig_AudioConfig_Audio_Baud_MIN, 0, 0, 0, 0}
|
||||
#define ModuleConfig_SerialConfig_init_default {0, 0, 0, 0, _ModuleConfig_SerialConfig_Serial_Baud_MIN, 0, _ModuleConfig_SerialConfig_Serial_Mode_MIN}
|
||||
#define ModuleConfig_ExternalNotificationConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
#define ModuleConfig_StoreForwardConfig_init_default {0, 0, 0, 0, 0}
|
||||
#define ModuleConfig_RangeTestConfig_init_default {0, 0, 0}
|
||||
#define ModuleConfig_TelemetryConfig_init_default {0, 0, 0, 0, 0}
|
||||
#define ModuleConfig_CannedMessageConfig_init_default {0, 0, 0, 0, _ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _ModuleConfig_CannedMessageConfig_InputEventChar_MIN, 0, 0, "", 0}
|
||||
#define ModuleConfig_init_zero {0, {ModuleConfig_MQTTConfig_init_zero}}
|
||||
#define ModuleConfig_MQTTConfig_init_zero {0, "", "", "", 0, 0}
|
||||
#define ModuleConfig_RemoteHardwareConfig_init_zero {0}
|
||||
#define ModuleConfig_AudioConfig_init_zero {0, 0, _ModuleConfig_AudioConfig_Audio_Baud_MIN, 0, 0, 0, 0}
|
||||
#define ModuleConfig_SerialConfig_init_zero {0, 0, 0, 0, _ModuleConfig_SerialConfig_Serial_Baud_MIN, 0, _ModuleConfig_SerialConfig_Serial_Mode_MIN}
|
||||
#define ModuleConfig_ExternalNotificationConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
#define ModuleConfig_StoreForwardConfig_init_zero {0, 0, 0, 0, 0}
|
||||
#define ModuleConfig_RangeTestConfig_init_zero {0, 0, 0}
|
||||
#define ModuleConfig_TelemetryConfig_init_zero {0, 0, 0, 0, 0}
|
||||
#define ModuleConfig_CannedMessageConfig_init_zero {0, 0, 0, 0, _ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _ModuleConfig_CannedMessageConfig_InputEventChar_MIN, 0, 0, "", 0}
|
||||
#define meshtastic_ModuleConfig_init_default {0, {meshtastic_ModuleConfig_MQTTConfig_init_default}}
|
||||
#define meshtastic_ModuleConfig_MQTTConfig_init_default {0, "", "", "", 0, 0}
|
||||
#define meshtastic_ModuleConfig_RemoteHardwareConfig_init_default {0}
|
||||
#define meshtastic_ModuleConfig_AudioConfig_init_default {0, 0, _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_MIN, 0, 0, 0, 0}
|
||||
#define meshtastic_ModuleConfig_SerialConfig_init_default {0, 0, 0, 0, _meshtastic_ModuleConfig_SerialConfig_Serial_Baud_MIN, 0, _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MIN}
|
||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
#define meshtastic_ModuleConfig_StoreForwardConfig_init_default {0, 0, 0, 0, 0}
|
||||
#define meshtastic_ModuleConfig_RangeTestConfig_init_default {0, 0, 0}
|
||||
#define meshtastic_ModuleConfig_TelemetryConfig_init_default {0, 0, 0, 0, 0}
|
||||
#define meshtastic_ModuleConfig_CannedMessageConfig_init_default {0, 0, 0, 0, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, 0, 0, "", 0}
|
||||
#define meshtastic_ModuleConfig_init_zero {0, {meshtastic_ModuleConfig_MQTTConfig_init_zero}}
|
||||
#define meshtastic_ModuleConfig_MQTTConfig_init_zero {0, "", "", "", 0, 0}
|
||||
#define meshtastic_ModuleConfig_RemoteHardwareConfig_init_zero {0}
|
||||
#define meshtastic_ModuleConfig_AudioConfig_init_zero {0, 0, _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_MIN, 0, 0, 0, 0}
|
||||
#define meshtastic_ModuleConfig_SerialConfig_init_zero {0, 0, 0, 0, _meshtastic_ModuleConfig_SerialConfig_Serial_Baud_MIN, 0, _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MIN}
|
||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
#define meshtastic_ModuleConfig_StoreForwardConfig_init_zero {0, 0, 0, 0, 0}
|
||||
#define meshtastic_ModuleConfig_RangeTestConfig_init_zero {0, 0, 0}
|
||||
#define meshtastic_ModuleConfig_TelemetryConfig_init_zero {0, 0, 0, 0, 0}
|
||||
#define meshtastic_ModuleConfig_CannedMessageConfig_init_zero {0, 0, 0, 0, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, 0, 0, "", 0}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define ModuleConfig_MQTTConfig_enabled_tag 1
|
||||
#define ModuleConfig_MQTTConfig_address_tag 2
|
||||
#define ModuleConfig_MQTTConfig_username_tag 3
|
||||
#define ModuleConfig_MQTTConfig_password_tag 4
|
||||
#define ModuleConfig_MQTTConfig_encryption_enabled_tag 5
|
||||
#define ModuleConfig_MQTTConfig_json_enabled_tag 6
|
||||
#define ModuleConfig_RemoteHardwareConfig_enabled_tag 1
|
||||
#define ModuleConfig_AudioConfig_codec2_enabled_tag 1
|
||||
#define ModuleConfig_AudioConfig_ptt_pin_tag 2
|
||||
#define ModuleConfig_AudioConfig_bitrate_tag 3
|
||||
#define ModuleConfig_AudioConfig_i2s_ws_tag 4
|
||||
#define ModuleConfig_AudioConfig_i2s_sd_tag 5
|
||||
#define ModuleConfig_AudioConfig_i2s_din_tag 6
|
||||
#define ModuleConfig_AudioConfig_i2s_sck_tag 7
|
||||
#define ModuleConfig_SerialConfig_enabled_tag 1
|
||||
#define ModuleConfig_SerialConfig_echo_tag 2
|
||||
#define ModuleConfig_SerialConfig_rxd_tag 3
|
||||
#define ModuleConfig_SerialConfig_txd_tag 4
|
||||
#define ModuleConfig_SerialConfig_baud_tag 5
|
||||
#define ModuleConfig_SerialConfig_timeout_tag 6
|
||||
#define ModuleConfig_SerialConfig_mode_tag 7
|
||||
#define ModuleConfig_ExternalNotificationConfig_enabled_tag 1
|
||||
#define ModuleConfig_ExternalNotificationConfig_output_ms_tag 2
|
||||
#define ModuleConfig_ExternalNotificationConfig_output_tag 3
|
||||
#define ModuleConfig_ExternalNotificationConfig_active_tag 4
|
||||
#define ModuleConfig_ExternalNotificationConfig_alert_message_tag 5
|
||||
#define ModuleConfig_ExternalNotificationConfig_alert_bell_tag 6
|
||||
#define ModuleConfig_ExternalNotificationConfig_use_pwm_tag 7
|
||||
#define ModuleConfig_ExternalNotificationConfig_output_vibra_tag 8
|
||||
#define ModuleConfig_ExternalNotificationConfig_output_buzzer_tag 9
|
||||
#define ModuleConfig_ExternalNotificationConfig_alert_message_vibra_tag 10
|
||||
#define ModuleConfig_ExternalNotificationConfig_alert_message_buzzer_tag 11
|
||||
#define ModuleConfig_ExternalNotificationConfig_alert_bell_vibra_tag 12
|
||||
#define ModuleConfig_ExternalNotificationConfig_alert_bell_buzzer_tag 13
|
||||
#define ModuleConfig_ExternalNotificationConfig_nag_timeout_tag 14
|
||||
#define ModuleConfig_StoreForwardConfig_enabled_tag 1
|
||||
#define ModuleConfig_StoreForwardConfig_heartbeat_tag 2
|
||||
#define ModuleConfig_StoreForwardConfig_records_tag 3
|
||||
#define ModuleConfig_StoreForwardConfig_history_return_max_tag 4
|
||||
#define ModuleConfig_StoreForwardConfig_history_return_window_tag 5
|
||||
#define ModuleConfig_RangeTestConfig_enabled_tag 1
|
||||
#define ModuleConfig_RangeTestConfig_sender_tag 2
|
||||
#define ModuleConfig_RangeTestConfig_save_tag 3
|
||||
#define ModuleConfig_TelemetryConfig_device_update_interval_tag 1
|
||||
#define ModuleConfig_TelemetryConfig_environment_update_interval_tag 2
|
||||
#define ModuleConfig_TelemetryConfig_environment_measurement_enabled_tag 3
|
||||
#define ModuleConfig_TelemetryConfig_environment_screen_enabled_tag 4
|
||||
#define ModuleConfig_TelemetryConfig_environment_display_fahrenheit_tag 5
|
||||
#define ModuleConfig_CannedMessageConfig_rotary1_enabled_tag 1
|
||||
#define ModuleConfig_CannedMessageConfig_inputbroker_pin_a_tag 2
|
||||
#define ModuleConfig_CannedMessageConfig_inputbroker_pin_b_tag 3
|
||||
#define ModuleConfig_CannedMessageConfig_inputbroker_pin_press_tag 4
|
||||
#define ModuleConfig_CannedMessageConfig_inputbroker_event_cw_tag 5
|
||||
#define ModuleConfig_CannedMessageConfig_inputbroker_event_ccw_tag 6
|
||||
#define ModuleConfig_CannedMessageConfig_inputbroker_event_press_tag 7
|
||||
#define ModuleConfig_CannedMessageConfig_updown1_enabled_tag 8
|
||||
#define ModuleConfig_CannedMessageConfig_enabled_tag 9
|
||||
#define ModuleConfig_CannedMessageConfig_allow_input_source_tag 10
|
||||
#define ModuleConfig_CannedMessageConfig_send_bell_tag 11
|
||||
#define ModuleConfig_mqtt_tag 1
|
||||
#define ModuleConfig_serial_tag 2
|
||||
#define ModuleConfig_external_notification_tag 3
|
||||
#define ModuleConfig_store_forward_tag 4
|
||||
#define ModuleConfig_range_test_tag 5
|
||||
#define ModuleConfig_telemetry_tag 6
|
||||
#define ModuleConfig_canned_message_tag 7
|
||||
#define ModuleConfig_audio_tag 8
|
||||
#define ModuleConfig_remote_hardware_tag 9
|
||||
#define meshtastic_ModuleConfig_MQTTConfig_enabled_tag 1
|
||||
#define meshtastic_ModuleConfig_MQTTConfig_address_tag 2
|
||||
#define meshtastic_ModuleConfig_MQTTConfig_username_tag 3
|
||||
#define meshtastic_ModuleConfig_MQTTConfig_password_tag 4
|
||||
#define meshtastic_ModuleConfig_MQTTConfig_encryption_enabled_tag 5
|
||||
#define meshtastic_ModuleConfig_MQTTConfig_json_enabled_tag 6
|
||||
#define meshtastic_ModuleConfig_RemoteHardwareConfig_enabled_tag 1
|
||||
#define meshtastic_ModuleConfig_AudioConfig_codec2_enabled_tag 1
|
||||
#define meshtastic_ModuleConfig_AudioConfig_ptt_pin_tag 2
|
||||
#define meshtastic_ModuleConfig_AudioConfig_bitrate_tag 3
|
||||
#define meshtastic_ModuleConfig_AudioConfig_i2s_ws_tag 4
|
||||
#define meshtastic_ModuleConfig_AudioConfig_i2s_sd_tag 5
|
||||
#define meshtastic_ModuleConfig_AudioConfig_i2s_din_tag 6
|
||||
#define meshtastic_ModuleConfig_AudioConfig_i2s_sck_tag 7
|
||||
#define meshtastic_ModuleConfig_SerialConfig_enabled_tag 1
|
||||
#define meshtastic_ModuleConfig_SerialConfig_echo_tag 2
|
||||
#define meshtastic_ModuleConfig_SerialConfig_rxd_tag 3
|
||||
#define meshtastic_ModuleConfig_SerialConfig_txd_tag 4
|
||||
#define meshtastic_ModuleConfig_SerialConfig_baud_tag 5
|
||||
#define meshtastic_ModuleConfig_SerialConfig_timeout_tag 6
|
||||
#define meshtastic_ModuleConfig_SerialConfig_mode_tag 7
|
||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_enabled_tag 1
|
||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_output_ms_tag 2
|
||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_output_tag 3
|
||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_active_tag 4
|
||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_alert_message_tag 5
|
||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_alert_bell_tag 6
|
||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_use_pwm_tag 7
|
||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_output_vibra_tag 8
|
||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_output_buzzer_tag 9
|
||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_alert_message_vibra_tag 10
|
||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_alert_message_buzzer_tag 11
|
||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_alert_bell_vibra_tag 12
|
||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_alert_bell_buzzer_tag 13
|
||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_nag_timeout_tag 14
|
||||
#define meshtastic_ModuleConfig_StoreForwardConfig_enabled_tag 1
|
||||
#define meshtastic_ModuleConfig_StoreForwardConfig_heartbeat_tag 2
|
||||
#define meshtastic_ModuleConfig_StoreForwardConfig_records_tag 3
|
||||
#define meshtastic_ModuleConfig_StoreForwardConfig_history_return_max_tag 4
|
||||
#define meshtastic_ModuleConfig_StoreForwardConfig_history_return_window_tag 5
|
||||
#define meshtastic_ModuleConfig_RangeTestConfig_enabled_tag 1
|
||||
#define meshtastic_ModuleConfig_RangeTestConfig_sender_tag 2
|
||||
#define meshtastic_ModuleConfig_RangeTestConfig_save_tag 3
|
||||
#define meshtastic_ModuleConfig_TelemetryConfig_device_update_interval_tag 1
|
||||
#define meshtastic_ModuleConfig_TelemetryConfig_environment_update_interval_tag 2
|
||||
#define meshtastic_ModuleConfig_TelemetryConfig_environment_measurement_enabled_tag 3
|
||||
#define meshtastic_ModuleConfig_TelemetryConfig_environment_screen_enabled_tag 4
|
||||
#define meshtastic_ModuleConfig_TelemetryConfig_environment_display_fahrenheit_tag 5
|
||||
#define meshtastic_ModuleConfig_CannedMessageConfig_rotary1_enabled_tag 1
|
||||
#define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_pin_a_tag 2
|
||||
#define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_pin_b_tag 3
|
||||
#define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_pin_press_tag 4
|
||||
#define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_event_cw_tag 5
|
||||
#define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_event_ccw_tag 6
|
||||
#define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_event_press_tag 7
|
||||
#define meshtastic_ModuleConfig_CannedMessageConfig_updown1_enabled_tag 8
|
||||
#define meshtastic_ModuleConfig_CannedMessageConfig_enabled_tag 9
|
||||
#define meshtastic_ModuleConfig_CannedMessageConfig_allow_input_source_tag 10
|
||||
#define meshtastic_ModuleConfig_CannedMessageConfig_send_bell_tag 11
|
||||
#define meshtastic_ModuleConfig_mqtt_tag 1
|
||||
#define meshtastic_ModuleConfig_serial_tag 2
|
||||
#define meshtastic_ModuleConfig_external_notification_tag 3
|
||||
#define meshtastic_ModuleConfig_store_forward_tag 4
|
||||
#define meshtastic_ModuleConfig_range_test_tag 5
|
||||
#define meshtastic_ModuleConfig_telemetry_tag 6
|
||||
#define meshtastic_ModuleConfig_canned_message_tag 7
|
||||
#define meshtastic_ModuleConfig_audio_tag 8
|
||||
#define meshtastic_ModuleConfig_remote_hardware_tag 9
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define ModuleConfig_FIELDLIST(X, a) \
|
||||
#define meshtastic_ModuleConfig_FIELDLIST(X, a) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,mqtt,payload_variant.mqtt), 1) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,serial,payload_variant.serial), 2) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,external_notification,payload_variant.external_notification), 3) \
|
||||
@@ -419,34 +419,34 @@ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,telemetry,payload_variant.te
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,canned_message,payload_variant.canned_message), 7) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,audio,payload_variant.audio), 8) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,remote_hardware,payload_variant.remote_hardware), 9)
|
||||
#define ModuleConfig_CALLBACK NULL
|
||||
#define ModuleConfig_DEFAULT NULL
|
||||
#define ModuleConfig_payload_variant_mqtt_MSGTYPE ModuleConfig_MQTTConfig
|
||||
#define ModuleConfig_payload_variant_serial_MSGTYPE ModuleConfig_SerialConfig
|
||||
#define ModuleConfig_payload_variant_external_notification_MSGTYPE ModuleConfig_ExternalNotificationConfig
|
||||
#define ModuleConfig_payload_variant_store_forward_MSGTYPE ModuleConfig_StoreForwardConfig
|
||||
#define ModuleConfig_payload_variant_range_test_MSGTYPE ModuleConfig_RangeTestConfig
|
||||
#define ModuleConfig_payload_variant_telemetry_MSGTYPE ModuleConfig_TelemetryConfig
|
||||
#define ModuleConfig_payload_variant_canned_message_MSGTYPE ModuleConfig_CannedMessageConfig
|
||||
#define ModuleConfig_payload_variant_audio_MSGTYPE ModuleConfig_AudioConfig
|
||||
#define ModuleConfig_payload_variant_remote_hardware_MSGTYPE ModuleConfig_RemoteHardwareConfig
|
||||
#define meshtastic_ModuleConfig_CALLBACK NULL
|
||||
#define meshtastic_ModuleConfig_DEFAULT NULL
|
||||
#define meshtastic_ModuleConfig_payload_variant_mqtt_MSGTYPE meshtastic_ModuleConfig_MQTTConfig
|
||||
#define meshtastic_ModuleConfig_payload_variant_serial_MSGTYPE meshtastic_ModuleConfig_SerialConfig
|
||||
#define meshtastic_ModuleConfig_payload_variant_external_notification_MSGTYPE meshtastic_ModuleConfig_ExternalNotificationConfig
|
||||
#define meshtastic_ModuleConfig_payload_variant_store_forward_MSGTYPE meshtastic_ModuleConfig_StoreForwardConfig
|
||||
#define meshtastic_ModuleConfig_payload_variant_range_test_MSGTYPE meshtastic_ModuleConfig_RangeTestConfig
|
||||
#define meshtastic_ModuleConfig_payload_variant_telemetry_MSGTYPE meshtastic_ModuleConfig_TelemetryConfig
|
||||
#define meshtastic_ModuleConfig_payload_variant_canned_message_MSGTYPE meshtastic_ModuleConfig_CannedMessageConfig
|
||||
#define meshtastic_ModuleConfig_payload_variant_audio_MSGTYPE meshtastic_ModuleConfig_AudioConfig
|
||||
#define meshtastic_ModuleConfig_payload_variant_remote_hardware_MSGTYPE meshtastic_ModuleConfig_RemoteHardwareConfig
|
||||
|
||||
#define ModuleConfig_MQTTConfig_FIELDLIST(X, a) \
|
||||
#define meshtastic_ModuleConfig_MQTTConfig_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, BOOL, enabled, 1) \
|
||||
X(a, STATIC, SINGULAR, STRING, address, 2) \
|
||||
X(a, STATIC, SINGULAR, STRING, username, 3) \
|
||||
X(a, STATIC, SINGULAR, STRING, password, 4) \
|
||||
X(a, STATIC, SINGULAR, BOOL, encryption_enabled, 5) \
|
||||
X(a, STATIC, SINGULAR, BOOL, json_enabled, 6)
|
||||
#define ModuleConfig_MQTTConfig_CALLBACK NULL
|
||||
#define ModuleConfig_MQTTConfig_DEFAULT NULL
|
||||
#define meshtastic_ModuleConfig_MQTTConfig_CALLBACK NULL
|
||||
#define meshtastic_ModuleConfig_MQTTConfig_DEFAULT NULL
|
||||
|
||||
#define ModuleConfig_RemoteHardwareConfig_FIELDLIST(X, a) \
|
||||
#define meshtastic_ModuleConfig_RemoteHardwareConfig_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, BOOL, enabled, 1)
|
||||
#define ModuleConfig_RemoteHardwareConfig_CALLBACK NULL
|
||||
#define ModuleConfig_RemoteHardwareConfig_DEFAULT NULL
|
||||
#define meshtastic_ModuleConfig_RemoteHardwareConfig_CALLBACK NULL
|
||||
#define meshtastic_ModuleConfig_RemoteHardwareConfig_DEFAULT NULL
|
||||
|
||||
#define ModuleConfig_AudioConfig_FIELDLIST(X, a) \
|
||||
#define meshtastic_ModuleConfig_AudioConfig_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, BOOL, codec2_enabled, 1) \
|
||||
X(a, STATIC, SINGULAR, UINT32, ptt_pin, 2) \
|
||||
X(a, STATIC, SINGULAR, UENUM, bitrate, 3) \
|
||||
@@ -454,10 +454,10 @@ X(a, STATIC, SINGULAR, UINT32, i2s_ws, 4) \
|
||||
X(a, STATIC, SINGULAR, UINT32, i2s_sd, 5) \
|
||||
X(a, STATIC, SINGULAR, UINT32, i2s_din, 6) \
|
||||
X(a, STATIC, SINGULAR, UINT32, i2s_sck, 7)
|
||||
#define ModuleConfig_AudioConfig_CALLBACK NULL
|
||||
#define ModuleConfig_AudioConfig_DEFAULT NULL
|
||||
#define meshtastic_ModuleConfig_AudioConfig_CALLBACK NULL
|
||||
#define meshtastic_ModuleConfig_AudioConfig_DEFAULT NULL
|
||||
|
||||
#define ModuleConfig_SerialConfig_FIELDLIST(X, a) \
|
||||
#define meshtastic_ModuleConfig_SerialConfig_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, BOOL, enabled, 1) \
|
||||
X(a, STATIC, SINGULAR, BOOL, echo, 2) \
|
||||
X(a, STATIC, SINGULAR, UINT32, rxd, 3) \
|
||||
@@ -465,10 +465,10 @@ X(a, STATIC, SINGULAR, UINT32, txd, 4) \
|
||||
X(a, STATIC, SINGULAR, UENUM, baud, 5) \
|
||||
X(a, STATIC, SINGULAR, UINT32, timeout, 6) \
|
||||
X(a, STATIC, SINGULAR, UENUM, mode, 7)
|
||||
#define ModuleConfig_SerialConfig_CALLBACK NULL
|
||||
#define ModuleConfig_SerialConfig_DEFAULT NULL
|
||||
#define meshtastic_ModuleConfig_SerialConfig_CALLBACK NULL
|
||||
#define meshtastic_ModuleConfig_SerialConfig_DEFAULT NULL
|
||||
|
||||
#define ModuleConfig_ExternalNotificationConfig_FIELDLIST(X, a) \
|
||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, BOOL, enabled, 1) \
|
||||
X(a, STATIC, SINGULAR, UINT32, output_ms, 2) \
|
||||
X(a, STATIC, SINGULAR, UINT32, output, 3) \
|
||||
@@ -483,35 +483,35 @@ X(a, STATIC, SINGULAR, BOOL, alert_message_buzzer, 11) \
|
||||
X(a, STATIC, SINGULAR, BOOL, alert_bell_vibra, 12) \
|
||||
X(a, STATIC, SINGULAR, BOOL, alert_bell_buzzer, 13) \
|
||||
X(a, STATIC, SINGULAR, UINT32, nag_timeout, 14)
|
||||
#define ModuleConfig_ExternalNotificationConfig_CALLBACK NULL
|
||||
#define ModuleConfig_ExternalNotificationConfig_DEFAULT NULL
|
||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_CALLBACK NULL
|
||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_DEFAULT NULL
|
||||
|
||||
#define ModuleConfig_StoreForwardConfig_FIELDLIST(X, a) \
|
||||
#define meshtastic_ModuleConfig_StoreForwardConfig_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, BOOL, enabled, 1) \
|
||||
X(a, STATIC, SINGULAR, BOOL, heartbeat, 2) \
|
||||
X(a, STATIC, SINGULAR, UINT32, records, 3) \
|
||||
X(a, STATIC, SINGULAR, UINT32, history_return_max, 4) \
|
||||
X(a, STATIC, SINGULAR, UINT32, history_return_window, 5)
|
||||
#define ModuleConfig_StoreForwardConfig_CALLBACK NULL
|
||||
#define ModuleConfig_StoreForwardConfig_DEFAULT NULL
|
||||
#define meshtastic_ModuleConfig_StoreForwardConfig_CALLBACK NULL
|
||||
#define meshtastic_ModuleConfig_StoreForwardConfig_DEFAULT NULL
|
||||
|
||||
#define ModuleConfig_RangeTestConfig_FIELDLIST(X, a) \
|
||||
#define meshtastic_ModuleConfig_RangeTestConfig_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, BOOL, enabled, 1) \
|
||||
X(a, STATIC, SINGULAR, UINT32, sender, 2) \
|
||||
X(a, STATIC, SINGULAR, BOOL, save, 3)
|
||||
#define ModuleConfig_RangeTestConfig_CALLBACK NULL
|
||||
#define ModuleConfig_RangeTestConfig_DEFAULT NULL
|
||||
#define meshtastic_ModuleConfig_RangeTestConfig_CALLBACK NULL
|
||||
#define meshtastic_ModuleConfig_RangeTestConfig_DEFAULT NULL
|
||||
|
||||
#define ModuleConfig_TelemetryConfig_FIELDLIST(X, a) \
|
||||
#define meshtastic_ModuleConfig_TelemetryConfig_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, device_update_interval, 1) \
|
||||
X(a, STATIC, SINGULAR, UINT32, environment_update_interval, 2) \
|
||||
X(a, STATIC, SINGULAR, BOOL, environment_measurement_enabled, 3) \
|
||||
X(a, STATIC, SINGULAR, BOOL, environment_screen_enabled, 4) \
|
||||
X(a, STATIC, SINGULAR, BOOL, environment_display_fahrenheit, 5)
|
||||
#define ModuleConfig_TelemetryConfig_CALLBACK NULL
|
||||
#define ModuleConfig_TelemetryConfig_DEFAULT NULL
|
||||
#define meshtastic_ModuleConfig_TelemetryConfig_CALLBACK NULL
|
||||
#define meshtastic_ModuleConfig_TelemetryConfig_DEFAULT NULL
|
||||
|
||||
#define ModuleConfig_CannedMessageConfig_FIELDLIST(X, a) \
|
||||
#define meshtastic_ModuleConfig_CannedMessageConfig_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, BOOL, rotary1_enabled, 1) \
|
||||
X(a, STATIC, SINGULAR, UINT32, inputbroker_pin_a, 2) \
|
||||
X(a, STATIC, SINGULAR, UINT32, inputbroker_pin_b, 3) \
|
||||
@@ -523,43 +523,43 @@ X(a, STATIC, SINGULAR, BOOL, updown1_enabled, 8) \
|
||||
X(a, STATIC, SINGULAR, BOOL, enabled, 9) \
|
||||
X(a, STATIC, SINGULAR, STRING, allow_input_source, 10) \
|
||||
X(a, STATIC, SINGULAR, BOOL, send_bell, 11)
|
||||
#define ModuleConfig_CannedMessageConfig_CALLBACK NULL
|
||||
#define ModuleConfig_CannedMessageConfig_DEFAULT NULL
|
||||
#define meshtastic_ModuleConfig_CannedMessageConfig_CALLBACK NULL
|
||||
#define meshtastic_ModuleConfig_CannedMessageConfig_DEFAULT NULL
|
||||
|
||||
extern const pb_msgdesc_t ModuleConfig_msg;
|
||||
extern const pb_msgdesc_t ModuleConfig_MQTTConfig_msg;
|
||||
extern const pb_msgdesc_t ModuleConfig_RemoteHardwareConfig_msg;
|
||||
extern const pb_msgdesc_t ModuleConfig_AudioConfig_msg;
|
||||
extern const pb_msgdesc_t ModuleConfig_SerialConfig_msg;
|
||||
extern const pb_msgdesc_t ModuleConfig_ExternalNotificationConfig_msg;
|
||||
extern const pb_msgdesc_t ModuleConfig_StoreForwardConfig_msg;
|
||||
extern const pb_msgdesc_t ModuleConfig_RangeTestConfig_msg;
|
||||
extern const pb_msgdesc_t ModuleConfig_TelemetryConfig_msg;
|
||||
extern const pb_msgdesc_t ModuleConfig_CannedMessageConfig_msg;
|
||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_msg;
|
||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_MQTTConfig_msg;
|
||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_RemoteHardwareConfig_msg;
|
||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_AudioConfig_msg;
|
||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_SerialConfig_msg;
|
||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_ExternalNotificationConfig_msg;
|
||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_StoreForwardConfig_msg;
|
||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_RangeTestConfig_msg;
|
||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_TelemetryConfig_msg;
|
||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_CannedMessageConfig_msg;
|
||||
|
||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||
#define ModuleConfig_fields &ModuleConfig_msg
|
||||
#define ModuleConfig_MQTTConfig_fields &ModuleConfig_MQTTConfig_msg
|
||||
#define ModuleConfig_RemoteHardwareConfig_fields &ModuleConfig_RemoteHardwareConfig_msg
|
||||
#define ModuleConfig_AudioConfig_fields &ModuleConfig_AudioConfig_msg
|
||||
#define ModuleConfig_SerialConfig_fields &ModuleConfig_SerialConfig_msg
|
||||
#define ModuleConfig_ExternalNotificationConfig_fields &ModuleConfig_ExternalNotificationConfig_msg
|
||||
#define ModuleConfig_StoreForwardConfig_fields &ModuleConfig_StoreForwardConfig_msg
|
||||
#define ModuleConfig_RangeTestConfig_fields &ModuleConfig_RangeTestConfig_msg
|
||||
#define ModuleConfig_TelemetryConfig_fields &ModuleConfig_TelemetryConfig_msg
|
||||
#define ModuleConfig_CannedMessageConfig_fields &ModuleConfig_CannedMessageConfig_msg
|
||||
#define meshtastic_ModuleConfig_fields &meshtastic_ModuleConfig_msg
|
||||
#define meshtastic_ModuleConfig_MQTTConfig_fields &meshtastic_ModuleConfig_MQTTConfig_msg
|
||||
#define meshtastic_ModuleConfig_RemoteHardwareConfig_fields &meshtastic_ModuleConfig_RemoteHardwareConfig_msg
|
||||
#define meshtastic_ModuleConfig_AudioConfig_fields &meshtastic_ModuleConfig_AudioConfig_msg
|
||||
#define meshtastic_ModuleConfig_SerialConfig_fields &meshtastic_ModuleConfig_SerialConfig_msg
|
||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_fields &meshtastic_ModuleConfig_ExternalNotificationConfig_msg
|
||||
#define meshtastic_ModuleConfig_StoreForwardConfig_fields &meshtastic_ModuleConfig_StoreForwardConfig_msg
|
||||
#define meshtastic_ModuleConfig_RangeTestConfig_fields &meshtastic_ModuleConfig_RangeTestConfig_msg
|
||||
#define meshtastic_ModuleConfig_TelemetryConfig_fields &meshtastic_ModuleConfig_TelemetryConfig_msg
|
||||
#define meshtastic_ModuleConfig_CannedMessageConfig_fields &meshtastic_ModuleConfig_CannedMessageConfig_msg
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define ModuleConfig_AudioConfig_size 19
|
||||
#define ModuleConfig_CannedMessageConfig_size 49
|
||||
#define ModuleConfig_ExternalNotificationConfig_size 40
|
||||
#define ModuleConfig_MQTTConfig_size 201
|
||||
#define ModuleConfig_RangeTestConfig_size 10
|
||||
#define ModuleConfig_RemoteHardwareConfig_size 2
|
||||
#define ModuleConfig_SerialConfig_size 26
|
||||
#define ModuleConfig_StoreForwardConfig_size 22
|
||||
#define ModuleConfig_TelemetryConfig_size 18
|
||||
#define ModuleConfig_size 204
|
||||
#define meshtastic_ModuleConfig_AudioConfig_size 19
|
||||
#define meshtastic_ModuleConfig_CannedMessageConfig_size 49
|
||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_size 40
|
||||
#define meshtastic_ModuleConfig_MQTTConfig_size 201
|
||||
#define meshtastic_ModuleConfig_RangeTestConfig_size 10
|
||||
#define meshtastic_ModuleConfig_RemoteHardwareConfig_size 2
|
||||
#define meshtastic_ModuleConfig_SerialConfig_size 26
|
||||
#define meshtastic_ModuleConfig_StoreForwardConfig_size 22
|
||||
#define meshtastic_ModuleConfig_TelemetryConfig_size 18
|
||||
#define meshtastic_ModuleConfig_size 204
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.4.7 */
|
||||
|
||||
#include "./mqtt.pb.h"
|
||||
#include "meshtastic/mqtt.pb.h"
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
PB_BIND(ServiceEnvelope, ServiceEnvelope, AUTO)
|
||||
PB_BIND(meshtastic_ServiceEnvelope, meshtastic_ServiceEnvelope, AUTO)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#ifndef PB_MESHTASTIC_MESHTASTIC_MQTT_PB_H_INCLUDED
|
||||
#define PB_MESHTASTIC_MESHTASTIC_MQTT_PB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
#include "./mesh.pb.h"
|
||||
#include "meshtastic/mesh.pb.h"
|
||||
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
@@ -12,16 +12,16 @@
|
||||
|
||||
/* Struct definitions */
|
||||
/* This message wraps a MeshPacket with extra metadata about the sender and how it arrived. */
|
||||
typedef struct _ServiceEnvelope {
|
||||
typedef struct _meshtastic_ServiceEnvelope {
|
||||
/* The (probably encrypted) packet */
|
||||
struct _MeshPacket *packet;
|
||||
struct _meshtastic_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;
|
||||
} meshtastic_ServiceEnvelope;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -29,30 +29,30 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define ServiceEnvelope_init_default {NULL, NULL, NULL}
|
||||
#define ServiceEnvelope_init_zero {NULL, NULL, NULL}
|
||||
#define meshtastic_ServiceEnvelope_init_default {NULL, NULL, NULL}
|
||||
#define meshtastic_ServiceEnvelope_init_zero {NULL, NULL, NULL}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define ServiceEnvelope_packet_tag 1
|
||||
#define ServiceEnvelope_channel_id_tag 2
|
||||
#define ServiceEnvelope_gateway_id_tag 3
|
||||
#define meshtastic_ServiceEnvelope_packet_tag 1
|
||||
#define meshtastic_ServiceEnvelope_channel_id_tag 2
|
||||
#define meshtastic_ServiceEnvelope_gateway_id_tag 3
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define ServiceEnvelope_FIELDLIST(X, a) \
|
||||
#define meshtastic_ServiceEnvelope_FIELDLIST(X, a) \
|
||||
X(a, POINTER, OPTIONAL, MESSAGE, packet, 1) \
|
||||
X(a, POINTER, SINGULAR, STRING, channel_id, 2) \
|
||||
X(a, POINTER, SINGULAR, STRING, gateway_id, 3)
|
||||
#define ServiceEnvelope_CALLBACK NULL
|
||||
#define ServiceEnvelope_DEFAULT NULL
|
||||
#define ServiceEnvelope_packet_MSGTYPE MeshPacket
|
||||
#define meshtastic_ServiceEnvelope_CALLBACK NULL
|
||||
#define meshtastic_ServiceEnvelope_DEFAULT NULL
|
||||
#define meshtastic_ServiceEnvelope_packet_MSGTYPE meshtastic_MeshPacket
|
||||
|
||||
extern const pb_msgdesc_t ServiceEnvelope_msg;
|
||||
extern const pb_msgdesc_t meshtastic_ServiceEnvelope_msg;
|
||||
|
||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||
#define ServiceEnvelope_fields &ServiceEnvelope_msg
|
||||
#define meshtastic_ServiceEnvelope_fields &meshtastic_ServiceEnvelope_msg
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
/* ServiceEnvelope_size depends on runtime parameters */
|
||||
/* meshtastic_ServiceEnvelope_size depends on runtime parameters */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.4.7 */
|
||||
|
||||
#include "./portnums.pb.h"
|
||||
#include "meshtastic/portnums.pb.h"
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
@@ -22,87 +22,87 @@
|
||||
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 {
|
||||
typedef enum _meshtastic_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,
|
||||
meshtastic_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) */
|
||||
PortNum_TEXT_MESSAGE_APP = 1,
|
||||
meshtastic_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,
|
||||
meshtastic_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,
|
||||
meshtastic_PortNum_POSITION_APP = 3,
|
||||
/* The built-in user info app.
|
||||
Payload is a [User](/docs/developers/protobufs/api#user) message */
|
||||
PortNum_NODEINFO_APP = 4,
|
||||
meshtastic_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,
|
||||
meshtastic_PortNum_ROUTING_APP = 5,
|
||||
/* Admin control packets.
|
||||
Payload is a [AdminMessage](/docs/developers/protobufs/api#adminmessage) message */
|
||||
PortNum_ADMIN_APP = 6,
|
||||
meshtastic_PortNum_ADMIN_APP = 6,
|
||||
/* Compressed TEXT_MESSAGE payloads. */
|
||||
PortNum_TEXT_MESSAGE_COMPRESSED_APP = 7,
|
||||
meshtastic_PortNum_TEXT_MESSAGE_COMPRESSED_APP = 7,
|
||||
/* Waypoint payloads.
|
||||
Payload is a [Waypoint](/docs/developers/protobufs/api#waypoint) message */
|
||||
PortNum_WAYPOINT_APP = 8,
|
||||
meshtastic_PortNum_WAYPOINT_APP = 8,
|
||||
/* Audio Payloads.
|
||||
Encapsulated codec2 packets. On 2.4 GHZ Bandwidths only for now */
|
||||
PortNum_AUDIO_APP = 9,
|
||||
meshtastic_PortNum_AUDIO_APP = 9,
|
||||
/* Provides a 'ping' service that replies to any packet it receives.
|
||||
Also serves as a small example module. */
|
||||
PortNum_REPLY_APP = 32,
|
||||
meshtastic_PortNum_REPLY_APP = 32,
|
||||
/* Used for the python IP tunnel feature */
|
||||
PortNum_IP_TUNNEL_APP = 33,
|
||||
meshtastic_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,
|
||||
meshtastic_PortNum_SERIAL_APP = 64,
|
||||
/* STORE_FORWARD_APP (Work in Progress)
|
||||
Maintained by Jm Casler (MC Hamster) : jm@casler.org */
|
||||
PortNum_STORE_FORWARD_APP = 65,
|
||||
meshtastic_PortNum_STORE_FORWARD_APP = 65,
|
||||
/* Optional port for messages for the range test module. */
|
||||
PortNum_RANGE_TEST_APP = 66,
|
||||
meshtastic_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,
|
||||
meshtastic_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,
|
||||
meshtastic_PortNum_ZPS_APP = 68,
|
||||
/* Used to let multiple instances of Linux native applications communicate
|
||||
as if they did using their LoRa chip.
|
||||
Maintained by GitHub user GUVWAF.
|
||||
Project files at https://github.com/GUVWAF/Meshtasticator */
|
||||
PortNum_SIMULATOR_APP = 69,
|
||||
meshtastic_PortNum_SIMULATOR_APP = 69,
|
||||
/* Provides a traceroute functionality to show the route a packet towards
|
||||
a certain destination would take on the mesh. */
|
||||
PortNum_TRACEROUTE_APP = 70,
|
||||
meshtastic_PortNum_TRACEROUTE_APP = 70,
|
||||
/* 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/firmware/blob/master/bin/regen-protos.sh)) */
|
||||
PortNum_PRIVATE_APP = 256,
|
||||
meshtastic_PortNum_PRIVATE_APP = 256,
|
||||
/* ATAK Forwarder Module https://github.com/paulmandal/atak-forwarder */
|
||||
PortNum_ATAK_FORWARDER = 257,
|
||||
meshtastic_PortNum_ATAK_FORWARDER = 257,
|
||||
/* Currently we limit port nums to no higher than this value */
|
||||
PortNum_MAX = 511
|
||||
} PortNum;
|
||||
meshtastic_PortNum_MAX = 511
|
||||
} meshtastic_PortNum;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Helper constants for enums */
|
||||
#define _PortNum_MIN PortNum_UNKNOWN_APP
|
||||
#define _PortNum_MAX PortNum_MAX
|
||||
#define _PortNum_ARRAYSIZE ((PortNum)(PortNum_MAX+1))
|
||||
#define _meshtastic_PortNum_MIN meshtastic_PortNum_UNKNOWN_APP
|
||||
#define _meshtastic_PortNum_MAX meshtastic_PortNum_MAX
|
||||
#define _meshtastic_PortNum_ARRAYSIZE ((meshtastic_PortNum)(meshtastic_PortNum_MAX+1))
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.4.7 */
|
||||
|
||||
#include "./remote_hardware.pb.h"
|
||||
#include "meshtastic/remote_hardware.pb.h"
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
PB_BIND(HardwareMessage, HardwareMessage, AUTO)
|
||||
PB_BIND(meshtastic_HardwareMessage, meshtastic_HardwareMessage, AUTO)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -11,22 +11,22 @@
|
||||
|
||||
/* Enum definitions */
|
||||
/* TODO: REPLACE */
|
||||
typedef enum _HardwareMessage_Type {
|
||||
typedef enum _meshtastic_HardwareMessage_Type {
|
||||
/* Unset/unused */
|
||||
HardwareMessage_Type_UNSET = 0,
|
||||
meshtastic_HardwareMessage_Type_UNSET = 0,
|
||||
/* Set gpio gpios based on gpio_mask/gpio_value */
|
||||
HardwareMessage_Type_WRITE_GPIOS = 1,
|
||||
meshtastic_HardwareMessage_Type_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. */
|
||||
HardwareMessage_Type_WATCH_GPIOS = 2,
|
||||
meshtastic_HardwareMessage_Type_WATCH_GPIOS = 2,
|
||||
/* The gpios listed in gpio_mask have changed, the new values are listed in gpio_value */
|
||||
HardwareMessage_Type_GPIOS_CHANGED = 3,
|
||||
meshtastic_HardwareMessage_Type_GPIOS_CHANGED = 3,
|
||||
/* Read the gpios specified in gpio_mask, send back a READ_GPIOS_REPLY reply with gpio_value populated */
|
||||
HardwareMessage_Type_READ_GPIOS = 4,
|
||||
meshtastic_HardwareMessage_Type_READ_GPIOS = 4,
|
||||
/* A reply to READ_GPIOS. gpio_mask and gpio_value will be populated */
|
||||
HardwareMessage_Type_READ_GPIOS_REPLY = 5
|
||||
} HardwareMessage_Type;
|
||||
meshtastic_HardwareMessage_Type_READ_GPIOS_REPLY = 5
|
||||
} meshtastic_HardwareMessage_Type;
|
||||
|
||||
/* Struct definitions */
|
||||
/* An example app to show off the module system. This message is used for
|
||||
@@ -38,15 +38,15 @@ typedef enum _HardwareMessage_Type {
|
||||
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 {
|
||||
typedef struct _meshtastic_HardwareMessage {
|
||||
/* What type of HardwareMessage is this? */
|
||||
HardwareMessage_Type type;
|
||||
meshtastic_HardwareMessage_Type type;
|
||||
/* 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;
|
||||
} meshtastic_HardwareMessage;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -54,37 +54,37 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Helper constants for enums */
|
||||
#define _HardwareMessage_Type_MIN HardwareMessage_Type_UNSET
|
||||
#define _HardwareMessage_Type_MAX HardwareMessage_Type_READ_GPIOS_REPLY
|
||||
#define _HardwareMessage_Type_ARRAYSIZE ((HardwareMessage_Type)(HardwareMessage_Type_READ_GPIOS_REPLY+1))
|
||||
#define _meshtastic_HardwareMessage_Type_MIN meshtastic_HardwareMessage_Type_UNSET
|
||||
#define _meshtastic_HardwareMessage_Type_MAX meshtastic_HardwareMessage_Type_READ_GPIOS_REPLY
|
||||
#define _meshtastic_HardwareMessage_Type_ARRAYSIZE ((meshtastic_HardwareMessage_Type)(meshtastic_HardwareMessage_Type_READ_GPIOS_REPLY+1))
|
||||
|
||||
#define HardwareMessage_type_ENUMTYPE HardwareMessage_Type
|
||||
#define meshtastic_HardwareMessage_type_ENUMTYPE meshtastic_HardwareMessage_Type
|
||||
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define HardwareMessage_init_default {_HardwareMessage_Type_MIN, 0, 0}
|
||||
#define HardwareMessage_init_zero {_HardwareMessage_Type_MIN, 0, 0}
|
||||
#define meshtastic_HardwareMessage_init_default {_meshtastic_HardwareMessage_Type_MIN, 0, 0}
|
||||
#define meshtastic_HardwareMessage_init_zero {_meshtastic_HardwareMessage_Type_MIN, 0, 0}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define HardwareMessage_type_tag 1
|
||||
#define HardwareMessage_gpio_mask_tag 2
|
||||
#define HardwareMessage_gpio_value_tag 3
|
||||
#define meshtastic_HardwareMessage_type_tag 1
|
||||
#define meshtastic_HardwareMessage_gpio_mask_tag 2
|
||||
#define meshtastic_HardwareMessage_gpio_value_tag 3
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define HardwareMessage_FIELDLIST(X, a) \
|
||||
#define meshtastic_HardwareMessage_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UENUM, type, 1) \
|
||||
X(a, STATIC, SINGULAR, UINT64, gpio_mask, 2) \
|
||||
X(a, STATIC, SINGULAR, UINT64, gpio_value, 3)
|
||||
#define HardwareMessage_CALLBACK NULL
|
||||
#define HardwareMessage_DEFAULT NULL
|
||||
#define meshtastic_HardwareMessage_CALLBACK NULL
|
||||
#define meshtastic_HardwareMessage_DEFAULT NULL
|
||||
|
||||
extern const pb_msgdesc_t HardwareMessage_msg;
|
||||
extern const pb_msgdesc_t meshtastic_HardwareMessage_msg;
|
||||
|
||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||
#define HardwareMessage_fields &HardwareMessage_msg
|
||||
#define meshtastic_HardwareMessage_fields &meshtastic_HardwareMessage_msg
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define HardwareMessage_size 24
|
||||
#define meshtastic_HardwareMessage_size 24
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.4.7 */
|
||||
|
||||
#include "./rtttl.pb.h"
|
||||
#include "meshtastic/rtttl.pb.h"
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
PB_BIND(RTTTLConfig, RTTTLConfig, AUTO)
|
||||
PB_BIND(meshtastic_RTTTLConfig, meshtastic_RTTTLConfig, AUTO)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
|
||||
/* Struct definitions */
|
||||
/* Canned message module configuration. */
|
||||
typedef struct _RTTTLConfig {
|
||||
typedef struct _meshtastic_RTTTLConfig {
|
||||
/* Ringtone for PWM Buzzer in RTTTL Format. */
|
||||
char ringtone[230];
|
||||
} RTTTLConfig;
|
||||
} meshtastic_RTTTLConfig;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -22,25 +22,25 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define RTTTLConfig_init_default {""}
|
||||
#define RTTTLConfig_init_zero {""}
|
||||
#define meshtastic_RTTTLConfig_init_default {""}
|
||||
#define meshtastic_RTTTLConfig_init_zero {""}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define RTTTLConfig_ringtone_tag 1
|
||||
#define meshtastic_RTTTLConfig_ringtone_tag 1
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define RTTTLConfig_FIELDLIST(X, a) \
|
||||
#define meshtastic_RTTTLConfig_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, STRING, ringtone, 1)
|
||||
#define RTTTLConfig_CALLBACK NULL
|
||||
#define RTTTLConfig_DEFAULT NULL
|
||||
#define meshtastic_RTTTLConfig_CALLBACK NULL
|
||||
#define meshtastic_RTTTLConfig_DEFAULT NULL
|
||||
|
||||
extern const pb_msgdesc_t RTTTLConfig_msg;
|
||||
extern const pb_msgdesc_t meshtastic_RTTTLConfig_msg;
|
||||
|
||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||
#define RTTTLConfig_fields &RTTTLConfig_msg
|
||||
#define meshtastic_RTTTLConfig_fields &meshtastic_RTTTLConfig_msg
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define RTTTLConfig_size 232
|
||||
#define meshtastic_RTTTLConfig_size 232
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.4.7 */
|
||||
|
||||
#include "./storeforward.pb.h"
|
||||
#include "meshtastic/storeforward.pb.h"
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
PB_BIND(StoreAndForward, StoreAndForward, AUTO)
|
||||
PB_BIND(meshtastic_StoreAndForward, meshtastic_StoreAndForward, AUTO)
|
||||
|
||||
|
||||
PB_BIND(StoreAndForward_Statistics, StoreAndForward_Statistics, AUTO)
|
||||
PB_BIND(meshtastic_StoreAndForward_Statistics, meshtastic_StoreAndForward_Statistics, AUTO)
|
||||
|
||||
|
||||
PB_BIND(StoreAndForward_History, StoreAndForward_History, AUTO)
|
||||
PB_BIND(meshtastic_StoreAndForward_History, meshtastic_StoreAndForward_History, AUTO)
|
||||
|
||||
|
||||
PB_BIND(StoreAndForward_Heartbeat, StoreAndForward_Heartbeat, AUTO)
|
||||
PB_BIND(meshtastic_StoreAndForward_Heartbeat, meshtastic_StoreAndForward_Heartbeat, AUTO)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -12,42 +12,42 @@
|
||||
/* Enum definitions */
|
||||
/* 001 - 063 = From Router
|
||||
064 - 127 = From Client */
|
||||
typedef enum _StoreAndForward_RequestResponse {
|
||||
typedef enum _meshtastic_StoreAndForward_RequestResponse {
|
||||
/* Unset/unused */
|
||||
StoreAndForward_RequestResponse_UNSET = 0,
|
||||
meshtastic_StoreAndForward_RequestResponse_UNSET = 0,
|
||||
/* Router is an in error state. */
|
||||
StoreAndForward_RequestResponse_ROUTER_ERROR = 1,
|
||||
meshtastic_StoreAndForward_RequestResponse_ROUTER_ERROR = 1,
|
||||
/* Router heartbeat */
|
||||
StoreAndForward_RequestResponse_ROUTER_HEARTBEAT = 2,
|
||||
meshtastic_StoreAndForward_RequestResponse_ROUTER_HEARTBEAT = 2,
|
||||
/* Router has requested the client respond. This can work as a
|
||||
"are you there" message. */
|
||||
StoreAndForward_RequestResponse_ROUTER_PING = 3,
|
||||
meshtastic_StoreAndForward_RequestResponse_ROUTER_PING = 3,
|
||||
/* The response to a "Ping" */
|
||||
StoreAndForward_RequestResponse_ROUTER_PONG = 4,
|
||||
meshtastic_StoreAndForward_RequestResponse_ROUTER_PONG = 4,
|
||||
/* Router is currently busy. Please try again later. */
|
||||
StoreAndForward_RequestResponse_ROUTER_BUSY = 5,
|
||||
meshtastic_StoreAndForward_RequestResponse_ROUTER_BUSY = 5,
|
||||
/* Router is responding to a request for history. */
|
||||
StoreAndForward_RequestResponse_ROUTER_HISTORY = 6,
|
||||
meshtastic_StoreAndForward_RequestResponse_ROUTER_HISTORY = 6,
|
||||
/* Router is responding to a request for stats. */
|
||||
StoreAndForward_RequestResponse_ROUTER_STATS = 7,
|
||||
meshtastic_StoreAndForward_RequestResponse_ROUTER_STATS = 7,
|
||||
/* Client is an in error state. */
|
||||
StoreAndForward_RequestResponse_CLIENT_ERROR = 64,
|
||||
meshtastic_StoreAndForward_RequestResponse_CLIENT_ERROR = 64,
|
||||
/* Client has requested a replay from the router. */
|
||||
StoreAndForward_RequestResponse_CLIENT_HISTORY = 65,
|
||||
meshtastic_StoreAndForward_RequestResponse_CLIENT_HISTORY = 65,
|
||||
/* Client has requested stats from the router. */
|
||||
StoreAndForward_RequestResponse_CLIENT_STATS = 66,
|
||||
meshtastic_StoreAndForward_RequestResponse_CLIENT_STATS = 66,
|
||||
/* Client has requested the router respond. This can work as a
|
||||
"are you there" message. */
|
||||
StoreAndForward_RequestResponse_CLIENT_PING = 67,
|
||||
meshtastic_StoreAndForward_RequestResponse_CLIENT_PING = 67,
|
||||
/* The response to a "Ping" */
|
||||
StoreAndForward_RequestResponse_CLIENT_PONG = 68,
|
||||
meshtastic_StoreAndForward_RequestResponse_CLIENT_PONG = 68,
|
||||
/* Client has requested that the router abort processing the client's request */
|
||||
StoreAndForward_RequestResponse_CLIENT_ABORT = 106
|
||||
} StoreAndForward_RequestResponse;
|
||||
meshtastic_StoreAndForward_RequestResponse_CLIENT_ABORT = 106
|
||||
} meshtastic_StoreAndForward_RequestResponse;
|
||||
|
||||
/* Struct definitions */
|
||||
/* TODO: REPLACE */
|
||||
typedef struct _StoreAndForward_Statistics {
|
||||
typedef struct _meshtastic_StoreAndForward_Statistics {
|
||||
/* Number of messages we have ever seen */
|
||||
uint32_t messages_total;
|
||||
/* Number of messages we have currently saved our history. */
|
||||
@@ -66,42 +66,42 @@ typedef struct _StoreAndForward_Statistics {
|
||||
uint32_t return_max;
|
||||
/* Is the heartbeat enabled on the server? */
|
||||
uint32_t return_window;
|
||||
} StoreAndForward_Statistics;
|
||||
} meshtastic_StoreAndForward_Statistics;
|
||||
|
||||
/* TODO: REPLACE */
|
||||
typedef struct _StoreAndForward_History {
|
||||
typedef struct _meshtastic_StoreAndForward_History {
|
||||
/* Number of that will be sent to the client */
|
||||
uint32_t history_messages;
|
||||
/* The window of messages that was used to filter the history client requested */
|
||||
uint32_t window;
|
||||
/* The window of messages that was used to filter the history client requested */
|
||||
uint32_t last_request;
|
||||
} StoreAndForward_History;
|
||||
} meshtastic_StoreAndForward_History;
|
||||
|
||||
/* TODO: REPLACE */
|
||||
typedef struct _StoreAndForward_Heartbeat {
|
||||
typedef struct _meshtastic_StoreAndForward_Heartbeat {
|
||||
/* Number of that will be sent to the client */
|
||||
uint32_t period;
|
||||
/* If set, this is not the primary Store & Forward router on the mesh */
|
||||
uint32_t secondary;
|
||||
} StoreAndForward_Heartbeat;
|
||||
} meshtastic_StoreAndForward_Heartbeat;
|
||||
|
||||
/* TODO: REPLACE */
|
||||
typedef struct _StoreAndForward {
|
||||
typedef struct _meshtastic_StoreAndForward {
|
||||
/* TODO: REPLACE */
|
||||
StoreAndForward_RequestResponse rr;
|
||||
meshtastic_StoreAndForward_RequestResponse rr;
|
||||
pb_size_t which_variant;
|
||||
union {
|
||||
/* TODO: REPLACE */
|
||||
StoreAndForward_Statistics stats;
|
||||
meshtastic_StoreAndForward_Statistics stats;
|
||||
/* TODO: REPLACE */
|
||||
StoreAndForward_History history;
|
||||
meshtastic_StoreAndForward_History history;
|
||||
/* TODO: REPLACE */
|
||||
StoreAndForward_Heartbeat heartbeat;
|
||||
meshtastic_StoreAndForward_Heartbeat heartbeat;
|
||||
/* Empty Payload */
|
||||
bool empty;
|
||||
} variant;
|
||||
} StoreAndForward;
|
||||
} meshtastic_StoreAndForward;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -109,61 +109,61 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Helper constants for enums */
|
||||
#define _StoreAndForward_RequestResponse_MIN StoreAndForward_RequestResponse_UNSET
|
||||
#define _StoreAndForward_RequestResponse_MAX StoreAndForward_RequestResponse_CLIENT_ABORT
|
||||
#define _StoreAndForward_RequestResponse_ARRAYSIZE ((StoreAndForward_RequestResponse)(StoreAndForward_RequestResponse_CLIENT_ABORT+1))
|
||||
#define _meshtastic_StoreAndForward_RequestResponse_MIN meshtastic_StoreAndForward_RequestResponse_UNSET
|
||||
#define _meshtastic_StoreAndForward_RequestResponse_MAX meshtastic_StoreAndForward_RequestResponse_CLIENT_ABORT
|
||||
#define _meshtastic_StoreAndForward_RequestResponse_ARRAYSIZE ((meshtastic_StoreAndForward_RequestResponse)(meshtastic_StoreAndForward_RequestResponse_CLIENT_ABORT+1))
|
||||
|
||||
#define StoreAndForward_rr_ENUMTYPE StoreAndForward_RequestResponse
|
||||
#define meshtastic_StoreAndForward_rr_ENUMTYPE meshtastic_StoreAndForward_RequestResponse
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define StoreAndForward_init_default {_StoreAndForward_RequestResponse_MIN, 0, {StoreAndForward_Statistics_init_default}}
|
||||
#define StoreAndForward_Statistics_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
#define StoreAndForward_History_init_default {0, 0, 0}
|
||||
#define StoreAndForward_Heartbeat_init_default {0, 0}
|
||||
#define StoreAndForward_init_zero {_StoreAndForward_RequestResponse_MIN, 0, {StoreAndForward_Statistics_init_zero}}
|
||||
#define StoreAndForward_Statistics_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
#define StoreAndForward_History_init_zero {0, 0, 0}
|
||||
#define StoreAndForward_Heartbeat_init_zero {0, 0}
|
||||
#define meshtastic_StoreAndForward_init_default {_meshtastic_StoreAndForward_RequestResponse_MIN, 0, {meshtastic_StoreAndForward_Statistics_init_default}}
|
||||
#define meshtastic_StoreAndForward_Statistics_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
#define meshtastic_StoreAndForward_History_init_default {0, 0, 0}
|
||||
#define meshtastic_StoreAndForward_Heartbeat_init_default {0, 0}
|
||||
#define meshtastic_StoreAndForward_init_zero {_meshtastic_StoreAndForward_RequestResponse_MIN, 0, {meshtastic_StoreAndForward_Statistics_init_zero}}
|
||||
#define meshtastic_StoreAndForward_Statistics_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
#define meshtastic_StoreAndForward_History_init_zero {0, 0, 0}
|
||||
#define meshtastic_StoreAndForward_Heartbeat_init_zero {0, 0}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define StoreAndForward_Statistics_messages_total_tag 1
|
||||
#define StoreAndForward_Statistics_messages_saved_tag 2
|
||||
#define StoreAndForward_Statistics_messages_max_tag 3
|
||||
#define StoreAndForward_Statistics_up_time_tag 4
|
||||
#define StoreAndForward_Statistics_requests_tag 5
|
||||
#define StoreAndForward_Statistics_requests_history_tag 6
|
||||
#define StoreAndForward_Statistics_heartbeat_tag 7
|
||||
#define StoreAndForward_Statistics_return_max_tag 8
|
||||
#define StoreAndForward_Statistics_return_window_tag 9
|
||||
#define StoreAndForward_History_history_messages_tag 1
|
||||
#define StoreAndForward_History_window_tag 2
|
||||
#define StoreAndForward_History_last_request_tag 3
|
||||
#define StoreAndForward_Heartbeat_period_tag 1
|
||||
#define StoreAndForward_Heartbeat_secondary_tag 2
|
||||
#define StoreAndForward_rr_tag 1
|
||||
#define StoreAndForward_stats_tag 2
|
||||
#define StoreAndForward_history_tag 3
|
||||
#define StoreAndForward_heartbeat_tag 4
|
||||
#define StoreAndForward_empty_tag 5
|
||||
#define meshtastic_StoreAndForward_Statistics_messages_total_tag 1
|
||||
#define meshtastic_StoreAndForward_Statistics_messages_saved_tag 2
|
||||
#define meshtastic_StoreAndForward_Statistics_messages_max_tag 3
|
||||
#define meshtastic_StoreAndForward_Statistics_up_time_tag 4
|
||||
#define meshtastic_StoreAndForward_Statistics_requests_tag 5
|
||||
#define meshtastic_StoreAndForward_Statistics_requests_history_tag 6
|
||||
#define meshtastic_StoreAndForward_Statistics_heartbeat_tag 7
|
||||
#define meshtastic_StoreAndForward_Statistics_return_max_tag 8
|
||||
#define meshtastic_StoreAndForward_Statistics_return_window_tag 9
|
||||
#define meshtastic_StoreAndForward_History_history_messages_tag 1
|
||||
#define meshtastic_StoreAndForward_History_window_tag 2
|
||||
#define meshtastic_StoreAndForward_History_last_request_tag 3
|
||||
#define meshtastic_StoreAndForward_Heartbeat_period_tag 1
|
||||
#define meshtastic_StoreAndForward_Heartbeat_secondary_tag 2
|
||||
#define meshtastic_StoreAndForward_rr_tag 1
|
||||
#define meshtastic_StoreAndForward_stats_tag 2
|
||||
#define meshtastic_StoreAndForward_history_tag 3
|
||||
#define meshtastic_StoreAndForward_heartbeat_tag 4
|
||||
#define meshtastic_StoreAndForward_empty_tag 5
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define StoreAndForward_FIELDLIST(X, a) \
|
||||
#define meshtastic_StoreAndForward_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UENUM, rr, 1) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (variant,stats,variant.stats), 2) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (variant,history,variant.history), 3) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (variant,heartbeat,variant.heartbeat), 4) \
|
||||
X(a, STATIC, ONEOF, BOOL, (variant,empty,variant.empty), 5)
|
||||
#define StoreAndForward_CALLBACK NULL
|
||||
#define StoreAndForward_DEFAULT NULL
|
||||
#define StoreAndForward_variant_stats_MSGTYPE StoreAndForward_Statistics
|
||||
#define StoreAndForward_variant_history_MSGTYPE StoreAndForward_History
|
||||
#define StoreAndForward_variant_heartbeat_MSGTYPE StoreAndForward_Heartbeat
|
||||
#define meshtastic_StoreAndForward_CALLBACK NULL
|
||||
#define meshtastic_StoreAndForward_DEFAULT NULL
|
||||
#define meshtastic_StoreAndForward_variant_stats_MSGTYPE meshtastic_StoreAndForward_Statistics
|
||||
#define meshtastic_StoreAndForward_variant_history_MSGTYPE meshtastic_StoreAndForward_History
|
||||
#define meshtastic_StoreAndForward_variant_heartbeat_MSGTYPE meshtastic_StoreAndForward_Heartbeat
|
||||
|
||||
#define StoreAndForward_Statistics_FIELDLIST(X, a) \
|
||||
#define meshtastic_StoreAndForward_Statistics_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, messages_total, 1) \
|
||||
X(a, STATIC, SINGULAR, UINT32, messages_saved, 2) \
|
||||
X(a, STATIC, SINGULAR, UINT32, messages_max, 3) \
|
||||
@@ -173,38 +173,38 @@ X(a, STATIC, SINGULAR, UINT32, requests_history, 6) \
|
||||
X(a, STATIC, SINGULAR, BOOL, heartbeat, 7) \
|
||||
X(a, STATIC, SINGULAR, UINT32, return_max, 8) \
|
||||
X(a, STATIC, SINGULAR, UINT32, return_window, 9)
|
||||
#define StoreAndForward_Statistics_CALLBACK NULL
|
||||
#define StoreAndForward_Statistics_DEFAULT NULL
|
||||
#define meshtastic_StoreAndForward_Statistics_CALLBACK NULL
|
||||
#define meshtastic_StoreAndForward_Statistics_DEFAULT NULL
|
||||
|
||||
#define StoreAndForward_History_FIELDLIST(X, a) \
|
||||
#define meshtastic_StoreAndForward_History_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, history_messages, 1) \
|
||||
X(a, STATIC, SINGULAR, UINT32, window, 2) \
|
||||
X(a, STATIC, SINGULAR, UINT32, last_request, 3)
|
||||
#define StoreAndForward_History_CALLBACK NULL
|
||||
#define StoreAndForward_History_DEFAULT NULL
|
||||
#define meshtastic_StoreAndForward_History_CALLBACK NULL
|
||||
#define meshtastic_StoreAndForward_History_DEFAULT NULL
|
||||
|
||||
#define StoreAndForward_Heartbeat_FIELDLIST(X, a) \
|
||||
#define meshtastic_StoreAndForward_Heartbeat_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, period, 1) \
|
||||
X(a, STATIC, SINGULAR, UINT32, secondary, 2)
|
||||
#define StoreAndForward_Heartbeat_CALLBACK NULL
|
||||
#define StoreAndForward_Heartbeat_DEFAULT NULL
|
||||
#define meshtastic_StoreAndForward_Heartbeat_CALLBACK NULL
|
||||
#define meshtastic_StoreAndForward_Heartbeat_DEFAULT NULL
|
||||
|
||||
extern const pb_msgdesc_t StoreAndForward_msg;
|
||||
extern const pb_msgdesc_t StoreAndForward_Statistics_msg;
|
||||
extern const pb_msgdesc_t StoreAndForward_History_msg;
|
||||
extern const pb_msgdesc_t StoreAndForward_Heartbeat_msg;
|
||||
extern const pb_msgdesc_t meshtastic_StoreAndForward_msg;
|
||||
extern const pb_msgdesc_t meshtastic_StoreAndForward_Statistics_msg;
|
||||
extern const pb_msgdesc_t meshtastic_StoreAndForward_History_msg;
|
||||
extern const pb_msgdesc_t meshtastic_StoreAndForward_Heartbeat_msg;
|
||||
|
||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||
#define StoreAndForward_fields &StoreAndForward_msg
|
||||
#define StoreAndForward_Statistics_fields &StoreAndForward_Statistics_msg
|
||||
#define StoreAndForward_History_fields &StoreAndForward_History_msg
|
||||
#define StoreAndForward_Heartbeat_fields &StoreAndForward_Heartbeat_msg
|
||||
#define meshtastic_StoreAndForward_fields &meshtastic_StoreAndForward_msg
|
||||
#define meshtastic_StoreAndForward_Statistics_fields &meshtastic_StoreAndForward_Statistics_msg
|
||||
#define meshtastic_StoreAndForward_History_fields &meshtastic_StoreAndForward_History_msg
|
||||
#define meshtastic_StoreAndForward_Heartbeat_fields &meshtastic_StoreAndForward_Heartbeat_msg
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define StoreAndForward_Heartbeat_size 12
|
||||
#define StoreAndForward_History_size 18
|
||||
#define StoreAndForward_Statistics_size 50
|
||||
#define StoreAndForward_size 54
|
||||
#define meshtastic_StoreAndForward_Heartbeat_size 12
|
||||
#define meshtastic_StoreAndForward_History_size 18
|
||||
#define meshtastic_StoreAndForward_Statistics_size 50
|
||||
#define meshtastic_StoreAndForward_size 54
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.4.7 */
|
||||
|
||||
#include "./telemetry.pb.h"
|
||||
#include "meshtastic/telemetry.pb.h"
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
PB_BIND(DeviceMetrics, DeviceMetrics, AUTO)
|
||||
PB_BIND(meshtastic_DeviceMetrics, meshtastic_DeviceMetrics, AUTO)
|
||||
|
||||
|
||||
PB_BIND(EnvironmentMetrics, EnvironmentMetrics, AUTO)
|
||||
PB_BIND(meshtastic_EnvironmentMetrics, meshtastic_EnvironmentMetrics, AUTO)
|
||||
|
||||
|
||||
PB_BIND(Telemetry, Telemetry, AUTO)
|
||||
PB_BIND(meshtastic_Telemetry, meshtastic_Telemetry, AUTO)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -11,38 +11,38 @@
|
||||
|
||||
/* Enum definitions */
|
||||
/* TODO: REPLACE */
|
||||
typedef enum _TelemetrySensorType {
|
||||
typedef enum _meshtastic_TelemetrySensorType {
|
||||
/* No external telemetry sensor explicitly set */
|
||||
TelemetrySensorType_SENSOR_UNSET = 0,
|
||||
meshtastic_TelemetrySensorType_SENSOR_UNSET = 0,
|
||||
/* High accuracy temperature, pressure, humidity */
|
||||
TelemetrySensorType_BME280 = 1,
|
||||
meshtastic_TelemetrySensorType_BME280 = 1,
|
||||
/* High accuracy temperature, pressure, humidity, and air resistance */
|
||||
TelemetrySensorType_BME680 = 2,
|
||||
meshtastic_TelemetrySensorType_BME680 = 2,
|
||||
/* Very high accuracy temperature */
|
||||
TelemetrySensorType_MCP9808 = 3,
|
||||
meshtastic_TelemetrySensorType_MCP9808 = 3,
|
||||
/* Moderate accuracy current and voltage */
|
||||
TelemetrySensorType_INA260 = 4,
|
||||
meshtastic_TelemetrySensorType_INA260 = 4,
|
||||
/* Moderate accuracy current and voltage */
|
||||
TelemetrySensorType_INA219 = 5,
|
||||
meshtastic_TelemetrySensorType_INA219 = 5,
|
||||
/* High accuracy temperature and pressure */
|
||||
TelemetrySensorType_BMP280 = 6,
|
||||
meshtastic_TelemetrySensorType_BMP280 = 6,
|
||||
/* High accuracy temperature and humidity */
|
||||
TelemetrySensorType_SHTC3 = 7,
|
||||
meshtastic_TelemetrySensorType_SHTC3 = 7,
|
||||
/* High accuracy pressure */
|
||||
TelemetrySensorType_LPS22 = 8,
|
||||
meshtastic_TelemetrySensorType_LPS22 = 8,
|
||||
/* 3-Axis magnetic sensor */
|
||||
TelemetrySensorType_QMC6310 = 9,
|
||||
meshtastic_TelemetrySensorType_QMC6310 = 9,
|
||||
/* 6-Axis inertial measurement sensor */
|
||||
TelemetrySensorType_QMI8658 = 10,
|
||||
meshtastic_TelemetrySensorType_QMI8658 = 10,
|
||||
/* 3-Axis magnetic sensor */
|
||||
TelemetrySensorType_QMC5883L = 11,
|
||||
meshtastic_TelemetrySensorType_QMC5883L = 11,
|
||||
/* High accuracy temperature and humidity */
|
||||
TelemetrySensorType_SHT31 = 12
|
||||
} TelemetrySensorType;
|
||||
meshtastic_TelemetrySensorType_SHT31 = 12
|
||||
} meshtastic_TelemetrySensorType;
|
||||
|
||||
/* Struct definitions */
|
||||
/* Key native device metrics such as battery level */
|
||||
typedef struct _DeviceMetrics {
|
||||
typedef struct _meshtastic_DeviceMetrics {
|
||||
/* 1-100 (0 means powered) */
|
||||
uint32_t battery_level;
|
||||
/* Voltage measured */
|
||||
@@ -51,10 +51,10 @@ typedef struct _DeviceMetrics {
|
||||
float channel_utilization;
|
||||
/* Percent of airtime for transmission used within the last hour. */
|
||||
float air_util_tx;
|
||||
} DeviceMetrics;
|
||||
} meshtastic_DeviceMetrics;
|
||||
|
||||
/* Weather station or other environmental metrics */
|
||||
typedef struct _EnvironmentMetrics {
|
||||
typedef struct _meshtastic_EnvironmentMetrics {
|
||||
/* Temperature measured */
|
||||
float temperature;
|
||||
/* Relative humidity percent measured */
|
||||
@@ -67,24 +67,24 @@ typedef struct _EnvironmentMetrics {
|
||||
float voltage;
|
||||
/* Current measured */
|
||||
float current;
|
||||
} EnvironmentMetrics;
|
||||
} meshtastic_EnvironmentMetrics;
|
||||
|
||||
/* Types of Measurements the telemetry module is equipped to handle */
|
||||
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).
|
||||
typedef struct _meshtastic_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;
|
||||
pb_size_t which_variant;
|
||||
union {
|
||||
/* Key native device metrics such as battery level */
|
||||
DeviceMetrics device_metrics;
|
||||
meshtastic_DeviceMetrics device_metrics;
|
||||
/* Weather station or other environmental metrics */
|
||||
EnvironmentMetrics environment_metrics;
|
||||
meshtastic_EnvironmentMetrics environment_metrics;
|
||||
} variant;
|
||||
} Telemetry;
|
||||
} meshtastic_Telemetry;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -92,78 +92,78 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Helper constants for enums */
|
||||
#define _TelemetrySensorType_MIN TelemetrySensorType_SENSOR_UNSET
|
||||
#define _TelemetrySensorType_MAX TelemetrySensorType_SHT31
|
||||
#define _TelemetrySensorType_ARRAYSIZE ((TelemetrySensorType)(TelemetrySensorType_SHT31+1))
|
||||
#define _meshtastic_TelemetrySensorType_MIN meshtastic_TelemetrySensorType_SENSOR_UNSET
|
||||
#define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_SHT31
|
||||
#define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_SHT31+1))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define DeviceMetrics_init_default {0, 0, 0, 0}
|
||||
#define EnvironmentMetrics_init_default {0, 0, 0, 0, 0, 0}
|
||||
#define Telemetry_init_default {0, 0, {DeviceMetrics_init_default}}
|
||||
#define DeviceMetrics_init_zero {0, 0, 0, 0}
|
||||
#define EnvironmentMetrics_init_zero {0, 0, 0, 0, 0, 0}
|
||||
#define Telemetry_init_zero {0, 0, {DeviceMetrics_init_zero}}
|
||||
#define meshtastic_DeviceMetrics_init_default {0, 0, 0, 0}
|
||||
#define meshtastic_EnvironmentMetrics_init_default {0, 0, 0, 0, 0, 0}
|
||||
#define meshtastic_Telemetry_init_default {0, 0, {meshtastic_DeviceMetrics_init_default}}
|
||||
#define meshtastic_DeviceMetrics_init_zero {0, 0, 0, 0}
|
||||
#define meshtastic_EnvironmentMetrics_init_zero {0, 0, 0, 0, 0, 0}
|
||||
#define meshtastic_Telemetry_init_zero {0, 0, {meshtastic_DeviceMetrics_init_zero}}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define DeviceMetrics_battery_level_tag 1
|
||||
#define DeviceMetrics_voltage_tag 2
|
||||
#define DeviceMetrics_channel_utilization_tag 3
|
||||
#define DeviceMetrics_air_util_tx_tag 4
|
||||
#define EnvironmentMetrics_temperature_tag 1
|
||||
#define EnvironmentMetrics_relative_humidity_tag 2
|
||||
#define EnvironmentMetrics_barometric_pressure_tag 3
|
||||
#define EnvironmentMetrics_gas_resistance_tag 4
|
||||
#define EnvironmentMetrics_voltage_tag 5
|
||||
#define EnvironmentMetrics_current_tag 6
|
||||
#define Telemetry_time_tag 1
|
||||
#define Telemetry_device_metrics_tag 2
|
||||
#define Telemetry_environment_metrics_tag 3
|
||||
#define meshtastic_DeviceMetrics_battery_level_tag 1
|
||||
#define meshtastic_DeviceMetrics_voltage_tag 2
|
||||
#define meshtastic_DeviceMetrics_channel_utilization_tag 3
|
||||
#define meshtastic_DeviceMetrics_air_util_tx_tag 4
|
||||
#define meshtastic_EnvironmentMetrics_temperature_tag 1
|
||||
#define meshtastic_EnvironmentMetrics_relative_humidity_tag 2
|
||||
#define meshtastic_EnvironmentMetrics_barometric_pressure_tag 3
|
||||
#define meshtastic_EnvironmentMetrics_gas_resistance_tag 4
|
||||
#define meshtastic_EnvironmentMetrics_voltage_tag 5
|
||||
#define meshtastic_EnvironmentMetrics_current_tag 6
|
||||
#define meshtastic_Telemetry_time_tag 1
|
||||
#define meshtastic_Telemetry_device_metrics_tag 2
|
||||
#define meshtastic_Telemetry_environment_metrics_tag 3
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define DeviceMetrics_FIELDLIST(X, a) \
|
||||
#define meshtastic_DeviceMetrics_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, battery_level, 1) \
|
||||
X(a, STATIC, SINGULAR, FLOAT, voltage, 2) \
|
||||
X(a, STATIC, SINGULAR, FLOAT, channel_utilization, 3) \
|
||||
X(a, STATIC, SINGULAR, FLOAT, air_util_tx, 4)
|
||||
#define DeviceMetrics_CALLBACK NULL
|
||||
#define DeviceMetrics_DEFAULT NULL
|
||||
#define meshtastic_DeviceMetrics_CALLBACK NULL
|
||||
#define meshtastic_DeviceMetrics_DEFAULT NULL
|
||||
|
||||
#define EnvironmentMetrics_FIELDLIST(X, a) \
|
||||
#define meshtastic_EnvironmentMetrics_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, FLOAT, temperature, 1) \
|
||||
X(a, STATIC, SINGULAR, FLOAT, relative_humidity, 2) \
|
||||
X(a, STATIC, SINGULAR, FLOAT, barometric_pressure, 3) \
|
||||
X(a, STATIC, SINGULAR, FLOAT, gas_resistance, 4) \
|
||||
X(a, STATIC, SINGULAR, FLOAT, voltage, 5) \
|
||||
X(a, STATIC, SINGULAR, FLOAT, current, 6)
|
||||
#define EnvironmentMetrics_CALLBACK NULL
|
||||
#define EnvironmentMetrics_DEFAULT NULL
|
||||
#define meshtastic_EnvironmentMetrics_CALLBACK NULL
|
||||
#define meshtastic_EnvironmentMetrics_DEFAULT NULL
|
||||
|
||||
#define Telemetry_FIELDLIST(X, a) \
|
||||
#define meshtastic_Telemetry_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, FIXED32, time, 1) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (variant,device_metrics,variant.device_metrics), 2) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (variant,environment_metrics,variant.environment_metrics), 3)
|
||||
#define Telemetry_CALLBACK NULL
|
||||
#define Telemetry_DEFAULT NULL
|
||||
#define Telemetry_variant_device_metrics_MSGTYPE DeviceMetrics
|
||||
#define Telemetry_variant_environment_metrics_MSGTYPE EnvironmentMetrics
|
||||
#define meshtastic_Telemetry_CALLBACK NULL
|
||||
#define meshtastic_Telemetry_DEFAULT NULL
|
||||
#define meshtastic_Telemetry_variant_device_metrics_MSGTYPE meshtastic_DeviceMetrics
|
||||
#define meshtastic_Telemetry_variant_environment_metrics_MSGTYPE meshtastic_EnvironmentMetrics
|
||||
|
||||
extern const pb_msgdesc_t DeviceMetrics_msg;
|
||||
extern const pb_msgdesc_t EnvironmentMetrics_msg;
|
||||
extern const pb_msgdesc_t Telemetry_msg;
|
||||
extern const pb_msgdesc_t meshtastic_DeviceMetrics_msg;
|
||||
extern const pb_msgdesc_t meshtastic_EnvironmentMetrics_msg;
|
||||
extern const pb_msgdesc_t meshtastic_Telemetry_msg;
|
||||
|
||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||
#define DeviceMetrics_fields &DeviceMetrics_msg
|
||||
#define EnvironmentMetrics_fields &EnvironmentMetrics_msg
|
||||
#define Telemetry_fields &Telemetry_msg
|
||||
#define meshtastic_DeviceMetrics_fields &meshtastic_DeviceMetrics_msg
|
||||
#define meshtastic_EnvironmentMetrics_fields &meshtastic_EnvironmentMetrics_msg
|
||||
#define meshtastic_Telemetry_fields &meshtastic_Telemetry_msg
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define DeviceMetrics_size 21
|
||||
#define EnvironmentMetrics_size 30
|
||||
#define Telemetry_size 37
|
||||
#define meshtastic_DeviceMetrics_size 21
|
||||
#define meshtastic_EnvironmentMetrics_size 30
|
||||
#define meshtastic_Telemetry_size 37
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.4.7 */
|
||||
|
||||
#include "./xmodem.pb.h"
|
||||
#include "meshtastic/xmodem.pb.h"
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
PB_BIND(XModem, XModem, AUTO)
|
||||
PB_BIND(meshtastic_XModem, meshtastic_XModem, AUTO)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -10,25 +10,25 @@
|
||||
#endif
|
||||
|
||||
/* Enum definitions */
|
||||
typedef enum _XModem_Control {
|
||||
XModem_Control_NUL = 0,
|
||||
XModem_Control_SOH = 1,
|
||||
XModem_Control_STX = 2,
|
||||
XModem_Control_EOT = 4,
|
||||
XModem_Control_ACK = 6,
|
||||
XModem_Control_NAK = 21,
|
||||
XModem_Control_CAN = 24,
|
||||
XModem_Control_CTRLZ = 26
|
||||
} XModem_Control;
|
||||
typedef enum _meshtastic_XModem_Control {
|
||||
meshtastic_XModem_Control_NUL = 0,
|
||||
meshtastic_XModem_Control_SOH = 1,
|
||||
meshtastic_XModem_Control_STX = 2,
|
||||
meshtastic_XModem_Control_EOT = 4,
|
||||
meshtastic_XModem_Control_ACK = 6,
|
||||
meshtastic_XModem_Control_NAK = 21,
|
||||
meshtastic_XModem_Control_CAN = 24,
|
||||
meshtastic_XModem_Control_CTRLZ = 26
|
||||
} meshtastic_XModem_Control;
|
||||
|
||||
/* Struct definitions */
|
||||
typedef PB_BYTES_ARRAY_T(128) XModem_buffer_t;
|
||||
typedef struct _XModem {
|
||||
XModem_Control control;
|
||||
typedef PB_BYTES_ARRAY_T(128) meshtastic_XModem_buffer_t;
|
||||
typedef struct _meshtastic_XModem {
|
||||
meshtastic_XModem_Control control;
|
||||
uint16_t seq;
|
||||
uint16_t crc16;
|
||||
XModem_buffer_t buffer;
|
||||
} XModem;
|
||||
meshtastic_XModem_buffer_t buffer;
|
||||
} meshtastic_XModem;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -36,39 +36,39 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Helper constants for enums */
|
||||
#define _XModem_Control_MIN XModem_Control_NUL
|
||||
#define _XModem_Control_MAX XModem_Control_CTRLZ
|
||||
#define _XModem_Control_ARRAYSIZE ((XModem_Control)(XModem_Control_CTRLZ+1))
|
||||
#define _meshtastic_XModem_Control_MIN meshtastic_XModem_Control_NUL
|
||||
#define _meshtastic_XModem_Control_MAX meshtastic_XModem_Control_CTRLZ
|
||||
#define _meshtastic_XModem_Control_ARRAYSIZE ((meshtastic_XModem_Control)(meshtastic_XModem_Control_CTRLZ+1))
|
||||
|
||||
#define XModem_control_ENUMTYPE XModem_Control
|
||||
#define meshtastic_XModem_control_ENUMTYPE meshtastic_XModem_Control
|
||||
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define XModem_init_default {_XModem_Control_MIN, 0, 0, {0, {0}}}
|
||||
#define XModem_init_zero {_XModem_Control_MIN, 0, 0, {0, {0}}}
|
||||
#define meshtastic_XModem_init_default {_meshtastic_XModem_Control_MIN, 0, 0, {0, {0}}}
|
||||
#define meshtastic_XModem_init_zero {_meshtastic_XModem_Control_MIN, 0, 0, {0, {0}}}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define XModem_control_tag 1
|
||||
#define XModem_seq_tag 2
|
||||
#define XModem_crc16_tag 3
|
||||
#define XModem_buffer_tag 4
|
||||
#define meshtastic_XModem_control_tag 1
|
||||
#define meshtastic_XModem_seq_tag 2
|
||||
#define meshtastic_XModem_crc16_tag 3
|
||||
#define meshtastic_XModem_buffer_tag 4
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define XModem_FIELDLIST(X, a) \
|
||||
#define meshtastic_XModem_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UENUM, control, 1) \
|
||||
X(a, STATIC, SINGULAR, UINT32, seq, 2) \
|
||||
X(a, STATIC, SINGULAR, UINT32, crc16, 3) \
|
||||
X(a, STATIC, SINGULAR, BYTES, buffer, 4)
|
||||
#define XModem_CALLBACK NULL
|
||||
#define XModem_DEFAULT NULL
|
||||
#define meshtastic_XModem_CALLBACK NULL
|
||||
#define meshtastic_XModem_DEFAULT NULL
|
||||
|
||||
extern const pb_msgdesc_t XModem_msg;
|
||||
extern const pb_msgdesc_t meshtastic_XModem_msg;
|
||||
|
||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||
#define XModem_fields &XModem_msg
|
||||
#define meshtastic_XModem_fields &meshtastic_XModem_msg
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define XModem_size 141
|
||||
#define meshtastic_XModem_size 141
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
#include "mesh/http/ContentHelper.h"
|
||||
#include "mesh/http/WebServer.h"
|
||||
#include "mesh/http/WiFiAPClient.h"
|
||||
#include "mqtt/JSON.h"
|
||||
#include "power.h"
|
||||
#include "sleep.h"
|
||||
#include <FSCommon.h>
|
||||
#include <HTTPBodyParser.hpp>
|
||||
#include <HTTPMultipartBodyParser.hpp>
|
||||
#include <HTTPURLEncodedBodyParser.hpp>
|
||||
#include "mqtt/JSON.h"
|
||||
|
||||
#ifdef ARCH_ESP32
|
||||
#include "esp_task_wdt.h"
|
||||
@@ -321,7 +321,7 @@ void handleFsBrowseStatic(HTTPRequest *req, HTTPResponse *res)
|
||||
|
||||
res->print(value->Stringify().c_str());
|
||||
|
||||
delete value;
|
||||
delete value;
|
||||
}
|
||||
|
||||
void handleFsDeleteStatic(HTTPRequest *req, HTTPResponse *res)
|
||||
@@ -336,7 +336,7 @@ void handleFsDeleteStatic(HTTPRequest *req, HTTPResponse *res)
|
||||
std::string pathDelete = "/" + paramValDelete;
|
||||
if (FSCom.remove(pathDelete.c_str())) {
|
||||
LOG_INFO("%s\n", pathDelete.c_str());
|
||||
JSONObject jsonObjOuter;
|
||||
JSONObject jsonObjOuter;
|
||||
jsonObjOuter["status"] = new JSONValue("ok");
|
||||
JSONValue *value = new JSONValue(jsonObjOuter);
|
||||
res->print(value->Stringify().c_str());
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
void registerHandlers(HTTPServer *insecureServer, HTTPSServer *secureServer);
|
||||
|
||||
// Declare some handler functions for the various URLs on the server
|
||||
@@ -22,7 +21,6 @@ void handleAdmin(HTTPRequest *req, HTTPResponse *res);
|
||||
void handleAdminSettings(HTTPRequest *req, HTTPResponse *res);
|
||||
void handleAdminSettingsApply(HTTPRequest *req, HTTPResponse *res);
|
||||
|
||||
|
||||
// Interface to the PhoneAPI to access the protobufs with messages
|
||||
class HttpAPI : public PhoneAPI
|
||||
{
|
||||
@@ -34,7 +32,6 @@ class HttpAPI : public PhoneAPI
|
||||
// Nothing here yet
|
||||
|
||||
protected:
|
||||
|
||||
/// Check the current underlying physical link to see if the client is currently connected
|
||||
virtual bool checkIsConnected() override { return true; } // FIXME, be smarter about this
|
||||
};
|
||||
|
||||
@@ -152,7 +152,7 @@ void createSSLCert()
|
||||
if (millis() / 1000 >= 3) {
|
||||
screen->setSSLFrames();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
runLoop = false;
|
||||
} else {
|
||||
@@ -165,7 +165,8 @@ void createSSLCert()
|
||||
|
||||
WebServerThread *webServerThread;
|
||||
|
||||
WebServerThread::WebServerThread() : concurrency::OSThread("WebServerThread") {
|
||||
WebServerThread::WebServerThread() : concurrency::OSThread("WebServerThread")
|
||||
{
|
||||
if (!config.network.wifi_enabled) {
|
||||
disable();
|
||||
}
|
||||
|
||||
@@ -194,7 +194,8 @@ bool initWifi()
|
||||
WiFi.onEvent(WiFiEvent);
|
||||
WiFi.setAutoReconnect(true);
|
||||
WiFi.setSleep(false);
|
||||
if (config.network.address_mode == Config_NetworkConfig_AddressMode_STATIC && config.network.ipv4_config.ip != 0) {
|
||||
if (config.network.address_mode == meshtastic_Config_NetworkConfig_AddressMode_STATIC &&
|
||||
config.network.ipv4_config.ip != 0) {
|
||||
WiFi.config(config.network.ipv4_config.ip, config.network.ipv4_config.gateway, config.network.ipv4_config.subnet,
|
||||
config.network.ipv4_config.dns,
|
||||
config.network.ipv4_config.dns); // Wifi wants two DNS servers... set both to the same value
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "configuration.h"
|
||||
#include "concurrency/Periodic.h"
|
||||
#include "configuration.h"
|
||||
#include <Arduino.h>
|
||||
#include <functional>
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@ size_t pb_encode_to_bytes(uint8_t *destbuf, size_t destbufsize, const pb_msgdesc
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(destbuf, destbufsize);
|
||||
if (!pb_encode(&stream, fields, src_struct)) {
|
||||
LOG_ERROR("Panic: can't encode protobuf reason='%s'\n", PB_GET_ERROR(&stream));
|
||||
assert(0); // If this asser fails it probably means you made a field too large for the max limits specified in mesh.options
|
||||
assert(
|
||||
0); // If this asser fails it probably means you made a field too large for the max limits specified in mesh.options
|
||||
} else {
|
||||
return stream.bytes_written;
|
||||
}
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
#define MAX_RX_TOPHONE 32
|
||||
|
||||
/// max number of nodes allowed in the mesh
|
||||
#define MAX_NUM_NODES (member_size(DeviceState, node_db) / member_size(DeviceState, node_db[0]))
|
||||
#define MAX_NUM_NODES (member_size(meshtastic_DeviceState, node_db) / member_size(meshtastic_DeviceState, node_db[0]))
|
||||
|
||||
/// Max number of channels allowed
|
||||
#define MAX_NUM_CHANNELS (member_size(ChannelFile, channels) / member_size(ChannelFile, channels[0]))
|
||||
#define MAX_NUM_CHANNELS (member_size(meshtastic_ChannelFile, channels) / member_size(meshtastic_ChannelFile, channels[0]))
|
||||
|
||||
/// helper function for encoding a record as a protobuf, any failures to encode are fatal and we will panic
|
||||
/// returns the encoded packet size
|
||||
|
||||
Reference in New Issue
Block a user