5#include <QtCore/QByteArrayView>
15double degreesMinutes(
double degrees)
17 const double magnitude = std::abs(degrees);
18 const double whole = std::trunc(magnitude);
19 return whole * 100.0 + (magnitude - whole) * 60.0;
34QByteArray
line(std::string_view command)
36 return QByteArrayView(command).toByteArray() +
"\r\n";
39QByteArray
line(std::string_view command,
char port)
41 return line(command).replace(
"{port}", QByteArray(1, port));
46 return "$PASHS,POS,AVG," + QByteArray::number(
static_cast<unsigned>(duration.count())) +
"\r\n";
51 const double latitude = position.latitudeDegrees;
52 const double longitude = position.longitudeDegrees;
61 {.label =
"$PASHS,POS (fixed position)"});
67 for (
const Setting& setting : settings) {
68 result.
steps.emplace_back(
GPSCommandSequence::Command gpsCommand(QByteArray wire, std::chrono::milliseconds timeout, std::variant< GPSTextMatcher, GPSCommandSequence::RawReply > reply, GPSCommandOptions options={})
QByteArray gpsFixedDecimal(double value, int decimals)
QByteArray surveyStart(std::chrono::seconds duration)
GPSCommandOutcome rejection(std::string_view reply)
A NAK rejects any command.
GPSCommandSequence::Command fixedPositionCommand(const GPSEllipsoidPosition &position)
The fixedPosition() command, acknowledged by an ACK and labelled without its coordinates.
QByteArray fixedPosition(const GPSEllipsoidPosition &position)
GPSCommandSequence sequence(std::span< const Setting > settings, char port)
settings for port, each acknowledged by an ACK.
constexpr std::chrono::milliseconds RESPONSE_TIMEOUT
Per attempt, for every command.
GPSCommandOutcome acknowledgement(std::string_view reply)
A $PASHS setting is acknowledged by an ACK.
QByteArray line(std::string_view command)
command as one CR/LF-terminated line.
std::vector< Command > steps
WGS84 geodetic position with ellipsoid height, not mean-sea-level altitude.