configurationmanager.cpp 10.7 KB
Newer Older
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
1 2
/*
 *  Copyright (C) 2007 Savoir-Faire Linux inc.
3
 *  Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
4
 *  Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
5
 *  Author: Guillaume Carmel-Archambault <guillaume.carmel-archambault@savoirfairelinux.com>
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
6 7 8
 *                                                                              
 *  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
9
 *  the Free Software Foundation; either version 3 of the License, or
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
10 11 12 13 14 15 16 17 18 19 20
 *  (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.
 */
21

Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
22 23
#include <global.h>
#include <configurationmanager.h>
24
#include <sstream>
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
25 26
#include "../manager.h"

27
const char* ConfigurationManager::SERVER_PATH = "/org/sflphone/SFLphone/ConfigurationManager";
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
28 29 30



31
	ConfigurationManager::ConfigurationManager( DBus::Connection& connection )
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
32 33 34 35
: DBus::ObjectAdaptor(connection, SERVER_PATH)
{
}

36 37
	std::map< std::string, std::string > 
ConfigurationManager::getAccountDetails( const std::string& accountID )
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
38
{
39
	return Manager::instance().getAccountDetails(accountID);
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
40 41
}

42
	void 
43 44
ConfigurationManager::setAccountDetails( const std::string& accountID, 
		const std::map< std::string, std::string >& details )
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
45
{
46 47
	_debug("ConfigurationManager::setAccountDetails received\n");
	Manager::instance().setAccountDetails(accountID, details);
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
48 49
}

50
	void 
51
ConfigurationManager::sendRegister( const std::string& accountID, const int32_t& expire )
52 53 54 55
{
	Manager::instance().sendRegister(accountID, expire);
}

56
	void 
57
ConfigurationManager::addAccount( const std::map< std::string, std::string >& details )
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
58
{
59 60
	_debug("ConfigurationManager::addAccount received\n");
	Manager::instance().addAccount(details);
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
61 62 63
}


64
	void 
65
ConfigurationManager::removeAccount( const std::string& accoundID )
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
66
{
67 68
	_debug("ConfigurationManager::removeAccount received\n");
	return Manager::instance().removeAccount(accoundID);
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
69 70
}

71
std::vector< std::string > 
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
72
ConfigurationManager::getAccountList(  )
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
73
{
74 75
	_debug("ConfigurationManager::getAccountList received\n");
	return Manager::instance().getAccountList();
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
76 77 78
}


79
std::vector< std::string > 
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
80
ConfigurationManager::getToneLocaleList(  )
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
81
{
82
        std::vector< std::string > ret;
83
	_debug("ConfigurationManager::getToneLocaleList received\n");
84
        return ret;
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
85 86 87 88
}



89
	std::string 
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
90 91
ConfigurationManager::getVersion(  )
{
92
        std::string ret("");
93
	_debug("ConfigurationManager::getVersion received\n");
94
        return ret;
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
95 96 97 98

}


99
	std::vector< std::string > 
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
100 101
ConfigurationManager::getRingtoneList(  )
{
102
	std::vector< std::string >  ret;
103
	_debug("ConfigurationManager::getRingtoneList received\n");
104
        return ret;
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
105 106 107 108
}



109
	std::vector< std::string  > 
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
110 111
ConfigurationManager::getCodecList(  )
{
112
	_debug("ConfigurationManager::getCodecList received\n");
113
	return Manager::instance().getCodecList();
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
114 115
}

116 117
	std::vector< std::string > 
ConfigurationManager::getCodecDetails( const int32_t& payload )
118 119 120 121 122
{
	_debug("ConfigurationManager::getCodecList received\n");
	return Manager::instance().getCodecDetails( payload );
}

123
	std::vector< std::string > 
124
ConfigurationManager::getActiveCodecList(  )
125
{
126 127
	_debug("ConfigurationManager::getActiveCodecList received\n");
	return Manager::instance().getActiveCodecList();
128
}
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
129

130
void 
131
ConfigurationManager::setActiveCodecList( const std::vector< std::string >& list )
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
132
{
133 134
	_debug("ConfigurationManager::setActiveCodecList received\n");
	 Manager::instance().setActiveCodecList(list);
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
135 136
}

137
// Audio devices related methods
138
  std::vector< std::string >
139
ConfigurationManager::getInputAudioPluginList()
140
{
141 142
	_debug("ConfigurationManager::getInputAudioPluginList received\n");
	return Manager::instance().getInputAudioPluginList();
143
}
144

145
  std::vector< std::string >
146
ConfigurationManager::getOutputAudioPluginList()
147
{
148 149
	_debug("ConfigurationManager::getOutputAudioPluginList received\n");
	return Manager::instance().getOutputAudioPluginList();
150
}
151 152

  void
153
ConfigurationManager::setInputAudioPlugin(const std::string& audioPlugin)
154 155 156 157 158 159
{
	_debug("ConfigurationManager::setInputAudioPlugin received\n");
	return Manager::instance().setInputAudioPlugin(audioPlugin);
}

  void
160
ConfigurationManager::setOutputAudioPlugin(const std::string& audioPlugin)
161 162 163 164 165
{
	_debug("ConfigurationManager::setOutputAudioPlugin received\n");
	return Manager::instance().setOutputAudioPlugin(audioPlugin);
}

166
  std::vector< std::string >
167 168 169 170 171 172
ConfigurationManager::getAudioOutputDeviceList()
{
	_debug("ConfigurationManager::getAudioOutputDeviceList received\n");
	return Manager::instance().getAudioOutputDeviceList();
}
void
173
ConfigurationManager::setAudioOutputDevice(const int32_t& index)
174 175 176 177
{
	_debug("ConfigurationManager::setAudioOutputDevice received\n");
	return Manager::instance().setAudioOutputDevice(index);
}
178
std::vector< std::string >
179 180 181 182 183 184
ConfigurationManager::getAudioInputDeviceList()
{
	_debug("ConfigurationManager::getAudioInputDeviceList received\n");
	return Manager::instance().getAudioInputDeviceList();
}
void
185
ConfigurationManager::setAudioInputDevice(const int32_t& index)
186 187 188 189
{
	_debug("ConfigurationManager::setAudioInputDevice received\n");
	return Manager::instance().setAudioInputDevice(index);
}
190
std::vector< std::string >
191 192 193 194 195
ConfigurationManager::getCurrentAudioDevicesIndex()
{
	_debug("ConfigurationManager::getCurrentAudioDeviceIndex received\n");
	return Manager::instance().getCurrentAudioDevicesIndex();
}
196 197
 int32_t
ConfigurationManager::getAudioDeviceIndex(const std::string& name)
198
{
199 200
	_debug("ConfigurationManager::getAudioDeviceIndex received\n");
	return Manager::instance().getAudioDeviceIndex(name);
201 202
}

203
std::string 
204 205 206 207 208 209
ConfigurationManager::getCurrentAudioOutputPlugin( void )
{
   _debug("ConfigurationManager::getCurrentAudioOutputPlugin received\n");
   return Manager::instance().getCurrentAudioOutputPlugin();
}

210

211
	std::vector< std::string > 
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
212 213
ConfigurationManager::getPlaybackDeviceList(  )
{
214
	std::vector< std::string >  ret;
215
	_debug("ConfigurationManager::getPlaybackDeviceList received\n");
216
        return ret;
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
217 218
}

219
	std::vector< std::string > 
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
220 221
ConfigurationManager::getRecordDeviceList(  )
{
222
	std::vector< std::string >  ret;
223
	_debug("ConfigurationManager::getRecordDeviceList received\n");
224
        return ret;
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
225 226

}
Emmanuel Milou's avatar
Emmanuel Milou committed
227

228
int32_t
Emmanuel Milou's avatar
Emmanuel Milou committed
229 230 231 232
ConfigurationManager::isIax2Enabled( void )
{
  return Manager::instance().isIax2Enabled(  ); 
}
233 234 235 236 237 238 239

void
ConfigurationManager::ringtoneEnabled( void )
{
  Manager::instance().ringtoneEnabled(  ); 
}

240
int32_t
241 242 243 244
ConfigurationManager::isRingtoneEnabled( void )
{
  return Manager::instance().isRingtoneEnabled(  ); 
}
245

246
std::string
247 248 249 250 251 252
ConfigurationManager::getRingtoneChoice( void )
{
  return Manager::instance().getRingtoneChoice(  ); 
}

void
253
ConfigurationManager::setRingtoneChoice( const std::string& tone )
254 255 256 257
{
  Manager::instance().setRingtoneChoice( tone ); 
}

258 259 260 261 262 263 264 265 266 267 268 269
std::string
ConfigurationManager::getRecordPath( void )
{
  return Manager::instance().getRecordPath( );
}

void
ConfigurationManager::setRecordPath( const std::string& recPath)
{
  Manager::instance().setRecordPath( recPath );
}

270
int32_t
Emmanuel Milou's avatar
Emmanuel Milou committed
271 272 273 274 275 276 277 278 279 280 281
ConfigurationManager::getDialpad( void )
{
  return Manager::instance().getDialpad(  ); 
}

void
ConfigurationManager::setDialpad( void )
{
  Manager::instance().setDialpad( ); 
}

282
int32_t
283 284 285 286 287 288 289 290 291 292 293
ConfigurationManager::getSearchbar( void )
{
  return Manager::instance().getSearchbar(  ); 
}

void
ConfigurationManager::setSearchbar( void )
{
  Manager::instance().setSearchbar( ); 
}

294
int32_t
295 296 297 298 299 300 301 302 303 304 305
ConfigurationManager::getVolumeControls( void )
{
  return Manager::instance().getVolumeControls(  ); 
}

void
ConfigurationManager::setVolumeControls( void )
{
  Manager::instance().setVolumeControls( ); 
}

306
int32_t
307 308 309 310 311 312
ConfigurationManager::getMaxCalls( void )
{
  return Manager::instance().getMaxCalls(  ); 
}

void
313
ConfigurationManager::setMaxCalls( const int32_t& calls )
314 315 316 317
{
  Manager::instance().setMaxCalls( calls ); 
}

Emmanuel Milou's avatar
Emmanuel Milou committed
318 319 320 321 322 323
void
ConfigurationManager::startHidden( void )
{
  Manager::instance().startHidden(  ); 
}

324
int32_t
Emmanuel Milou's avatar
Emmanuel Milou committed
325 326 327 328 329
ConfigurationManager::isStartHidden( void )
{
  return Manager::instance().isStartHidden(  ); 
}

330 331 332 333 334 335
void
ConfigurationManager::switchPopupMode( void )
{
  Manager::instance().switchPopupMode(  ); 
}

336
int32_t
337 338 339 340 341
ConfigurationManager::popupMode( void )
{
  return Manager::instance().popupMode(  ); 
}

342 343 344 345 346 347
void
ConfigurationManager::setNotify( void )
{
  _debug("Manager received setNotify\n");
  Manager::instance().setNotify( ); 
}
348

349
int32_t
350 351 352 353 354
ConfigurationManager::getNotify( void )
{
  _debug("Manager received getNotify\n");
  return Manager::instance().getNotify(  ); 
}
Emmanuel Milou's avatar
Emmanuel Milou committed
355

356
void
357
ConfigurationManager::setAudioManager( const int32_t& api )
358 359 360 361 362
{
  _debug("Manager received setAudioManager\n");
  Manager::instance().setAudioManager( api ); 
}

363
int32_t
364 365 366 367 368 369
ConfigurationManager::getAudioManager( void )
{
  _debug("Manager received getAudioManager\n");
  return Manager::instance().getAudioManager(  ); 
}

370 371 372 373 374 375 376
void
ConfigurationManager::setMailNotify( void )
{
  _debug("Manager received setMailNotify\n");
  Manager::instance().setMailNotify( ); 
}

377
int32_t
378 379 380 381 382
ConfigurationManager::getMailNotify( void )
{
  _debug("Manager received getMailNotify\n");
  return Manager::instance().getMailNotify(  ); 
}
383

384
int32_t 
385 386 387 388 389 390 391 392 393 394 395
ConfigurationManager::getPulseAppVolumeControl( void )
{
  return Manager::instance().getPulseAppVolumeControl();
}
    
void 
ConfigurationManager::setPulseAppVolumeControl( void )
{
  Manager::instance().setPulseAppVolumeControl();
}

396 397 398 399 400 401 402 403 404 405 406 407 408
int32_t 
ConfigurationManager::getSipPort( void )
{
  return Manager::instance().getSipPort();
}
 
void 
ConfigurationManager::setSipPort( const int32_t& portNum )
{
  _debug("Manager received setSipPort: %d\n", portNum);
  Manager::instance().setSipPort(portNum);
}

Emmanuel Milou's avatar
Emmanuel Milou committed
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427
std::string ConfigurationManager::getStunServer( void )
{
    return Manager::instance().getStunServer();
}
    
void ConfigurationManager::setStunServer( const std::string& server )
{
    Manager::instance().setStunServer( server );
}

void ConfigurationManager::enableStun (void)
{
    Manager::instance().enableStun();
}

int32_t ConfigurationManager::isStunEnabled (void)
{
    return Manager::instance().isStunEnabled();
}
428 429 430 431

std::map<std::string, int32_t> ConfigurationManager::getAddressbookSettings (void) {
    return Manager::instance().getAddressbookSettings ();
}
432 433 434 435

void ConfigurationManager::setAddressbookSettings (const std::map<std::string, int32_t>& settings) {
    Manager::instance().setAddressbookSettings (settings);
}