Skip to main content
GNSS Documentation
GitHub Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

C++ API

Include <jimmypaputto/GnssHat.hpp>, namespace JimmyPaputto.

IGnssHat Interface

The main API. Obtain an instance via the factory method:

auto* hat = IGnssHat::create();

Lifecycle

Method Return Description
IGnssHat::create() IGnssHat* Factory — detects HAT variant and returns the correct implementation
start(const GnssConfig& config) bool Configure the u-blox module and start data acquisition. Returns false on validation or communication failure
name() std::string_view HAT product name (e.g. "L1 GNSS HAT", "L1/L5 GNSS TIME HAT")
Method Return Description
waitAndGetFreshNavigation() Navigation Block until new navigation data arrives, then return it
navigation() Navigation Return the last known navigation data immediately (non-blocking)

Reset

Method Return Description
softResetUbloxSom_HotStart() void Soft reset — preserves ephemeris and almanac for fast TTFF
hardResetUbloxSom_ColdStart() void Full cold reset — clears all stored satellite data

RTK

Method Return Description
rtk() IRtk* RTK interface. Non-null only on the RTK HAT

Timepulse

Method Return Description
enableTimepulse() bool Enable timepulse interrupt on GPIO 5
disableTimepulse() void Disable timepulse interrupt
timepulse() void Block until the next timepulse edge

Time Mark

Method Return Description
timeMark() std::optional<TimeMark> Return last TimeMark or std::nullopt (non-blocking)
waitAndGetFreshTimeMark() TimeMark Block until a new TimeMark event arrives
enableTimeMarkTrigger() bool Enable EXTINT pin (GPIO 17) as output for software triggers
disableTimeMarkTrigger() void Disable EXTINT trigger
triggerTimeMark(edge) void Toggle/raise/lower EXTINT pin. Default: ETimeMarkTriggerEdge::Toggle

GPSD Forwarding

Method Return Description
startForwardForGpsd() bool Create virtual serial port and start NMEA forwarding thread
stopForwardForGpsd() void Stop forwarding and remove virtual device
joinForwardForGpsd() void Block until the forwarder thread finishes
getGpsdDevicePath() std::string Path to the virtual serial port (e.g. /dev/jimmypaputto/gnss)

IRtk Interface

Accessed via hat->rtk(). Returns nullptr on non-RTK HATs.

IRtk* rtk = hat->rtk();
IBase* base = rtk->base();
IRover* rover = rtk->rover();

IBase

Method Return Description
getFullCorrections() vector<vector<uint8_t>> Full RTCM3 correction set (M7M)
getTinyCorrections() vector<vector<uint8_t>> Compact RTCM3 correction set (M4M)
getRtcm3Frame(uint16_t id) vector<uint8_t> Specific RTCM3 message by ID

IRover

Method Return Description
applyCorrections(const vector<vector<uint8_t>>& corrections) void Inject RTCM3 corrections from a base station

Utility Functions

Namespace JimmyPaputto::Utils:

Function Return Description
eFixQuality2string(EFixQuality) std::string Fix quality to human-readable string
eFixStatus2string(EFixStatus) std::string Fix status to string
eFixType2string(EFixType) std::string Fix type to string
jammingState2string(EJammingState) std::string Jamming state to string
antennaStatus2string(EAntennaStatus) std::string Antenna status to string
antennaPower2string(EAntennaPower) std::string Antenna power to string
eBand2string(EGnssBand) std::string GNSS band to string
geofencingStatus2string(EGeofencingStatus) std::string Geofencing status to string
geofenceStatus2string(EGeofenceStatus) std::string Per-fence status to string
gnssId2string(EGnssId) std::string Constellation to string
svQuality2string(ESvQuality) std::string Signal quality to string
timeMarkMode2string(ETimeMarkMode) std::string Time mark mode to string
timeMarkRun2string(ETimeMarkRun) std::string Time mark run state to string
timeMarkTimeBase2string(ETimeMarkTimeBase) std::string Time base to string
utcTimeFromGnss_ISO8601(const PositionVelocityTime&) std::string UTC time as ISO 8601 string