17 return [message = rate.
message, value = rate.
rate, version = rate.
version](std::string_view body) {
20 if (version.empty() && reply.
size() == 5 && reply.
back().empty()) {
25 reply.
size() == (version.empty() ? 4 : 5) && reply[2] == message &&
27 (version.empty() || reply[4] == version));
35 QByteArray body =
"PQTMCFGSVIN,W,";
36 if (std::holds_alternative<GPSBaseStationConfig::Fixed>(mode)) {
40 const auto& survey = std::get<GPSBaseStationConfig::SurveyIn>(mode);
41 body +=
"1," + QByteArray::number(
static_cast<qint64
>(survey.duration.count())) +
',' +
57 const qsizetype comma = body.indexOf(
',');
58 return [name = body.first(comma < 0 ? body.size() : comma).toByteArray()](std::string_view reply) {
66 for (
const auto& rate : rates) {
67 const QByteArray message = QByteArrayView(rate.message).toByteArray();
69 if (!rate.version.empty()) {
70 suffix =
',' + QByteArrayView(rate.version).toByteArray();
72 const QByteArray write =
"PQTMCFGMSGRATE,W," + message +
',' + QByteArray::number(rate.rate) + suffix;
73 const QByteArray read =
"PQTMCFGMSGRATE,R," + message + suffix;
75 sequence.
steps.emplace_back(
command(read, rateReadback(rate)));
GPSCommandSequence::Command gpsCommand(QByteArray wire, std::chrono::milliseconds timeout, std::variant< GPSTextMatcher, GPSCommandSequence::RawReply > reply, GPSCommandOptions options={})
std::function< GPSCommandOutcome(std::string_view reply)> GPSTextMatcher
Resolves the outstanding command from one text reply a decoder offers; Pending keeps waiting.
QByteArray gpsFixedDecimal(double value, int decimals)
Borrowed fields for the largest supported PQTM reply, including empty trailing fields.
Borrowed fields for the largest supported PQTM reply, including empty trailing fields.
std::string_view back() const
QByteArray frame(QByteArrayView body)
body as one "$<body>*hh\r\n" sentence, with uppercase checksum digits.
GPSCommandOutcome acknowledgement(const Fields &reply, std::string_view command)
"<command>,OK" acknowledges and "<command>,ERROR,<code>" rejects a setting.
GPSCommandOutcome readback(const Fields &reply, std::string_view command, bool matches)
bool number(std::string_view text, T &result)
GPSCommandSequence::Command command(QByteArrayView body, GPSTextMatcher reply, std::chrono::milliseconds timeout)
body labelled by its text, framed as a sentence, and completed by reply within timeout.
GPSTextMatcher acknowledgement(QByteArrayView body)
Completes the setting body with its "<name>,OK" acknowledgement.
QByteArray writeBase(const GPSBaseStationConfig::Mode &mode, const GPSProtocolMath::Ecef &position, bool distanceField)
GPSCommandSequence messageRates(std::span< const MessageRate > rates)
PQTMCFGMSGRATE,W for each of rates, each followed by its PQTMCFGMSGRATE,R readback.
std::variant< SurveyIn, Fixed, ReceiverAveraging > Mode
std::vector< Command > steps
std::string_view version
Message version; standard NMEA messages have none.