Question

i´m testing upnpx Library to control a sonos multi room audio system... working quit well. I have just one main problem with events. If i get an volume change event from sonos renderer, like this

<Event xmlns="urn:schemas-upnp-org:metadata-1-0/RCS/"><InstanceID val="0"><Volume channel="Master" val="66"/><Volume channel="LF" val="100"/><Volume channel="RF" val="100"/></InstanceID></Event>

i´m getting not the hole event and wrong values in
-(void)UPnPEvent:(BasicUPnPService*)sender events:(NSDictionary*)events{

InstanceID = 100; Volume = 100;

it should be ...

InstanceID = 0; Volume = 66;

I would be very happy if someone could advise me into the right direction!

Best regards FTZ

upnpxdemo[66489:1310b] BasicParser.h didStartElement: propertyset

upnpxdemo[66489:1310b] BasicParser.h didStartElement: property

upnpxdemo[66489:1310b] BasicParser.h didStartElement: LastChange

upnpxdemo[66489:1310b] BasicParser.h didEndElement: LastChange, obj: <Event xmlns="urn:schemas-upnp-org:metadata-1-0/RCS/"><InstanceID val="0"><Volume channel="Master" val="52"/><Volume channel="LF" val="100"/><Volume channel="RF" val="100"/></InstanceID></Event>

upnpxdemo[66489:1310b] LastChange - element:LastChange, value:<Event xmlns="urn:schemas-upnp-org:metadata-1-0/RCS/"><InstanceID val="0"><Volume channel="Master" val="52"/><Volume channel="LF" val="100"/><Volume channel="RF" val="100"/></InstanceID></Event>

upnpxdemo[66489:1310b] BasicParser.h didStartElement: Event

upnpxdemo[66489:1310b] BasicParser.h didStartElement: InstanceID

upnpxdemo[66489:1310b] BasicParser.h didStartElement: Volume

upnpxdemo[66489:1310b] LastChangeParser.h void propertyName name:Volume value:52

upnpxdemo[66489:1310b] BasicParser.h didStartElement: Volume

upnpxdemo[66489:1310b] LastChangeParser.h void propertyName name:Volume value:100

upnpxdemo[66489:1310b] BasicParser.h didStartElement: Volume

upnpxdemo[66489:1310b] LastChangeParser.h void propertyName name:Volume value:100

upnpxdemo[66489:1310b] LastChangeParser.h void propertyName name:InstanceID value:100

upnpxdemo[66489:1310b] Event Digctionary: {
    InstanceID = 100;
    Volume = 100;
}
Was it helpful?

Solution

The event is correct. I downloaded upnpx source but could not readily understand the BasicParser and UPnPEventParser logic - i worked in Objective-C only for so long. I wonder how is upnpx accounting for the fact that you can have multiple values for the same key, different only by channel attribute. It's an exception in the naming convention for LastChange event, the keys are generally unique. The last Volume present in the event is 100, so upnpx is perhaps replacing value for Volume key all the time.

It does not explain the InstanceID misnumbering though. Are you sure you got that one right? Can you post a full dump of the events NSDictionary?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top