Preserve BLE command replies and respect negotiated mOTA MTU

This commit is contained in:
mikecarper committed 2026-10-15 11:05:00 -07:00
1 parent 6b75ad07d3
commit e57ab1309f
18 files changed
+1111 -10

No files matched your search

+16
View File
@@ -25,6 +25,9 @@
#endif
#include <Mesh.h>
#include <helpers/CompanionHardwareCommandCompat.h>
#if defined(MESH_HIL_BLE_BENCH) && MESH_HIL_BLE_BENCH
#include <helpers/CompanionBleBench.h>
#endif
#include <helpers/CompanionStatusResponse.h>
#include <helpers/CompanionReader.h>
#include <helpers/IdentityGeneration.h>
@@ -5742,6 +5745,19 @@ void MyMesh::handleCmdFrame(size_t len) {
return;
}
#if defined(MESH_HIL_BLE_BENCH) && MESH_HIL_BLE_BENCH
if (cmd_frame[0] == mesh::companion::kBleBenchCommand) {
// Direct Companion transport benchmark only: no RF dispatch, settings,
// identity reads or persistent state. Reuse the normal reply queue and
// its required-frame admission/backpressure, including the source route.
const size_t echoed = mesh::companion::buildBleBenchEcho(
cmd_frame, len, out_frame, MAX_FRAME_SIZE);
if (echoed) _serial->writeFrame(out_frame, echoed);
else writeErrFrame(ERR_CODE_ILLEGAL_ARG);
return;
}
#endif
servicePendingSerialReply();
const bool starts_long_lived_request =
(cmd_frame[0] == CMD_SEND_LOGIN && len >= 1 + PUB_KEY_SIZE)
+11 -1
View File
@@ -469,7 +469,17 @@ public:
}
private:
mesh::ota::SerialMotaSource _source;
class Source : public mesh::ota::SerialMotaSource {
public:
using mesh::ota::SerialMotaSource::SerialMotaSource;
protected:
uint16_t responseFrameCapacity() const override {
return bluetooth_interface.motaResponseCapacity();
}
};
static_assert(sizeof(Source) == sizeof(mesh::ota::SerialMotaSource),
"BLE source MTU policy must not allocate additional state");
Source _source;
uint32_t _packets_sent_at_start;
uint32_t _last_packets_sent;
};