added logic for handling invitations

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4993 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-02-26 15:49:07 +00:00
parent a4320d785f
commit b748f1a3f1
6 changed files with 36 additions and 6 deletions

View File

@ -49,6 +49,8 @@ VOIPPlugin::VOIPPlugin()
QObject::connect(mPluginNotifier,SIGNAL(voipInvitationReceived(const QString&)),mPluginGUIHandler,SLOT(ReceivedInvitation(const QString&)),Qt::QueuedConnection) ; QObject::connect(mPluginNotifier,SIGNAL(voipInvitationReceived(const QString&)),mPluginGUIHandler,SLOT(ReceivedInvitation(const QString&)),Qt::QueuedConnection) ;
QObject::connect(mPluginNotifier,SIGNAL(voipDataReceived(const QString&)),mPluginGUIHandler,SLOT(ReceivedVoipData(const QString&)),Qt::QueuedConnection) ; QObject::connect(mPluginNotifier,SIGNAL(voipDataReceived(const QString&)),mPluginGUIHandler,SLOT(ReceivedVoipData(const QString&)),Qt::QueuedConnection) ;
QObject::connect(mPluginNotifier,SIGNAL(voipAcceptReceived(const QString&)),mPluginGUIHandler,SLOT(ReceivedVoipAccept(const QString&)),Qt::QueuedConnection) ;
QObject::connect(mPluginNotifier,SIGNAL(voipHangUpReceived(const QString&)),mPluginGUIHandler,SLOT(ReceivedVoipHangUp(const QString&)),Qt::QueuedConnection) ;
} }
void VOIPPlugin::setInterfaces(RsPlugInInterfaces &interfaces) void VOIPPlugin::setInterfaces(RsPlugInInterfaces &interfaces)

View File

@ -11,6 +11,16 @@ void PluginGUIHandler::ReceivedInvitation(const QString& peer_id)
std::cerr << "****** Plugin GUI handler: received data!" << std::endl; std::cerr << "****** Plugin GUI handler: received data!" << std::endl;
} }
void PluginGUIHandler::ReceivedVoipHangUp(const QString& peer_id)
{
std::cerr << "****** Plugin GUI handler: received HangUp!" << std::endl;
}
void PluginGUIHandler::ReceivedVoipAccept(const QString& peer_id)
{
std::cerr << "****** Plugin GUI handler: received VoipAccept!" << std::endl;
}
void PluginGUIHandler::ReceivedVoipData(const QString& peer_id) void PluginGUIHandler::ReceivedVoipData(const QString& peer_id)
{ {
std::cerr << "****** Plugin GUI handler: received invitation!" << std::endl; std::cerr << "****** Plugin GUI handler: received invitation!" << std::endl;

View File

@ -14,4 +14,6 @@ class PluginGUIHandler: public QObject
public slots: public slots:
void ReceivedInvitation(const QString& peer_id) ; void ReceivedInvitation(const QString& peer_id) ;
void ReceivedVoipData(const QString& peer_id) ; void ReceivedVoipData(const QString& peer_id) ;
void ReceivedVoipHangUp(const QString& peer_id) ;
void ReceivedVoipAccept(const QString& peer_id) ;
}; };

View File

@ -8,3 +8,11 @@ void PluginNotifier::notifyReceivedVoipData(const std::string& peer_id)
{ {
emit voipDataReceived(QString::fromStdString(peer_id)) ; emit voipDataReceived(QString::fromStdString(peer_id)) ;
} }
void PluginNotifier::notifyReceivedVoipAccept(const std::string& peer_id)
{
emit voipAcceptReceived(QString::fromStdString(peer_id)) ;
}
void PluginNotifier::notifyReceivedVoipHangUp(const std::string& peer_id)
{
emit voipHangUpReceived(QString::fromStdString(peer_id)) ;
}

View File

@ -14,8 +14,12 @@ class PluginNotifier: public QObject
public: public:
void notifyReceivedVoipData(const std::string& peer_id) ; void notifyReceivedVoipData(const std::string& peer_id) ;
void notifyReceivedVoipInvite(const std::string& peer_id) ; void notifyReceivedVoipInvite(const std::string& peer_id) ;
void notifyReceivedVoipHangUp(const std::string& peer_id) ;
void notifyReceivedVoipAccept(const std::string& peer_id) ;
signals: signals:
void voipInvitationReceived(const QString&) ; // signal emitted when an invitation has been received void voipInvitationReceived(const QString&) ; // signal emitted when an invitation has been received
void voipDataReceived(const QString&) ; // signal emitted when some voip data has been received void voipDataReceived(const QString&) ; // signal emitted when some voip data has been received
void voipHangUpReceived(const QString& peer_id) ; // emitted when the peer closes the call (i.e. hangs up)
void voipAcceptReceived(const QString& peer_id) ; // emitted when the peer accepts the call
}; };

View File

@ -42,6 +42,7 @@
/**** /****
* #define DEBUG_VORS 1 * #define DEBUG_VORS 1
****/ ****/
#define DEBUG_VORS 1
/* DEFINE INTERFACE POINTER! */ /* DEFINE INTERFACE POINTER! */
@ -300,18 +301,21 @@ void p3VoRS::handleProtocol(RsVoipProtocolItem *item)
{ {
// should we keep a list of received requests? // should we keep a list of received requests?
// we notify the notifier that something occurred.
switch(item->protocol) switch(item->protocol)
{ {
case RsVoipProtocolItem::VoipProtocol_Ring: std::cerr << "Received protocol ring item." << std::endl; case RsVoipProtocolItem::VoipProtocol_Ring: std::cerr << "p3VoRS::handleProtocol(): Received protocol ring item." << std::endl;
mNotify->notifyReceivedVoipInvite(item->PeerId()); mNotify->notifyReceivedVoipInvite(item->PeerId());
break ; break ;
case RsVoipProtocolItem::VoipProtocol_Ackn: case RsVoipProtocolItem::VoipProtocol_Ackn: std::cerr << "p3VoRS::handleProtocol(): Received protocol accept call" << std::endl;
case RsVoipProtocolItem::VoipProtocol_Close: mNotify->notifyReceivedVoipAccept(item->PeerId());
break ;
case RsVoipProtocolItem::VoipProtocol_Close: std::cerr << "p3VoRS::handleProtocol(): Received protocol Close call." << std::endl;
mNotify->notifyReceivedVoipHangUp(item->PeerId());
break ;
default: default:
std::cerr << "Received protocol item # " << item->protocol << ": not handled yet ! Sorry" << std::endl; std::cerr << "p3VoRS::handleProtocol(): Received protocol item # " << item->protocol << ": not handled yet ! Sorry" << std::endl;
break ; break ;
} }