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

Function sectionPty

tests/rigctld_test.cpp:2176–2207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2174};
2175
2176void sectionPty(Runner& r, const QString& ptyPath)
2177{
2178 r.section(QStringLiteral("Section 16 — PTY round-trip (skips if device cannot be opened)"));
2179
2180 PtyClient p;
2181 if (!p.openDevice(ptyPath)) {
2182 const QString why = QStringLiteral("cannot open %1 (%2)")
2183 .arg(ptyPath, QString::fromLocal8Bit(::strerror(errno)));
2184 for (const char* name : { "16.1 get_freq via PTY", "16.2 get_mode via PTY",
2185 "16.3 get_info via PTY" })
2186 r.skip(QString::fromLatin1(name), why);
2187 return;
2188 }
2189
2190 QStringList lines = p.query(QStringLiteral("\\get_freq"));
2191 const QString freq = PtyClient::field(lines, QStringLiteral("Frequency"));
2192 r.check(QStringLiteral("16.1 get_freq via PTY → Frequency: <integer>"),
2193 PtyClient::ok(lines) && isInt(freq),
2194 freq.isEmpty() ? QStringLiteral("(no response)") : freq);
2195
2196 lines = p.query(QStringLiteral("\\get_mode"));
2197 const QString mode = PtyClient::field(lines, QStringLiteral("Mode"));
2198 r.check(QStringLiteral("16.2 get_mode via PTY → Mode: <string>"),
2199 PtyClient::ok(lines) && !mode.isEmpty(),
2200 mode.isEmpty() ? QStringLiteral("(no response)") : mode);
2201
2202 lines = p.query(QStringLiteral("\\get_rig_info"));
2203 const QString info = PtyClient::field(lines, QStringLiteral("Info"));
2204 r.check(QStringLiteral("16.3 get_rig_info via PTY → Info: <string>"),
2205 PtyClient::ok(lines) && !info.isEmpty(),
2206 info.isEmpty() ? QStringLiteral("(no response)") : info);
2207}
2208#else
2209void sectionPty(Runner& r, const QString&)
2210{

Callers 1

mainFunction · 0.85

Calls 8

fieldFunction · 0.85
isIntFunction · 0.85
sectionMethod · 0.45
openDeviceMethod · 0.45
skipMethod · 0.45
queryMethod · 0.45
checkMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected