17 #ifndef ADAFRUIT_UBX_H 18 #define ADAFRUIT_UBX_H 26 #define UBX_SYNC_CHAR_1 0xB5 27 #define UBX_SYNC_CHAR_2 0x62 28 // UBX ACK Message IDs 29 #define UBX_ACK_NAK 0x00 30 #define UBX_ACK_ACK 0x01 41 uint16_t payloadLen, uint8_t *payload);
54 bool sendMessage(uint8_t msgClass, uint8_t msgId, uint8_t *payload,
57 uint8_t *payload, uint16_t length,
58 uint16_t timeout_ms = 500);
62 uint16_t timeout_ms = 500);
71 static const uint16_t MAX_PAYLOAD_SIZE = 64;
72 uint8_t _buffer[MAX_PAYLOAD_SIZE +
88 ParserState _parserState = WAIT_SYNC_1;
91 uint16_t _payloadLength;
92 uint16_t _payloadCounter;
97 void calculateChecksum(uint8_t *buffer, uint16_t len, uint8_t &checksumA,
104 uint8_t _lastMsgClass;
106 uint16_t _lastPayloadLength;
107 uint8_t _lastPayload[8];
110 #endif // ADAFRUIT_UBX_H void setMessageCallback(UBXMessageCallback callback)
Sets the callback function for UBX messages.
Definition: Adafruit_UBX.cpp:128
void(* UBXMessageCallback)(uint8_t msgClass, uint8_t msgId, uint16_t payloadLen, uint8_t *payload)
Callback function type for UBX messages - defined at global scope so other classes can use it...
Definition: Adafruit_UBX.h:40
-
UBXSendStatus sendMessageWithAck(uint8_t msgClass, uint8_t msgId, uint8_t *payload, uint16_t length, uint16_t timeout_ms=500)
Send a UBX message and wait for acknowledgment.
Definition: Adafruit_UBX.cpp:328
+
UBXSendStatus sendMessageWithAck(uint8_t msgClass, uint8_t msgId, uint8_t *payload, uint16_t length, uint16_t timeout_ms=500)
Send a UBX message and wait for acknowledgment.
Definition: Adafruit_UBX.cpp:326
-
bool checkMessages()
Check for new UBX messages and parse them.
Definition: Adafruit_UBX.cpp:165
+
bool checkMessages()
Check for new UBX messages and parse them.
Definition: Adafruit_UBX.cpp:163
UBXMessageCallback onUBXMessage
Callback for message received.
Definition: Adafruit_UBX.h:65
UBXPortId
Definition: Adafruit_uBlox_typedef.h:60
Class for parsing UBX protocol messages from u-blox GPS/RTK modules.
Definition: Adafruit_UBX.h:46
-
bool begin()
Initializes the UBX parser.
Definition: Adafruit_UBX.cpp:50
+
bool begin()
Initializes the UBX parser.
Definition: Adafruit_UBX.cpp:48
~Adafruit_UBX()
Destructor.
Definition: Adafruit_UBX.cpp:39
-
UBXSendStatus setUBXOnly(UBXPortId portID, bool checkAck=true, uint16_t timeout_ms=500)
Configure the GPS module to output only UBX protocol (disables NMEA)
Definition: Adafruit_UBX.cpp:62
-
bool sendMessage(uint8_t msgClass, uint8_t msgId, uint8_t *payload, uint16_t length)
Send a UBX message to the GPS module.
Definition: Adafruit_UBX.cpp:411
+
UBXSendStatus setUBXOnly(UBXPortId portID, bool checkAck=true, uint16_t timeout_ms=500)
Configure the GPS module to output only UBX protocol (disables NMEA)
Definition: Adafruit_UBX.cpp:60
+
bool sendMessage(uint8_t msgClass, uint8_t msgId, uint8_t *payload, uint16_t length)
Send a UBX message to the GPS module.
Definition: Adafruit_UBX.cpp:409
UBXSendStatus
Definition: Adafruit_uBlox_typedef.h:52
uint8_t verbose_debug
0=off, 1=basic, 2=verbose
Definition: Adafruit_UBX.h:50
Adafruit_UBX(Stream &stream)
Constructor.
Definition: Adafruit_UBX.cpp:31