Commit b51a4e98 authored by Pierre-Luc Beaudoin's avatar Pierre-Luc Beaudoin
Browse files

getAccountList works

parent b2474a95
......@@ -6,6 +6,7 @@ noinst_LTLIBRARIES = libdbus.la
libdbus_la_SOURCES = \
callmanager.cpp \
configurationmanager.cpp \
dbusmanagerimpl.cpp
libdbus_la_CXXFLAGS = -DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone\"
......@@ -15,5 +16,6 @@ libdbus_la_LIBADD =
noinst_HEADERS = \
callmanager-glue.h \
callmanager.h \
configurationmanager.h \
dbusmanager.h \
dbusmanagerimpl.h
......@@ -16,8 +16,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <global.h>
#include <callmanager.h>
#include "../manager.h"
const char* CallManager::SERVER_PATH = "/org/sflphone/SFLPhone/CallManager";
......@@ -32,27 +33,28 @@ CallManager::placeCall( const ::DBus::String& accountID,
const ::DBus::String& to )
{
_debug("CallManager::placeCall received\n");
Manager::instance().outgoingCall(accountID, callID, to);
}
void
CallManager::refuse( const ::DBus::String& callID )
{
_debug("CallManager::refuse received\n");
Manager::instance().refuseCall(callID);
}
void
CallManager::accept( const ::DBus::String& callID )
{
_debug("CallManager::accept received\n");
Manager::instance().answerCall(callID);
}
void
CallManager::hangUp( const ::DBus::String& callID )
{
_debug("CallManager::hangUp received\n");
Manager::instance().hangupCall(callID);
}
......@@ -60,34 +62,39 @@ void
CallManager::hold( const ::DBus::String& callID )
{
_debug("CallManager::hold received\n");
Manager::instance().onHoldCall(callID);
}
void
CallManager::unhold( const ::DBus::String& callID )
{
_debug("CallManager::unhold received\n");
Manager::instance().offHoldCall(callID);
}
void
CallManager::transfert( const ::DBus::String& callID, const ::DBus::String& to )
{
_debug("CallManager::transfert received\n");
Manager::instance().transferCall(callID, to);
}
void
CallManager::setVolume( const ::DBus::String& device, const ::DBus::Double & value )
{
_debug("CallManager::setVolume received\n");
//TODO
Manager::instance().setSpkrVolume(value);
Manager::instance().setMicVolume(value);
}
::DBus::Double
CallManager::getVolume( const ::DBus::String& device )
{
_debug("CallManager::getVolume received\n");
//TODO
Manager::instance().getSpkrVolume();
Manager::instance().getMicVolume();
return 0;
}
......
......@@ -21,7 +21,6 @@
#define CALLMANAGER_H
#include "callmanager-glue.h"
#include "../gui/guiframework.h"
#include <dbus-c++/dbus.h>
......
/*
* Copyright (C) 2007 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <global.h>
#include <configurationmanager.h>
#include "../manager.h"
const char* ConfigurationManager::SERVER_PATH = "/org/sflphone/SFLPhone/ConfigurationManager";
ConfigurationManager::ConfigurationManager( DBus::Connection& connection )
: DBus::ObjectAdaptor(connection, SERVER_PATH)
{
}
std::map< ::DBus::String, ::DBus::String >
ConfigurationManager::getAccountDetails( const ::DBus::String& accountID )
{
_debug("ConfigurationManager::getAccountDetails received\n");
}
void
ConfigurationManager::addAccount( const std::map< ::DBus::String, ::DBus::String >& details )
{
_debug("ConfigurationManager::addAccount received\n");
}
std::vector< ::DBus::String >
ConfigurationManager::getAccountList( )
{
_debug("ConfigurationManager::getAccountList received\n");
return Manager::instance().getAccountList();
}
void
ConfigurationManager::setSTUN( const std::map< ::DBus::String, ::DBus::String >& details )
{
_debug("ConfigurationManager::setSTUN received\n");
}
std::map< ::DBus::String, ::DBus::String >
ConfigurationManager::getSTUN( )
{
_debug("ConfigurationManager::getSTUN received\n");
}
void
ConfigurationManager::setPlayTonesLocally( const ::DBus::Bool& flag )
{
_debug("ConfigurationManager::setPlayTonesLocally received\n");
}
::DBus::Bool
ConfigurationManager::getPlayTonesLocally( )
{
_debug("ConfigurationManager::getPlayTonesLocally received\n");
}
void
ConfigurationManager::setTonePulseLenght( const ::DBus::Int32& milliseconds )
{
_debug("ConfigurationManager::setTonePulseLenght received\n");
}
::DBus::Int32
ConfigurationManager::getTonePulseLenght( )
{
_debug("ConfigurationManager::getTonePulseLenght received\n");
}
void
ConfigurationManager::getToneLocaleList( const std::vector< ::DBus::String >& list )
{
_debug("ConfigurationManager::getToneLocaleList received\n");
}
void
ConfigurationManager::setToneLocale( const ::DBus::String& locale )
{
_debug("ConfigurationManager::setToneLocale received\n");
}
::DBus::String
ConfigurationManager::getToneLocale( )
{
_debug("ConfigurationManager::getToneLocale received\n");
}
::DBus::String
ConfigurationManager::getVersion( )
{
_debug("ConfigurationManager::getVersion received\n");
}
std::vector< ::DBus::String >
ConfigurationManager::getRingtoneList( )
{
_debug("ConfigurationManager::getRingtoneList received\n");
}
void
ConfigurationManager::setRingtone( const ::DBus::String& ringtone )
{
_debug("ConfigurationManager::setRingtone received\n");
}
::DBus::String
ConfigurationManager::getRingtone( )
{
_debug("ConfigurationManager::getRingtone received\n");
}
std::vector< ::DBus::String >
ConfigurationManager::getCodecList( )
{
_debug("ConfigurationManager::getCodecList received\n");
}
void
ConfigurationManager::setCodecPreferedOrder( const std::vector< ::DBus::String >& ringtone )
{
_debug("ConfigurationManager::setCodecPreferedOrder received\n");
}
std::vector< ::DBus::String >
ConfigurationManager::getCodecPreferedOrder( )
{
_debug("ConfigurationManager::getCodecPreferedOrder received\n");
}
std::vector< ::DBus::String >
ConfigurationManager::getPlaybackDeviceList( )
{
_debug("ConfigurationManager::getPlaybackDeviceList received\n");
}
void
ConfigurationManager::setPlaybackDevice( const ::DBus::String& device )
{
_debug("ConfigurationManager::setPlaybackDevice received\n");
}
::DBus::String
ConfigurationManager::getPlaybackDevice( )
{
_debug("ConfigurationManager::getPlaybackDevice received\n");
}
std::vector< ::DBus::String >
ConfigurationManager::getRecordDeviceList( )
{
_debug("ConfigurationManager::getRecordDeviceList received\n");
}
void
ConfigurationManager::setRecordDevice( const ::DBus::String& device )
{
_debug("ConfigurationManager::setRecordDevice received\n");
}
::DBus::String
ConfigurationManager::getRecordDevice( )
{
_debug("ConfigurationManager::getRecordDevice received\n");
}
std::vector< ::DBus::String >
ConfigurationManager::getSampleRateList( )
{
_debug("ConfigurationManager::getSampleRateList received\n");
}
void
ConfigurationManager::setSampleRate( const ::DBus::String& sampleRate )
{
_debug("ConfigurationManager::setSampleRate received\n");
}
::DBus::String
ConfigurationManager::getSampleRate( )
{
_debug("ConfigurationManager::getSampleRate received\n");
}
/*
* Copyright (C) 2007 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef CONFIGURATIONMANAGER_H
#define CONFIGURATIONMANAGER_H
#include "configurationmanager-glue.h"
#include <dbus-c++/dbus.h>
class ConfigurationManager
: public org::sflphone::SFLPhone::ConfigurationManager,
public DBus::IntrospectableAdaptor,
public DBus::ObjectAdaptor
{
public:
ConfigurationManager(DBus::Connection& connection);
static const char* SERVER_PATH;
public:
std::map< ::DBus::String, ::DBus::String > getAccountDetails( const ::DBus::String& accountID );
void addAccount( const std::map< ::DBus::String, ::DBus::String >& details );
std::vector< ::DBus::String > getAccountList( );
void setSTUN( const std::map< ::DBus::String, ::DBus::String >& details );
std::map< ::DBus::String, ::DBus::String > getSTUN( );
void setPlayTonesLocally( const ::DBus::Bool& flag );
::DBus::Bool getPlayTonesLocally( );
void setTonePulseLenght( const ::DBus::Int32& milliseconds );
::DBus::Int32 getTonePulseLenght( );
void getToneLocaleList( const std::vector< ::DBus::String >& list );
void setToneLocale( const ::DBus::String& locale );
::DBus::String getToneLocale( );
::DBus::String getVersion( );
std::vector< ::DBus::String > getRingtoneList( );
void setRingtone( const ::DBus::String& ringtone );
::DBus::String getRingtone( );
std::vector< ::DBus::String > getCodecList( );
void setCodecPreferedOrder( const std::vector< ::DBus::String >& ringtone );
std::vector< ::DBus::String > getCodecPreferedOrder( );
std::vector< ::DBus::String > getPlaybackDeviceList( );
void setPlaybackDevice( const ::DBus::String& device );
::DBus::String getPlaybackDevice( );
std::vector< ::DBus::String > getRecordDeviceList( );
void setRecordDevice( const ::DBus::String& device );
::DBus::String getRecordDevice( );
std::vector< ::DBus::String > getSampleRateList( );
void setSampleRate( const ::DBus::String& sampleRate );
::DBus::String getSampleRate( );
};
#endif//CONFIGURATIONMANAGER_H
......@@ -24,21 +24,21 @@ const char* DBusManagerImpl::SERVER_NAME = "org.sflphone.SFLPhone";
int
DBusManagerImpl::exec(){
DBus::default_dispatcher = &_dispatcher;
DBus::default_dispatcher = &_dispatcher;
DBus::Connection conn = DBus::Connection::SessionBus();
conn.request_name(SERVER_NAME);
DBus::Connection conn = DBus::Connection::SessionBus();
conn.request_name(SERVER_NAME);
_callManager = new CallManager(conn);
_configurationManager = new ConfigurationManager(conn);
_callManager = new CallManager(conn);
//_configurationManager = new ConfigurationManager(conn);
Manager::instance().getEvents(); // Register accounts
_debug("Starting DBus event loop\n");
_dispatcher.enter();
_dispatcher.enter();
return 1;
return 1;
}
......@@ -21,6 +21,7 @@
#define __DBUSMANAGERIMPL_H__
#include "callmanager.h"
#include "configurationmanager.h"
class DBusManagerImpl {
public:
......@@ -30,6 +31,7 @@ class DBusManagerImpl {
private:
CallManager * _callManager;
ConfigurationManager * _configurationManager;
DBus::BusDispatcher _dispatcher;
};
......
......@@ -178,7 +178,8 @@ GuiFramework::getCallStatus(const std::string& sequenceId)
bool
GuiFramework::getAccountList(const std::string& sequenceId)
{
return Manager::instance().getAccountList(sequenceId);
Manager::instance().getAccountList( );
return true;
}
const CallID&
GuiFramework::getCurrentId()
......
......@@ -1494,36 +1494,22 @@ ManagerImpl::getDirListing(const std::string& sequenceId, const std::string& pat
}
}
bool
ManagerImpl::getAccountList(const std::string& sequenceId)
std::vector< std::string >
ManagerImpl::getAccountList()
{
bool oneActive = false;
TokenList tk;
std::vector< std::string > v;
AccountMap::iterator iter = _accountMap.begin();
while ( iter != _accountMap.end() ) {
if ( iter->second != 0 ) {
_debug("Account List: %s\n", iter->first.data());
tk.push_back(iter->first);
// we try to send one active account for default account on start
// this is not the way it should be...
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);
oneActive = true;
} else {
tk.push_back("Inactive");
tk.push_back(getConfigString(iter->first,CONFIG_ACCOUNT_ALIAS));
//_gui->sendMessage("131", sequenceId, tk);
}
tk.clear();
v.push_back(iter->first.data());
}
iter++;
}
return oneActive;
_debug("Size: %d\n", v.size());
return v;
}
//THREAD=Main
......
......@@ -188,10 +188,10 @@ public:
bool detachZeroconfEvents(Pattern::Observer& observer);
bool getCallStatus(const std::string& sequenceId);
/**
* Get account list and status
* @param return true if there is atleast one active
* Get account list
* @return A list of accoundIDs
*/
bool getAccountList(const std::string& sequenceId);
std::vector< std::string > getAccountList();
bool getConfigAll(const std::string& sequenceId);
bool getConfig(const std::string& section, const std::string& name, TokenList& arg);
bool setConfig(const std::string& section, const std::string& name, const std::string& value);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment