Babel
Epitech's C++ VoIP project
|
Go to the documentation of this file.
5 #ifndef BABEL_UDPSOCKET_HPP
6 #define BABEL_UDPSOCKET_HPP
20 UDPSocket(std::int16_t port, std::shared_ptr<Babel::IAudioManager> &, std::shared_ptr<Babel::ICodec> &);
27 write(std::array<unsigned char, 4000> &data, std::int32_t size,
const std::string &address,
int port);
44 std::shared_ptr<Babel::IAudioManager>
_audio;
46 std::shared_ptr<Babel::ICodec>
_codec;
51 #endif //BABEL_UDPSOCKET_HPP
std::shared_ptr< Babel::IAudioManager > _audio
audio interface to play sound
Definition: UDPSocket.hpp:44
std::unique_ptr< QUdpSocket > _socket
Qt's UDP socket.
Definition: UDPSocket.hpp:42
void close()
closes the socket
Definition: UDPSocket.cpp:60
wrapper around Qt UDP socket, ICodec and Portaudio
Definition: UDPSocket.hpp:16
Definition: IAudioManager.hpp:13
std::mutex _mutex
mutex for closing the socket
Definition: UDPSocket.hpp:40
std::int64_t write(std::array< unsigned char, 4000 > &data, std::int32_t size, const std::string &address, int port)
writes data to socket
Definition: UDPSocket.cpp:27
UDPSocket(std::int16_t port, std::shared_ptr< Babel::IAudioManager > &, std::shared_ptr< Babel::ICodec > &)
ctor
Definition: UDPSocket.cpp:15
std::shared_ptr< Babel::ICodec > _codec
codec interface to encode and decode sound
Definition: UDPSocket.hpp:46
void readPending()
reads the incoming datagrams when they arrive
Definition: UDPSocket.cpp:37
~UDPSocket() override
dtor
Definition: UDPSocket.cpp:56
uint16_t getLocalPort() const
get the port that the UDPSocket is listening
Definition: UDPSocket.cpp:65