[coherence-dev] Help with Subscription
Frank Scholz
fs at beebits.net
Mon Apr 13 11:34:13 CEST 2009
Hi Taj,
> I'm acquainting myself with the Coherence codebase by writing a simple
> av control point GUI with PyQt.
very nice!
> At the moment I am able to read and control various variables for
> rendering control and AV transport. However I am still having trouble
> understanding how subscriptions work.
Event subscription, and therefor updating of StateVariables, is handled
differently in Coherence core and in the ControlPoint instance.
The core takes care only about the existence of devices and services,
as the ControlPoint - if told so - automatically subscribes to
these services and creates convenience client classes.
The Inspector is a special case, as it is supposed to handle
devices which aren't known to Coherence yet or don't have any
UPnP specification at all. It fires up a ControlPoint instance
but instructs it to not auto-create any clients and subscriptions.
self.controlpoint = ControlPoint(self.coherence,auto_client=[])
(http://coherence.beebits.net/browser/trunk/UPnP-Inspector/upnp_inspector/base.py#L38)
The Inspector now activates event subscription by itself:
for service in device.services:
service.subscribe()
(http://coherence.beebits.net/browser/trunk/UPnP-Inspector/upnp_inspector/devices.py#L390)
That 'service.subscribe()' is probably missing on your side.
But if you are 'only' interested in UPnP A/V devices you might be better
of with activating just a ControlPoint like this:
ControlPoint(coherence,auto_client=['MediaServer','MediaRenderer'])
(http://coherence.beebits.net/wiki/Examples)
> 2) Regarding state variable values:
>
> service = self.device.get_service_by_type('AVTransport')
> variable = service.get_state_variable('TransportState', instance=0)
> print variable.value
>
> In this case here, value is always coming back empty. Is this also an
> async call, how do I listen for the result?
the moment we have Event subscription activated these variables are
filled with values.
Regards,
Frank
More information about the coherence-dev
mailing list