Actionlist

Nov 6, 2013 at 1:25 AM
First, I want to say "THANK YOU" for such a nice piece of work!

I am currently working on a C# project that connects to my Smart TV. (Sony Bravia)
I have found all kinds of sample code written in Python and Ruby, so finding this library was a God Send!

My 1st question is this:
Available on Network Interface IP Addresses: 
  fe80::8147:4d99:d992:6904%13
  192.168.0.2

Device: BRAVIA55 (urn:schemas-upnp-org:device:MediaRenderer:1) (UDN:uuid:00000000-0000-1010-8000-F0BF97F535B0)
( 
    dlna:X_DLNADOC = 'DMR-1.50', 
    av:X_MaxBGMCount = '64', 
    av:X_StandardDMR = '1.1', 
    av:X_IRCCCode = 'AAAAAQAAAAEAAAAvAw==', 
    pnpx:X_compatibleId = 'MS_DigitalMediaDeviceClass_DMR_V001', 
    pnpx:X_deviceCategory = 'MediaDevices', 
    pnpx:X_hardwareId = 'VEN_0033&DEV_0006&REV_01', 
    df:X_deviceCategory = 'Display.TV Multimedia.DMR', 
    av:X_IRCC_Version = '1.0', 
    av:X_CategoryInfo = 'AAIAAACk', 
    av:X_UNR_Version = '1.2', 
    av:X_CERS_ActionList_URL = 'http://192.168.0.15:80/cers/ActionList.xml', 
    av:X_S2MTV_Version = '1.0', 
    av:X_S2MTV_BaseURL = 'http://192.168.0.15:80/s2mtv'
)
{
    Service: urn:upnp-org:serviceId:RenderingControl (urn:schemas-upnp-org:service:RenderingControl:1)
    Service: urn:upnp-org:serviceId:ConnectionManager (urn:schemas-upnp-org:service:ConnectionManager:1)
    Service: urn:upnp-org:serviceId:AVTransport (urn:schemas-upnp-org:service:AVTransport:1)
    Service: urn:schemas-sony-com:serviceId:IRCC (urn:schemas-sony-com:service:IRCC:1)
In the above snip, you will see a url to the ActionList.XML.

it contains the following information:
<actionList>
<action name="register" mode="2" url="http://192.168.0.15:80/cers/api/register"/>
<action name="getText" url="http://192.168.0.15:80/cers/api/getText"/>
<action name="sendText" url="http://192.168.0.15:80/cers/api/sendText"/>
<action name="getSystemInformation" url="http://192.168.0.15:80/cers/api/getSystemInformation"/>
<action name="getRemoteCommandList" url="http://192.168.0.15:80/cers/api/getRemoteCommandList"/>
<action name="getStatus" url="http://192.168.0.15:80/cers/api/getStatus"/>
<action name="BgmSearch::search" url="http://192.168.0.15:80/BgmSearch/search"/>
</actionList>
I'm pretty sure these are needed in order to Register the device and retrieve the Command list from the device.

Using your "Managed UPnP Test" I see where everything else is found (Services, State variables and such), but nowhere do I see where it gets the information to create the methods contained in the action list.

Am I going about this wrong or am I not using the correct way to obtain the information??
Nov 15, 2013 at 12:28 AM
Edited Nov 15, 2013 at 12:29 AM
The best way i've found for enumerating the available actions is like so (c# example, should be easy enough to convert into vb.net if that's what you are using):
using ManagedUPnP.Descriptions;

foreach (Service svc in device.Services)
            {
                //...do something with the service...
                foreach (ActionDescription action in svc.Description().Actions.Values)
                {
                    //...do something with the with the action
                }
            }
also, something that took me a while to work out, to get the unusedproperties for the root device, including "av:X_CERS_ActionList_URL = 'http://192.168.0.15:80/cers/ActionList.xml'", you can use:
IEnumerable<KeyValuePair<string, string>> lhsUnused = dev.GetDescription(dev.RootDeviceDescription()).GetUnusedProperties();
                foreach (KeyValuePair<string, string> prop in lhsUnused)
                {
                    if (prop.Key == "av:X_CERS_ActionList_URL")
                    {
                        //do something
                    }
                }
Coordinator
Nov 15, 2013 at 1:01 PM
Edited Nov 15, 2013 at 1:02 PM
Hello KHerron,

First of all I would like to apologise for not getting to your question earlier, I either missed it in my email or did not receive the notification.

The action list you are referring to is not a standard UPnP action list, but rather appears to be some sort of DLNA specific action list, this is why the Framework does not support parsing it by default, you will need to parse this action list and process it yourself, the true UPnP action lists are defined on a UPnP Service description document using the structure defined in this document:

http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf

At page number 50.

As you can see from the document an action list is described in a service description document which looks much like this:
<?xml version="1.0"?>
<scpd xmlns="urn:schemas-upnp-org:service-1-0">
<specVersion>
    <major>1</major>
    <minor>0</minor>
</specVersion>
<actionList>
    <action>
        <name>SetDefaultConnectionService</name>
        <argumentList>
            <argument>
            <name>NewDefaultConnectionService</name>
            <direction>in</direction>
            <relatedStateVariable>DefaultConnectionService</relatedStateVariable>
            </argument>
        </argumentList>
    </action>
    <action>
        <name>GetDefaultConnectionService</name>
        <argumentList>
            <argument>
            <name>NewDefaultConnectionService</name>
            <direction>out</direction>
            <relatedStateVariable>DefaultConnectionService</relatedStateVariable>
            </argument>
        </argumentList>
    </action>
</actionList>
<serviceStateTable>
    <stateVariable sendEvents="yes">
        <name>DefaultConnectionService</name>
        <dataType>string</dataType>
    </stateVariable>
</serviceStateTable>
</scpd>
This is a totally different thing to the DLNA specific action lists you have found in your DLNA device and is out of scope of the UPnP framework, however, if you do write code to pass it feel free to create your own CodePlex project so that people may benefit from your experience.

I will admit I have not had the time to determine how DLNA devices describe their capabilities, but this does seem like a nice way for them to do it! :)

As dominicskey has pointed out, the way to get access to non-standard device properties is to use the GetUnusedProperties method, this method will find all non-standard and unused properties and return them so you can process them.

Kind Regards,
TheToid