Babel
Epitech's C++ VoIP project
|
wrapper around Qt UDP socket, ICodec and Portaudio More...
#include <UDPSocket.hpp>
Public Member Functions | |
UDPSocket (std::int16_t port, std::shared_ptr< Babel::IAudioManager > &, std::shared_ptr< Babel::ICodec > &) | |
ctor More... | |
~UDPSocket () override | |
dtor More... | |
std::int64_t | write (std::array< unsigned char, 4000 > &data, std::int32_t size, const std::string &address, int port) |
writes data to socket More... | |
void | close () |
closes the socket More... | |
void | readPending () |
reads the incoming datagrams when they arrive More... | |
uint16_t | getLocalPort () const |
get the port that the UDPSocket is listening More... | |
Private Attributes | |
std::mutex | _mutex |
mutex for closing the socket More... | |
std::unique_ptr< QUdpSocket > | _socket |
Qt's UDP socket. More... | |
std::shared_ptr< Babel::IAudioManager > | _audio |
audio interface to play sound More... | |
std::shared_ptr< Babel::ICodec > | _codec |
codec interface to encode and decode sound More... | |
wrapper around Qt UDP socket, ICodec and Portaudio
Babel::UDPSocket::UDPSocket | ( | std::int16_t | port, |
std::shared_ptr< Babel::IAudioManager > & | audio, | ||
std::shared_ptr< Babel::ICodec > & | opus | ||
) |
ctor
|
override |
dtor
void Babel::UDPSocket::close | ( | ) |
closes the socket
uint16_t Babel::UDPSocket::getLocalPort | ( | ) | const |
get the port that the UDPSocket is listening
void Babel::UDPSocket::readPending | ( | ) |
reads the incoming datagrams when they arrive
std::int64_t Babel::UDPSocket::write | ( | std::array< unsigned char, 4000 > & | data, |
std::int32_t | size, | ||
const std::string & | address, | ||
int | port | ||
) |
writes data to socket
|
private |
audio interface to play sound
|
private |
codec interface to encode and decode sound
|
private |
mutex for closing the socket
|
private |
Qt's UDP socket.