dbusconfigurationmanager.h 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. * Copyright (C) 2004-2017 Savoir-faire Linux Inc.
  3. *
  4. * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
  5. * Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>
  6. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
  7. * Author: Guillaume Carmel-Archambault <guillaume.carmel-archambault@savoirfairelinux.com>
  8. * Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 3 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  23. */
  24. #ifndef __RING_DBUSCONFIGURATIONMANAGER_H__
  25. #define __RING_DBUSCONFIGURATIONMANAGER_H__
  26. #include <vector>
  27. #include <map>
  28. #include <string>
  29. #include "dbus_cpp.h"
  30. #if __GNUC__ >= 5 || (__GNUC__ >=4 && __GNUC_MINOR__ >= 6)
  31. /* This warning option only exists for gcc 4.6.0 and greater. */
  32. #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
  33. #endif
  34. #pragma GCC diagnostic ignored "-Wignored-qualifiers"
  35. #pragma GCC diagnostic ignored "-Wunused-parameter"
  36. #include "dbusconfigurationmanager.adaptor.h"
  37. #pragma GCC diagnostic warning "-Wignored-qualifiers"
  38. #pragma GCC diagnostic warning "-Wunused-parameter"
  39. #if __GNUC__ >= 5 || (__GNUC__ >=4 && __GNUC_MINOR__ >= 6)
  40. /* This warning option only exists for gcc 4.6.0 and greater. */
  41. #pragma GCC diagnostic warning "-Wunused-but-set-variable"
  42. #endif
  43. class DBusConfigurationManager :
  44. public cx::ring::Ring::ConfigurationManager_adaptor,
  45. public DBus::IntrospectableAdaptor,
  46. public DBus::ObjectAdaptor
  47. {
  48. public:
  49. DBusConfigurationManager(DBus::Connection& connection);
  50. // Methods
  51. std::map<std::string, std::string> getAccountDetails(const std::string& accountID);
  52. std::map<std::string, std::string> getVolatileAccountDetails(const std::string& accountID);
  53. void setAccountDetails(const std::string& accountID, const std::map<std::string, std::string>& details);
  54. std::map<std::string, std::string> testAccountICEInitialization(const std::string& accountID);
  55. void setAccountActive(const std::string& accountID, const bool& active);
  56. std::map<std::string, std::string> getAccountTemplate(const std::string& accountType);
  57. std::string addAccount(const std::map<std::string, std::string>& details);
  58. bool exportOnRing(const std::string& accountID, const std::string& password);
  59. bool revokeDevice(const std::string& accountID, const std::string& password, const std::string& device);
  60. std::map<std::string, std::string> getKnownRingDevices(const std::string& accountID);
  61. bool lookupName(const std::string& account, const std::string& nameserver, const std::string& name);
  62. bool lookupAddress(const std::string& account, const std::string& nameserver, const std::string& address);
  63. bool registerName(const std::string& account, const std::string& password, const std::string& name);
  64. void removeAccount(const std::string& accoundID);
  65. std::vector<std::string> getAccountList();
  66. void sendRegister(const std::string& accoundID, const bool& enable);
  67. void registerAllAccounts(void);
  68. uint64_t sendTextMessage(const std::string& accoundID, const std::string& to, const std::map<std::string, std::string>& payloads);
  69. int getMessageStatus(const uint64_t& id);
  70. std::map<std::string, std::string> getTlsDefaultSettings();
  71. std::vector<std::string> getSupportedCiphers(const std::string& accountID);
  72. std::vector<unsigned> getCodecList();
  73. std::vector<std::string> getSupportedTlsMethod();
  74. std::map<std::string, std::string> getCodecDetails(const std::string& accountID, const unsigned& codecId);
  75. bool setCodecDetails(const std::string& accountID, const unsigned& codecId, const std::map<std::string, std::string>& details);
  76. std::vector<unsigned> getActiveCodecList(const std::string& accountID);
  77. void setActiveCodecList(const std::string& accountID, const std::vector<unsigned>& list);
  78. std::vector<std::string> getAudioPluginList();
  79. void setAudioPlugin(const std::string& audioPlugin);
  80. std::vector<std::string> getAudioOutputDeviceList();
  81. void setAudioOutputDevice(const int32_t& index);
  82. void setAudioInputDevice(const int32_t& index);
  83. void setAudioRingtoneDevice(const int32_t& index);
  84. std::vector<std::string> getAudioInputDeviceList();
  85. std::vector<std::string> getCurrentAudioDevicesIndex();
  86. int32_t getAudioInputDeviceIndex(const std::string& name);
  87. int32_t getAudioOutputDeviceIndex(const std::string& name);
  88. std::string getCurrentAudioOutputPlugin();
  89. bool getNoiseSuppressState();
  90. void setNoiseSuppressState(const bool& state);
  91. bool isAgcEnabled();
  92. void setAgcState(const bool& enabled);
  93. void muteDtmf(const bool& mute);
  94. bool isDtmfMuted();
  95. bool isCaptureMuted();
  96. void muteCapture(const bool& mute);
  97. bool isPlaybackMuted();
  98. void mutePlayback(const bool& mute);
  99. bool isRingtoneMuted();
  100. void muteRingtone(const bool& mute);
  101. std::string getAudioManager();
  102. bool setAudioManager(const std::string& api);
  103. std::vector<std::string> getSupportedAudioManagers();
  104. std::string getRecordPath();
  105. void setRecordPath(const std::string& recPath);
  106. bool getIsAlwaysRecording();
  107. void setIsAlwaysRecording(const bool& rec);
  108. void setHistoryLimit(const int32_t& days);
  109. int32_t getHistoryLimit();
  110. void setAccountsOrder(const std::string& order);
  111. std::map<std::string, std::string> getHookSettings();
  112. void setHookSettings(const std::map<std::string, std::string>& settings);
  113. std::vector<std::map<std::string, std::string>> getCredentials(const std::string& accountID);
  114. void setCredentials(const std::string& accountID, const std::vector<std::map<std::string, std::string>>& details);
  115. std::string getAddrFromInterfaceName(const std::string& interface);
  116. std::vector<std::string> getAllIpInterface();
  117. std::vector<std::string> getAllIpInterfaceByName();
  118. std::map<std::string, std::string> getShortcuts();
  119. void setShortcuts(const std::map<std::string, std::string> &shortcutsMap);
  120. void setVolume(const std::string& device, const double& value);
  121. double getVolume(const std::string& device);
  122. std::map<std::string, std::string> validateCertificate(const std::string& accountId, const std::string& certificate);
  123. std::map<std::string, std::string> validateCertificatePath(const std::string& accountId, const std::string& certificatePath, const std::string& privateKey, const std::string& privateKeyPass, const std::string& caList);
  124. std::map<std::string, std::string> getCertificateDetails(const std::string& certificate);
  125. std::map<std::string, std::string> getCertificateDetailsPath(const std::string& certificatePath, const std::string& privateKey, const std::string& privateKeyPass);
  126. std::vector<std::string> getPinnedCertificates();
  127. std::vector<std::string> pinCertificate(const std::vector<uint8_t>& certificate, const bool& local);
  128. bool unpinCertificate(const std::string& certId);
  129. void pinCertificatePath(const std::string& path);
  130. unsigned unpinCertificatePath(const std::string& path);
  131. bool pinRemoteCertificate(const std::string& accountId, const std::string& certId);
  132. bool setCertificateStatus(const std::string& account, const std::string& certId, const std::string& status);
  133. std::vector<std::string> getCertificatesByStatus(const std::string& account, const std::string& status);
  134. std::map<std::string, std::string> getTrustRequests(const std::string& accountId);
  135. bool acceptTrustRequest(const std::string& accountId, const std::string& from);
  136. bool discardTrustRequest(const std::string& accountId, const std::string& from);
  137. void sendTrustRequest(const std::string& accountId, const std::string& to, const std::vector<uint8_t>& payload);
  138. void addContact(const std::string& accountId, const std::string& uri);
  139. void removeContact(const std::string& accountId, const std::string& uri);
  140. std::vector<std::map<std::string, std::string>> getContacts(const std::string& accountId);
  141. int exportAccounts(const std::vector<std::string>& accountIDs, const std::string& filepath, const std::string& password);
  142. int importAccounts(const std::string& archivePath, const std::string& password);
  143. void connectivityChanged();
  144. };
  145. #endif // __RING_DBUSCONFIGURATIONMANAGER_H__