dbusconfigurationmanager.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. /*
  2. * Copyright (C) 2004-2017 Savoir-faire Linux Inc.
  3. *
  4. * Author: Philippe Proulx <philippe.proulx@savoirfairelinux.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19. */
  20. #ifdef HAVE_CONFIG_H
  21. #include "config.h"
  22. #endif
  23. #include "dbusconfigurationmanager.h"
  24. #include "configurationmanager_interface.h"
  25. #include "media/audio/audiolayer.h"
  26. DBusConfigurationManager::DBusConfigurationManager(DBus::Connection& connection)
  27. : DBus::ObjectAdaptor(connection, "/cx/ring/Ring/ConfigurationManager")
  28. {}
  29. auto
  30. DBusConfigurationManager::getAccountDetails(const std::string& accountID) -> decltype(DRing::getAccountDetails(accountID))
  31. {
  32. return DRing::getAccountDetails(accountID);
  33. }
  34. auto
  35. DBusConfigurationManager::getVolatileAccountDetails(const std::string& accountID) -> decltype(DRing::getVolatileAccountDetails(accountID))
  36. {
  37. return DRing::getVolatileAccountDetails(accountID);
  38. }
  39. void
  40. DBusConfigurationManager::setAccountDetails(const std::string& accountID, const std::map<std::string, std::string>& details)
  41. {
  42. DRing::setAccountDetails(accountID, details);
  43. }
  44. auto
  45. DBusConfigurationManager::testAccountICEInitialization(const std::string& accountID) -> decltype(DRing::testAccountICEInitialization(accountID))
  46. {
  47. return DRing::testAccountICEInitialization(accountID);
  48. }
  49. void
  50. DBusConfigurationManager::setAccountActive(const std::string& accountID, const bool& active)
  51. {
  52. DRing::setAccountActive(accountID, active);
  53. }
  54. auto
  55. DBusConfigurationManager::getAccountTemplate(const std::string& accountType) -> decltype(DRing::getAccountTemplate(accountType))
  56. {
  57. return DRing::getAccountTemplate(accountType);
  58. }
  59. auto
  60. DBusConfigurationManager::addAccount(const std::map<std::string, std::string>& details) -> decltype(DRing::addAccount(details))
  61. {
  62. return DRing::addAccount(details);
  63. }
  64. auto
  65. DBusConfigurationManager::exportOnRing(const std::string& accountID, const std::string& password) -> decltype(DRing::exportOnRing(accountID, password))
  66. {
  67. return DRing::exportOnRing(accountID, password);
  68. }
  69. auto
  70. DBusConfigurationManager::revokeDevice(const std::string& accountID, const std::string& password, const std::string& device) -> decltype(DRing::revokeDevice(accountID, password, device))
  71. {
  72. return DRing::revokeDevice(accountID, password, device);
  73. }
  74. auto
  75. DBusConfigurationManager::getKnownRingDevices(const std::string& accountID) -> decltype(DRing::getKnownRingDevices(accountID))
  76. {
  77. return DRing::getKnownRingDevices(accountID);
  78. }
  79. auto
  80. DBusConfigurationManager::lookupName(const std::string& account, const std::string& nameserver, const std::string& name) -> decltype(DRing::lookupName(account, nameserver, name))
  81. {
  82. return DRing::lookupName(account, nameserver, name);
  83. }
  84. auto
  85. DBusConfigurationManager::lookupAddress(const std::string& account, const std::string& nameserver, const std::string& address) -> decltype(DRing::lookupAddress(account, nameserver, address))
  86. {
  87. return DRing::lookupAddress(account, nameserver, address);
  88. }
  89. auto
  90. DBusConfigurationManager::registerName(const std::string& account, const std::string& password, const std::string& name) -> decltype(DRing::registerName(account, password, name))
  91. {
  92. return DRing::registerName(account, password, name);
  93. }
  94. void
  95. DBusConfigurationManager::removeAccount(const std::string& accountID)
  96. {
  97. DRing::removeAccount(accountID);
  98. }
  99. auto
  100. DBusConfigurationManager::getAccountList() -> decltype(DRing::getAccountList())
  101. {
  102. return DRing::getAccountList();
  103. }
  104. void
  105. DBusConfigurationManager::sendRegister(const std::string& accountID, const bool& enable)
  106. {
  107. DRing::sendRegister(accountID, enable);
  108. }
  109. void
  110. DBusConfigurationManager::registerAllAccounts(void)
  111. {
  112. DRing::registerAllAccounts();
  113. }
  114. auto
  115. DBusConfigurationManager::sendTextMessage(const std::string& accountID, const std::string& to, const std::map<std::string, std::string>& payloads) -> decltype(DRing::sendAccountTextMessage(accountID, to, payloads))
  116. {
  117. return DRing::sendAccountTextMessage(accountID, to, payloads);
  118. }
  119. auto
  120. DBusConfigurationManager::getMessageStatus(const uint64_t& id) -> decltype(DRing::getMessageStatus(id))
  121. {
  122. return DRing::getMessageStatus(id);
  123. }
  124. auto
  125. DBusConfigurationManager::getTlsDefaultSettings() -> decltype(DRing::getTlsDefaultSettings())
  126. {
  127. return DRing::getTlsDefaultSettings();
  128. }
  129. auto
  130. DBusConfigurationManager::getCodecList() -> decltype(DRing::getCodecList())
  131. {
  132. return DRing::getCodecList();
  133. }
  134. auto
  135. DBusConfigurationManager::getSupportedTlsMethod() -> decltype(DRing::getSupportedTlsMethod())
  136. {
  137. return DRing::getSupportedTlsMethod();
  138. }
  139. auto
  140. DBusConfigurationManager::getSupportedCiphers(const std::string& accountID) -> decltype(DRing::getSupportedCiphers(accountID))
  141. {
  142. return DRing::getSupportedCiphers(accountID);
  143. }
  144. auto
  145. DBusConfigurationManager::getCodecDetails(const std::string& accountID, const unsigned& codecId) -> decltype(DRing::getCodecDetails(accountID, codecId))
  146. {
  147. return DRing::getCodecDetails(accountID, codecId);
  148. }
  149. auto
  150. DBusConfigurationManager::setCodecDetails(const std::string& accountID, const unsigned& codecId, const std::map<std::string, std::string>& details)
  151. -> decltype(DRing::setCodecDetails(accountID, codecId, details))
  152. {
  153. return DRing::setCodecDetails(accountID, codecId, details);
  154. }
  155. auto
  156. DBusConfigurationManager::getActiveCodecList(const std::string& accountID) -> decltype(DRing::getActiveCodecList(accountID))
  157. {
  158. return DRing::getActiveCodecList(accountID);
  159. }
  160. void
  161. DBusConfigurationManager::setActiveCodecList(const std::string& accountID, const std::vector<unsigned>& list)
  162. {
  163. DRing::setActiveCodecList(accountID, list);
  164. }
  165. auto
  166. DBusConfigurationManager::getAudioPluginList() -> decltype(DRing::getAudioPluginList())
  167. {
  168. return DRing::getAudioPluginList();
  169. }
  170. void
  171. DBusConfigurationManager::setAudioPlugin(const std::string& audioPlugin)
  172. {
  173. DRing::setAudioPlugin(audioPlugin);
  174. }
  175. auto
  176. DBusConfigurationManager::getAudioOutputDeviceList() -> decltype(DRing::getAudioOutputDeviceList())
  177. {
  178. return DRing::getAudioOutputDeviceList();
  179. }
  180. void
  181. DBusConfigurationManager::setAudioOutputDevice(const int32_t& index)
  182. {
  183. DRing::setAudioOutputDevice(index);
  184. }
  185. void
  186. DBusConfigurationManager::setAudioInputDevice(const int32_t& index)
  187. {
  188. DRing::setAudioInputDevice(index);
  189. }
  190. void
  191. DBusConfigurationManager::setAudioRingtoneDevice(const int32_t& index)
  192. {
  193. DRing::setAudioRingtoneDevice(index);
  194. }
  195. auto
  196. DBusConfigurationManager::getAudioInputDeviceList() -> decltype(DRing::getAudioInputDeviceList())
  197. {
  198. return DRing::getAudioInputDeviceList();
  199. }
  200. auto
  201. DBusConfigurationManager::getCurrentAudioDevicesIndex() -> decltype(DRing::getCurrentAudioDevicesIndex())
  202. {
  203. return DRing::getCurrentAudioDevicesIndex();
  204. }
  205. auto
  206. DBusConfigurationManager::getAudioInputDeviceIndex(const std::string& name) -> decltype(DRing::getAudioInputDeviceIndex(name))
  207. {
  208. return DRing::getAudioInputDeviceIndex(name);
  209. }
  210. auto
  211. DBusConfigurationManager::getAudioOutputDeviceIndex(const std::string& name) -> decltype(DRing::getAudioOutputDeviceIndex(name))
  212. {
  213. return DRing::getAudioOutputDeviceIndex(name);
  214. }
  215. auto
  216. DBusConfigurationManager::getCurrentAudioOutputPlugin() -> decltype(DRing::getCurrentAudioOutputPlugin())
  217. {
  218. return DRing::getCurrentAudioOutputPlugin();
  219. }
  220. auto
  221. DBusConfigurationManager::getNoiseSuppressState() -> decltype(DRing::getNoiseSuppressState())
  222. {
  223. return DRing::getNoiseSuppressState();
  224. }
  225. void
  226. DBusConfigurationManager::setNoiseSuppressState(const bool& state)
  227. {
  228. DRing::setNoiseSuppressState(state);
  229. }
  230. auto
  231. DBusConfigurationManager::isAgcEnabled() -> decltype(DRing::isAgcEnabled())
  232. {
  233. return DRing::isAgcEnabled();
  234. }
  235. void
  236. DBusConfigurationManager::setAgcState(const bool& enabled)
  237. {
  238. DRing::setAgcState(enabled);
  239. }
  240. void
  241. DBusConfigurationManager::muteDtmf(const bool& mute)
  242. {
  243. DRing::muteDtmf(mute);
  244. }
  245. auto
  246. DBusConfigurationManager::isDtmfMuted() -> decltype(DRing::isDtmfMuted())
  247. {
  248. return DRing::isDtmfMuted();
  249. }
  250. auto
  251. DBusConfigurationManager::isCaptureMuted() -> decltype(DRing::isCaptureMuted())
  252. {
  253. return DRing::isCaptureMuted();
  254. }
  255. void
  256. DBusConfigurationManager::muteCapture(const bool& mute)
  257. {
  258. DRing::muteCapture(mute);
  259. }
  260. auto
  261. DBusConfigurationManager::isPlaybackMuted() -> decltype(DRing::isPlaybackMuted())
  262. {
  263. return DRing::isPlaybackMuted();
  264. }
  265. void
  266. DBusConfigurationManager::mutePlayback(const bool& mute)
  267. {
  268. DRing::mutePlayback(mute);
  269. }
  270. auto
  271. DBusConfigurationManager::isRingtoneMuted() -> decltype(DRing::isRingtoneMuted())
  272. {
  273. return DRing::isRingtoneMuted();
  274. }
  275. void
  276. DBusConfigurationManager::muteRingtone(const bool& mute)
  277. {
  278. DRing::muteRingtone(mute);
  279. }
  280. auto
  281. DBusConfigurationManager::getAudioManager() -> decltype(DRing::getAudioManager())
  282. {
  283. return DRing::getAudioManager();
  284. }
  285. auto
  286. DBusConfigurationManager::setAudioManager(const std::string& api) -> decltype(DRing::setAudioManager(api))
  287. {
  288. return DRing::setAudioManager(api);
  289. }
  290. std::vector<std::string>
  291. DBusConfigurationManager::getSupportedAudioManagers()
  292. {
  293. return {
  294. #if HAVE_ALSA
  295. ALSA_API_STR,
  296. #endif
  297. #if HAVE_PULSE
  298. PULSEAUDIO_API_STR,
  299. #endif
  300. #if HAVE_JACK
  301. JACK_API_STR,
  302. #endif
  303. };
  304. }
  305. auto
  306. DBusConfigurationManager::getRecordPath() -> decltype(DRing::getRecordPath())
  307. {
  308. return DRing::getRecordPath();
  309. }
  310. void
  311. DBusConfigurationManager::setRecordPath(const std::string& recPath)
  312. {
  313. DRing::setRecordPath(recPath);
  314. }
  315. auto
  316. DBusConfigurationManager::getIsAlwaysRecording() -> decltype(DRing::getIsAlwaysRecording())
  317. {
  318. return DRing::getIsAlwaysRecording();
  319. }
  320. void
  321. DBusConfigurationManager::setIsAlwaysRecording(const bool& rec)
  322. {
  323. DRing::setIsAlwaysRecording(rec);
  324. }
  325. void
  326. DBusConfigurationManager::setHistoryLimit(const int32_t& days)
  327. {
  328. DRing::setHistoryLimit(days);
  329. }
  330. auto
  331. DBusConfigurationManager::getHistoryLimit() -> decltype(DRing::getHistoryLimit())
  332. {
  333. return DRing::getHistoryLimit();
  334. }
  335. void
  336. DBusConfigurationManager::setAccountsOrder(const std::string& order)
  337. {
  338. DRing::setAccountsOrder(order);
  339. }
  340. auto
  341. DBusConfigurationManager::getHookSettings() -> decltype(DRing::getHookSettings())
  342. {
  343. return DRing::getHookSettings();
  344. }
  345. void
  346. DBusConfigurationManager::setHookSettings(const std::map<std::string, std::string>& settings)
  347. {
  348. DRing::setHookSettings(settings);
  349. }
  350. auto
  351. DBusConfigurationManager::validateCertificate(const std::string& accountId, const std::string& certificate) -> decltype(DRing::validateCertificate(accountId, certificate))
  352. {
  353. return DRing::validateCertificate(accountId, certificate);
  354. }
  355. auto
  356. DBusConfigurationManager::validateCertificatePath(const std::string& accountId, const std::string& certificate, const std::string& privateKey, const std::string& privateKeyPass, const std::string& caList) -> decltype(DRing::validateCertificatePath(accountId, certificate, privateKey, privateKeyPass, caList))
  357. {
  358. return DRing::validateCertificatePath(accountId, certificate, privateKey, privateKeyPass, caList);
  359. }
  360. auto
  361. DBusConfigurationManager::getCertificateDetails(const std::string& certificate) -> decltype(DRing::getCertificateDetails(certificate))
  362. {
  363. return DRing::getCertificateDetails(certificate);
  364. }
  365. auto
  366. DBusConfigurationManager::getCertificateDetailsPath(const std::string& certificate, const std::string& privateKey, const std::string& privateKeyPass) -> decltype(DRing::getCertificateDetailsPath(certificate, privateKey, privateKeyPass))
  367. {
  368. return DRing::getCertificateDetailsPath(certificate, privateKey, privateKeyPass);
  369. }
  370. auto
  371. DBusConfigurationManager::getPinnedCertificates() -> decltype(DRing::getPinnedCertificates())
  372. {
  373. return DRing::getPinnedCertificates();
  374. }
  375. auto
  376. DBusConfigurationManager::pinCertificate(const std::vector<uint8_t>& certificate, const bool& local) -> decltype(DRing::pinCertificate(certificate, local))
  377. {
  378. return DRing::pinCertificate(certificate, local);
  379. }
  380. void
  381. DBusConfigurationManager::pinCertificatePath(const std::string& certPath)
  382. {
  383. return DRing::pinCertificatePath(certPath);
  384. }
  385. auto
  386. DBusConfigurationManager::unpinCertificate(const std::string& certId) -> decltype(DRing::unpinCertificate(certId))
  387. {
  388. return DRing::unpinCertificate(certId);
  389. }
  390. auto
  391. DBusConfigurationManager::unpinCertificatePath(const std::string& p) -> decltype(DRing::unpinCertificatePath(p))
  392. {
  393. return DRing::unpinCertificatePath(p);
  394. }
  395. auto
  396. DBusConfigurationManager::pinRemoteCertificate(const std::string& accountId, const std::string& certId) -> decltype(DRing::pinRemoteCertificate(accountId, certId))
  397. {
  398. return DRing::pinRemoteCertificate(accountId, certId);
  399. }
  400. auto
  401. DBusConfigurationManager::setCertificateStatus(const std::string& accountId, const std::string& certId, const std::string& status) -> decltype(DRing::setCertificateStatus(accountId, certId, status))
  402. {
  403. return DRing::setCertificateStatus(accountId, certId, status);
  404. }
  405. auto
  406. DBusConfigurationManager::getCertificatesByStatus(const std::string& accountId, const std::string& status) -> decltype(DRing::getCertificatesByStatus(accountId, status))
  407. {
  408. return DRing::getCertificatesByStatus(accountId, status);
  409. }
  410. auto
  411. DBusConfigurationManager::getTrustRequests(const std::string& accountId) -> decltype(DRing::getTrustRequests(accountId))
  412. {
  413. return DRing::getTrustRequests(accountId);
  414. }
  415. auto
  416. DBusConfigurationManager::acceptTrustRequest(const std::string& accountId, const std::string& from) -> decltype(DRing::acceptTrustRequest(accountId, from))
  417. {
  418. return DRing::acceptTrustRequest(accountId, from);
  419. }
  420. auto
  421. DBusConfigurationManager::discardTrustRequest(const std::string& accountId, const std::string& from) -> decltype(DRing::discardTrustRequest(accountId, from))
  422. {
  423. return DRing::discardTrustRequest(accountId, from);
  424. }
  425. void
  426. DBusConfigurationManager::sendTrustRequest(const std::string& accountId, const std::string& to, const std::vector<uint8_t>& payload)
  427. {
  428. DRing::sendTrustRequest(accountId, to, payload);
  429. }
  430. void
  431. DBusConfigurationManager::addContact(const std::string& accountId, const std::string& uri)
  432. {
  433. DRing::addContact(accountId, uri);
  434. }
  435. void
  436. DBusConfigurationManager::removeContact(const std::string& accountId, const std::string& uri)
  437. {
  438. DRing::removeContact(accountId, uri);
  439. }
  440. auto
  441. DBusConfigurationManager::getContacts(const std::string& accountId) -> decltype(DRing::getContacts(accountId))
  442. {
  443. return DRing::getContacts(accountId);
  444. }
  445. auto
  446. DBusConfigurationManager::getCredentials(const std::string& accountID) -> decltype(DRing::getCredentials(accountID))
  447. {
  448. return DRing::getCredentials(accountID);
  449. }
  450. void
  451. DBusConfigurationManager::setCredentials(const std::string& accountID, const std::vector<std::map<std::string, std::string>>& details)
  452. {
  453. DRing::setCredentials(accountID, details);
  454. }
  455. auto
  456. DBusConfigurationManager::getAddrFromInterfaceName(const std::string& interface) -> decltype(DRing::getAddrFromInterfaceName(interface))
  457. {
  458. return DRing::getAddrFromInterfaceName(interface);
  459. }
  460. auto
  461. DBusConfigurationManager::getAllIpInterface() -> decltype(DRing::getAllIpInterface())
  462. {
  463. return DRing::getAllIpInterface();
  464. }
  465. auto
  466. DBusConfigurationManager::getAllIpInterfaceByName() -> decltype(DRing::getAllIpInterfaceByName())
  467. {
  468. return DRing::getAllIpInterfaceByName();
  469. }
  470. auto
  471. DBusConfigurationManager::getShortcuts() -> decltype(DRing::getShortcuts())
  472. {
  473. return DRing::getShortcuts();
  474. }
  475. void
  476. DBusConfigurationManager::setShortcuts(const std::map<std::string, std::string> &shortcutsMap)
  477. {
  478. DRing::setShortcuts(shortcutsMap);
  479. }
  480. void
  481. DBusConfigurationManager::setVolume(const std::string& device, const double& value)
  482. {
  483. DRing::setVolume(device, value);
  484. }
  485. auto
  486. DBusConfigurationManager::getVolume(const std::string& device) -> decltype(DRing::getVolume(device))
  487. {
  488. return DRing::getVolume(device);
  489. }
  490. auto
  491. DBusConfigurationManager::exportAccounts(const std::vector<std::string>& accountIDs, const std::string& filepath, const std::string& password) -> decltype(DRing::exportAccounts(accountIDs, filepath, password))
  492. {
  493. return DRing::exportAccounts(accountIDs, filepath, password);
  494. }
  495. auto
  496. DBusConfigurationManager::importAccounts(const std::string& archivePath, const std::string& password) -> decltype(DRing::importAccounts(archivePath, password))
  497. {
  498. return DRing::importAccounts(archivePath, password);
  499. }
  500. void
  501. DBusConfigurationManager::connectivityChanged()
  502. {
  503. DRing::connectivityChanged();
  504. }