0.4.1
Loading...
Searching...
No Matches
NAV::vendor::espressif::EspressifUartSensor Class Reference

Class to read out Espressif Sensors. More...

Public Member Functions

 EspressifUartSensor ()=default
 Default constructor.
 
 EspressifUartSensor (const EspressifUartSensor &)=delete
 Copy constructor.
 
 EspressifUartSensor (EspressifUartSensor &&)=delete
 Move constructor.
 
 EspressifUartSensor (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.
 
EspressifUartSensoroperator= (const EspressifUartSensor &)=delete
 Copy assignment operator.
 
EspressifUartSensoroperator= (EspressifUartSensor &&)=delete
 Move assignment operator.
 
 ~EspressifUartSensor ()=default
 Destructor.
 

Static Public Attributes

static constexpr uint8_t BINARY_SYNC_CHAR_1
 µ - First sync character which begins a new binary message
 
static constexpr uint8_t BINARY_SYNC_CHAR_2
 b - 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

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 _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 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 Espressif Sensors.

Definition at line 24 of file EspressifUartSensor.hpp.

Constructor & Destructor Documentation

◆ EspressifUartSensor() [1/4]

NAV::vendor::espressif::EspressifUartSensor::EspressifUartSensor ( std::string name)
explicit

Constructor.

Parameters
[in]nameName of the Parent Node

Definition at line 14 of file EspressifUartSensor.cpp.

◆ EspressifUartSensor() [2/4]

NAV::vendor::espressif::EspressifUartSensor::EspressifUartSensor ( )
default

Default constructor.

◆ ~EspressifUartSensor()

NAV::vendor::espressif::EspressifUartSensor::~EspressifUartSensor ( )
default

Destructor.

◆ EspressifUartSensor() [3/4]

NAV::vendor::espressif::EspressifUartSensor::EspressifUartSensor ( const EspressifUartSensor & )
delete

Copy constructor.

◆ EspressifUartSensor() [4/4]

NAV::vendor::espressif::EspressifUartSensor::EspressifUartSensor ( EspressifUartSensor && )
delete

Move constructor.

Member Function Documentation

◆ checksumFunction()

bool NAV::vendor::espressif::EspressifUartSensor::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 135 of file EspressifUartSensor.cpp.

◆ findPacket()

std::unique_ptr< uart::protocol::Packet > NAV::vendor::espressif::EspressifUartSensor::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 32 of file EspressifUartSensor.cpp.

◆ isErrorFunction()

bool NAV::vendor::espressif::EspressifUartSensor::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 151 of file EspressifUartSensor.cpp.

◆ isResponseFunction()

bool NAV::vendor::espressif::EspressifUartSensor::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 156 of file EspressifUartSensor.cpp.

◆ operator->()

uart::sensors::UartSensor * NAV::vendor::espressif::EspressifUartSensor::operator-> ( )
inline

Arrow operator overload.

Definition at line 44 of file EspressifUartSensor.hpp.

◆ operator=() [1/2]

EspressifUartSensor & NAV::vendor::espressif::EspressifUartSensor::operator= ( const EspressifUartSensor & )
delete

Copy assignment operator.

◆ operator=() [2/2]

EspressifUartSensor & NAV::vendor::espressif::EspressifUartSensor::operator= ( EspressifUartSensor && )
delete

Move assignment operator.

◆ packetFinderFunction()

void NAV::vendor::espressif::EspressifUartSensor::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 106 of file EspressifUartSensor.cpp.

◆ packetTypeFunction()

uart::protocol::Packet::Type NAV::vendor::espressif::EspressifUartSensor::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 122 of file EspressifUartSensor.cpp.

◆ resetTracking()

void NAV::vendor::espressif::EspressifUartSensor::resetTracking ( )
private

Resets the current message tracking.

Definition at line 20 of file EspressifUartSensor.cpp.

Field Documentation

◆ _binaryPayloadLength

uint16_t NAV::vendor::espressif::EspressifUartSensor::_binaryPayloadLength
private

Payload length of the current packet.

Definition at line 107 of file EspressifUartSensor.hpp.

◆ _binaryPayloadLength1Found

bool NAV::vendor::espressif::EspressifUartSensor::_binaryPayloadLength1Found
private

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

Definition at line 103 of file EspressifUartSensor.hpp.

◆ _binaryPayloadLength2Found

bool NAV::vendor::espressif::EspressifUartSensor::_binaryPayloadLength2Found
private

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

Definition at line 104 of file EspressifUartSensor.hpp.

◆ _binarySyncChar2Found

bool NAV::vendor::espressif::EspressifUartSensor::_binarySyncChar2Found
private

Flag if the second binary end character was found.

Definition at line 102 of file EspressifUartSensor.hpp.

◆ _buffer

std::vector<uint8_t> NAV::vendor::espressif::EspressifUartSensor::_buffer
private

Buffer to collect messages till they are complete.

Definition at line 110 of file EspressifUartSensor.hpp.

◆ _currentlyBuildingBinaryPacket

bool NAV::vendor::espressif::EspressifUartSensor::_currentlyBuildingBinaryPacket
private

Flag if currently a binary packet is built.

Definition at line 100 of file EspressifUartSensor.hpp.

◆ _name

const std::string NAV::vendor::espressif::EspressifUartSensor::_name
private

Name of the Parent Node.

Definition at line 56 of file EspressifUartSensor.hpp.

◆ _numOfBytesRemainingForCompletePacket

size_t NAV::vendor::espressif::EspressifUartSensor::_numOfBytesRemainingForCompletePacket
private

Amount of bytes remaining for a complete packet.

Definition at line 115 of file EspressifUartSensor.hpp.

◆ _runningDataIndex

size_t NAV::vendor::espressif::EspressifUartSensor::_runningDataIndex
private

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

Definition at line 113 of file EspressifUartSensor.hpp.

◆ _sensor

uart::sensors::UartSensor NAV::vendor::espressif::EspressifUartSensor::_sensor
private

UartSensor object which handles the UART interface.

Definition at line 59 of file EspressifUartSensor.hpp.

◆ BINARY_SYNC_CHAR_1

uint8_t NAV::vendor::espressif::EspressifUartSensor::BINARY_SYNC_CHAR_1
staticconstexpr

µ - First sync character which begins a new binary message

Definition at line 51 of file EspressifUartSensor.hpp.

◆ BINARY_SYNC_CHAR_2

uint8_t NAV::vendor::espressif::EspressifUartSensor::BINARY_SYNC_CHAR_2
staticconstexpr

b - Second sync character which begins a new binary message

Definition at line 52 of file EspressifUartSensor.hpp.

◆ ENDIANNESS

uart::Endianness NAV::vendor::espressif::EspressifUartSensor::ENDIANNESS
staticconstexprprivate

Endianess of the sensor.

Definition at line 97 of file EspressifUartSensor.hpp.

◆ PACKET_HEADER_LENGTH

size_t NAV::vendor::espressif::EspressifUartSensor::PACKET_HEADER_LENGTH
staticconstexprprivate

Length of the header of each packet.

Definition at line 98 of file EspressifUartSensor.hpp.


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