Public Member Functions | Private Member Functions | Private Attributes | List of all members
psen_scan::PSENscanUDPInterface Class Reference

Class for the UDP communication with the scanner. More...

#include <psen_scan_udp_interface.h>

Inheritance diagram for psen_scan::PSENscanUDPInterface:
Inheritance graph
[legend]

Public Member Functions

void close () override
 Closes the connection to the scanner device. More...
 
void open () override
 Opens the connection to the scanner device. More...
 
 PSENscanUDPInterface (const std::string &scanner_ip, const uint32_t &host_udp_port, const unsigned short scanner_port_write=PSEN_SCAN_PORT_WRITE, const unsigned short scanner_port_read=PSEN_SCAN_PORT_READ)
 
std::size_t read (boost::asio::mutable_buffers_1 &buffer, const std::chrono::steady_clock::duration timeout) override
 Receive data from the scanner. More...
 
void write (const boost::asio::mutable_buffers_1 &buffer) override
 Sends data to the scanner device. More...
 
virtual ~PSENscanUDPInterface ()
 
- Public Member Functions inherited from psen_scan::ScannerCommunicationInterface
virtual ~ScannerCommunicationInterface ()=default
 

Private Member Functions

bool isUdpMsgAvailable () const
 

Private Attributes

boost::asio::io_service io_service_
 
boost::asio::ip::udp::socket socket_read_
 
boost::asio::ip::udp::socket socket_write_
 
boost::asio::ip::udp::endpoint udp_read_endpoint_
 
boost::asio::ip::udp::endpoint udp_write_endpoint_
 

Detailed Description

Class for the UDP communication with the scanner.

Definition at line 33 of file psen_scan_udp_interface.h.

Constructor & Destructor Documentation

◆ PSENscanUDPInterface()

psen_scan::PSENscanUDPInterface::PSENscanUDPInterface ( const std::string &  scanner_ip,
const uint32_t &  host_udp_port,
const unsigned short  scanner_port_write = PSEN_SCAN_PORT_WRITE,
const unsigned short  scanner_port_read = PSEN_SCAN_PORT_READ 
)

Definition at line 28 of file psen_scan_udp_interface.cpp.

◆ ~PSENscanUDPInterface()

psen_scan::PSENscanUDPInterface::~PSENscanUDPInterface ( )
virtual

Definition at line 39 of file psen_scan_udp_interface.cpp.

Member Function Documentation

◆ close()

void psen_scan::PSENscanUDPInterface::close ( )
overridevirtual

Closes the connection to the scanner device.

Implements psen_scan::ScannerCommunicationInterface.

Definition at line 59 of file psen_scan_udp_interface.cpp.

◆ isUdpMsgAvailable()

bool psen_scan::PSENscanUDPInterface::isUdpMsgAvailable ( ) const
private

Definition at line 88 of file psen_scan_udp_interface.cpp.

◆ open()

void psen_scan::PSENscanUDPInterface::open ( )
overridevirtual

Opens the connection to the scanner device.

Implements psen_scan::ScannerCommunicationInterface.

Definition at line 44 of file psen_scan_udp_interface.cpp.

◆ read()

std::size_t psen_scan::PSENscanUDPInterface::read ( boost::asio::mutable_buffers_1 &  buffer,
const std::chrono::steady_clock::duration  timeout 
)
overridevirtual

Receive data from the scanner.

Parameters
bufferBuffer which contains the data received from the scanner device after the function call is done.
timeoutDefines how long to wait for new messages from the scanner device.
Returns
the number of bytes received from the scanner device.
Exceptions
UDPReadTimeoutExceptioninidcating a timeout while reading data from the scanner device.

Implements psen_scan::ScannerCommunicationInterface.

Definition at line 93 of file psen_scan_udp_interface.cpp.

◆ write()

void psen_scan::PSENscanUDPInterface::write ( const boost::asio::mutable_buffers_1 &  buffer)
overridevirtual

Sends data to the scanner device.

Parameters
bufferData which have to be send to the scanner device.

Implements psen_scan::ScannerCommunicationInterface.

Definition at line 74 of file psen_scan_udp_interface.cpp.

Member Data Documentation

◆ io_service_

boost::asio::io_service psen_scan::PSENscanUDPInterface::io_service_
private

Definition at line 54 of file psen_scan_udp_interface.h.

◆ socket_read_

boost::asio::ip::udp::socket psen_scan::PSENscanUDPInterface::socket_read_
private

Definition at line 56 of file psen_scan_udp_interface.h.

◆ socket_write_

boost::asio::ip::udp::socket psen_scan::PSENscanUDPInterface::socket_write_
private

Definition at line 55 of file psen_scan_udp_interface.h.

◆ udp_read_endpoint_

boost::asio::ip::udp::endpoint psen_scan::PSENscanUDPInterface::udp_read_endpoint_
private

Definition at line 58 of file psen_scan_udp_interface.h.

◆ udp_write_endpoint_

boost::asio::ip::udp::endpoint psen_scan::PSENscanUDPInterface::udp_write_endpoint_
private

Definition at line 57 of file psen_scan_udp_interface.h.


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


psen_scan
Author(s):
autogenerated on Mon Feb 28 2022 23:16:20