Files
MeshCore/test/fixtures/morse_reply_prefix.cpp
T
mikecarper 0be4c7488c Add bounded Morse receive and negotiated RS232 autosleep
Add native narrow-band CW capture, ACK-first remote sessions, retained LoRa-readable pages, checked restoration and transport-safe progress. Add stock-compatible negotiated heartbeat/autosleep and recovery. Include host regressions and identity-bound HIL runners; keep unverified faster tuning HIL-only and document outstanding hardware validation.
2026-10-13 01:24:39 -07:00

22 lines
859 B
C++

struct Callbacks {
TestRadio* radio;
mesh::Radio* getProfileRadio() { return radio; }
};
struct PrefixedCLI {
Callbacks* _callbacks;
void handle(const char* command, char* reply) { @COMMON_MORSE_CALL@ }
};
int main() {
TestRadio radio; radio.rx_supported = true;
radio.capture = std::string(mesh::MorseRx::CaptureCapacity, 'E');
Callbacks callbacks{&radio}; PrefixedCLI cli{&callbacks};
char reply[161]; memset(reply, '~', sizeof(reply)); memcpy(reply, "AB:", 3);
cli.handle("morse read", reply + 3);
assert(!memcmp(reply, "AB:", 3) && reply[160] == '~');
assert(memchr(reply + 3, 0, 157));
unsigned offset = 0, total = 0, next = 0;
assert(sscanf(reply + 3, "> %u/%u next=%u", &offset, &total, &next) == 3);
assert(offset == 0 && total == mesh::MorseRx::CaptureCapacity && next > 0 && next < 125);
assert(strlen(reply) < 160);
}