From 94611b11415b016ac0c80c191b78d2e55cb36bf1 Mon Sep 17 00:00:00 2001 From: Alexandre Lision <alexandre.lision@gmail.com> Date: Mon, 9 Feb 2015 12:38:49 -0500 Subject: [PATCH] Remove Client abstraction layer Refs #65862 Change-Id: I43cee3d565f769a1c463e0f2e2195c92429a4800 --- daemon/src/account.cpp | 2 +- daemon/src/client/Makefile.am | 6 +- daemon/src/client/client.cpp | 93 ------------- daemon/src/client/client.h | 81 ------------ daemon/src/managerimpl.cpp | 123 ++++++++++-------- daemon/src/managerimpl.h | 26 ++-- daemon/src/media/audio/alsa/alsalayer.cpp | 6 +- daemon/src/media/audio/opensl/opensllayer.cpp | 2 +- daemon/src/media/audio/sound/audiofile.cpp | 2 +- daemon/src/ring_api.cpp | 8 +- daemon/src/sip/pres_sub_client.cpp | 6 +- daemon/src/sip/pres_sub_server.cpp | 2 +- daemon/src/sip/sipaccount.cpp | 6 +- daemon/src/sip/sipaccountbase.cpp | 2 +- daemon/src/sip/sipcall.cpp | 2 +- daemon/src/sip/sippresence.cpp | 7 +- daemon/src/sip/sipvoiplink.cpp | 3 +- daemon/test/accounttest.cpp | 2 +- 18 files changed, 115 insertions(+), 264 deletions(-) delete mode 100644 daemon/src/client/client.cpp delete mode 100644 daemon/src/client/client.h diff --git a/daemon/src/account.cpp b/daemon/src/account.cpp index 454bdbf0ca..1fc905fd3d 100644 --- a/daemon/src/account.cpp +++ b/daemon/src/account.cpp @@ -150,7 +150,7 @@ void Account::setRegistrationState(RegistrationState state) if (state != registrationState_) { registrationState_ = state; // Notify the client - ConfigurationManager *c(Manager::instance().getClient()->getConfigurationManager()); + ConfigurationManager *c(Manager::instance().getConfigurationManager()); c->registrationStateChanged(accountID_, static_cast<int32_t>(registrationState_)); c->volatileAccountDetailsChanged(accountID_, getVolatileAccountDetails()); } diff --git a/daemon/src/client/Makefile.am b/daemon/src/client/Makefile.am index 4eb5b4af49..988530745d 100644 --- a/daemon/src/client/Makefile.am +++ b/daemon/src/client/Makefile.am @@ -3,8 +3,7 @@ include $(top_srcdir)/globals.mak noinst_LTLIBRARIES = libclient.la noinst_HEADERS = callmanager.h \ - configurationmanager.h \ - client.h + configurationmanager.h PRESENCE_SRC = presencemanager.cpp noinst_HEADERS += presencemanager.h @@ -14,8 +13,7 @@ VIDEO_SRC = videomanager.cpp noinst_HEADERS += videomanager.h endif -libclient_la_SOURCES = client.cpp \ - callmanager.cpp \ +libclient_la_SOURCES = callmanager.cpp \ configurationmanager.cpp \ $(PRESENCE_SRC) \ $(VIDEO_SRC) diff --git a/daemon/src/client/client.cpp b/daemon/src/client/client.cpp deleted file mode 100644 index 11bbae1fc7..0000000000 --- a/daemon/src/client/client.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. - * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "client.h" -#include "callmanager.h" -#include "configurationmanager.h" -#include "presencemanager.h" - -#ifdef RING_VIDEO -#include "videomanager.h" -#endif // RING_VIDEO - -namespace ring { - -Client::Client() : - callManager_(new CallManager) - , configurationManager_(new ConfigurationManager) - , presenceManager_(new PresenceManager) -#ifdef RING_VIDEO - , videoManager_(new VideoManager) -#endif -#ifdef USE_NETWORKMANAGER - , networkManager_(0) -#endif -{} - -Client::~Client() -{ -#ifdef USE_NETWORKMANAGER - delete networkManager_; -#endif -#ifdef RING_VIDEO - delete videoManager_; -#endif - delete configurationManager_; - delete presenceManager_; - delete callManager_; -} - -CallManager * Client::getCallManager() -{ - return callManager_; -} - -ConfigurationManager * Client::getConfigurationManager() -{ - return configurationManager_; -} - -PresenceManager * Client::getPresenceManager() -{ - return presenceManager_; -} - -#ifdef RING_VIDEO -VideoManager * Client::getVideoManager() -{ - return videoManager_; -} -#endif - -} // namespace ring diff --git a/daemon/src/client/client.h b/daemon/src/client/client.h deleted file mode 100644 index 329bb65c65..0000000000 --- a/daemon/src/client/client.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. - * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ - -#ifndef __CLIENT_H__ -#define __CLIENT_H__ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "noncopyable.h" - -namespace ring { - -class ConfigurationManager; -class CallManager; -class NetworkManager; -class Instance; -class PresenceManager; - -#ifdef RING_VIDEO -class VideoManager; -#endif - -class Client { - public: - Client(); - ~Client(); - - CallManager * getCallManager(); - - ConfigurationManager * getConfigurationManager(); - - PresenceManager * getPresenceManager(); - -#ifdef RING_VIDEO - VideoManager* getVideoManager(); -#endif - - private: - NON_COPYABLE(Client); - CallManager* callManager_; - ConfigurationManager* configurationManager_; - PresenceManager* presenceManager_; -#ifdef RING_VIDEO - VideoManager *videoManager_; -#endif -#if USE_NETWORKMANAGER - NetworkManager* networkManager_; -#endif -}; - -} // namespace ring - -#endif diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp index 45013502e8..5857100532 100644 --- a/daemon/src/managerimpl.cpp +++ b/daemon/src/managerimpl.cpp @@ -73,6 +73,7 @@ #include "client/configurationmanager.h" #include "client/callmanager.h" +#include "client/presencemanager.h" #ifdef RING_VIDEO #include "client/videomanager.h" @@ -158,8 +159,16 @@ ManagerImpl::ManagerImpl() : pluginManager_(new PluginManager) , preferences(), voipPreferences(), hookPreference(), audioPreference(), shortcutPreferences(), - hasTriedToRegister_(false), audioCodecFactory(*pluginManager_), client_(), - currentCallMutex_(), dtmfKey_(), dtmfBuf_(0, AudioFormat::MONO()), + hasTriedToRegister_(false), audioCodecFactory(*pluginManager_), + callManager_(new CallManager), configurationManager_(new ConfigurationManager), + presenceManager_(new PresenceManager) +#ifdef RING_VIDEO + , videoManager_(new VideoManager) +#endif +#ifdef USE_NETWORKMANAGER + , networkManager_(0) +#endif + , currentCallMutex_(), dtmfKey_(), dtmfBuf_(0, AudioFormat::MONO()), toneMutex_(), telephoneTone_(), audiofile_(), audioLayerMutex_(), waitingCalls_(), waitingCallsMutex_(), path_() , ringbufferpool_(new RingBufferPool) @@ -176,6 +185,32 @@ ManagerImpl::ManagerImpl() : ManagerImpl::~ManagerImpl() {} +CallManager* +ManagerImpl::getCallManager() +{ + return callManager_.get(); +} + +ConfigurationManager* +ManagerImpl::getConfigurationManager() +{ + return configurationManager_.get(); +} + +PresenceManager* +ManagerImpl::getPresenceManager() +{ + return presenceManager_.get(); +} + +#ifdef RING_VIDEO +VideoManager* +ManagerImpl::getVideoManager() +{ + return videoManager_.get(); +} +#endif + bool ManagerImpl::parseConfiguration() { @@ -493,7 +528,7 @@ ManagerImpl::answerCall(const std::string& call_id) if (audioPreference.getIsAlwaysRecording()) toggleRecordingCall(call_id); - client_.getCallManager()->callStateChanged(call_id, "CURRENT"); + getCallManager()->callStateChanged(call_id, "CURRENT"); return result; } @@ -518,7 +553,7 @@ ManagerImpl::hangupCall(const std::string& callId) stopTone(); RING_DBG("Send call state change (HUNGUP) for id %s", callId.c_str()); - client_.getCallManager()->callStateChanged(callId, "HUNGUP"); + getCallManager()->callStateChanged(callId, "HUNGUP"); /* We often get here when the call was hungup before being created */ auto call = getCallFromCallID(callId); @@ -609,7 +644,7 @@ ManagerImpl::onHoldCall(const std::string& callId) if (current_call_id == callId) unsetCurrentCall(); - client_.getCallManager()->callStateChanged(callId, "HOLD"); + getCallManager()->callStateChanged(callId, "HOLD"); return result; } @@ -647,7 +682,7 @@ ManagerImpl::offHoldCall(const std::string& callId) return false; } - client_.getCallManager()->callStateChanged(callId, "UNHOLD"); + getCallManager()->callStateChanged(callId, "UNHOLD"); if (isConferenceParticipant(callId)) switchCall(getCallFromCallID(call->getConfId())); @@ -682,13 +717,13 @@ ManagerImpl::transferCall(const std::string& callId, const std::string& to) void ManagerImpl::transferFailed() { - client_.getCallManager()->transferFailed(); + getCallManager()->transferFailed(); } void ManagerImpl::transferSucceeded() { - client_.getCallManager()->transferSucceeded(); + getCallManager()->transferSucceeded(); } bool @@ -722,7 +757,7 @@ ManagerImpl::refuseCall(const std::string& id) removeWaitingCall(id); - client_.getCallManager()->callStateChanged(id, "HUNGUP"); + getCallManager()->callStateChanged(id, "HUNGUP"); // Disconnect streams removeStream(*call); @@ -743,7 +778,7 @@ ManagerImpl::createConference(const std::string& id1, const std::string& id2) // Add conference to map conferenceMap_.insert(std::make_pair(conf->getConfID(), conf)); - client_.getCallManager()->conferenceCreated(conf->getConfID()); + getCallManager()->conferenceCreated(conf->getConfID()); return conf; } @@ -765,7 +800,7 @@ ManagerImpl::removeConference(const std::string& conference_id) return; } - client_.getCallManager()->conferenceRemoved(conference_id); + getCallManager()->conferenceRemoved(conference_id); // We now need to bind the audio to the remain participant @@ -825,7 +860,7 @@ ManagerImpl::holdConference(const std::string& id) conf->setState(isRec ? Conference::HOLD_REC : Conference::HOLD); - client_.getCallManager()->conferenceChanged(conf->getConfID(), conf->getStateStr()); + getCallManager()->conferenceChanged(conf->getConfID(), conf->getStateStr()); return true; } @@ -858,7 +893,7 @@ ManagerImpl::unHoldConference(const std::string& id) conf->setState(isRec ? Conference::ACTIVE_ATTACHED_REC : Conference::ACTIVE_ATTACHED); - client_.getCallManager()->conferenceChanged(conf->getConfID(), conf->getStateStr()); + getCallManager()->conferenceChanged(conf->getConfID(), conf->getStateStr()); return true; } @@ -988,7 +1023,7 @@ ManagerImpl::addMainParticipant(const std::string& conference_id) else RING_WARN("Invalid conference state while adding main participant"); - client_.getCallManager()->conferenceChanged(conference_id, conf->getStateStr()); + getCallManager()->conferenceChanged(conference_id, conf->getStateStr()); } switchCall(getCallFromCallID(conference_id)); @@ -1132,7 +1167,7 @@ ManagerImpl::createConfFromParticipantList(const std::vector< std::string > &par if (!callSuccess) conf->remove(generatedCallID); else { - client_.getCallManager()->newCallCreated(account, generatedCallID, tostr); + getCallManager()->newCallCreated(account, generatedCallID, tostr); successCounter++; } } @@ -1140,7 +1175,7 @@ ManagerImpl::createConfFromParticipantList(const std::vector< std::string > &par // Create the conference if and only if at least 2 calls have been successfully created if (successCounter >= 2) { conferenceMap_[conf->getConfID()] = conf; - client_.getCallManager()->conferenceCreated(conf->getConfID()); + getCallManager()->conferenceCreated(conf->getConfID()); conf->setRecordingFormat(ringbufferpool_->getInternalAudioFormat()); } } @@ -1202,7 +1237,7 @@ ManagerImpl::detachParticipant(const std::string& call_id) else RING_WARN("Undefined behavior, invalid conference state in detach participant"); - client_.getCallManager()->conferenceChanged(conf->getConfID(), + getCallManager()->conferenceChanged(conf->getConfID(), conf->getStateStr()); unsetCurrentCall(); @@ -1236,7 +1271,7 @@ ManagerImpl::removeParticipant(const std::string& call_id) removeStream(*call); - client_.getCallManager()->conferenceChanged(conf->getConfID(), conf->getStateStr()); + getCallManager()->conferenceChanged(conf->getConfID(), conf->getStateStr()); processRemainingParticipants(*conf); } @@ -1541,7 +1576,7 @@ ManagerImpl::incomingCall(Call &call, const std::string& accountId) std::string from("<" + number + ">"); - client_.getCallManager()->incomingCall(accountId, callID, call.getDisplayName() + " " + from); + getCallManager()->incomingCall(accountId, callID, call.getDisplayName() + " " + from); } //THREAD=VoIP @@ -1572,10 +1607,10 @@ ManagerImpl::incomingMessage(const std::string& callID, } // in case of a conference we must notify client using conference id - client_.getCallManager()->incomingMessage(conf->getConfID(), from, message); + getCallManager()->incomingMessage(conf->getConfID(), from, message); } else - client_.getCallManager()->incomingMessage(callID, from, message); + getCallManager()->incomingMessage(callID, from, message); } //THREAD=VoIP @@ -1664,7 +1699,7 @@ ManagerImpl::peerAnsweredCall(Call& call) if (audioPreference.getIsAlwaysRecording()) toggleRecordingCall(call_id); - client_.getCallManager()->callStateChanged(call_id, "CURRENT"); + getCallManager()->callStateChanged(call_id, "CURRENT"); } //THREAD=VoIP Call=Outgoing @@ -1677,7 +1712,7 @@ ManagerImpl::peerRingingCall(Call& call) if (isCurrentCall(call)) ringback(); - client_.getCallManager()->callStateChanged(call_id, "RINGING"); + getCallManager()->callStateChanged(call_id, "RINGING"); } //THREAD=VoIP Call=Outgoing/Ingoing @@ -1698,7 +1733,7 @@ ManagerImpl::peerHungupCall(Call& call) call.peerHungup(); saveHistory(); - client_.getCallManager()->callStateChanged(call_id, "HUNGUP"); + getCallManager()->callStateChanged(call_id, "HUNGUP"); checkAudio(); removeWaitingCall(call_id); @@ -1714,7 +1749,7 @@ ManagerImpl::callBusy(Call& call) { const auto call_id = call.getCallId(); - client_.getCallManager()->callStateChanged(call_id, "BUSY"); + getCallManager()->callStateChanged(call_id, "BUSY"); if (isCurrentCall(call)) { playATone(Tone::TONE_BUSY); @@ -1731,7 +1766,7 @@ ManagerImpl::callFailure(Call& call) { const auto call_id = call.getCallId(); - client_.getCallManager()->callStateChanged(call_id, "FAILURE"); + getCallManager()->callStateChanged(call_id, "FAILURE"); if (isCurrentCall(call)) { playATone(Tone::TONE_BUSY); @@ -1753,7 +1788,7 @@ void ManagerImpl::startVoiceMessageNotification(const std::string& accountId, int nb_msg) { - client_.getCallManager()->voiceMailNotify(accountId, nb_msg); + getCallManager()->voiceMailNotify(accountId, nb_msg); } /** @@ -1800,7 +1835,7 @@ ManagerImpl::stopTone() if (audiofile_) { std::string filepath(audiofile_->getFilePath()); - client_.getCallManager()->recordPlaybackStopped(filepath); + getCallManager()->recordPlaybackStopped(filepath); audiofile_.reset(); } } @@ -1893,7 +1928,7 @@ ManagerImpl::playRingtone(const std::string& accountID) std::lock_guard<std::mutex> m(toneMutex_); if (audiofile_) { - client_.getCallManager()->recordPlaybackStopped(audiofile_->getFilePath()); + getCallManager()->recordPlaybackStopped(audiofile_->getFilePath()); audiofile_.reset(); } @@ -2112,8 +2147,8 @@ ManagerImpl::toggleRecordingCall(const std::string& id) } const bool result = rec->toggleRecording(); - client_.getCallManager()->recordPlaybackFilepath(id, rec->getFilename()); - client_.getCallManager()->recordingStateChanged(id, result); + getCallManager()->recordPlaybackFilepath(id, rec->getFilename()); + getCallManager()->recordingStateChanged(id, result); return result; } @@ -2145,7 +2180,7 @@ ManagerImpl::startRecordedFilePlayback(const std::string& filepath) std::lock_guard<std::mutex> m(toneMutex_); if (audiofile_) { - client_.getCallManager()->recordPlaybackStopped(audiofile_->getFilePath()); + getCallManager()->recordPlaybackStopped(audiofile_->getFilePath()); audiofile_.reset(); } @@ -2184,7 +2219,7 @@ void ManagerImpl::stopRecordedFilePlayback(const std::string& filepath) std::lock_guard<std::mutex> m(toneMutex_); audiofile_.reset(); } - client_.getCallManager()->recordPlaybackStopped(filepath); + getCallManager()->recordPlaybackStopped(filepath); } void ManagerImpl::setHistoryLimit(int days) @@ -2444,7 +2479,7 @@ ManagerImpl::setAccountDetails(const std::string& accountID, account->doUnregister(); // Update account details to the client side - client_.getConfigurationManager()->accountsChanged(); + getConfigurationManager()->accountsChanged(); }); } @@ -2489,7 +2524,7 @@ ManagerImpl::addAccount(const std::map<std::string, std::string>& details) saveConfig(); - client_.getConfigurationManager()->accountsChanged(); + getConfigurationManager()->accountsChanged(); return newAccountID; } @@ -2512,7 +2547,7 @@ void ManagerImpl::removeAccount(const std::string& accountID) saveConfig(); - client_.getConfigurationManager()->accountsChanged(); + getConfigurationManager()->accountsChanged(); } bool @@ -2710,7 +2745,7 @@ ManagerImpl::saveHistory() if (!history_.save()) RING_ERR("Could not save history!"); else - client_.getConfigurationManager()->historyChanged(); + getConfigurationManager()->historyChanged(); } void @@ -2782,20 +2817,6 @@ ManagerImpl::getAudioDriver() return audiodriver_; } -Client* -ManagerImpl::getClient() -{ - return &client_; -} - -#ifdef RING_VIDEO -VideoManager * -ManagerImpl::getVideoManager() -{ - return client_.getVideoManager(); -} -#endif - std::shared_ptr<Call> ManagerImpl::newOutgoingCall(const std::string& id, const std::string& toUrl, diff --git a/daemon/src/managerimpl.h b/daemon/src/managerimpl.h index 0371145f71..41e3daaa11 100644 --- a/daemon/src/managerimpl.h +++ b/daemon/src/managerimpl.h @@ -49,8 +49,6 @@ #include <random> #include <atomic> -#include "client/client.h" - #include "conference.h" #include "account_factory.h" @@ -75,6 +73,12 @@ class PluginManager; class AudioFile; class DTMF; class TelephoneTone; +class ConfigurationManager; +class PresenceManager; +class CallManager; +#ifdef RING_VIDEO +class VideoManager; +#endif /** To send multiple string */ typedef std::list<std::string> TokenList; @@ -97,6 +101,13 @@ class ManagerImpl { ManagerImpl(); ~ManagerImpl(); + std::unique_ptr<ConfigurationManager> configurationManager_; + std::unique_ptr<CallManager> callManager_; + std::unique_ptr<PresenceManager> presenceManager_; + +#ifdef RING_VIDEO + std::unique_ptr<VideoManager> videoManager_; +#endif /** * General preferences configuration */ @@ -784,8 +795,6 @@ class ManagerImpl { */ void playATone(Tone::TONEID toneId); - Client client_; - /** Current Call ID */ std::shared_ptr<Call> currentCall_ = nullptr; @@ -872,11 +881,10 @@ class ManagerImpl { */ bool hasCurrentCall() const; - /** - * Return the current Client - * @return A pointer to the Client instance - */ - Client* getClient(); + CallManager* getCallManager(); + ConfigurationManager* getConfigurationManager(); + PresenceManager* getPresenceManager(); + #ifdef RING_VIDEO VideoManager * getVideoManager(); #endif diff --git a/daemon/src/media/audio/alsa/alsalayer.cpp b/daemon/src/media/audio/alsa/alsalayer.cpp index e8c885aecd..698883a97c 100644 --- a/daemon/src/media/audio/alsa/alsalayer.cpp +++ b/daemon/src/media/audio/alsa/alsalayer.cpp @@ -103,18 +103,18 @@ void AlsaThread::initAudioLayer(void) alsa_->is_capture_open_ = alsa_->openDevice(&alsa_->captureHandle_, pcmc, SND_PCM_STREAM_CAPTURE); if (not alsa_->is_capture_open_) - Manager::instance().getClient()->getConfigurationManager()->errorAlert(ALSA_CAPTURE_DEVICE); + Manager::instance().getConfigurationManager()->errorAlert(ALSA_CAPTURE_DEVICE); } if (not alsa_->is_playback_open_) { alsa_->is_playback_open_ = alsa_->openDevice(&alsa_->playbackHandle_, pcmp, SND_PCM_STREAM_PLAYBACK); if (not alsa_->is_playback_open_) - Manager::instance().getClient()->getConfigurationManager()->errorAlert(ALSA_PLAYBACK_DEVICE); + Manager::instance().getConfigurationManager()->errorAlert(ALSA_PLAYBACK_DEVICE); if (alsa_->getIndexPlayback() != alsa_->getIndexRingtone()) if (!alsa_->openDevice(&alsa_->ringtoneHandle_, pcmr, SND_PCM_STREAM_PLAYBACK)) - Manager::instance().getClient()->getConfigurationManager()->errorAlert(ALSA_PLAYBACK_DEVICE); + Manager::instance().getConfigurationManager()->errorAlert(ALSA_PLAYBACK_DEVICE); } alsa_->hardwareFormatAvailable(alsa_->getFormat()); diff --git a/daemon/src/media/audio/opensl/opensllayer.cpp b/daemon/src/media/audio/opensl/opensllayer.cpp index 0275c131de..f915add1cd 100644 --- a/daemon/src/media/audio/opensl/opensllayer.cpp +++ b/daemon/src/media/audio/opensl/opensllayer.cpp @@ -115,7 +115,7 @@ OpenSLLayer::startStream() RING_DBG("Start OpenSL audio layer"); - std::vector<int32_t> hw_infos = Manager::instance().getClient()->getConfigurationManager()->getHardwareAudioFormat(); + std::vector<int32_t> hw_infos = Manager::instance().getConfigurationManager()->getHardwareAudioFormat(); hardwareFormat_ = AudioFormat(hw_infos[0], 1); // Mono on Android hardwareBuffSize_ = hw_infos[1]; diff --git a/daemon/src/media/audio/sound/audiofile.cpp b/daemon/src/media/audio/sound/audiofile.cpp index 0ab5bc9395..010d74b5b1 100644 --- a/daemon/src/media/audio/sound/audiofile.cpp +++ b/daemon/src/media/audio/sound/audiofile.cpp @@ -59,7 +59,7 @@ AudioFile::onBufferFinish() } if ((updatePlaybackScale_ % 5) == 0) { - CallManager *cm = Manager::instance().getClient()->getCallManager(); + CallManager *cm = Manager::instance().getCallManager(); cm->updatePlaybackScale(filepath_, pos_ / divisor, buffer_->frames() / divisor); } diff --git a/daemon/src/ring_api.cpp b/daemon/src/ring_api.cpp index dd6175b1fe..b1083dd363 100644 --- a/daemon/src/ring_api.cpp +++ b/daemon/src/ring_api.cpp @@ -50,23 +50,23 @@ static ring::CallManager* getCallManager() { - return ring::Manager::instance().getClient()->getCallManager(); + return ring::Manager::instance().getCallManager(); } static ring::ConfigurationManager* getConfigurationManager() { - return ring::Manager::instance().getClient()->getConfigurationManager(); + return ring::Manager::instance().getConfigurationManager(); } static ring::PresenceManager* getPresenceManager() { - return ring::Manager::instance().getClient()->getPresenceManager(); + return ring::Manager::instance().getPresenceManager(); } #ifdef RING_VIDEO static ring::VideoManager* getVideoManager() { - return ring::Manager::instance().getClient()->getVideoManager(); + return ring::Manager::instance().getVideoManager(); } #endif // RING_VIDEO diff --git a/daemon/src/sip/pres_sub_client.cpp b/daemon/src/sip/pres_sub_client.cpp index 8a85819cc7..6f60e3d132 100644 --- a/daemon/src/sip/pres_sub_client.cpp +++ b/daemon/src/sip/pres_sub_client.cpp @@ -92,7 +92,7 @@ PresSubClient::pres_client_evsub_on_state(pjsip_evsub *sub, pjsip_event *event) if (state == PJSIP_EVSUB_STATE_ACCEPTED) { pres_client->enable(true); - Manager::instance().getClient()->getPresenceManager()->subscriptionStateChanged( + Manager::instance().getPresenceManager()->subscriptionStateChanged( pres->getAccount()->getAccountID(), pres_client->getURI().c_str(), PJ_TRUE); @@ -103,7 +103,7 @@ PresSubClient::pres_client_evsub_on_state(pjsip_evsub *sub, pjsip_event *event) int resub_delay = -1; pj_strdup_with_null(pres_client->pool_, &pres_client->term_reason_, pjsip_evsub_get_termination_reason(sub)); - Manager::instance().getClient()->getPresenceManager()->subscriptionStateChanged( + Manager::instance().getPresenceManager()->subscriptionStateChanged( pres->getAccount()->getAccountID(), pres_client->getURI().c_str(), PJ_FALSE); @@ -162,7 +162,7 @@ PresSubClient::pres_client_evsub_on_state(pjsip_evsub *sub, pjsip_event *event) * 2) change the support field in the account schema if the pres_sub's server * is the same as the account's server */ - Manager::instance().getClient()->getPresenceManager()->serverError( + Manager::instance().getPresenceManager()->serverError( pres_client->getPresence()->getAccount()->getAccountID(), error, msg); diff --git a/daemon/src/sip/pres_sub_server.cpp b/daemon/src/sip/pres_sub_server.cpp index 85a0cbf82f..3908be50e9 100644 --- a/daemon/src/sip/pres_sub_server.cpp +++ b/daemon/src/sip/pres_sub_server.cpp @@ -188,7 +188,7 @@ PresSubServer::pres_on_rx_subscribe_request(pjsip_rx_data *rdata) PresSubServer *presSubServer = new PresSubServer(pres, sub, remote, dlg); pjsip_evsub_set_mod_data(sub, pres->getModId(), presSubServer); // Notify the client. - Manager::instance().getClient()->getPresenceManager()->newServerSubscriptionRequest(presSubServer->remote_); + Manager::instance().getPresenceManager()->newServerSubscriptionRequest(presSubServer->remote_); pres->addPresSubServer(presSubServer); diff --git a/daemon/src/sip/sipaccount.cpp b/daemon/src/sip/sipaccount.cpp index 185684af8e..94406e7b49 100644 --- a/daemon/src/sip/sipaccount.cpp +++ b/daemon/src/sip/sipaccount.cpp @@ -1109,8 +1109,8 @@ SIPAccount::onRegister(pjsip_regc_cbparam *param) if (param->code && description) { std::string state(description->ptr, description->slen); - Manager::instance().getClient()->getConfigurationManager()->sipRegistrationStateChanged(getAccountID(), state, param->code); - Manager::instance().getClient()->getConfigurationManager()->volatileAccountDetailsChanged(accountID_, getVolatileAccountDetails()); + Manager::instance().getConfigurationManager()->sipRegistrationStateChanged(getAccountID(), state, param->code); + Manager::instance().getConfigurationManager()->volatileAccountDetailsChanged(accountID_, getVolatileAccountDetails()); std::pair<int, std::string> details(param->code, state); // TODO: there id a race condition for this ressource when closing the application setRegistrationStateDetailed(details); @@ -1818,7 +1818,7 @@ SIPAccount::supportPresence(int function, bool enabled) enablePresence(false); Manager::instance().saveConfig(); - Manager::instance().getClient()->getConfigurationManager()->accountsChanged(); + Manager::instance().getConfigurationManager()->accountsChanged(); } MatchRank diff --git a/daemon/src/sip/sipaccountbase.cpp b/daemon/src/sip/sipaccountbase.cpp index 4670d0a69c..868ae10c9c 100644 --- a/daemon/src/sip/sipaccountbase.cpp +++ b/daemon/src/sip/sipaccountbase.cpp @@ -277,7 +277,7 @@ SIPAccountBase::onTransportStateChanged(pjsip_transport_state state, const pjsip // Notify the client of the new transport state if (currentStatus != transportStatus_) - Manager::instance().getClient()->getConfigurationManager()->volatileAccountDetailsChanged(accountID_, getVolatileAccountDetails()); + Manager::instance().getConfigurationManager()->volatileAccountDetailsChanged(accountID_, getVolatileAccountDetails()); } void diff --git a/daemon/src/sip/sipcall.cpp b/daemon/src/sip/sipcall.cpp index c87fee60fa..bc77448987 100644 --- a/daemon/src/sip/sipcall.cpp +++ b/daemon/src/sip/sipcall.cpp @@ -63,7 +63,7 @@ namespace ring { static video::VideoSettings getSettings() { - const auto videoman = Manager::instance().getClient()->getVideoManager(); + const auto videoman = Manager::instance().getVideoManager(); return videoman->getSettings(videoman->getDefaultDevice()); } #endif diff --git a/daemon/src/sip/sippresence.cpp b/daemon/src/sip/sippresence.cpp index 2f361e8f91..222ed6e4fe 100644 --- a/daemon/src/sip/sippresence.cpp +++ b/daemon/src/sip/sippresence.cpp @@ -35,7 +35,6 @@ #include <sstream> #include "logger.h" #include "manager.h" -#include "client/client.h" #include "client/presencemanager.h" #include "client/configurationmanager.h" #include "sipaccount.h" @@ -206,7 +205,7 @@ void SIPPresence::reportPresSubClientNotification(const std::string& uri, pjsip_ note_ = note; } // report status to client signal - Manager::instance().getClient()->getPresenceManager()->newBuddyNotification(acc_ID, uri, status->info[0].basic_open, note); + Manager::instance().getPresenceManager()->newBuddyNotification(acc_ID, uri, status->info[0].basic_open, note); } void SIPPresence::subscribeClient(const std::string& uri, bool flag) @@ -382,7 +381,7 @@ SIPPresence::publish_cb(struct pjsip_publishc_cbparam *param) char errmsg[PJ_ERR_MSG_SIZE]; pj_strerror(param->status, errmsg, sizeof(errmsg)); RING_ERR("Client (PUBLISH) failed, status=%d, msg=%s", param->status, errmsg); - Manager::instance().getClient()->getPresenceManager()->serverError( + Manager::instance().getPresenceManager()->serverError( pres->getAccount()->getAccountID(), error, errmsg); @@ -396,7 +395,7 @@ SIPPresence::publish_cb(struct pjsip_publishc_cbparam *param) } else if ((param->code == PJSIP_SC_BAD_EVENT) || (param->code == PJSIP_SC_NOT_IMPLEMENTED)){ //489 or 501 RING_WARN("Client (PUBLISH) failed (%s)",error.c_str()); - Manager::instance().getClient()->getPresenceManager()->serverError( + Manager::instance().getPresenceManager()->serverError( pres->getAccount()->getAccountID(), error, "Publish not supported."); diff --git a/daemon/src/sip/sipvoiplink.cpp b/daemon/src/sip/sipvoiplink.cpp index a1863fed6b..3f7c8e40bb 100644 --- a/daemon/src/sip/sipvoiplink.cpp +++ b/daemon/src/sip/sipvoiplink.cpp @@ -62,7 +62,6 @@ #include "client/videomanager.h" #endif -#include "client/client.h" #include "client/callmanager.h" #include "client/configurationmanager.h" @@ -819,7 +818,7 @@ invite_session_state_changed_cb(pjsip_inv_session *inv, pjsip_event *ev) const pj_str_t * description = pjsip_get_status_text(statusCode); std::string desc(description->ptr, description->slen); - CallManager *cm = Manager::instance().getClient()->getCallManager(); + CallManager *cm = Manager::instance().getCallManager(); cm->sipCallStateChanged(call->getCallId(), desc, statusCode); } } diff --git a/daemon/test/accounttest.cpp b/daemon/test/accounttest.cpp index cc1a6d088b..39f7a27bdf 100644 --- a/daemon/test/accounttest.cpp +++ b/daemon/test/accounttest.cpp @@ -43,7 +43,7 @@ void AccountTest::TestAddRemove() { RING_DBG("-------------------- %s --------------------\n", __PRETTY_FUNCTION__); - std::map<std::string, std::string> details(Manager::instance().getClient()->getConfigurationManager()->getAccountTemplate()); + std::map<std::string, std::string> details(Manager::instance().getConfigurationManager()->getAccountTemplate()); details[Conf::CONFIG_ACCOUNT_TYPE] = "SIP"; details[Conf::CONFIG_ACCOUNT_ENABLE] = "false"; details[Conf::CONFIG_LOCAL_INTERFACE] = "default"; -- GitLab