18#include "uart/sensors/sensors.hpp"
48 std::unique_ptr<uart::protocol::Packet>
findPacket(uint8_t dataByte);
56 static constexpr uart::Endianness
ENDIANNESS = uart::Endianness::ENDIAN_BIG;
79 const uart::xplat::TimeStamp& timestamp,
80 uart::sensors::UartSensor::ValidPacketFoundHandler dispatchPacket,
void* dispatchPacketUserData,
86 static uart::protocol::Packet::Type
packetTypeFunction(
const uart::protocol::Packet& packet);
static constexpr uint32_t HEADER_FMT_XBIT2
Header Format X Bit 2.
HeaderType _packetType
Current packet type determined by the header.
KvhUartSensor & operator=(const KvhUartSensor &)=delete
Copy assignment operator.
static void packetFinderFunction(const std::vector< uint8_t > &data, const uart::xplat::TimeStamp ×tamp, uart::sensors::UartSensor::ValidPacketFoundHandler dispatchPacket, void *dispatchPacketUserData, void *userData)
Function which is called to find packets in the provided data buffer.
static constexpr uint32_t HEADER_FMT_A
Header Format A.
KvhUartSensor & operator=(KvhUartSensor &&)=delete
Move assignment operator.
static constexpr uint32_t HEADER_FMT_B
Header Format B.
std::unique_ptr< uart::protocol::Packet > findPacket(uint8_t dataByte)
Collects data bytes and searches for packages inside of them.
static constexpr size_t PACKET_HEADER_LENGTH
Length of the packet header.
static bool checksumFunction(const uart::protocol::Packet &packet)
Function which is called to verify packet integrity.
bool _asciiEndChar1Found
Flag if the first ascii end character was found.
const std::string _name
Name of the Parent Node.
static constexpr uart::Endianness ENDIANNESS
Endianess of the sensor.
void resetTracking()
Resets the current message tracking.
std::vector< uint8_t > _buffer
Buffer to collect messages till they are complete.
uart::sensors::UartSensor _sensor
UartSensor object which handles the UART interface.
~KvhUartSensor()=default
Destructor.
size_t _runningDataIndex
Used for correlating raw data with where the packet was found for the end user.
KvhUartSensor(KvhUartSensor &&)=delete
Move constructor.
static constexpr uint8_t ASCII_END_CHAR_1
First Ascii End character.
bool _currentlyBuildingBinaryPacket
Flag if currently a binary packet is built.
HeaderType
Possible Header Types.
@ FMT_UNKNOWN
Unknown format.
static uart::protocol::Packet::Type packetTypeFunction(const uart::protocol::Packet &packet)
Function which is called to determine the packet type (ascii/binary)
static constexpr uint32_t HEADER_FMT_C
Header Format C.
static bool isErrorFunction(const uart::protocol::Packet &packet)
Function which determines, if the packet is an Error Packet.
static constexpr uint32_t HEADER_FMT_XBIT
Header Format X Bit.
static constexpr uint8_t ASCII_END_CHAR_2
Second Ascii End character.
TagState
Possible states in the header building process.
KvhUartSensor(std::string name)
Constructor.
static constexpr size_t MAX_SIZE_ASCII_PACKET
Maximum size of a ascii packet before resetting it.
static constexpr uint8_t ASCII_ESCAPE_CHAR
Ascii Escape charater.
TagState _eState
Current state of the header building process.
uart::sensors::UartSensor * operator->()
Arrow operator overload.
HeaderType bFindImuHeader(uint8_t ui8Data)
Function which finds the header from the provided data.
bool _currentlyBuildingAsciiPacket
Flag if currently a ascii packet is built.
KvhUartSensor(const KvhUartSensor &)=delete
Copy constructor.
KvhUartSensor()=default
Default constructor.
static bool isResponseFunction(const uart::protocol::Packet &packet)
Function which determines, if the packet is a Response.