MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / sendMessage

Method sendMessage

src/models/NavtexModel.cpp:11–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9{}
10
11void NavtexModel::sendMessage(QChar txIdent, QChar subjectIndicator,
12 const QString& msgText, std::optional<uint> serialNum)
13{
14 // Format per FlexLib v4.2.18:
15 // navtex send tx_ident=<C> subject_indicator=<C> [serial_num=<N>] msg_text="..."
16 QString cmd = QString("navtex send tx_ident=%1 subject_indicator=%2")
17 .arg(txIdent)
18 .arg(subjectIndicator);
19 if (serialNum.has_value()) {
20 cmd += QString(" serial_num=%1").arg(serialNum.value());
21 }
22 // Quote-escape so an embedded `"` in the user's text doesn't break the
23 // radio's command parser. Backslash needs escaping first (otherwise the
24 // replacement double-escapes existing backslashes).
25 QString escaped = msgText;
26 escaped.replace('\\', "\\\\");
27 escaped.replace('"', "\\\"");
28 cmd += QString(" msg_text=\"%1\"").arg(escaped);
29
30 int seq = m_nextSeq++;
31
32 // Track as pending until radio responds with index
33 NavtexMsg msg;
34 msg.txIdent = txIdent;
35 msg.subjectIndicator = subjectIndicator;
36 msg.msgText = msgText;
37 msg.status = NavtexMsgStatus::Pending;
38 if (serialNum.has_value()) {
39 msg.serialNum = serialNum.value();
40 }
41 m_pendingMsgs[seq] = msg;
42
43 emit replyCommandReady(cmd, seq);
44}
45
46void NavtexModel::handleSendResponse(int seq, uint respVal, const QString& indexStr)
47{

Callers 3

sendAprsMessageFromUiMethod · 0.45
testOutgoingAckFlowFunction · 0.45
mainFunction · 0.45

Calls 1

valueMethod · 0.45

Tested by 2

testOutgoingAckFlowFunction · 0.36
mainFunction · 0.36