2015-11-03 02:13:15 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ICommunicator.hpp"
|
2015-09-28 23:25:12 +02:00
|
|
|
|
2015-10-30 13:43:06 +01:00
|
|
|
#include <mumlib.hpp>
|
2015-09-28 23:25:12 +02:00
|
|
|
|
2015-11-04 01:22:59 +01:00
|
|
|
#include <log4cpp/Category.hh>
|
|
|
|
#include <boost/noncopyable.hpp>
|
|
|
|
|
2015-09-28 23:25:12 +02:00
|
|
|
#include <string>
|
|
|
|
#include <stdexcept>
|
|
|
|
|
|
|
|
namespace mumble {
|
|
|
|
|
|
|
|
class Exception : public std::runtime_error {
|
|
|
|
public:
|
|
|
|
Exception(const char *message) : std::runtime_error(message) { }
|
|
|
|
};
|
|
|
|
|
2015-10-30 13:43:06 +01:00
|
|
|
class MumlibCallback;
|
|
|
|
|
2015-11-04 01:22:59 +01:00
|
|
|
class MumbleCommunicator : public ICommunicator, boost::noncopyable {
|
2015-09-28 23:25:12 +02:00
|
|
|
public:
|
2015-09-29 02:26:45 +02:00
|
|
|
MumbleCommunicator(
|
2015-11-03 02:13:15 +01:00
|
|
|
boost::asio::io_service &ioService);
|
|
|
|
|
|
|
|
void connect(
|
2015-09-29 02:26:45 +02:00
|
|
|
std::string user,
|
|
|
|
std::string password,
|
|
|
|
std::string host,
|
|
|
|
int port = 0);
|
2015-09-28 23:25:12 +02:00
|
|
|
|
|
|
|
~MumbleCommunicator();
|
|
|
|
|
2015-11-03 02:13:15 +01:00
|
|
|
virtual void sendPcmSamples(int16_t *samples, unsigned int length);
|
2015-10-16 22:41:37 +02:00
|
|
|
|
2015-11-04 00:53:52 +01:00
|
|
|
void sendTextMessage(std::string message);
|
|
|
|
|
2015-10-30 13:43:06 +01:00
|
|
|
public:
|
|
|
|
boost::asio::io_service &ioService;
|
2015-09-28 23:25:12 +02:00
|
|
|
|
2015-09-29 02:26:45 +02:00
|
|
|
log4cpp::Category &logger;
|
|
|
|
|
2015-10-30 13:43:06 +01:00
|
|
|
std::shared_ptr<mumlib::Mumlib> mum;
|
2015-09-29 02:26:45 +02:00
|
|
|
|
2015-10-30 13:43:06 +01:00
|
|
|
std::unique_ptr<MumlibCallback> callback;
|
|
|
|
|
|
|
|
friend class MumlibCallback;
|
2015-09-28 23:25:12 +02:00
|
|
|
};
|
|
|
|
}
|