OpenHome Forum
Unable to get any device attributes. - Printable Version

+- OpenHome Forum (http://forum.openhome.org)
+-- Forum: OpenHome (/forumdisplay.php?fid=1)
+--- Forum: Net (/forumdisplay.php?fid=5)
+--- Thread: Unable to get any device attributes. (/showthread.php?tid=1025)



Unable to get any device attributes. - dough - 05-07-2012 09:22 AM

Using the C API, I have tried calling CpDeviceCGetAttribute() function with all of the following keys.

"friendlyName"
"location"
"deviceXml"

On each call, the function returns 0, which according to comments in CpDevice.h means: "...it was not available".

Perhaps some of the attributes are genuinely not available for the devices I discovered, but I find it hard to believe that there is no XML device description!

Is there another way to get a device's attributes using the C API?
Also, is it possible to get other device attributes like Manufacturer, IP Address, Icon etc?

Doug


RE: Unable to get any device attributes. - simonc - 05-07-2012 09:48 AM

(05-07-2012 09:22 AM)dough Wrote:  Using the C API, I have tried calling CpDeviceCGetAttribute() function with all of the following keys.

"friendlyName"
"location"
"deviceXml"

On each call, the function returns 0, which according to comments in CpDevice.h means: "...it was not available".

Perhaps some of the attributes are genuinely not available for the devices I discovered, but I find it hard to believe that there is no XML device description!

You can query the following attributes:
  • "Upnp.Location"
  • "Upnp.DeviceXml"
  • "Upnp.FriendlyName"
  • "Upnp.PresentationUrl"

(05-07-2012 09:22 AM)dough Wrote:  Is there another way to get a device's attributes using the C API?
Also, is it possible to get other device attributes like Manufacturer, IP Address, Icon etc?

Attributes other than above can be retrieved by getting "Upnp.DeviceXml" then parsing the xml returned. (This may seem odd but is probably more efficient. ohNet uses a pretty rudimentary xml parser; apps targetting a particular platform will typically have access to far more efficient/capable parsers.)