summaryrefslogtreecommitdiff
path: root/libresourceqt
diff options
context:
space:
mode:
Diffstat (limited to 'libresourceqt')
-rw-r--r--libresourceqt/include/qt4/policy/resource-set.h3
-rw-r--r--libresourceqt/src/resource-engine.cpp10
-rw-r--r--libresourceqt/src/resource-set.cpp10
3 files changed, 15 insertions, 8 deletions
diff --git a/libresourceqt/include/qt4/policy/resource-set.h b/libresourceqt/include/qt4/policy/resource-set.h
index 4943c35..710dc7d 100644
--- a/libresourceqt/include/qt4/policy/resource-set.h
+++ b/libresourceqt/include/qt4/policy/resource-set.h
@@ -82,7 +82,8 @@ public:
* application.
* \param parent The optional parent of of this class.
*/
- ResourceSet(const QString &applicationClass, QObject *parent = NULL);
+ ResourceSet(const QString &applicationClass, QObject *parent = NULL,
+ bool alwaysReply = false, bool autoRelease = false);
/**
* The destructor
*/
diff --git a/libresourceqt/src/resource-engine.cpp b/libresourceqt/src/resource-engine.cpp
index 47ec436..e040562 100644
--- a/libresourceqt/src/resource-engine.cpp
+++ b/libresourceqt/src/resource-engine.cpp
@@ -207,8 +207,8 @@ static void handleAdviceMessage(resmsg_t *message, resset_t *libresourceSet, voi
void ResourceEngine::receivedAdvice(resmsg_notify_t *message)
{
- qDebug("ResourceEngine(%d) - %s: %04x", identifier, __FUNCTION__, message->resrc);
uint32_t allResources = allResourcesToBitmask(resourceSet);
+ qDebug("ResourceEngine(%d) - %s: have: %02x got %02x", identifier, __FUNCTION__, allResources, message->resrc);
if(message->resrc < allResources) {
emit resourcesLost(allResources-message->resrc);
}
@@ -296,8 +296,11 @@ static inline quint32 allResourcesToBitmask(const ResourceSet *resourceSet)
QList<Resource *> resourceList = resourceSet->resources();
quint32 bitmask = 0;
for (int i = 0; i < resourceList.size(); i++) {
- bitmask += resourceTypeToLibresourceType(resourceList[i]->type());
+ quint32 bits = resourceTypeToLibresourceType(resourceList[i]->type());
+ qDebug("Converted Resource 0x%02x to 0x%02x", resourceList[i]->type(), bits);
+ bitmask += bits;
}
+ qDebug("All resources as bitmask is 0x%04x", bitmask);
return bitmask;
}
@@ -331,7 +334,8 @@ quint32 ResourcePolicy::resourceTypeToLibresourceType(ResourceType type)
case HeadsetButtonsType:
return RESMSG_HEADSET_BUTTONS;
default:
- return 0;
+ qDebug("Unknown resource Type %d", quint32(type));
+ return 0xffff;
}
}
diff --git a/libresourceqt/src/resource-set.cpp b/libresourceqt/src/resource-set.cpp
index b5d3de2..f5faade 100644
--- a/libresourceqt/src/resource-set.cpp
+++ b/libresourceqt/src/resource-set.cpp
@@ -4,11 +4,12 @@ using namespace ResourcePolicy;
static quint32 resourceSetId=1;
-ResourceSet::ResourceSet(const QString &applicationClass, QObject * parent)
+ResourceSet::ResourceSet(const QString &applicationClass, QObject * parent,
+ bool initialAlwaysReply, bool initialAutoRelease)
: QObject(parent), resourceClass(applicationClass), resourceEngine(NULL),
- audioResource(NULL), autoRelease(false), alwaysReply(false),
- initialized(false), pendingAcquire(false), pendingUpdate(false),
- pendingAudioProperties(false)
+ audioResource(NULL), autoRelease(initialAutoRelease),
+ alwaysReply(initialAlwaysReply), initialized(false), pendingAcquire(false),
+ pendingUpdate(false), pendingAudioProperties(false)
{
identifier = resourceSetId++;
memset(resourceSet, 0, sizeof(QPointer<Resource *>)*NumberOfTypes);
@@ -378,6 +379,7 @@ void ResourceSet::handleReleased()
resourceSet[i]->unsetGranted();
}
}
+ qDebug("ResourceSet(%d) - resourcesReleased!", identifier);
emit resourcesReleased();
}