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

Method handleSendResponse

src/models/NavtexModel.cpp:46–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46void NavtexModel::handleSendResponse(int seq, uint respVal, const QString& indexStr)
47{
48 auto it = m_pendingMsgs.find(seq);
49 if (it == m_pendingMsgs.end()) {
50 qWarning() << "NavtexModel: no pending message for seq=" << seq;
51 return;
52 }
53
54 // Failure path: error responses come with respVal != 0 and an empty body
55 // (radio returns `R<seq>|<errcode>|`). Promote to Error and surface to the
56 // messages list so the UI can show what happened.
57 if (respVal != 0) {
58 qWarning() << "NavtexModel: send failed, resp=" << respVal << "seq=" << seq;
59 it->status = NavtexMsgStatus::Error;
60 m_msgs.append(*it);
61 m_pendingMsgs.erase(it);
62 emit messagesChanged();
63 return;
64 }
65
66 // Success path requires the index in the body.
67 if (indexStr.isEmpty()) {
68 qWarning() << "NavtexModel: send response missing index, seq=" << seq;
69 m_pendingMsgs.erase(it);
70 return;
71 }
72
73 bool ok = false;
74 uint idx = indexStr.toUInt(&ok);
75 if (!ok) {
76 qWarning() << "NavtexModel: failed to parse index from" << indexStr;
77 m_pendingMsgs.erase(it);
78 return;
79 }
80
81 it->idx = idx;
82 it->status = NavtexMsgStatus::Queued;
83 m_msgs.append(*it);
84 m_pendingMsgs.erase(it);
85 emit messagesChanged();
86}
87
88void NavtexModel::parseStatus(const QString& object, const QMap<QString, QString>& kvs)
89{

Callers 2

RadioModelMethod · 0.80
mainFunction · 0.80

Calls 3

findMethod · 0.80
eraseMethod · 0.80
isEmptyMethod · 0.45

Tested by 1

mainFunction · 0.64