You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#include<SparkFun_u-blox_GNSS_v3.h>//Click here to get the library: http://librarymanager/All#SparkFun_u-blox_GNSS_v3
38
+
39
+
// Define a custom class so we can override processLoggedUBX
40
+
classmy_SFE_UBLOX_GNSS : publicSFE_UBLOX_GNSS
41
+
{
42
+
public:
43
+
voidprocessLoggedUBX(ubxPacket *incomingUBX)
44
+
{
45
+
// processLoggedUBX will stall the library while it is executing
46
+
// For best results, quickly copy the data elsewhere. Avoid Serial prints, delays etc..
47
+
// incomingUBX->len contains the payload length (uint16_t)
48
+
// incomingUBX->payload points to the payload (uint8_t *)
49
+
// The ubxPacket struct is defined in u-blox_external_typedefs.h
50
+
51
+
Serial.printf("UBX message received: Class 0x%02x ID 0x%02x", incomingUBX->cls, incomingUBX->id);
52
+
if ((incomingUBX->cls == UBX_CLASS_MON) && (incomingUBX->id == UBX_MON_SYS))
53
+
{
54
+
// We can use the "extract" helper functions to read the data - useful for 16, 32 and 64-bit values
55
+
// The full list is:
56
+
// uint64_t extractLongLong(ubxPacket *msg, uint16_t spotToStart); // Combine eight bytes from payload into uint64_t
57
+
// uint64_t extractSignedLongLong(ubxPacket *msg, uint16_t spotToStart); // Combine eight bytes from payload into int64_t
58
+
// uint32_t extractLong(ubxPacket *msg, uint16_t spotToStart); // Combine four bytes from payload into long
59
+
// int32_t extractSignedLong(ubxPacket *msg, uint16_t spotToStart); // Combine four bytes from payload into signed long (avoiding any ambiguity caused by casting)
60
+
// uint16_t extractInt(ubxPacket *msg, uint16_t spotToStart); // Combine two bytes from payload into int
Copy file name to clipboardExpand all lines: src/u-blox_GNSS.h
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -239,6 +239,7 @@ class DevUBLOXGNSS
239
239
voidprocessRTCM(uint8_t incoming) __attribute__((weak)); // Given rtcm byte, do something with it. User can overwrite if desired to pipe bytes to radio, internet, etc.
240
240
voidprocessUBX(uint8_t incoming, ubxPacket *incomingUBX, uint8_t requestedClass, uint8_t requestedID); // Given a character, file it away into the uxb packet structure
241
241
voidprocessUBXpacket(ubxPacket *msg); // Once a packet has been received and validated, identify this packet's class/id and update internal flags
242
+
virtualvoidprocessLoggedUBX(ubxPacket *incomingUBX) {} // Process any UBX message with enableUBXlogging processMe set true
0 commit comments