Get Specific Property from a Service

Oct 3, 2014 at 7:39 PM
I have a description file that describes a service as below:
<service>
<serviceType>urn:schemas-sony-com:service:IRCC:1</serviceType>
<serviceId>urn:schemas-sony-com:serviceId:IRCC</serviceId>
<SCPDURL>/IRCCSCPD.xml</SCPDURL>
<controlURL>/upnp/control/IRCC</controlURL>
<eventSubURL>/</eventSubURL>
</service>
How do you retrieve a value on one of the service properties.
I need to get the value of <controlURL>, <SCPDURL> and <eventSubURL>

Can't figure out how to find or retrieve them??
Coordinator
Oct 4, 2014 at 2:02 PM
Edited Oct 4, 2014 at 3:06 PM
Hey KHerron,

This should be accessible by getting the DeviceServiceDescription object for the service (using lsService.DeviceServiceDescription() ), for example:

DeviceServiceDescription ldsdDescription = lsService.DeviceServiceDescription(lsService.Device.RootDeviceDescription());

ldsdServiceDescription.SCPDURL
ldsdServiceDescription.controlURL
ldsdServiceDescription.eventSubURL

Of course you will then have to determine if the URLs are relative or absolute URLs and prepend the device URL if needed (in your devices case it is using relative paths, but some devices will use absolute paths). Have a look in the GetDescription method of the DeviceServiceDescription on how to do this (using the URLBase method).

When I get some spare time to enhance the API framework I will add this functionality.

This is all off of the top of my head, so please let me know if you have troubles.

Thanks!
Oct 5, 2014 at 1:51 PM
Thank you for the quick response.

This works great. The only think I had to change was this:

foundVal1 = ldsdDescription.GetPropertyString("SCPDURL");
foundVal2 = ldsdDescription.GetPropertyString("controlURL");
foundVal3 = ldsdDescription.GetPropertyString("eventSubURL");

No square brackets.

Thank AGAIN!!!
Coordinator
Oct 5, 2014 at 10:31 PM
No problem KHerrorn.

Sorry yes, for some reason I was thinking they were a property array! :)

Cheers.