12#include <QtCore/QByteArray>
13#include <QtCore/QByteArrayView>
14#include <QtCore/QLatin1StringView>
15#include <QtCore/QString>
26class QLoggingCategory;
46 [[nodiscard]]
unsigned linkBaud(
unsigned requested,
unsigned fallback)
const
65 std::unique_ptr<GPSFamilyProtocol> (*
create)() =
nullptr;
78 [[nodiscard]] uint64_t
nowUs()
const;
88 _batch.
events.emplace_back(report);
94 _batch.
events.emplace_back(report);
107 _batch.
events.emplace_back(report);
115 _batch.
events.emplace_back(status);
124 status.duration = duration;
125 status.valid = valid;
126 status.active = active;
153 [[nodiscard]]
bool failed()
const;
165 [[nodiscard]]
GPSEventBatch _takeBatch() {
return std::exchange(_batch, {}); }
168 void _recycle(std::vector<GPSProtocolEvent>&& storage)
171 if (_batch.
events.empty() && _batch.
events.capacity() < storage.capacity()) {
172 _batch.
events.swap(storage);
224 [[nodiscard]]
virtual QString
identity()
const {
return {}; }
254 [[nodiscard]]
virtual std::chrono::milliseconds
nextReadSlice(std::chrono::milliseconds timeout)
const
270 return QString::fromUtf8(model.isEmpty() || firmware.isEmpty() ? model + firmware : model +
' ' + firmware);
274template <
typename Protocol>
277 return std::make_unique<Protocol>();
QString gpsReceiverIdentity(const QByteArray &model, const QByteArray &firmware)
A receiver identity as GPSFamilyProtocol::identity() reports it: "<model> <firmware>",...
QLatin1StringView(*)(const GPSFrame &frame) GPSSignatureFunction
const QLoggingCategory &(*)() GPSLogCategory
A family's logging category function, as declared by Q_DECLARE_LOGGING_CATEGORY; usable as qCWarning(...
std::unique_ptr< GPSFamilyProtocol > gpsCreateProtocol()
The create of a family whose protocol is default-constructed: .create = &gpsCreateProtocol<Protocol>.
std::variant< GPSDecodedPosition, GPSIntegrityReport, GPSDecodedSatellites, GPSDecodedSatelliteUsage, GPSSurveyReport, GPSRTCMFrame, GPSInputProtocol > GPSProtocolEvent
void markUpdates(GPSReceiveUpdates updates)
Adds updates a decoder reports for a frame without publishing an event, such as protocol activity.
void publishSatelliteUsage(std::optional< int > count)
void resolveReply(GPSCommandOutcome outcome)
Resolves the outstanding reply; Pending and later resolutions are ignored.
void offerReply(std::string_view reply)
Passes one decoded text reply to the outstanding text matcher, if any.
void publishAsReceived(GPSProtocolEvent event)
void publishSurvey(bool active, bool valid, std::chrono::seconds duration, const GPSEllipsoidPosition &position={})
Publishes survey-in progress; unknown coordinates remain NaN.
void publishIntegrity(GPSIntegrityReport &report)
Stamps the family's working report with the receipt time and publishes a copy.
void publishPosition(const GPSDecodedPosition &report)
void failControl(const QString &detail)
Records a protocol failure described by detail unless a failure is already recorded,...
void publishRTCM(std::span< const uint8_t > frame)
GPSStreamDemux & stream()
void publishSatellites(const GPSDecodedSatellites &report)
bool replyPending() const
True while a transact() reply is outstanding and unresolved.
void publishSurvey(GPSSurveyReport &status)
Stamps status with the receipt time and publishes a copy. Survey progress is not an update flag.
virtual bool receiverReady() const
virtual void serviceStreaming(GPSCommandChannel &channel)
virtual bool probe(GPSCommandChannel &channel)
virtual GPSReceiveUpdates receive(GPSCommandChannel &channel, std::chrono::milliseconds timeout)
One streaming receive. The default runs GPSCommandChannel::receiveCycle() and then the streaming serv...
virtual bool armNavigationDecode(GPSNavigationDecode decode, GPSDecodeContext &context)
GPSFamilyProtocol()=default
virtual GPSReceiveUpdates onFrame(const GPSFrame &frame, GPSDecodeContext &context)=0
virtual ~GPSFamilyProtocol()=default
virtual bool armDecodeOnly(const GPSConfig &config, GPSDecodeContext &context)
virtual bool configure(GPSCommandChannel &channel, GPSConfig config, unsigned &baud)=0
virtual bool completeReceiveCycle(GPSReceiveUpdates handled)
virtual QString identity() const
Model and firmware reported during configuration; empty when unknown.
virtual std::chrono::milliseconds nextReadSlice(std::chrono::milliseconds timeout) const
The longest single read in a receive cycle of timeout; the cycle deadline still bounds it.
virtual void flush(GPSDecodeContext &context)
Publishes time-driven output before each decode, such as expired epochs.
GPSPositionReport position(const GPSDecodedPosition &source, const GPSIntegrityReport &diagnostic, uint64_t nowUs)
Configuration used only by the RTK base-station role.
The receiver configuration requested for one configure() attempt.
GPSBaseStationConfig base
unsigned linkBaud(unsigned requested, unsigned fallback) const
The rate a family without a baud search runs the link at: requested, else detectedBaud,...
bool allowPersistentChanges
Decoded navigation plus whether the producer accepted its velocity solution.
WGS84 geodetic position with ellipsoid height, not mean-sea-level altitude.
Events decoded from one span of received bytes, in publication order.
std::vector< GPSProtocolEvent > events
GPSReceiveUpdates updates
What a decode-only runtime decodes from a receiver configured elsewhere (GPSFamilyProtocol::armNaviga...
bool corrections
RTCM3 frames are published too.
One RTCM3 frame the receiver produced, including its header and CRC.
std::span< const unsigned > baudCandidates
GPSLogCategory logCategory
GPSSignatureFunction signature
std::unique_ptr< GPSFamilyProtocol >(* create)()
unsigned autoBaudRate
Rate passed to configure() when none is selected; zero requests detection.
The framers of one receiver stream and how they share it.
GPSEllipsoidPosition position
uint64_t timestampUs
Receipt of this status; a status a family buffered keeps its original receipt.