summaryrefslogtreecommitdiff
path: root/AudioManagerDaemon/src
diff options
context:
space:
mode:
Diffstat (limited to 'AudioManagerDaemon/src')
-rw-r--r--AudioManagerDaemon/src/CAmCommandReceiver.cpp5
-rw-r--r--AudioManagerDaemon/src/CAmDatabaseHandlerMap.cpp13
-rw-r--r--AudioManagerDaemon/src/CAmDatabaseHandlerSQLite.cpp19
3 files changed, 37 insertions, 0 deletions
diff --git a/AudioManagerDaemon/src/CAmCommandReceiver.cpp b/AudioManagerDaemon/src/CAmCommandReceiver.cpp
index a6eff97..d903384 100644
--- a/AudioManagerDaemon/src/CAmCommandReceiver.cpp
+++ b/AudioManagerDaemon/src/CAmCommandReceiver.cpp
@@ -122,6 +122,11 @@ am_Error_e CAmCommandReceiver::setSystemProperty(const am_SystemProperty_s & pro
return (mControlSender->hookUserSetSystemProperty(property));
}
+am_Error_e CAmCommandReceiver::getVolume(const am_sinkID_t sinkID, am_mainVolume_t& mainVolume) const
+{
+ return (mDatabaseHandler->getSinkMainVolume(sinkID, mainVolume));
+}
+
am_Error_e CAmCommandReceiver::getListMainConnections(std::vector<am_MainConnectionType_s> & listConnections) const
{
return (mDatabaseHandler->getListVisibleMainConnections(listConnections));
diff --git a/AudioManagerDaemon/src/CAmDatabaseHandlerMap.cpp b/AudioManagerDaemon/src/CAmDatabaseHandlerMap.cpp
index 427b805..8cc216d 100644
--- a/AudioManagerDaemon/src/CAmDatabaseHandlerMap.cpp
+++ b/AudioManagerDaemon/src/CAmDatabaseHandlerMap.cpp
@@ -2381,6 +2381,19 @@ am_Error_e CAmDatabaseHandlerMap::changeSourceState(const am_sourceID_t sourceID
return (E_NON_EXISTENT);
}
+am_Error_e CAmDatabaseHandlerMap::getSinkMainVolume(const am_sinkID_t sinkID, am_mainVolume_t& mainVolume) const {
+ assert(sinkID!=0);
+
+ am_Sink_Database_s const * source = objectForKeyIfExistsInMap(sinkID, mMappedData.mSinkMap);
+ if( NULL!=source )
+ {
+ mainVolume = source->mainVolume;
+ return (E_OK);
+ }
+ mainVolume = -1;
+ return (E_NON_EXISTENT);
+}
+
am_Error_e CAmDatabaseHandlerMap::getSinkVolume(const am_sinkID_t sinkID, am_volume_t & volume) const
{
assert(sinkID!=0);
diff --git a/AudioManagerDaemon/src/CAmDatabaseHandlerSQLite.cpp b/AudioManagerDaemon/src/CAmDatabaseHandlerSQLite.cpp
index b7aafd9..c9f29eb 100644
--- a/AudioManagerDaemon/src/CAmDatabaseHandlerSQLite.cpp
+++ b/AudioManagerDaemon/src/CAmDatabaseHandlerSQLite.cpp
@@ -4068,6 +4068,25 @@ am_Error_e CAmDatabaseHandlerSQLite::changeSourceState(const am_sourceID_t sourc
return (E_OK);
}
+am_Error_e CAmDatabaseHandlerSQLite::getSinkMainVolume(const am_sinkID_t sinkID, am_mainVolume_t& mainVolume) const {
+ assert(sinkID!=0);
+ sqlite3_stmt* query = NULL;
+ mainVolume = -1;
+ std::string command = "SELECT mainVolume FROM " + std::string(SINK_TABLE) + " WHERE sinkID=" + i2s(sinkID);
+ int eCode = 0;
+ MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ mainVolume = sqlite3_column_int(query, 0);
+ }
+ else if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ {
+ logError("DatabaseHandler::getSinkVolume database error!:", eCode);
+ }
+ MY_SQLITE_FINALIZE(query)
+ return (E_OK);
+}
+
am_Error_e CAmDatabaseHandlerSQLite::getSinkVolume(const am_sinkID_t sinkID, am_volume_t & volume) const
{
assert(sinkID!=0);