0.4.1
Loading...
Searching...
No Matches
NAV::vendor::emlid::EmlidUartSensor Class Reference

Class to read out Emlid Sensors. More...

Public Member Functions

 EmlidUartSensor ()=default
 Default constructor.
 
 EmlidUartSensor (const EmlidUartSensor &)=delete
 Copy constructor.
 
 EmlidUartSensor (EmlidUartSensor &&)=delete
 Move constructor.
 
 EmlidUartSensor (std::string name)
 Constructor.
 
std::unique_ptr< uart::protocol::Packet > findPacket (uint8_t dataByte)
 Collects data bytes and searches for packages inside of them.
 
uart::sensors::UartSensor * operator-> ()
 Arrow operator overload.
 
EmlidUartSensoroperator= (const EmlidUartSensor &)=delete
 Copy assignment operator.
 
EmlidUartSensoroperator= (EmlidUartSensor &&)=delete
 Move assignment operator.
 
 ~EmlidUartSensor ()=default
 Destructor.
 

Static Public Attributes

static constexpr uint8_t ASCII_START_CHAR
 Ascii character which begins a new ascii message.
 
static constexpr uint8_t BINARY_SYNC_CHAR_1
 R - First sync character which begins a new binary message.
 
static constexpr uint8_t BINARY_SYNC_CHAR_2
 E - Second sync character which begins a new binary message.
 

Private Member Functions

void resetTracking ()
 Resets the current message tracking.
 

Static Private Member Functions

static bool checksumFunction (const uart::protocol::Packet &packet)
 Function which is called to verify packet integrity.
 
static bool isErrorFunction (const uart::protocol::Packet &packet)
 Function which determines, if the packet is an Error Packet.
 
static bool isResponseFunction (const uart::protocol::Packet &packet)
 Function which determines, if the packet is a Response.
 
static void packetFinderFunction (const std::vector< uint8_t > &data, const uart::xplat::TimeStamp &timestamp, uart::sensors::UartSensor::ValidPacketFoundHandler dispatchPacket, void *dispatchPacketUserData, void *userData)
 Function which is called to find packets in the provided data buffer.
 
static uart::protocol::Packet::Type packetTypeFunction (const uart::protocol::Packet &packet)
 Function which is called to determine the packet type (ascii/binary)
 

Private Attributes

bool _asciiEndChar1Found
 Flag if the first ascii end character was found.
 
uint8_t _binaryMsgId
 Message id of the current packet.
 
bool _binaryMsgIdFound
 Flag if the message id was found.
 
uint16_t _binaryPayloadLength
 Payload length of the current packet.
 
bool _binaryPayloadLength1Found
 Flag if the first byte of the payload length was found.
 
bool _binaryPayloadLength2Found
 Flag if the second byte of the payload length was found.
 
bool _binarySyncChar2Found
 Flag if the second binary end character was found.
 
std::vector< uint8_t > _buffer
 Buffer to collect messages till they are complete.
 
bool _currentlyBuildingAsciiPacket
 Flag if currently a ascii packet is built.
 
bool _currentlyBuildingBinaryPacket
 Flag if currently a binary packet is built.
 
const std::string _name
 Name of the Parent Node.
 
size_t _numOfBytesRemainingForCompletePacket
 Amount of bytes remaining for a complete packet.
 
size_t _runningDataIndex
 Used for correlating raw data with where the packet was found for the end user.
 
uart::sensors::UartSensor _sensor
 UartSensor object which handles the UART interface.
 

Static Private Attributes

static constexpr uint8_t ASCII_END_CHAR_1
 First Ascii End character.
 
static constexpr uint8_t ASCII_END_CHAR_2
 Second Ascii End character.
 
static constexpr uint8_t ASCII_ESCAPE_CHAR
 Ascii Escape charater.
 
static constexpr uart::Endianness ENDIANNESS
 Endianess of the sensor.
 
static constexpr size_t PACKET_HEADER_LENGTH
 Length of the header of each packet.
 

Detailed Description

Class to read out Emlid Sensors.

Definition at line 23 of file EmlidUartSensor.hpp.

Constructor & Destructor Documentation

◆ EmlidUartSensor() [1/4]

NAV::vendor::emlid::EmlidUartSensor::EmlidUartSensor ( std::string name)
explicit

Constructor.

Parameters
[in]nameName of the Parent Node

Definition at line 14 of file EmlidUartSensor.cpp.

◆ EmlidUartSensor() [2/4]

NAV::vendor::emlid::EmlidUartSensor::EmlidUartSensor ( )
default

Default constructor.

◆ ~EmlidUartSensor()

NAV::vendor::emlid::EmlidUartSensor::~EmlidUartSensor ( )
default

Destructor.

◆ EmlidUartSensor() [3/4]

NAV::vendor::emlid::EmlidUartSensor::EmlidUartSensor ( const EmlidUartSensor & )
delete

Copy constructor.

◆ EmlidUartSensor() [4/4]

NAV::vendor::emlid::EmlidUartSensor::EmlidUartSensor ( EmlidUartSensor && )
delete

Move constructor.

Member Function Documentation

◆ checksumFunction()

bool NAV::vendor::emlid::EmlidUartSensor::checksumFunction ( const uart::protocol::Packet & packet)
staticprivate

Function which is called to verify packet integrity.

Parameters
[in]packetPacket to calculate the checksum for
Returns
True if the packet is fault free

Definition at line 195 of file EmlidUartSensor.cpp.

◆ findPacket()

std::unique_ptr< uart::protocol::Packet > NAV::vendor::emlid::EmlidUartSensor::findPacket ( uint8_t dataByte)

Collects data bytes and searches for packages inside of them.

Parameters
[in]dataByteThe next data byte
Returns
nullptr if no packet found yet, otherwise a pointer to the packet

Definition at line 38 of file EmlidUartSensor.cpp.

◆ isErrorFunction()

bool NAV::vendor::emlid::EmlidUartSensor::isErrorFunction ( const uart::protocol::Packet & packet)
staticprivate

Function which determines, if the packet is an Error Packet.

Parameters
[in]packetThe packet to check

Definition at line 219 of file EmlidUartSensor.cpp.

◆ isResponseFunction()

bool NAV::vendor::emlid::EmlidUartSensor::isResponseFunction ( const uart::protocol::Packet & packet)
staticprivate

Function which determines, if the packet is a Response.

Parameters
[in]packetThe packet to check

Definition at line 224 of file EmlidUartSensor.cpp.

◆ operator->()

uart::sensors::UartSensor * NAV::vendor::emlid::EmlidUartSensor::operator-> ( )
inline

Arrow operator overload.

Definition at line 43 of file EmlidUartSensor.hpp.

◆ operator=() [1/2]

EmlidUartSensor & NAV::vendor::emlid::EmlidUartSensor::operator= ( const EmlidUartSensor & )
delete

Copy assignment operator.

◆ operator=() [2/2]

EmlidUartSensor & NAV::vendor::emlid::EmlidUartSensor::operator= ( EmlidUartSensor && )
delete

Move assignment operator.

◆ packetFinderFunction()

void NAV::vendor::emlid::EmlidUartSensor::packetFinderFunction ( const std::vector< uint8_t > & data,
const uart::xplat::TimeStamp & timestamp,
uart::sensors::UartSensor::ValidPacketFoundHandler dispatchPacket,
void * dispatchPacketUserData,
void * userData )
staticprivate

Function which is called to find packets in the provided data buffer.

Parameters
[in]dataRaw data buffer which has potential packets inside
[in]timestampTimestamp then the data in the buffer was received
[in]dispatchPacketFunction to call when a complete packet was found
[in]dispatchPacketUserDataUser data to forward to the dispatchPacket function
[in]userDataUser data provided when regisering this function. Should contain the sensor object

Definition at line 157 of file EmlidUartSensor.cpp.

◆ packetTypeFunction()

uart::protocol::Packet::Type NAV::vendor::emlid::EmlidUartSensor::packetTypeFunction ( const uart::protocol::Packet & packet)
staticprivate

Function which is called to determine the packet type (ascii/binary)

Parameters
[in]packetPacket to check the type of
Returns
The type of the packet

Definition at line 173 of file EmlidUartSensor.cpp.

◆ resetTracking()

void NAV::vendor::emlid::EmlidUartSensor::resetTracking ( )
private

Resets the current message tracking.

Definition at line 20 of file EmlidUartSensor.cpp.

Field Documentation

◆ _asciiEndChar1Found

bool NAV::vendor::emlid::EmlidUartSensor::_asciiEndChar1Found
private

Flag if the first ascii end character was found.

Definition at line 106 of file EmlidUartSensor.hpp.

◆ _binaryMsgId

uint8_t NAV::vendor::emlid::EmlidUartSensor::_binaryMsgId
private

Message id of the current packet.

Definition at line 113 of file EmlidUartSensor.hpp.

◆ _binaryMsgIdFound

bool NAV::vendor::emlid::EmlidUartSensor::_binaryMsgIdFound
private

Flag if the message id was found.

Definition at line 108 of file EmlidUartSensor.hpp.

◆ _binaryPayloadLength

uint16_t NAV::vendor::emlid::EmlidUartSensor::_binaryPayloadLength
private

Payload length of the current packet.

Definition at line 115 of file EmlidUartSensor.hpp.

◆ _binaryPayloadLength1Found

bool NAV::vendor::emlid::EmlidUartSensor::_binaryPayloadLength1Found
private

Flag if the first byte of the payload length was found.

Definition at line 109 of file EmlidUartSensor.hpp.

◆ _binaryPayloadLength2Found

bool NAV::vendor::emlid::EmlidUartSensor::_binaryPayloadLength2Found
private

Flag if the second byte of the payload length was found.

Definition at line 110 of file EmlidUartSensor.hpp.

◆ _binarySyncChar2Found

bool NAV::vendor::emlid::EmlidUartSensor::_binarySyncChar2Found
private

Flag if the second binary end character was found.

Definition at line 107 of file EmlidUartSensor.hpp.

◆ _buffer

std::vector<uint8_t> NAV::vendor::emlid::EmlidUartSensor::_buffer
private

Buffer to collect messages till they are complete.

Definition at line 118 of file EmlidUartSensor.hpp.

◆ _currentlyBuildingAsciiPacket

bool NAV::vendor::emlid::EmlidUartSensor::_currentlyBuildingAsciiPacket
private

Flag if currently a ascii packet is built.

Definition at line 103 of file EmlidUartSensor.hpp.

◆ _currentlyBuildingBinaryPacket

bool NAV::vendor::emlid::EmlidUartSensor::_currentlyBuildingBinaryPacket
private

Flag if currently a binary packet is built.

Definition at line 104 of file EmlidUartSensor.hpp.

◆ _name

const std::string NAV::vendor::emlid::EmlidUartSensor::_name
private

Name of the Parent Node.

Definition at line 56 of file EmlidUartSensor.hpp.

◆ _numOfBytesRemainingForCompletePacket

size_t NAV::vendor::emlid::EmlidUartSensor::_numOfBytesRemainingForCompletePacket
private

Amount of bytes remaining for a complete packet.

Definition at line 123 of file EmlidUartSensor.hpp.

◆ _runningDataIndex

size_t NAV::vendor::emlid::EmlidUartSensor::_runningDataIndex
private

Used for correlating raw data with where the packet was found for the end user.

Definition at line 121 of file EmlidUartSensor.hpp.

◆ _sensor

uart::sensors::UartSensor NAV::vendor::emlid::EmlidUartSensor::_sensor
private

UartSensor object which handles the UART interface.

Definition at line 59 of file EmlidUartSensor.hpp.

◆ ASCII_END_CHAR_1

uint8_t NAV::vendor::emlid::EmlidUartSensor::ASCII_END_CHAR_1
staticconstexprprivate

First Ascii End character.

Definition at line 99 of file EmlidUartSensor.hpp.

◆ ASCII_END_CHAR_2

uint8_t NAV::vendor::emlid::EmlidUartSensor::ASCII_END_CHAR_2
staticconstexprprivate

Second Ascii End character.

Definition at line 100 of file EmlidUartSensor.hpp.

◆ ASCII_ESCAPE_CHAR

uint8_t NAV::vendor::emlid::EmlidUartSensor::ASCII_ESCAPE_CHAR
staticconstexprprivate

Ascii Escape charater.

Definition at line 101 of file EmlidUartSensor.hpp.

◆ ASCII_START_CHAR

uint8_t NAV::vendor::emlid::EmlidUartSensor::ASCII_START_CHAR
staticconstexpr

Ascii character which begins a new ascii message.

Definition at line 52 of file EmlidUartSensor.hpp.

◆ BINARY_SYNC_CHAR_1

uint8_t NAV::vendor::emlid::EmlidUartSensor::BINARY_SYNC_CHAR_1
staticconstexpr

R - First sync character which begins a new binary message.

Definition at line 50 of file EmlidUartSensor.hpp.

◆ BINARY_SYNC_CHAR_2

uint8_t NAV::vendor::emlid::EmlidUartSensor::BINARY_SYNC_CHAR_2
staticconstexpr

E - Second sync character which begins a new binary message.

Definition at line 51 of file EmlidUartSensor.hpp.

◆ ENDIANNESS

uart::Endianness NAV::vendor::emlid::EmlidUartSensor::ENDIANNESS
staticconstexprprivate

Endianess of the sensor.

Definition at line 97 of file EmlidUartSensor.hpp.

◆ PACKET_HEADER_LENGTH

size_t NAV::vendor::emlid::EmlidUartSensor::PACKET_HEADER_LENGTH
staticconstexprprivate

Length of the header of each packet.

Definition at line 98 of file EmlidUartSensor.hpp.


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