From 7542b0aa2149eac23976ad5da2b3602aa06dd986 Mon Sep 17 00:00:00 2001 From: christian mueller Date: Wed, 2 May 2012 14:42:55 +0200 Subject: * [GAM-70] fix wrong type on database interface for source sound properties Signed-off-by: christian mueller --- AudioManagerDaemon/include/CAmDatabaseHandler.h | 4 ++-- AudioManagerDaemon/src/CAmControlReceiver.cpp | 8 ++++---- AudioManagerDaemon/src/CAmDatabaseHandler.cpp | 13 ++++++------- AudioManagerDaemon/src/main.cpp | 2 +- .../test/AmControlInterfaceTest/CAmControlInterfaceTest.cpp | 4 ++-- PluginRoutingInterfaceDbus/src/CAmDbusSend.cpp | 1 + 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/AudioManagerDaemon/include/CAmDatabaseHandler.h b/AudioManagerDaemon/include/CAmDatabaseHandler.h index 6bd5b85..8509594 100644 --- a/AudioManagerDaemon/include/CAmDatabaseHandler.h +++ b/AudioManagerDaemon/include/CAmDatabaseHandler.h @@ -101,8 +101,8 @@ public: am_Error_e getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s& mainConnectionData) const; am_Error_e getSinkVolume(const am_sinkID_t sinkID, am_volume_t& volume) const; am_Error_e getSourceVolume(const am_sourceID_t sourceID, am_volume_t& volume) const; - am_Error_e getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_SoundPropertyType_e propertyType, uint16_t& value) const; - am_Error_e getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_SoundPropertyType_e propertyType, uint16_t& value) const; + am_Error_e getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_SoundPropertyType_e propertyType, int16_t& value) const; + am_Error_e getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_SoundPropertyType_e propertyType, int16_t& value) const; am_Error_e getListSinksOfDomain(const am_domainID_t domainID, std::vector& listSinkID) const; am_Error_e getListSourcesOfDomain(const am_domainID_t domainID, std::vector& listSourceID) const; am_Error_e getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector& listGatewaysID) const; diff --git a/AudioManagerDaemon/src/CAmControlReceiver.cpp b/AudioManagerDaemon/src/CAmControlReceiver.cpp index e7cee4b..23ae544 100644 --- a/AudioManagerDaemon/src/CAmControlReceiver.cpp +++ b/AudioManagerDaemon/src/CAmControlReceiver.cpp @@ -130,7 +130,7 @@ am_Error_e CAmControlReceiver::setSinkSoundProperty(am_Handle_s & handle, const { logInfo("CAmControlReceiver::setSinkSoundProperty got called, sinkID=", sinkID, "soundProperty.Type=", soundProperty.type, "soundProperty.value=", soundProperty.value); - uint16_t value; + int16_t value; if (mDatabaseHandler->getSinkSoundPropertyValue(sinkID, soundProperty.type, value) != E_OK) return (E_UNKNOWN); if (value == soundProperty.value) @@ -142,7 +142,7 @@ am_Error_e CAmControlReceiver::setSinkSoundProperties(am_Handle_s & handle, cons { logInfo("CAmControlReceiver::setSinkSoundProperties got called, sinkID=", sinkID); - uint16_t value; + int16_t value; bool noChange = true; std::vector::const_iterator it = listSoundProperties.begin(); for (; it != listSoundProperties.end(); ++it) @@ -161,7 +161,7 @@ am_Error_e CAmControlReceiver::setSourceSoundProperty(am_Handle_s & handle, cons { logInfo("CAmControlReceiver::setSourceSoundProperty got called, sourceID=", sourceID, "soundProperty.Type=", soundProperty.type, "soundProperty.value=", soundProperty.value); - uint16_t value; + int16_t value; if (mDatabaseHandler->getSourceSoundPropertyValue(sourceID, soundProperty.type, value) != E_OK) return (E_UNKNOWN); if (value == soundProperty.value) @@ -173,7 +173,7 @@ am_Error_e CAmControlReceiver::setSourceSoundProperties(am_Handle_s & handle, co { logInfo("CAmControlReceiver::setSourceSoundProperties got called, sourceID=", sourceID); - uint16_t value; + int16_t value; bool noChange = true; std::vector::const_iterator it = listSoundProperties.begin(); for (; it != listSoundProperties.end(); ++it) diff --git a/AudioManagerDaemon/src/CAmDatabaseHandler.cpp b/AudioManagerDaemon/src/CAmDatabaseHandler.cpp index 68a82c6..1f7e9f8 100644 --- a/AudioManagerDaemon/src/CAmDatabaseHandler.cpp +++ b/AudioManagerDaemon/src/CAmDatabaseHandler.cpp @@ -3789,7 +3789,7 @@ am_Error_e CAmDatabaseHandler::getSourceVolume(const am_sourceID_t sourceID, am_ return (E_OK); } -am_Error_e CAmDatabaseHandler::getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_SoundPropertyType_e propertyType, uint16_t & value) const +am_Error_e CAmDatabaseHandler::getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_SoundPropertyType_e propertyType, int16_t & value) const { assert(sinkID!=0); if (!existSink(sinkID)) @@ -3800,14 +3800,13 @@ am_Error_e CAmDatabaseHandler::getSinkSoundPropertyValue(const am_sinkID_t sinkI std::string command = "SELECT value FROM SinkSoundProperty" + i2s(sinkID) + " WHERE soundPropertyType=" + i2s(propertyType); MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL) - while ((eCode = sqlite3_step(query)) == SQLITE_ROW) + if ((eCode = sqlite3_step(query)) == SQLITE_ROW) { value = sqlite3_column_int(query, 0); } - - if (eCode != SQLITE_DONE) + else { - logError("DatabaseHandler::getSinkSoundPropertyValue SQLITE error code:", eCode); + logError("DatabaseHandler::getDomainState database error!:", eCode); MY_SQLITE_FINALIZE(query) return (E_DATABASE_ERROR); } @@ -3817,7 +3816,7 @@ am_Error_e CAmDatabaseHandler::getSinkSoundPropertyValue(const am_sinkID_t sinkI return (E_OK); } -am_Error_e CAmDatabaseHandler::getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_SoundPropertyType_e propertyType, uint16_t & value) const +am_Error_e CAmDatabaseHandler::getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_SoundPropertyType_e propertyType, int16_t & value) const { assert(sourceID!=0); if (!existSource(sourceID)) @@ -4111,7 +4110,7 @@ am_Error_e CAmDatabaseHandler::changeSinkSoundPropertyDB(const am_SoundProperty_ assert(sinkID!=0); MY_SQLITE_FINALIZE(query) - logInfo("DatabaseHandler::changeSinkSoundPropertyDB changed MainSinkSoundProperty of sink:", sinkID, "type:", soundProperty.type, "to:", soundProperty.value); + logInfo("DatabaseHandler::changeSinkSoundPropertyDB changed SinkSoundProperty of sink:", sinkID, "type:", soundProperty.type, "to:", soundProperty.value); return (E_OK); } diff --git a/AudioManagerDaemon/src/main.cpp b/AudioManagerDaemon/src/main.cpp index 92a1e41..b01b98d 100644 --- a/AudioManagerDaemon/src/main.cpp +++ b/AudioManagerDaemon/src/main.cpp @@ -173,7 +173,7 @@ void parseCommandLine(int argc, char **argv) int option = getopt(argc, argv, "h::v::c::l::r::L::R::d::t::m::i::p::T::"); #else int option = getopt(argc, argv, "h::v::c::l::r::L::R::d::t::m::i::p::"); - #endif WITH_DBUS_WRAPPER + #endif //WITH_DBUS_WRAPPER #else #ifdef WITH_DBUS_WRAPPER int option = getopt(argc, argv, "h::v::V::c::l::r::L::R::d::t::m::i::p::T::"); diff --git a/AudioManagerDaemon/test/AmControlInterfaceTest/CAmControlInterfaceTest.cpp b/AudioManagerDaemon/test/AmControlInterfaceTest/CAmControlInterfaceTest.cpp index 4441f63..f056819 100644 --- a/AudioManagerDaemon/test/AmControlInterfaceTest/CAmControlInterfaceTest.cpp +++ b/AudioManagerDaemon/test/AmControlInterfaceTest/CAmControlInterfaceTest.cpp @@ -418,7 +418,7 @@ TEST_F(CAmControlInterfaceTest,ackSetSinkSoundProperty) std::vector handlesList; am_Handle_s handle; am_SoundProperty_s soundProperty; - uint16_t oldvalue; + int16_t oldvalue; pCF.createSink(sink); pCF.createDomain(domain); domain.name = "mock"; @@ -470,7 +470,7 @@ TEST_F(CAmControlInterfaceTest,ackSetSourceSoundProperty) std::vector handlesList; am_Handle_s handle; am_SoundProperty_s soundProperty; - uint16_t oldvalue; + int16_t oldvalue; pCF.createSource(source); pCF.createDomain(domain); domain.name = "mock"; diff --git a/PluginRoutingInterfaceDbus/src/CAmDbusSend.cpp b/PluginRoutingInterfaceDbus/src/CAmDbusSend.cpp index cca1cd7..765bc1d 100644 --- a/PluginRoutingInterfaceDbus/src/CAmDbusSend.cpp +++ b/PluginRoutingInterfaceDbus/src/CAmDbusSend.cpp @@ -127,6 +127,7 @@ am_Error_e CAmRoutingDbusSend::send() DBUS_TYPE_INT16, &error, // DBUS_TYPE_INVALID)) return (E_UNKNOWN); + dbus_message_unref(reply); return (static_cast(error)); } } -- cgit v1.2.1