Skip to main content
GNSS HAT Library Documentation
Shop 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

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

Reset

MethodReturnDescription
softResetUbloxSom_HotStart()voidSoft reset — preserves ephemeris and almanac for fast TTFF
hardResetUbloxSom_ColdStart()voidFull cold reset — clears all stored satellite data

RTK

MethodReturnDescription
rtk()IRtk*RTK interface. Non-null only on the RTK HAT

Timepulse

MethodReturnDescription
enableTimepulse()boolEnable timepulse interrupt on GPIO 5
disableTimepulse()voidDisable timepulse interrupt
timepulse()voidBlock until the next timepulse edge

Time Mark

MethodReturnDescription
timeMark()std::optional<TimeMark>Return last TimeMark or std::nullopt (non-blocking)
waitAndGetFreshTimeMark()TimeMarkBlock until a new TimeMark event arrives
enableTimeMarkTrigger()boolEnable EXTINT pin (GPIO 17) as output for software triggers
disableTimeMarkTrigger()voidDisable EXTINT trigger
triggerTimeMark(edge)voidToggle/raise/lower EXTINT pin. Default: ETimeMarkTriggerEdge::Toggle

GPSD Forwarding

MethodReturnDescription
startForwardForGpsd()boolCreate virtual serial port and start NMEA forwarding thread
stopForwardForGpsd()voidStop forwarding and remove virtual device
joinForwardForGpsd()voidBlock until the forwarder thread finishes
getGpsdDevicePath()std::stringPath 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

MethodReturnDescription
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

MethodReturnDescription
applyCorrections(const vector<vector<uint8_t>>& corrections)voidInject RTCM3 corrections from a base station

Utility Functions

Namespace JimmyPaputto::Utils:

FunctionReturnDescription
eFixQuality2string(EFixQuality)std::stringFix quality to human-readable string
eFixStatus2string(EFixStatus)std::stringFix status to string
eFixType2string(EFixType)std::stringFix type to string
jammingState2string(EJammingState)std::stringJamming state to string
antennaStatus2string(EAntennaStatus)std::stringAntenna status to string
antennaPower2string(EAntennaPower)std::stringAntenna power to string
eBand2string(EGnssBand)std::stringGNSS band to string
geofencingStatus2string(EGeofencingStatus)std::stringGeofencing status to string
geofenceStatus2string(EGeofenceStatus)std::stringPer-fence status to string
gnssId2string(EGnssId)std::stringConstellation to string
svQuality2string(ESvQuality)std::stringSignal quality to string
timeMarkMode2string(ETimeMarkMode)std::stringTime mark mode to string
timeMarkRun2string(ETimeMarkRun)std::stringTime mark run state to string
timeMarkTimeBase2string(ETimeMarkTimeBase)std::stringTime base to string
utcTimeFromGnss_ISO8601(const PositionVelocityTime&)std::stringUTC time as ISO 8601 string