0

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;
}
hairboat
  • 650
  • 19
  • 29

1 Answers1

1

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?

Pavel Zdenek
  • 7,146
  • 1
  • 23
  • 38
  • Thanks for your answer, i added the log of the event... thx FTZ – user1386639 Nov 04 '12 at 00:18
  • So i was right about the `Volume`. The log refers to it 3 times without ever mentioning the `channel` property, which means that the 3 values are stored in the same NSDictionary key (overwriting the previous value). The incorrect `InstanceID` seems to be somehow connected to this overwriting, as it gets the same value. I don't have time to study the upnpx code. But it's definitely a bug in there and a Defect should be filled at upnpx site. – Pavel Zdenek Nov 04 '12 at 21:37
  • Hi Pavel, thanks for your evaluation of the problem!! I will fill an issue at upnpx group. – user1386639 Nov 04 '12 at 22:14
  • Thanking on Stack Overflow = upvoting and/or accepting the answer :) – Pavel Zdenek Nov 05 '12 at 09:03