Skyward boardcore
Loading...
Searching...
No Matches
Boardcore::UBXFrame Struct Reference

Generic UBX frame. More...

#include <UBXFrame.h>

Inheritance diagram for Boardcore::UBXFrame:

Public Member Functions

 UBXFrame ()=default
 
 UBXFrame (UBXMessage message, const uint8_t *payload, uint16_t payloadLength)
 Construct a new UBXFrame with the specified message and given payload.
 
uint16_t getLength () const
 Return the total frame length.
 
uint16_t getRealPayloadLength () const
 Return the stored payload length.
 
UBXMessage getMessage () const
 
bool isValid () const
 Tells whether the current frame is valid or not. Checks the preamble and the checksum.
 
void writePacked (uint8_t *frame) const
 Writes the current message into the given array.
 
void readPacked (const uint8_t *frame)
 Reads a raw frame.
 
void calcChecksum (uint8_t *checksum) const
 Computes the frame checksum.
 

Public Attributes

uint8_t preamble [2]
 
uint16_t message
 
uint16_t payloadLength
 
uint8_t payload [MAX_PAYLOAD_LENGTH]
 
uint8_t checksum [2]
 

Static Public Attributes

static constexpr uint16_t MAX_PAYLOAD_LENGTH = 92
 
static constexpr uint16_t MAX_FRAME_LENGTH = MAX_PAYLOAD_LENGTH + 8
 
static constexpr uint8_t PREAMBLE [] = {0xb5, 0x62}
 
static constexpr uint8_t WAIT = 0xff
 

Detailed Description

Generic UBX frame.

Definition at line 51 of file UBXFrame.h.

Constructor & Destructor Documentation

◆ UBXFrame() [1/2]

Boardcore::UBXFrame::UBXFrame ( )
default

◆ UBXFrame() [2/2]

Boardcore::UBXFrame::UBXFrame ( UBXMessage message,
const uint8_t * payload,
uint16_t payloadLength )
inline

Construct a new UBXFrame with the specified message and given payload.

Definition at line 203 of file UBXFrame.h.

Member Function Documentation

◆ calcChecksum()

void Boardcore::UBXFrame::calcChecksum ( uint8_t * checksum) const
inline

Computes the frame checksum.

Parameters
checksumArray of 2 elements where to store the checksum

Definition at line 256 of file UBXFrame.h.

◆ getLength()

uint16_t Boardcore::UBXFrame::getLength ( ) const
inline

Return the total frame length.

Definition at line 213 of file UBXFrame.h.

◆ getMessage()

UBXMessage Boardcore::UBXFrame::getMessage ( ) const
inline

Definition at line 220 of file UBXFrame.h.

◆ getRealPayloadLength()

uint16_t Boardcore::UBXFrame::getRealPayloadLength ( ) const
inline

Return the stored payload length.

Definition at line 215 of file UBXFrame.h.

◆ isValid()

bool Boardcore::UBXFrame::isValid ( ) const
inline

Tells whether the current frame is valid or not. Checks the preamble and the checksum.

Definition at line 225 of file UBXFrame.h.

◆ readPacked()

void Boardcore::UBXFrame::readPacked ( const uint8_t * frame)
inline

Reads a raw frame.

Note that the frame bytes are assumed to start with the preamble.

Parameters
frameAn array of length at least MAX_FRAME_LENGTH.

Definition at line 247 of file UBXFrame.h.

◆ writePacked()

void Boardcore::UBXFrame::writePacked ( uint8_t * frame) const
inline

Writes the current message into the given array.

Parameters
frameMust be an array of the proper length.

Definition at line 238 of file UBXFrame.h.

Member Data Documentation

◆ checksum

uint8_t Boardcore::UBXFrame::checksum[2]

Definition at line 62 of file UBXFrame.h.

◆ MAX_FRAME_LENGTH

constexpr uint16_t Boardcore::UBXFrame::MAX_FRAME_LENGTH = MAX_PAYLOAD_LENGTH + 8
staticconstexpr

Definition at line 54 of file UBXFrame.h.

◆ MAX_PAYLOAD_LENGTH

constexpr uint16_t Boardcore::UBXFrame::MAX_PAYLOAD_LENGTH = 92
staticconstexpr

Definition at line 53 of file UBXFrame.h.

◆ message

uint16_t Boardcore::UBXFrame::message

Definition at line 59 of file UBXFrame.h.

◆ payload

uint8_t Boardcore::UBXFrame::payload[MAX_PAYLOAD_LENGTH]

Definition at line 61 of file UBXFrame.h.

◆ payloadLength

uint16_t Boardcore::UBXFrame::payloadLength

Definition at line 60 of file UBXFrame.h.

◆ preamble

uint8_t Boardcore::UBXFrame::preamble[2]

Definition at line 58 of file UBXFrame.h.

◆ PREAMBLE

constexpr uint8_t Boardcore::UBXFrame::PREAMBLE = {0xb5, 0x62}
staticconstexpr

Definition at line 55 of file UBXFrame.h.

◆ WAIT

constexpr uint8_t Boardcore::UBXFrame::WAIT = 0xff
staticconstexpr

Definition at line 56 of file UBXFrame.h.


The documentation for this struct was generated from the following files: