Public Member Functions | Private Attributes | List of all members
sl::UdpChannel Class Reference
Inheritance diagram for sl::UdpChannel:
Inheritance graph
[legend]

Public Member Functions

bool bind (const std::string &ip, sl_s32 port)
 
void clearReadCache ()
 
void close ()
 
void flush ()
 
int getChannelType ()
 
bool open ()
 
int read (void *buffer, size_t size)
 
void setStatus (_u32 flag)
 
 UdpChannel (const std::string &ip, int port)
 
bool waitForData (size_t size, sl_u32 timeoutInMs, size_t *actualReady)
 
sl_result waitForDataExt (size_t &size_hint, sl_u32 timeoutInMs)
 
int write (const void *data, size_t size)
 
- Public Member Functions inherited from sl::IChannel
virtual ~IChannel ()
 

Private Attributes

rp::net::DGramSocket_binded_socket
 
std::string _ip
 
int _port
 
rp::net::SocketAddress _socket
 

Detailed Description

Definition at line 39 of file sl_udp_channel.cpp.

Constructor & Destructor Documentation

◆ UdpChannel()

sl::UdpChannel::UdpChannel ( const std::string &  ip,
int  port 
)
inline

Definition at line 42 of file sl_udp_channel.cpp.

Member Function Documentation

◆ bind()

bool sl::UdpChannel::bind ( const std::string &  ip,
sl_s32  port 
)
inline

Definition at line 47 of file sl_udp_channel.cpp.

◆ clearReadCache()

void sl::UdpChannel::clearReadCache ( )
inlinevirtual

Clear read cache

Implements sl::IChannel.

Definition at line 108 of file sl_udp_channel.cpp.

◆ close()

void sl::UdpChannel::close ( )
inlinevirtual

Close communication channel

Implements sl::IChannel.

Definition at line 60 of file sl_udp_channel.cpp.

◆ flush()

void sl::UdpChannel::flush ( )
inlinevirtual

Flush all written data to remote endpoint

Implements sl::IChannel.

Definition at line 65 of file sl_udp_channel.cpp.

◆ getChannelType()

int sl::UdpChannel::getChannelType ( )
inlinevirtual

Implements sl::IChannel.

Definition at line 114 of file sl_udp_channel.cpp.

◆ open()

bool sl::UdpChannel::open ( )
inlinevirtual

Open communication channel (return true if succeed)

Implements sl::IChannel.

Definition at line 53 of file sl_udp_channel.cpp.

◆ read()

int sl::UdpChannel::read ( void *  buffer,
size_t  size 
)
inlinevirtual

Read data from the chanel

Parameters
bufferThe buffer to receive data
sizeThe size of the read buffer
Returns
Bytes read (negative for read failure)

Implements sl::IChannel.

Definition at line 98 of file sl_udp_channel.cpp.

◆ setStatus()

void sl::UdpChannel::setStatus ( _u32  flag)
inline

Definition at line 112 of file sl_udp_channel.cpp.

◆ waitForData()

bool sl::UdpChannel::waitForData ( size_t  size,
sl_u32  timeoutInMs,
size_t *  actualReady 
)
inlinevirtual

Wait for some data

Parameters
sizeBytes to wait
timeoutInMsWait timeout (in microseconds, -1 for forever)
actualReady[out] actual ready bytes
Returns
true for data ready

Implements sl::IChannel.

Definition at line 85 of file sl_udp_channel.cpp.

◆ waitForDataExt()

sl_result sl::UdpChannel::waitForDataExt ( size_t &  size_hint,
sl_u32  timeoutInMs 
)
inlinevirtual

Wait for some data

Parameters
size_hintByte count may available to retrieve without beening blocked
timeoutInMsWait timeout (in microseconds, -1 for forever)
Returns
RESULT_OK if there is data available for receiving RESULT_OPERATION_TIMEOUT if the given timeout duration is exceed RESULT_OPERATION_FAIL if there is something wrong with the channel

Implements sl::IChannel.

Definition at line 70 of file sl_udp_channel.cpp.

◆ write()

int sl::UdpChannel::write ( const void *  data,
size_t  size 
)
inlinevirtual

Send data to remote endpoint

Parameters
dataThe data buffer
sizeThe size of data buffer (in bytes)
Returns
Bytes written (negative for write failure)

Implements sl::IChannel.

Definition at line 93 of file sl_udp_channel.cpp.

Member Data Documentation

◆ _binded_socket

rp::net::DGramSocket* sl::UdpChannel::_binded_socket
private

Definition at line 119 of file sl_udp_channel.cpp.

◆ _ip

std::string sl::UdpChannel::_ip
private

Definition at line 121 of file sl_udp_channel.cpp.

◆ _port

int sl::UdpChannel::_port
private

Definition at line 122 of file sl_udp_channel.cpp.

◆ _socket

rp::net::SocketAddress sl::UdpChannel::_socket
private

Definition at line 120 of file sl_udp_channel.cpp.


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


rplidar_ros
Author(s):
autogenerated on Fri Aug 2 2024 08:42:14