diff --git a/src/Makefile.am b/src/Makefile.am index 08d58c35f95de2974da7680acfba9d6dde9f9bf3..c9c4db07d03f13a1f986d5b3660911dd76955722 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -37,7 +37,7 @@ sflphoned_CXXFLAGS = -DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone #sflphoned_LDFLAGS = -static sflphoned_LDADD = ./libsflphone.la $(SFLPHONE_LIBS) $(ZEROCONFLIB) $(LIB_DNSSD) $(IAX_LIBS) $(EXOSIP_LIBS) -AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/libs $(libccext2_CFLAGS) $(libccgnu2_CFLAGS) $(IAX_CFLAGS) $(USER_INCLUDES) +AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/libs $(libccext2_CFLAGS) $(libccgnu2_CFLAGS) $(IAX_CFLAGS) $(USER_INCLUDES) $(libdbuscpp_CFLAGS) #libsflphone_la_LDFLAGS= -version-info 0:1:0 libsflphone_la_LIBADD = \ diff --git a/src/audio/Makefile.am b/src/audio/Makefile.am index 8627495750165768e76c50cbfa067091a01d2ae4..d30ca7c765e3807ef70de1d9a26c2997ff9ec77d 100644 --- a/src/audio/Makefile.am +++ b/src/audio/Makefile.am @@ -17,7 +17,7 @@ audiortp.cpp dtmf.cpp tone.cpp audiocodec.cpp audiolayer.cpp audiodev tonegenerator.cpp ulaw.cpp codecDescriptor.cpp \ audioloop.cpp ringbuffer.cpp $(SPEEX_SOURCES_CPP) -AM_CXXFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/libs $(libccext2_CFLAGS) $(libccrtp1_CFLAGS) $(USER_INCLUDES) +AM_CXXFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/libs $(libccext2_CFLAGS) $(libdbuscpp_CFLAGS) $(libccrtp1_CFLAGS) $(USER_INCLUDES) libaudio_la_LIBADD = gsm/libgsm.la $(SPEEX_LIB) libaudio_la_CPPFLAGS = $(SPEEX_FLAG) diff --git a/src/dbus/Makefile.am b/src/dbus/Makefile.am index 2339a1ce9c5276757d8d1dd6a320f6ea58cc0f1c..0339293abad9447935bbd45371f5d6bc0e24b626 100644 --- a/src/dbus/Makefile.am +++ b/src/dbus/Makefile.am @@ -4,8 +4,9 @@ EXTRA_DIST = *.xml README noinst_LTLIBRARIES = libdbus.la -libdbus_la_SOURCES = callmanager.cpp \ - dbusmanagerimpl.cpp +libdbus_la_SOURCES = \ + callmanager.cpp \ + dbusmanagerimpl.cpp libdbus_la_CXXFLAGS = -DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone\" libdbus_la_CPPFLAGS = -I$(top_srcdir)/libs -I$(top_srcdir)/src $(libccext2_CFLAGS) $(libdbuscpp_CFLAGS) diff --git a/src/dbus/callmanager-glue.h b/src/dbus/callmanager-glue.h index 15405360af542347360dcc8069c6618947173412..952287791b76959193dfe3d7f4b73fbb83877365 100644 --- a/src/dbus/callmanager-glue.h +++ b/src/dbus/callmanager-glue.h @@ -10,6 +10,7 @@ namespace org { namespace sflphone { +namespace SFLPhone { class CallManager : public ::DBus::InterfaceAdaptor @@ -17,7 +18,7 @@ class CallManager public: CallManager() - : ::DBus::InterfaceAdaptor("org.sflphone.CallManager") + : ::DBus::InterfaceAdaptor("org.sflphone.SFLPhone.CallManager") { register_method(CallManager, placeCall, _placeCall_stub); register_method(CallManager, refuse, _refuse_stub); @@ -101,14 +102,14 @@ public: { "callID", "s", false }, { 0, 0, 0 } }; - static ::DBus::IntrospectedArgument incommingCall_args[] = + static ::DBus::IntrospectedArgument incomingCall_args[] = { { "accountID", "s", false }, { "callID", "s", false }, { "from", "s", false }, { 0, 0, 0 } }; - static ::DBus::IntrospectedArgument incommingMessage_args[] = + static ::DBus::IntrospectedArgument incomingMessage_args[] = { { "accountID", "s", false }, { "from", "s", false }, @@ -158,8 +159,8 @@ public: }; static ::DBus::IntrospectedMethod CallManager_signals[] = { - { "incommingCall", incommingCall_args }, - { "incommingMessage", incommingMessage_args }, + { "incomingCall", incomingCall_args }, + { "incomingMessage", incomingMessage_args }, { "ring", ring_args }, { "pickedUp", pickedUp_args }, { "hungUp", hungUp_args }, @@ -173,7 +174,7 @@ public: }; static ::DBus::IntrospectedInterface CallManager_interface = { - "org.sflphone.CallManager", + "org.sflphone.SFLPhone.CallManager", CallManager_methods, CallManager_signals, CallManager_properties @@ -209,18 +210,18 @@ public: /* signal emitters for this interface */ - void incommingCall( const ::DBus::String& arg1, const ::DBus::String& arg2, const ::DBus::String& arg3 ) + void incomingCall( const ::DBus::String& arg1, const ::DBus::String& arg2, const ::DBus::String& arg3 ) { - ::DBus::SignalMessage sig("incommingCall"); + ::DBus::SignalMessage sig("incomingCall"); ::DBus::MessageIter wi = sig.writer(); wi << arg1; wi << arg2; wi << arg3; emit_signal(sig); } - void incommingMessage( const ::DBus::String& arg1, const ::DBus::String& arg2 ) + void incomingMessage( const ::DBus::String& arg1, const ::DBus::String& arg2 ) { - ::DBus::SignalMessage sig("incommingMessage"); + ::DBus::SignalMessage sig("incomingMessage"); ::DBus::MessageIter wi = sig.writer(); wi << arg1; wi << arg2; @@ -387,5 +388,5 @@ private: } }; -} } +} } } #endif//__dbusxx__callmanager_glue_h__ADAPTOR_MARSHAL_H diff --git a/src/dbus/callmanager-introspec.xml b/src/dbus/callmanager-introspec.xml index 82eefbe162df98e79431a4c8690c31233b915586..50c4846f202a6cc874c88e249a4a8d824e9909d8 100644 --- a/src/dbus/callmanager-introspec.xml +++ b/src/dbus/callmanager-introspec.xml @@ -1,6 +1,6 @@ <?xml version="1.0" ?> -<node name="/org/sflphone/CallManager"> - <interface name="org.sflphone.CallManager"> +<node name="/org/sflphone/SFLPhone"> + <interface name="org.sflphone.SFLPhone.CallManager"> <method name="placeCall"> <arg type="s" name="accountID" direction="in"/> @@ -56,13 +56,13 @@ <arg type="s" name="callID" direction="out"/> </method> - <signal name="incommingCall"> + <signal name="incomingCall"> <arg type="s" name="accountID" /> <arg type="s" name="callID" /> <arg type="s" name="from" /> </signal> - <signal name="incommingMessage"> + <signal name="incomingMessage"> <arg type="s" name="accountID" /> <arg type="s" name="from" /> </signal> diff --git a/src/dbus/callmanager.h b/src/dbus/callmanager.h index 87ea0889fe31d46cf1128082d4561c3465c495db..cfeaf18f0f225e9a51b4f648eb5a1f7eac80824e 100644 --- a/src/dbus/callmanager.h +++ b/src/dbus/callmanager.h @@ -25,7 +25,7 @@ class CallManager -: public org::sflphone::CallManager, +: public org::sflphone::SFLPhone::CallManager, public DBus::IntrospectableAdaptor, public DBus::ObjectAdaptor { diff --git a/src/dbus/configurationmanager-glue.h b/src/dbus/configurationmanager-glue.h index 93cb0341e40ec08fb1693a2d19714ad077978de8..8bf08fb85418a380468f2b9a5fb6349e0753def6 100644 --- a/src/dbus/configurationmanager-glue.h +++ b/src/dbus/configurationmanager-glue.h @@ -10,6 +10,7 @@ namespace org { namespace sflphone { +namespace SFLPhone { class ConfigurationManager : public ::DBus::InterfaceAdaptor @@ -17,7 +18,7 @@ class ConfigurationManager public: ConfigurationManager() - : ::DBus::InterfaceAdaptor("org.sflphone.ConfigurationManager") + : ::DBus::InterfaceAdaptor("org.sflphone.SFLPhone.ConfigurationManager") { register_method(ConfigurationManager, getAccountDetails, _getAccountDetails_stub); register_method(ConfigurationManager, addAccount, _addAccount_stub); @@ -239,7 +240,7 @@ public: }; static ::DBus::IntrospectedInterface ConfigurationManager_interface = { - "org.sflphone.ConfigurationManager", + "org.sflphone.SFLPhone.ConfigurationManager", ConfigurationManager_methods, ConfigurationManager_signals, ConfigurationManager_properties @@ -573,5 +574,5 @@ private: } }; -} } +} } } #endif//__dbusxx__configurationmanager_glue_h__ADAPTOR_MARSHAL_H diff --git a/src/dbus/dbusmanagerimpl.cpp b/src/dbus/dbusmanagerimpl.cpp index fce813f4cb50788fb745b1c62ca1c446fb882be2..32c686a3c2e10e1ce4bff88947700ebdcec74431 100644 --- a/src/dbus/dbusmanagerimpl.cpp +++ b/src/dbus/dbusmanagerimpl.cpp @@ -22,11 +22,6 @@ const char* DBusManagerImpl::SERVER_NAME = "org.sflphone.SFLPhone"; -void -DBusManagerImpl::connect(){ - -} - int DBusManagerImpl::exec(){ diff --git a/src/dbus/dbusmanagerimpl.h b/src/dbus/dbusmanagerimpl.h index 9b0c5d38fc9817d81700f94001bbec9e8592a380..e020e238c6c2461e948488bf1846163b9f59b979 100644 --- a/src/dbus/dbusmanagerimpl.h +++ b/src/dbus/dbusmanagerimpl.h @@ -24,7 +24,7 @@ class DBusManagerImpl { public: - void connect(); + CallManager * getCallManager(){ return _callManager; }; int exec(); static const char* SERVER_NAME; diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index 846fa28d47b0461a860fdf8fc1f7ac64c8cecba7..32ef328ecf02c7fa26d2e6d9e33e4b4431a462c0 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -20,5 +20,5 @@ noinst_LTLIBRARIES = libguiframework.la libguiframework_la_SOURCES = guiframework.cpp guiframework.h libguiframework_la_CPPFLAGS = -I$(top_srcdir)/libs -I$(top_srcdir)/src -libguiframework_la_CXXFLAGS = $(libccext2_CFLAGS) +libguiframework_la_CXXFLAGS = $(libccext2_CFLAGS) $(libdbuscpp_CFLAGS) libguiframework_la_LIBADD = $(serverlib) diff --git a/src/main.cpp b/src/main.cpp index 5d5b6223f5050bbb95db9a10c50ca53ba54fb873..078feb70476a322d107adf9a7eeb12bd2a8a14fc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -77,6 +77,7 @@ main (int argc, char **argv) { //GUI = &(GUIServer::instance()); //GUIServer::instance().setSessionPort(sessionPort); //Manager::instance().setGui(GUI); + Manager::instance().setDBusManager(&DBusManager::instance()); exit_code = DBusManager::instance().exec(); } diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp index 14d7cc134b58f6cb1967957244a5354aa711b241..3446a131dee049ddf61e6597e120b65270d938c2 100644 --- a/src/managerimpl.cpp +++ b/src/managerimpl.cpp @@ -66,7 +66,7 @@ ManagerImpl::ManagerImpl (void) _path = ""; _exist = 0; _setupLoaded = false; - _gui = 0; + _dbus = NULL; // sound _audiodriver = 0; @@ -599,7 +599,7 @@ ManagerImpl::incomingCall(Call* call, const AccountID& accountId) from.append(number); from.append(">"); } - _gui->incomingCall(accountId, call->getCallId(), from); + _dbus->getCallManager()->incomingCall(accountId, call->getCallId(), from); return true; } @@ -607,8 +607,8 @@ ManagerImpl::incomingCall(Call* call, const AccountID& accountId) //THREAD=VoIP void ManagerImpl::incomingMessage(const AccountID& accountId, const std::string& message) { - if (_gui) { - _gui->incomingMessage(accountId, message); + if (_dbus) { + _dbus->getCallManager()->incomingMessage(accountId, message); } } @@ -619,7 +619,7 @@ ManagerImpl::peerAnsweredCall(const CallID& id) if (isCurrentCall(id)) { stopTone(false); } - if (_gui) _gui->peerAnsweredCall(id); + if (_dbus) _dbus->getCallManager()->pickedUp(id); } //THREAD=VoIP Call=Outgoing @@ -629,7 +629,7 @@ ManagerImpl::peerRingingCall(const CallID& id) if (isCurrentCall(id)) { ringback(); } - if (_gui) _gui->peerRingingCall(id); + if (_dbus) _dbus->getCallManager()->ring(id); } //THREAD=VoIP Call=Outgoing/Ingoing @@ -647,7 +647,7 @@ ManagerImpl::peerHungupCall(const CallID& id) } removeWaitingCall(id); removeCallAccount(id); - if (_gui) _gui->peerHungupCall(id); + if (_dbus) _dbus->getCallManager()->hungUp(id); } //THREAD=VoIP @@ -660,7 +660,7 @@ ManagerImpl::callBusy(const CallID& id) { } removeCallAccount(id); removeWaitingCall(id); - if(_gui) _gui->displayErrorText( id, "Call is busy"); + //if(_gui) _gui->displayErrorText( id, "Call is busy"); } //THREAD=VoIP @@ -672,9 +672,9 @@ ManagerImpl::callFailure(const CallID& id) playATone(Tone::TONE_BUSY); switchCall(""); } - if (_gui) { + /*if (_gui) { _gui->callFailure(id); - } + }*/ removeCallAccount(id); removeWaitingCall(id); } @@ -683,61 +683,61 @@ ManagerImpl::callFailure(const CallID& id) void ManagerImpl::displayTextMessage(const CallID& id, const std::string& message) { - if(_gui) { + /*if(_gui) { _gui->displayTextMessage(id, message); - } + }*/ } //THREAD=VoIP void ManagerImpl::displayErrorText(const CallID& id, const std::string& message) { - if(_gui) { + /*if(_gui) { _gui->displayErrorText(id, message); } else { std::cerr << message << std::endl; - } + }*/ } //THREAD=VoIP void ManagerImpl::displayError (const std::string& error) { - if(_gui) { + /*if(_gui) { _gui->displayError(error); - } + }*/ } //THREAD=VoIP void ManagerImpl::displayStatus(const std::string& status) { - if(_gui) { + /*if(_gui) { _gui->displayStatus(status); - } + }*/ } //THREAD=VoIP void ManagerImpl::displayConfigError (const std::string& message) { - if(_gui) { + /*if(_gui) { _gui->displayConfigError(message); - } + }*/ } //THREAD=VoIP void ManagerImpl::startVoiceMessageNotification(const AccountID& accountId, const std::string& nb_msg) { - if (_gui) _gui->sendVoiceNbMessage(accountId, nb_msg); + //if (_gui) _gui->sendVoiceNbMessage(accountId, nb_msg); } //THREAD=VoIP void ManagerImpl::stopVoiceMessageNotification(const AccountID& accountId) { - if (_gui) _gui->sendVoiceNbMessage(accountId, std::string("0")); + //if (_gui) _gui->sendVoiceNbMessage(accountId, std::string("0")); } //THREAD=VoIP @@ -745,21 +745,21 @@ void ManagerImpl::registrationSucceed(const AccountID& accountid) { Account* acc = getAccount(accountid); - if ( acc ) { + /*if ( acc ) { acc->setState(true); if (_gui) _gui->sendRegistrationState(accountid, true); - } + }*/ } //THREAD=VoIP void ManagerImpl::registrationFailed(const AccountID& accountid) { - Account* acc = getAccount(accountid); + /*Account* acc = getAccount(accountid); if ( acc ) { acc->setState(false); if (_gui) _gui->sendRegistrationState(accountid, false); - } + }*/ } /** @@ -1141,7 +1141,7 @@ ManagerImpl::getZeroconf(const std::string& sequenceId) bool returnValue = false; #ifdef USE_ZEROCONF int useZeroconf = getConfigInt(PREFERENCES, CONFIG_ZEROCONF); - if (useZeroconf && _gui != NULL) { + if (useZeroconf && _dbus != NULL) { TokenList arg; TokenList argTXT; std::string newService = "new service"; @@ -1152,7 +1152,7 @@ ManagerImpl::getZeroconf(const std::string& sequenceId) arg.push_back(newService); while(iter!=services.end()) { arg.push_front(iter->first); - _gui->sendMessage("100",sequenceId,arg); + //_gui->sendMessage("100",sequenceId,arg); arg.pop_front(); // remove the first, the name TXTRecordMap record = iter->second.getTXTRecords(); @@ -1163,7 +1163,7 @@ ManagerImpl::getZeroconf(const std::string& sequenceId) argTXT.push_back(iterTXT->first); argTXT.push_back(iterTXT->second); argTXT.push_back(newTXT); - _gui->sendMessage("101",sequenceId,argTXT); + // _gui->sendMessage("101",sequenceId,argTXT); iterTXT++; } iter++; @@ -1229,7 +1229,7 @@ ManagerImpl::getEvents() { bool ManagerImpl::getCallStatus(const std::string& sequenceId) { - if (!_gui) { return false; } + if (!_dbus) { return false; } ost::MutexLock m(_callAccountMapMutex); CallAccountMap::iterator iter = _callAccountMap.begin(); TokenList tk; @@ -1274,7 +1274,7 @@ ManagerImpl::getCallStatus(const std::string& sequenceId) tk.push_back(iter->second); tk.push_back(destination); tk.push_back(status); - _gui->sendCallMessage(code, sequenceId, iter->first, tk); + //_gui->sendCallMessage(code, sequenceId, iter->first, tk); tk.clear(); iter++; @@ -1294,7 +1294,7 @@ ManagerImpl::getConfigAll(const std::string& sequenceId) returnValue = true; } while (tk.size()) { - _gui->sendMessage("100", sequenceId, tk); + //_gui->sendMessage("100", sequenceId, tk); tk = iter.next(); } return returnValue; @@ -1369,7 +1369,7 @@ ManagerImpl::getConfigList(const std::string& sequenceId, const std::string& nam } else { tk.push_back(strType.str()); } - _gui->sendMessage("100", sequenceId, tk); + // _gui->sendMessage("100", sequenceId, tk); iter++; } returnValue = true; @@ -1379,7 +1379,7 @@ ManagerImpl::getConfigList(const std::string& sequenceId, const std::string& nam str << 1; tk.push_back(str.str()); tk.push_back(""); // filepath - _gui->sendMessage("100", sequenceId, tk); + //_gui->sendMessage("100", sequenceId, tk); // share directory std::string path = std::string(PROGSHAREDIR) + DIR_SEPARATOR_STR + RINGDIR; @@ -1423,7 +1423,7 @@ ManagerImpl::getAudioDeviceList(const std::string& sequenceId, int ioDeviceMask) tk.push_back(device->getName()); tk.push_back(device->getApiName()); std::ostringstream rate; rate << (int)(device->getRate()); tk.push_back(rate.str()); - _gui->sendMessage("100", sequenceId, tk); + //_gui->sendMessage("100", sequenceId, tk); // don't forget to delete it after delete device; device = 0; @@ -1435,7 +1435,7 @@ ManagerImpl::getAudioDeviceList(const std::string& sequenceId, int ioDeviceMask) rate << "VARIABLE"; tk.clear(); tk.push_back(rate.str()); - _gui->sendMessage("101", sequenceId, tk); + //_gui->sendMessage("101", sequenceId, tk); return returnValue; } @@ -1462,7 +1462,7 @@ ManagerImpl::sendCountryTone(const std::string& sequenceId, int index, const std TokenList tk; std::ostringstream str; str << index; tk.push_back(str.str()); tk.push_back(name); - _gui->sendMessage("100", sequenceId, tk); + //_gui->sendMessage("100", sequenceId, tk); } //THREAD=Main @@ -1483,7 +1483,7 @@ ManagerImpl::getDirListing(const std::string& sequenceId, const std::string& pat str << (*nbFile); tk.push_back(str.str()); tk.push_back(filePathName); - _gui->sendMessage("100", sequenceId, tk); + //_gui->sendMessage("100", sequenceId, tk); (*nbFile)++; } } @@ -1510,12 +1510,12 @@ ManagerImpl::getAccountList(const std::string& sequenceId) if ( iter->second->isEnabled() || iter->second->shouldInitOnStart()) { tk.push_back("Active"); tk.push_back(getConfigString(iter->first,CONFIG_ACCOUNT_ALIAS)); - _gui->sendMessage("130", sequenceId, tk); + //_gui->sendMessage("130", sequenceId, tk); oneActive = true; } else { tk.push_back("Inactive"); tk.push_back(getConfigString(iter->first,CONFIG_ACCOUNT_ALIAS)); - _gui->sendMessage("131", sequenceId, tk); + //_gui->sendMessage("131", sequenceId, tk); } tk.clear(); diff --git a/src/managerimpl.h b/src/managerimpl.h index a364ff03e69a3f7d6640f710c8d8dd1c772daf08..fb35b620f12fc37714e3d819c7f52ae880df2dc1 100644 --- a/src/managerimpl.h +++ b/src/managerimpl.h @@ -28,6 +28,7 @@ #include <set> #include <map> #include <cc++/thread.h> +#include "dbus/dbusmanager.h" #include "stund/stun.h" #include "observer.h" @@ -41,6 +42,7 @@ #include "audio/dtmf.h" #include "audio/codecDescriptor.h" + class AudioLayer; class CodecDescriptor; class GuiFramework; @@ -94,7 +96,7 @@ public: * Set the graphic user interface : only GuiServer right now * @param gui A GuiFramework gui implmentation */ - void setGui (GuiFramework* gui) { _gui = gui; } + void setDBusManager (DBusManagerImpl* man) { _dbus = man; } // Accessor to audiodriver // it's multi-thread and use mutex internally @@ -416,7 +418,7 @@ private: // // Multithread variable (non protected) // - GuiFramework* _gui; + DBusManagerImpl * _dbus; /** Waiting Call Vectors */ CallIDSet _waitingCall;