Let StoreForward server send history to phoneAPI (#4282)

* Send StoreForward history of the server to a connected client
To extend the ToPhoneQueue

* Add delay after sending history info

* Don't allow history request over LoRa on default channel

---------

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
GUVWAF
2024-07-13 19:36:44 +02:00
committed by GitHub
parent 141ae296b7
commit 9e4ce86c2a
8 changed files with 259 additions and 183 deletions

View File

@@ -277,6 +277,17 @@ const char *Channels::getName(size_t chIndex)
return channelName;
}
bool Channels::isDefaultChannel(const meshtastic_Channel &ch)
{
if (ch.settings.psk.size == 1 && ch.settings.psk.bytes[0] == 1) {
const char *presetName = DisplayFormatters::getModemPresetDisplayName(config.lora.modem_preset, false);
// Check if the name is the default derived from the modem preset
if (strcmp(ch.settings.name, presetName) == 0)
return true;
}
return false;
}
bool Channels::hasDefaultChannel()
{
// If we don't use a preset or the default frequency slot, or we override the frequency, we don't have a default channel
@@ -285,13 +296,8 @@ bool Channels::hasDefaultChannel()
// Check if any of the channels are using the default name and PSK
for (size_t i = 0; i < getNumChannels(); i++) {
const auto &ch = getByIndex(i);
if (ch.settings.psk.size == 1 && ch.settings.psk.bytes[0] == 1) {
const char *name = getName(i);
const char *presetName = DisplayFormatters::getModemPresetDisplayName(config.lora.modem_preset, false);
// Check if the name is the default derived from the modem preset
if (strcmp(name, presetName) == 0)
return true;
}
if (isDefaultChannel(ch))
return true;
}
return false;
}
@@ -324,4 +330,4 @@ bool Channels::decryptForHash(ChannelIndex chIndex, ChannelHash channelHash)
int16_t Channels::setActiveByIndex(ChannelIndex channelIndex)
{
return setCrypto(channelIndex);
}
}