summaryrefslogtreecommitdiff
path: root/libresourceqt/src
diff options
context:
space:
mode:
authorWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-02-17 15:23:29 +0200
committerWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-02-17 15:23:29 +0200
commitfdb67c341fcb9ea0ae29a7889227ded6ac66a362 (patch)
treefc4f83d73390131a92063309a6878c74a5e2fe52 /libresourceqt/src
parent28aaf4eb7d89bba113d27a9a39fc787a03a05e31 (diff)
downloadlibresourceqt-fdb67c341fcb9ea0ae29a7889227ded6ac66a362.tar.gz
Implemented modes => we now get deny messages
Diffstat (limited to 'libresourceqt/src')
-rw-r--r--libresourceqt/src/resource-engine.cpp25
-rw-r--r--libresourceqt/src/resource-engine.h4
-rw-r--r--libresourceqt/src/resource-set.cpp20
3 files changed, 34 insertions, 15 deletions
diff --git a/libresourceqt/src/resource-engine.cpp b/libresourceqt/src/resource-engine.cpp
index 2704235..5c02b44 100644
--- a/libresourceqt/src/resource-engine.cpp
+++ b/libresourceqt/src/resource-engine.cpp
@@ -15,8 +15,15 @@ static void handleAdviceMessage(resmsg_t *msg, resset_t *rs, void *data);
ResourceEngine::ResourceEngine(ResourceSet *resourceSet)
: QObject(resourceSet), connected(false), resourceSet(resourceSet),
dbusEngine(NULL), libresourceConnection(NULL), libresourceSet(NULL),
- requestId(0), messageMap(), mode(0)
+ requestId(0), messageMap(), connectionMode(0)
{
+ if (resourceSet->alwaysGetReply()) {
+ connectionMode += RESMSG_MODE_ALWAYS_REPLY;
+ }
+ if (resourceSet->willAutoRelease()) {
+ connectionMode += RESOURCE_AUTO_RELEASE;
+ }
+ qDebug("connectionMode = %04x", connectionMode);
}
ResourceEngine::~ResourceEngine()
@@ -160,12 +167,12 @@ bool ResourceEngine::connectToManager()
resourceMessage.record.rset.all = allResources;
resourceMessage.record.rset.opt = optionalResources;
resourceMessage.record.rset.share = 0;
- resourceMessage.record.rset.mask = 0;
+ resourceMessage.record.rset.mask = connectionMode;
QByteArray ba = resourceSet->applicationClass().toLatin1();
resourceMessage.record.klass = ba.data();
- resourceMessage.record.mode = mode;
+ resourceMessage.record.mode = connectionMode;
qDebug("ResourceEngine is now connecting...");
libresourceSet = resconn_connect(libresourceConnection, &resourceMessage,
@@ -365,7 +372,7 @@ bool ResourceEngine::updateResources()
message.record.rset.all = allResources;
message.record.rset.opt = optionalResources;
message.record.rset.share = 0;
- message.record.rset.mask = 0;
+ message.record.rset.mask = connectionMode;
QByteArray ba = resourceSet->applicationClass().toLatin1();
message.record.klass = ba.data();
@@ -393,10 +400,13 @@ bool ResourceEngine::registerAudioStreamTag(const QString &)
bool ResourceEngine::registerAudioGroup(const QString &audioGroup)
{
+ if((audioGroup == "") || (audioGroup == QString()))
+ return false;
+
resmsg_t message;
memset(&message, 0, sizeof(resmsg_t));
- QByteArray ba = resourceSet->applicationClass().toLatin1();
+ QByteArray ba = audioGroup.toLatin1();
message.audio.group = ba.data();
message.audio.type = RESMSG_AUDIO;
@@ -441,8 +451,3 @@ void ResourceEngine::handleConnectionIsUp()
emit connectedToManager();
}
-void ResourceEngine::setMode(quint32 newMode)
-{
- mode = newMode;
-}
-
diff --git a/libresourceqt/src/resource-engine.h b/libresourceqt/src/resource-engine.h
index c966144..b1fec70 100644
--- a/libresourceqt/src/resource-engine.h
+++ b/libresourceqt/src/resource-engine.h
@@ -48,8 +48,6 @@ public:
void handleStatusMessage(quint32 requestNo);
void handleError(quint32 requestNo, qint32 code, const char *message);
- void setMode(quint32 newMode);
-
signals:
void resourcesBecameAvailable(quint32 bitmaskOfAvailableResources);
void resourcesGranted(quint32 bitmaskOfGrantedResources);
@@ -69,7 +67,7 @@ private:
resset_t *libresourceSet;
quint32 requestId;
QMap<quint32, resmsg_type_t> messageMap;
- quint32 mode;
+ quint32 connectionMode;
};
}
diff --git a/libresourceqt/src/resource-set.cpp b/libresourceqt/src/resource-set.cpp
index 3652939..bbb8d6e 100644
--- a/libresourceqt/src/resource-set.cpp
+++ b/libresourceqt/src/resource-set.cpp
@@ -174,14 +174,30 @@ QString ResourceSet::applicationClass()
return this->resourceClass;
}
-void ResourceSet::setAutoRelease()
+bool ResourceSet::setAutoRelease()
{
+ if(initialized)
+ return false;
autoRelease = true;
+ return true;
+}
+
+bool ResourceSet::willAutoRelease()
+{
+ return autoRelease;
}
-void ResourceSet::setAlwaysReply()
+bool ResourceSet::setAlwaysReply()
{
+ if(initialized)
+ return false;
alwaysReply = true;
+ return true;
+}
+
+bool ResourceSet::alwaysGetReply()
+{
+ return alwaysReply;
}
void ResourceSet::connectedHandler()