aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/upnp/Discovery.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-26 15:04:56 +0100
committerMax Kellermann <max@duempel.org>2014-01-26 15:04:56 +0100
commitbcc1f933702770c276e7353d71cb0c5fff75bc4a (patch)
treea7251a557d441353fcc630a8eba67b1e1c695efe /src/lib/upnp/Discovery.hxx
parentb161d723269d851a2d237880b8f5149b58b736c2 (diff)
downloadmpd-bcc1f933702770c276e7353d71cb0c5fff75bc4a.tar.gz
mpd-bcc1f933702770c276e7353d71cb0c5fff75bc4a.tar.xz
mpd-bcc1f933702770c276e7353d71cb0c5fff75bc4a.zip
upnp: add class UpnpCallback
Each Upnp*Async() call passes a new cookie pointer, and the cookie passed to UpnpRegisterClient() appears to be ignored. Using this interface is a more elegant approach than having one single "handler" function.
Diffstat (limited to '')
-rw-r--r--src/lib/upnp/Discovery.hxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/upnp/Discovery.hxx b/src/lib/upnp/Discovery.hxx
index 3208f8727..1a126edfd 100644
--- a/src/lib/upnp/Discovery.hxx
+++ b/src/lib/upnp/Discovery.hxx
@@ -20,6 +20,7 @@
#ifndef _UPNPPDISC_H_X_INCLUDED_
#define _UPNPPDISC_H_X_INCLUDED_
+#include "Callback.hxx"
#include "Device.hxx"
#include "WorkQueue.hxx"
#include "thread/Mutex.hxx"
@@ -46,7 +47,7 @@ public:
* We are only interested in MediaServers with a ContentDirectory service
* for now, but this could be made more general, by removing the filtering.
*/
-class UPnPDeviceDirectory {
+class UPnPDeviceDirectory final : UpnpCallback {
/**
* Each appropriate discovery event (executing in a libupnp thread
* context) queues the following task object for processing by the
@@ -154,6 +155,9 @@ private:
int OnAlive(Upnp_Discovery *disco);
int OnByeBye(Upnp_Discovery *disco);
int cluCallBack(Upnp_EventType et, void *evp);
+
+ /* virtual methods from class UpnpCallback */
+ virtual int Invoke(Upnp_EventType et, void *evp) override;
};