Finalized voice vatlib implementation.

refs #36
- Implemented the rest of the methods
- Added more commands to the voice sample, to login to voice server
- Login successfull. However, no voice yet.

refs #81
This commit is contained in:
Roland Winklmeier
2013-12-01 01:53:26 +01:00
committed by Mathew Sutcliffe
parent f91525b65b
commit 45b9f60444
5 changed files with 304 additions and 61 deletions

View File

@@ -12,6 +12,8 @@ Client::Client(QObject *parent) :
using namespace BlackCore;
connect(m_voiceClient, &IVoiceClient::squelchTestFinished, this, &Client::onSquelchTestFinished);
connect(m_voiceClient, &IVoiceClient::micTestFinished, this, &Client::onMicTestFinished);
connect(m_voiceClient, &IVoiceClient::connected, this, &Client::connectionStatusConnected);
@@ -19,8 +21,11 @@ Client::Client(QObject *parent) :
m_commands["help"] = std::bind(&Client::help, this, _1);
m_commands["echo"] = std::bind(&Client::echo, this, _1);
m_commands["exit"] = std::bind(&Client::exit, this, _1);
m_commands["runsquelchtest"] = std::bind(&Client::runSquelchTest, this, _1);
m_commands["runmictest"] = std::bind(&Client::runMicTest, this, _1);
m_commands["squelchtest"] = std::bind(&Client::runSquelchTest, this, _1);
m_commands["mictest"] = std::bind(&Client::runMicTest, this, _1);
m_commands["setcallsign"] = std::bind(&Client::setCallsignCmd, this, _1);
m_commands["initconnect"] = std::bind(&Client::initiateConnectionCmd, this, _1);
m_commands["termconnect"] = std::bind(&Client::terminateConnectionCmd, this, _1);
}
@@ -89,6 +94,30 @@ void Client::runMicTest(QTextStream &args)
m_voiceClient->runMicTest();
}
void Client::setCallsignCmd(QTextStream &args)
{
QString callsign;
args >> callsign;
m_voiceClient->setCallsign(BlackMisc::Aviation::CCallsign(callsign));
}
void Client::initiateConnectionCmd(QTextStream &args)
{
QString hostname;
QString channel;
args >> hostname >> channel;
std::cout << "Joining voice room: " << hostname.toStdString() << "/" << channel.toStdString() << std::endl;
m_voiceClient->joinVoiceRoom(0, BlackMisc::Voice::CVoiceRoom(hostname, channel));
printLinePrefix();
}
void Client::terminateConnectionCmd(QTextStream &args)
{
std::cout << "Leaving room." << std::endl;
m_voiceClient->leaveVoiceRoom(0);
printLinePrefix();
}
void Client::onSquelchTestFinished()
{
std::cout << "Input squelch: " << m_voiceClient->inputSquelch() << std::endl;
@@ -100,3 +129,16 @@ void Client::onMicTestFinished()
std::cout << "Mic test result: " << (int)m_voiceClient->micTestResult() << std::endl;
printLinePrefix();
}
void Client::connectionStatusConnected()
{
std::cout << "CONN_STATUS_CONNECTED" << std::endl;
printLinePrefix();
}
void Client::connectionStatusDisconnected()
{
std::cout << "CONN_STATUS_DISCONNECTED" << std::endl;
printLinePrefix();
}