summaryrefslogtreecommitdiff
path: root/AudioManagerDaemon
diff options
context:
space:
mode:
Diffstat (limited to 'AudioManagerDaemon')
-rw-r--r--AudioManagerDaemon/src/CAmDatabaseHandler.cpp26
-rw-r--r--AudioManagerDaemon/src/CAmDbusWrapper.cpp4
2 files changed, 21 insertions, 9 deletions
diff --git a/AudioManagerDaemon/src/CAmDatabaseHandler.cpp b/AudioManagerDaemon/src/CAmDatabaseHandler.cpp
index 2de067e..2f0fc06 100644
--- a/AudioManagerDaemon/src/CAmDatabaseHandler.cpp
+++ b/AudioManagerDaemon/src/CAmDatabaseHandler.cpp
@@ -184,11 +184,13 @@ am_Error_e CAmDatabaseHandler::enterDomainDB(const am_Domain_s & domainData, am_
//first check for a reserved domain
sqlite3_stmt* query = NULL;
int eCode = 0;
+ domainID=0;
std::string command = "SELECT domainID FROM " + std::string(DOMAIN_TABLE) + " WHERE name=?";
MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
MY_SQLITE_BIND_TEXT(query, 1, domainData.name.c_str(), domainData.name.size(), SQLITE_STATIC)
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
+ domainID = sqlite3_column_int(query, 0);
command = "UPDATE " + std::string(DOMAIN_TABLE) + " SET name=?, busname=?, nodename=?, early=?, complete=?, state=?, reserved=? WHERE domainID=" + i2s(sqlite3_column_int(query, 0));
}
else if (eCode == SQLITE_DONE)
@@ -221,7 +223,8 @@ am_Error_e CAmDatabaseHandler::enterDomainDB(const am_Domain_s & domainData, am_
}
MY_SQLITE_FINALIZE(query)
- domainID = sqlite3_last_insert_rowid(mpDatabase);
+ if (domainID==0)
+ domainID = sqlite3_last_insert_rowid(mpDatabase);
logInfo("DatabaseHandler::enterDomainDB entered new domain with name=", domainData.name, "busname=", domainData.busname, "nodename=", domainData.nodename, "assigned ID:", domainID);
am_Domain_s domain = domainData;
@@ -637,8 +640,10 @@ am_Error_e CAmDatabaseHandler::enterGatewayDB(const am_Gateway_s & gatewayData,
assert(!gatewayData.convertionMatrix.empty());
assert(!gatewayData.listSinkFormats.empty());
assert(!gatewayData.listSourceFormats.empty());
- assert(existSink(gatewayData.sinkID));
- assert(existSource(gatewayData.sourceID));
+
+ //might be that the sinks and sources are not there during registration time
+ //assert(existSink(gatewayData.sinkID));
+ //assert(existSource(gatewayData.sourceID));
sqlite3_stmt* query = NULL;
int eCode = 0;
@@ -1382,17 +1387,23 @@ am_Error_e CAmDatabaseHandler::removeSourceDB(const am_sourceID_t sourceID)
std::string command1 = "DROP table SourceConnectionFormat" + i2s(sourceID);
std::string command2 = "DROP table SourceMainSoundProperty" + i2s(sourceID);
std::string command3 = "DROP table SourceSoundProperty" + i2s(sourceID);
+ std::string command4 = "DROP table SourceNotificationConfiguration" + i2s(sourceID);
+ std::string command5 = "DROP table SourceMainNotificationConfiguration" + i2s(sourceID);
if (!sqQuery(command))
return (E_DATABASE_ERROR);
if (!sqQuery(command1))
return (E_DATABASE_ERROR);
if (!sqQuery(command3))
return (E_DATABASE_ERROR);
+ if (!sqQuery(command4))
+ return (E_DATABASE_ERROR);
if(visible)
{
if (!sqQuery(command2))
return (E_DATABASE_ERROR);
+ if (!sqQuery(command5))
+ return (E_DATABASE_ERROR);
}
logInfo("DatabaseHandler::removeSourceDB removed:", sourceID);
if (mpDatabaseObserver)
@@ -3787,11 +3798,11 @@ bool CAmDatabaseHandler::sourceVisible(const am_sourceID_t sourceID) const
bool returnVal = false;
MY_SQLITE_PREPARE_V2_BOOL(mpDatabase, command.c_str(), -1, &query, NULL)
- if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
returnVal = (bool) sqlite3_column_int(query, 0);
}
- else if (eCode != SQLITE_ROW)
+ else if (eCode != SQLITE_DONE)
{
returnVal = false;
logError("DatabaseHandler::sourceVisible database error!:", eCode);
@@ -3813,11 +3824,11 @@ bool CAmDatabaseHandler::sinkVisible(const am_sinkID_t sinkID) const
int eCode = 0;
bool returnVal = false;
MY_SQLITE_PREPARE_V2_BOOL(mpDatabase, command.c_str(), -1, &query, NULL)
- if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
returnVal = sqlite3_column_int(query, 0);
}
- else if (eCode != SQLITE_ROW)
+ else if (eCode != SQLITE_DONE)
{
returnVal = false;
logError("DatabaseHandler::sinkVisible database error!:", eCode);
@@ -4091,6 +4102,7 @@ am_Error_e CAmDatabaseHandler::getDomainState(const am_domainID_t domainID, am_D
am_Error_e CAmDatabaseHandler::peekDomain(const std::string & name, am_domainID_t & domainID)
{
+ domainID=0;
sqlite3_stmt* query = NULL, *queryInsert = NULL;
std::string command = "SELECT domainID FROM " + std::string(DOMAIN_TABLE) + " WHERE name=?";
int eCode = 0, eCode1 = 0;
diff --git a/AudioManagerDaemon/src/CAmDbusWrapper.cpp b/AudioManagerDaemon/src/CAmDbusWrapper.cpp
index e3955c9..be9b369 100644
--- a/AudioManagerDaemon/src/CAmDbusWrapper.cpp
+++ b/AudioManagerDaemon/src/CAmDbusWrapper.cpp
@@ -162,7 +162,7 @@ void CAmDbusWrapper::registerCallback(const DBusObjectPathVTable* vtable, const
*/
DBusHandlerResult CAmDbusWrapper::cbRootIntrospection(DBusConnection *conn, DBusMessage *msg, void *reference)
{
- logInfo("DBusWrapper::~cbRootIntrospection called:");
+ //logInfo("DBusWrapper::~cbRootIntrospection called:");
mpReference = (CAmDbusWrapper*) reference;
std::vector<std::string> nodesList = mpReference->mListNodes;
@@ -432,7 +432,7 @@ void CAmDbusWrapper::dbusPrepareCallback(const sh_pollHandle_t handle, void* use
while (dbus_connection_get_dispatch_status(mpDbusConnection) == DBUS_DISPATCH_DATA_REMAINS)
{
dbus_connection_dispatch(mpDbusConnection);
- logInfo("prepare was neccessary!");
+ //logInfo("prepare was neccessary!");
}
dbus_connection_unref(mpDbusConnection);
}