Target signed fleet commands by region and GPS radius

This commit is contained in:
mikecarper committed 2026-10-09 01:32:12 -07:00
1 parent 8b3655d76a
commit 4d446c2cd0
24 files changed
+2447 -107

No files matched your search

+3 -3
View File
@@ -9781,7 +9781,7 @@ bool MyMesh::handleCommand(const char* command, uint32_t sender_timestamp,
if (strncmp(text, "send", 4)
|| (text[4] != ' ' && text[4] != '\t')) {
snprintf(reply, reply_capacity,
"Error: use fleet send <channel-index> [all|key[,key...]] <command>");
"Error: use fleet send <channel> [all|key|region:name|home:name|gps:lat,lon:km[;target...]] <command>");
return true;
}
text += 4;
@@ -9808,11 +9808,11 @@ bool MyMesh::handleCommand(const char* command, uint32_t sender_timestamp,
// or list must never silently broaden a request to the whole fleet.
if (!mesh::FleetCommand::commandAllowed(text)) {
const size_t target_length = strcspn(text, " \t");
// A list is one atomic packet; it must never become partial fan-out.
// A target list is one signed request; never admit a partial list.
if (text[target_length] == 0
|| !mesh::FleetCommand::parseTargets(text, target_length, targets)) {
snprintf(reply, reply_capacity,
"Error: fleet targets must be all or comma-separated 8/12/64-hex keys");
"Error: targets: all, 8/12/64-hex keys, region names, home:name or gps:lat,lon:km; semicolon-separated");
return true;
}
text += target_length;
+7
View File
@@ -10,6 +10,9 @@
#include <helpers/UsbLogging.h>
#include <helpers/HilStartupTrace.h>
#include <helpers/FileRead.h>
#if MESH_ENABLE_FLEET_CONTROL
#include <helpers/FleetLocation.h>
#endif
#if MESH_ENABLE_TELEMETRY_HISTORY
#include <helpers/FilePresence.h>
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
@@ -4862,6 +4865,10 @@ void MyMesh::deleteScheduledRadioParams(bool temporary, const char* selector, ch
}
#if MESH_ENABLE_FLEET_CONTROL
bool MyMesh::getFleetLocation(int32_t& latitude_e6, int32_t& longitude_e6) const {
return mesh::readFleetLocation(_prefs, sensors, latitude_e6, longitude_e6);
}
void MyMesh::finishFleetReplyMutation(bool delivered) {
if (!fleet_schedule_pending_) return;
fleet_schedule_delivered_ = delivered;
+1
View File
@@ -1103,6 +1103,7 @@ public:
// CommonCLICallbacks
bool supportsFleetControl() const override { return true; }
#if MESH_ENABLE_FLEET_CONTROL
bool getFleetLocation(int32_t& latitude_e6, int32_t& longitude_e6) const override;
void beginFleetCommand() override { fleet_command_ = true; }
void endFleetCommand() override { fleet_command_ = false; }
bool hasFleetReplyMutation() const override { return fleet_schedule_pending_; }
+9
View File
@@ -12,6 +12,9 @@
#include <helpers/ota/OtaContext.h>
#endif
#include <helpers/FileRead.h>
#if MESH_ENABLE_FLEET_CONTROL
#include <helpers/FleetLocation.h>
#endif
#include <helpers/radiolib/RxBoostedGainDefaults.h>
#include <helpers/CLICommandUtils.h>
#include <helpers/ClientACLCLI.h>
@@ -1915,6 +1918,12 @@ void MyMesh::startRegionsLoad() {
region_load_active = true;
}
#if MESH_ENABLE_FLEET_CONTROL
bool MyMesh::getFleetLocation(int32_t& latitude_e6, int32_t& longitude_e6) const {
return mesh::readFleetLocation(_prefs, sensors, latitude_e6, longitude_e6);
}
#endif
bool MyMesh::saveRegions() {
return region_map.save(_fs);
}
+3
View File
@@ -438,6 +438,9 @@ protected:
public:
bool supportsFleetControl() const override { return true; }
#if MESH_ENABLE_FLEET_CONTROL
bool getFleetLocation(int32_t& latitude_e6, int32_t& longitude_e6) const override;
#endif
MyMesh(mesh::MainBoard& board, mesh::Radio& radio, mesh::MillisecondClock& ms, mesh::RNG& rng, mesh::RTCClock& rtc, mesh::MeshTables& tables);
void begin(FILESYSTEM* fs);