Public Member Functions | Private Member Functions | Private Attributes | List of all members
visionary::SafeVisionaryDataStream Class Reference

#include <SafeVisionaryDataStream.h>

Public Member Functions

void closeTcpConnection ()
 
void closeUdpConnection ()
 
bool getBlobStartTcp (std::vector< std::uint8_t > &receiveBufferPacketSize)
 
DataStreamError getLastError ()
 
bool getNextBlobTcp (std::vector< std::uint8_t > &receiveBufferPacketSize)
 
bool getNextBlobUdp ()
 
bool openTcpConnection (std::uint16_t port, std::string deviceIpAddress)
 Connects to the sensor data stream using the given TCP port and given IPAddress. More...
 
bool openUdpConnection (std::uint16_t port)
 
 SafeVisionaryDataStream (std::shared_ptr< VisionaryData > dataHandler)
 
 ~SafeVisionaryDataStream ()
 

Private Member Functions

bool getBlobStartUdp (bool &lastFragment)
 
bool getNextFragment (std::vector< std::uint8_t > &receiveBuffer)
 
int32_t getNextTcpReception (std::vector< std::uint8_t > &receiveBuffer)
 
bool parseBlobData ()
 
bool parseBlobHeaderTcp ()
 
bool parseBlobHeaderUdp ()
 
bool parseUdpHeader (std::vector< std::uint8_t > &buffer, UdpProtocolData &udpProtocolData)
 

Private Attributes

std::vector< uint8_t > m_blobDataBuffer
 Buffer which stores the received Blob data. More...
 
uint16_t m_blobNumber
 Number of current Blob. More...
 
std::vector< uint32_t > m_changeCounter
 Change counter for each data segment. More...
 
std::shared_ptr< VisionaryDatam_dataHandler
 Shared pointer to the Visionary data handler. More...
 
DataStreamError m_lastDataStreamError
 Stores the last error which occurred while parsing the data stream. More...
 
uint16_t m_numSegments
 number of Blob data segments More...
 
std::vector< uint32_t > m_offsetSegment
 Offset in byte for each data segment. More...
 
TcpSocket m_pTransportTcp
 Unique TCP socket used to receive the measurement data output stream. More...
 
std::unique_ptr< UdpSocketm_pTransportUdp
 Unique pointer the UDP socket used to receive the measurement data output stream. More...
 

Detailed Description

Definition at line 65 of file SafeVisionaryDataStream.h.

Constructor & Destructor Documentation

◆ SafeVisionaryDataStream()

visionary::SafeVisionaryDataStream::SafeVisionaryDataStream ( std::shared_ptr< VisionaryData dataHandler)

Definition at line 118 of file SafeVisionaryDataStream.cpp.

◆ ~SafeVisionaryDataStream()

visionary::SafeVisionaryDataStream::~SafeVisionaryDataStream ( )

Definition at line 128 of file SafeVisionaryDataStream.cpp.

Member Function Documentation

◆ closeTcpConnection()

void visionary::SafeVisionaryDataStream::closeTcpConnection ( )

Definition at line 165 of file SafeVisionaryDataStream.cpp.

◆ closeUdpConnection()

void visionary::SafeVisionaryDataStream::closeUdpConnection ( )

Closes the connection. It is allowed to call close of a connection that is not open. In this case this call is a no-op.

Definition at line 157 of file SafeVisionaryDataStream.cpp.

◆ getBlobStartTcp()

bool visionary::SafeVisionaryDataStream::getBlobStartTcp ( std::vector< std::uint8_t > &  receiveBufferPacketSize)

Definition at line 344 of file SafeVisionaryDataStream.cpp.

◆ getBlobStartUdp()

bool visionary::SafeVisionaryDataStream::getBlobStartUdp ( bool &  lastFragment)
private

Finds the start of the next Blob data.

This function gets the next Blob data telegram until a telegram with the fragment number 0 is received. In case the Blob data start has been found, this telegram is stored in the internal BlobData buffer.

Parameters
[out]lastFragmenttrue in case the Blob data consists only of one fragment

Definition at line 298 of file SafeVisionaryDataStream.cpp.

◆ getLastError()

DataStreamError visionary::SafeVisionaryDataStream::getLastError ( )

Gets the last error which occurred while parsing the data stream.

Returns
Returns the last error, OK in case there occurred no error

Definition at line 825 of file SafeVisionaryDataStream.cpp.

◆ getNextBlobTcp()

bool visionary::SafeVisionaryDataStream::getNextBlobTcp ( std::vector< std::uint8_t > &  receiveBufferPacketSize)
Returns
Returns true when a complete blob has been successfully received.

Definition at line 742 of file SafeVisionaryDataStream.cpp.

◆ getNextBlobUdp()

bool visionary::SafeVisionaryDataStream::getNextBlobUdp ( )

Receive a single blob from the connected device and store it in buffer.

Returns
Returns true when a complete blob has been successfully received.

Definition at line 661 of file SafeVisionaryDataStream.cpp.

◆ getNextFragment()

bool visionary::SafeVisionaryDataStream::getNextFragment ( std::vector< std::uint8_t > &  receiveBuffer)
private

Gets the next fragment of the Blob data via the opened UDP socket.

Parameters
[out]receiveBufferVector which contains the received fragment
Returns
Returns true in case the next fragment has been received successfully

Definition at line 174 of file SafeVisionaryDataStream.cpp.

◆ getNextTcpReception()

int32_t visionary::SafeVisionaryDataStream::getNextTcpReception ( std::vector< std::uint8_t > &  receiveBuffer)
private

Gets the next packet of the Blob data via the opened TCP socket.

Parameters
[out]receiveBufferVector which contains the received Packet
Returns
the received size of the tcp packet

Definition at line 203 of file SafeVisionaryDataStream.cpp.

◆ openTcpConnection()

bool visionary::SafeVisionaryDataStream::openTcpConnection ( std::uint16_t  port,
std::string  deviceIpAddress 
)

Connects to the sensor data stream using the given TCP port and given IPAddress.

Definition at line 144 of file SafeVisionaryDataStream.cpp.

◆ openUdpConnection()

bool visionary::SafeVisionaryDataStream::openUdpConnection ( std::uint16_t  port)

Connects to the sensor data stream using the given UDP port

Parameters
[in]portUDP port to bind
Return values
trueThe connection to the sensor data stream has been successfully established.
falseThe connection attempt failed; the sensor is either
  • switched off or streams on a different UPD port
  • not available using for PCs network settings (different subnet)
  • the protocol type or the port did not match. Please check your sensor documentation.

Definition at line 130 of file SafeVisionaryDataStream.cpp.

◆ parseBlobData()

bool visionary::SafeVisionaryDataStream::parseBlobData ( )
private

Parses the segments of the Blob data

Returns
Returns true in case the parsing of the Blob data has been successful, otherwise returns false

Definition at line 531 of file SafeVisionaryDataStream.cpp.

◆ parseBlobHeaderTcp()

bool visionary::SafeVisionaryDataStream::parseBlobHeaderTcp ( )
private

Parses and checks the Blob header of a complete Blob data telegram. In case the Blob header is valid

Returns
Returns true in case the Blob header is valid

Definition at line 381 of file SafeVisionaryDataStream.cpp.

◆ parseBlobHeaderUdp()

bool visionary::SafeVisionaryDataStream::parseBlobHeaderUdp ( )
private

Parses and checks the Blob header of a complete Blob data telegram. In case the Blob header is valid, the offset and change counter of each Blob data segment is stored.

Returns
Returns true in case the Blob header is valid

Definition at line 456 of file SafeVisionaryDataStream.cpp.

◆ parseUdpHeader()

bool visionary::SafeVisionaryDataStream::parseUdpHeader ( std::vector< std::uint8_t > &  buffer,
UdpProtocolData udpProtocolData 
)
private

Parses and checks the UDP header of one UDP fragment. Furthermore it returns some metadata regarding the fragment.

Parameters
[in]bufferVector which contains the received UDP telegram
[out]udpProtocolDatareference to the UDP protocol data which is gotten from the UDP telegram for later use
Returns
Returns true in case the UDP header is valid

Definition at line 231 of file SafeVisionaryDataStream.cpp.

Member Data Documentation

◆ m_blobDataBuffer

std::vector<uint8_t> visionary::SafeVisionaryDataStream::m_blobDataBuffer
private

Buffer which stores the received Blob data.

Definition at line 120 of file SafeVisionaryDataStream.h.

◆ m_blobNumber

uint16_t visionary::SafeVisionaryDataStream::m_blobNumber
private

Number of current Blob.

Definition at line 123 of file SafeVisionaryDataStream.h.

◆ m_changeCounter

std::vector<uint32_t> visionary::SafeVisionaryDataStream::m_changeCounter
private

Change counter for each data segment.

Definition at line 132 of file SafeVisionaryDataStream.h.

◆ m_dataHandler

std::shared_ptr<VisionaryData> visionary::SafeVisionaryDataStream::m_dataHandler
private

Shared pointer to the Visionary data handler.

Definition at line 111 of file SafeVisionaryDataStream.h.

◆ m_lastDataStreamError

DataStreamError visionary::SafeVisionaryDataStream::m_lastDataStreamError
private

Stores the last error which occurred while parsing the data stream.

Definition at line 135 of file SafeVisionaryDataStream.h.

◆ m_numSegments

uint16_t visionary::SafeVisionaryDataStream::m_numSegments
private

number of Blob data segments

Definition at line 126 of file SafeVisionaryDataStream.h.

◆ m_offsetSegment

std::vector<uint32_t> visionary::SafeVisionaryDataStream::m_offsetSegment
private

Offset in byte for each data segment.

Definition at line 129 of file SafeVisionaryDataStream.h.

◆ m_pTransportTcp

TcpSocket visionary::SafeVisionaryDataStream::m_pTransportTcp
private

Unique TCP socket used to receive the measurement data output stream.

Definition at line 117 of file SafeVisionaryDataStream.h.

◆ m_pTransportUdp

std::unique_ptr<UdpSocket> visionary::SafeVisionaryDataStream::m_pTransportUdp
private

Unique pointer the UDP socket used to receive the measurement data output stream.

Definition at line 114 of file SafeVisionaryDataStream.h.


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


sick_safevisionary_base
Author(s):
autogenerated on Sat Oct 21 2023 02:24:26