0.4.1
Loading...
Searching...
No Matches
NAV::vendor::kvh::KvhUartSensor Class Reference

Class to read out KVH Sensors. More...

Public Member Functions

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

Static Public Attributes

static constexpr uart::Endianness ENDIANNESS
 Endianess of the sensor.
 
static constexpr uint32_t HEADER_FMT_A
 Header Format A.
 
static constexpr uint32_t HEADER_FMT_B
 Header Format B.
 
static constexpr uint32_t HEADER_FMT_C
 Header Format C.
 
static constexpr uint32_t HEADER_FMT_XBIT
 Header Format X Bit.
 
static constexpr uint32_t HEADER_FMT_XBIT2
 Header Format X Bit 2.
 

Private Types

enum  HeaderType : uint8_t {
  FMT_A ,
  FMT_B ,
  FMT_C ,
  FMT_XBIT ,
  FMT_XBIT2 ,
  FMT_UNKNOWN
}
 Possible Header Types. More...
 
enum  TagState : uint8_t {
  SM_H1 ,
  SM_H2 ,
  SM_H3 ,
  SM_X3 ,
  SM_IDLE
}
 Possible states in the header building process. More...
 

Private Member Functions

HeaderType bFindImuHeader (uint8_t ui8Data)
 Function which finds the header from the provided data.
 
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.
 
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.
 
TagState _eState
 Current state of the header building process.
 
const std::string _name
 Name of the Parent Node.
 
HeaderType _packetType
 Current packet type determined by the header.
 
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 size_t MAX_SIZE_ASCII_PACKET
 Maximum size of a ascii packet before resetting it.
 
static constexpr size_t PACKET_HEADER_LENGTH
 Length of the packet header.
 

Detailed Description

Class to read out KVH Sensors.

Definition at line 23 of file KvhUartSensor.hpp.

Member Enumeration Documentation

◆ HeaderType

Possible Header Types.

Enumerator
FMT_A 

Use header A.

FMT_B 

Use header B.

FMT_C 

Use header C.

FMT_XBIT 

Format XBIT.

FMT_XBIT2 

Format XBIT2.

FMT_UNKNOWN 

Unknown format.

Definition at line 127 of file KvhUartSensor.hpp.

◆ TagState

Possible states in the header building process.

Enumerator
SM_H1 

H1.

SM_H2 

H2.

SM_H3 

H3.

SM_X3 

X3.

SM_IDLE 

IDLE.

Definition at line 114 of file KvhUartSensor.hpp.

Constructor & Destructor Documentation

◆ KvhUartSensor() [1/4]

NAV::vendor::kvh::KvhUartSensor::KvhUartSensor ( std::string name)
explicit

Constructor.

Parameters
[in]nameName of the Parent Node

Definition at line 14 of file KvhUartSensor.cpp.

◆ KvhUartSensor() [2/4]

NAV::vendor::kvh::KvhUartSensor::KvhUartSensor ( )
default

Default constructor.

◆ ~KvhUartSensor()

NAV::vendor::kvh::KvhUartSensor::~KvhUartSensor ( )
default

Destructor.

◆ KvhUartSensor() [3/4]

NAV::vendor::kvh::KvhUartSensor::KvhUartSensor ( const KvhUartSensor & )
delete

Copy constructor.

◆ KvhUartSensor() [4/4]

NAV::vendor::kvh::KvhUartSensor::KvhUartSensor ( KvhUartSensor && )
delete

Move constructor.

Member Function Documentation

◆ bFindImuHeader()

NAV::vendor::kvh::KvhUartSensor::HeaderType NAV::vendor::kvh::KvhUartSensor::bFindImuHeader ( uint8_t ui8Data)
private

Function which finds the header from the provided data.

Parameters
[in]ui8DataByte to construct the header from
Returns
Header type if found or unkown

Definition at line 31 of file KvhUartSensor.cpp.

◆ checksumFunction()

bool NAV::vendor::kvh::KvhUartSensor::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 275 of file KvhUartSensor.cpp.

◆ findPacket()

std::unique_ptr< uart::protocol::Packet > NAV::vendor::kvh::KvhUartSensor::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 113 of file KvhUartSensor.cpp.

◆ isErrorFunction()

bool NAV::vendor::kvh::KvhUartSensor::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 304 of file KvhUartSensor.cpp.

◆ isResponseFunction()

bool NAV::vendor::kvh::KvhUartSensor::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 309 of file KvhUartSensor.cpp.

◆ operator->()

uart::sensors::UartSensor * NAV::vendor::kvh::KvhUartSensor::operator-> ( )
inline

Arrow operator overload.

Definition at line 43 of file KvhUartSensor.hpp.

◆ operator=() [1/2]

KvhUartSensor & NAV::vendor::kvh::KvhUartSensor::operator= ( const KvhUartSensor & )
delete

Copy assignment operator.

◆ operator=() [2/2]

KvhUartSensor & NAV::vendor::kvh::KvhUartSensor::operator= ( KvhUartSensor && )
delete

Move assignment operator.

◆ packetFinderFunction()

void NAV::vendor::kvh::KvhUartSensor::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 233 of file KvhUartSensor.cpp.

◆ packetTypeFunction()

uart::protocol::Packet::Type NAV::vendor::kvh::KvhUartSensor::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 249 of file KvhUartSensor.cpp.

◆ resetTracking()

void NAV::vendor::kvh::KvhUartSensor::resetTracking ( )
private

Resets the current message tracking.

Definition at line 20 of file KvhUartSensor.cpp.

Field Documentation

◆ _asciiEndChar1Found

bool NAV::vendor::kvh::KvhUartSensor::_asciiEndChar1Found
private

Flag if the first ascii end character was found.

Definition at line 111 of file KvhUartSensor.hpp.

◆ _buffer

std::vector<uint8_t> NAV::vendor::kvh::KvhUartSensor::_buffer
private

Buffer to collect messages till they are complete.

Definition at line 146 of file KvhUartSensor.hpp.

◆ _currentlyBuildingAsciiPacket

bool NAV::vendor::kvh::KvhUartSensor::_currentlyBuildingAsciiPacket
private

Flag if currently a ascii packet is built.

Definition at line 108 of file KvhUartSensor.hpp.

◆ _currentlyBuildingBinaryPacket

bool NAV::vendor::kvh::KvhUartSensor::_currentlyBuildingBinaryPacket
private

Flag if currently a binary packet is built.

Definition at line 109 of file KvhUartSensor.hpp.

◆ _eState

TagState NAV::vendor::kvh::KvhUartSensor::_eState
private

Current state of the header building process.

Definition at line 124 of file KvhUartSensor.hpp.

◆ _name

const std::string NAV::vendor::kvh::KvhUartSensor::_name
private

Name of the Parent Node.

Definition at line 60 of file KvhUartSensor.hpp.

◆ _packetType

HeaderType NAV::vendor::kvh::KvhUartSensor::_packetType
private

Current packet type determined by the header.

Definition at line 138 of file KvhUartSensor.hpp.

◆ _runningDataIndex

size_t NAV::vendor::kvh::KvhUartSensor::_runningDataIndex
private

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

Definition at line 149 of file KvhUartSensor.hpp.

◆ _sensor

uart::sensors::UartSensor NAV::vendor::kvh::KvhUartSensor::_sensor
private

UartSensor object which handles the UART interface.

Definition at line 63 of file KvhUartSensor.hpp.

◆ ASCII_END_CHAR_1

uint8_t NAV::vendor::kvh::KvhUartSensor::ASCII_END_CHAR_1
staticconstexprprivate

First Ascii End character.

Definition at line 103 of file KvhUartSensor.hpp.

◆ ASCII_END_CHAR_2

uint8_t NAV::vendor::kvh::KvhUartSensor::ASCII_END_CHAR_2
staticconstexprprivate

Second Ascii End character.

Definition at line 104 of file KvhUartSensor.hpp.

◆ ASCII_ESCAPE_CHAR

uint8_t NAV::vendor::kvh::KvhUartSensor::ASCII_ESCAPE_CHAR
staticconstexprprivate

Ascii Escape charater.

Definition at line 105 of file KvhUartSensor.hpp.

◆ ENDIANNESS

uart::Endianness NAV::vendor::kvh::KvhUartSensor::ENDIANNESS
staticconstexpr

Endianess of the sensor.

Definition at line 56 of file KvhUartSensor.hpp.

◆ HEADER_FMT_A

uint32_t NAV::vendor::kvh::KvhUartSensor::HEADER_FMT_A
staticconstexpr

Header Format A.

Definition at line 50 of file KvhUartSensor.hpp.

◆ HEADER_FMT_B

uint32_t NAV::vendor::kvh::KvhUartSensor::HEADER_FMT_B
staticconstexpr

Header Format B.

Definition at line 51 of file KvhUartSensor.hpp.

◆ HEADER_FMT_C

uint32_t NAV::vendor::kvh::KvhUartSensor::HEADER_FMT_C
staticconstexpr

Header Format C.

Definition at line 52 of file KvhUartSensor.hpp.

◆ HEADER_FMT_XBIT

uint32_t NAV::vendor::kvh::KvhUartSensor::HEADER_FMT_XBIT
staticconstexpr

Header Format X Bit.

Definition at line 53 of file KvhUartSensor.hpp.

◆ HEADER_FMT_XBIT2

uint32_t NAV::vendor::kvh::KvhUartSensor::HEADER_FMT_XBIT2
staticconstexpr

Header Format X Bit 2.

Definition at line 54 of file KvhUartSensor.hpp.

◆ MAX_SIZE_ASCII_PACKET

size_t NAV::vendor::kvh::KvhUartSensor::MAX_SIZE_ASCII_PACKET
staticconstexprprivate

Maximum size of a ascii packet before resetting it.

Definition at line 106 of file KvhUartSensor.hpp.

◆ PACKET_HEADER_LENGTH

size_t NAV::vendor::kvh::KvhUartSensor::PACKET_HEADER_LENGTH
staticconstexprprivate

Length of the packet header.

Definition at line 101 of file KvhUartSensor.hpp.


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