core: Re-Add X_MS_MediaReceiverRegistrar service
authorJens Georg <mail@jensge.org>
Mon, 8 Mar 2010 08:52:36 +0000 (09:52 +0100)
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Mon, 22 Mar 2010 14:38:09 +0000 (16:38 +0200)
This serice is needed for XBox360

data/xml/Makefile.am
data/xml/X_MS_MediaReceiverRegistrar1.xml [new file with mode: 0644]
src/rygel/Makefile.am
src/rygel/rygel-media-receiver-registrar.vala [new file with mode: 0644]
src/rygel/rygel-plugin.vala

index 1883aee..3963648 100644 (file)
@@ -3,7 +3,8 @@ xml_DATA = MediaServer2.xml \
           ContentDirectory.xml \
           ConnectionManager.xml \
           AVTransport2.xml \
-          RenderingControl2.xml
+          RenderingControl2.xml \
+          X_MS_MediaReceiverRegistrar1.xml
 
 xmldir = $(datadir)/rygel/xml
 
diff --git a/data/xml/X_MS_MediaReceiverRegistrar1.xml b/data/xml/X_MS_MediaReceiverRegistrar1.xml
new file mode 100644 (file)
index 0000000..c862c1d
--- /dev/null
@@ -0,0 +1,96 @@
+<?xml version="1.0"?>
+<scpd xmlns="urn:schemas-upnp-org:service-1-0">
+    <specVersion>
+        <major>1</major>
+        <minor>0</minor>
+    </specVersion>
+    <actionList>
+        <action>
+            <name>IsAuthorized</name>
+            <argumentList>
+                <argument>
+                    <name>DeviceID</name>
+                    <direction>in</direction>
+                    <relatedStateVariable>A_ARG_TYPE_DeviceID</relatedStateVariable>
+                </argument>
+                <argument>
+                    <name>Result</name>
+                    <direction>out</direction>
+                    <relatedStateVariable>A_ARG_TYPE_Result</relatedStateVariable>
+                </argument>
+            </argumentList>
+        </action>
+        <action>
+            <name>RegisterDevice</name>
+            <argumentList>
+                <argument>
+                    <name>RegistrationReqMsg</name>
+                    <direction>in</direction>
+                    <relatedStateVariable>A_ARG_TYPE_RegistrationReqMsg</relatedStateVariable>
+                </argument>
+                <argument>
+                    <name>RegistrationRespMsg</name>
+                    <direction>out</direction>
+                    <relatedStateVariable>A_ARG_TYPE_RegistrationRespMsg</relatedStateVariable>
+                </argument>
+            </argumentList>
+        </action>
+        <action>
+            <name>IsValidated</name>
+            <argumentList>
+                <argument>
+                    <name>DeviceID</name>
+                    <direction>in</direction>
+                    <relatedStateVariable>A_ARG_TYPE_DeviceID</relatedStateVariable>
+                </argument>
+                <argument>
+                    <name>Result</name>
+                    <direction>out</direction>
+                    <relatedStateVariable>A_ARG_TYPE_Result</relatedStateVariable>
+                </argument>
+            </argumentList>
+        </action>
+    </actionList>
+    <serviceStateTable>
+        <stateVariable>
+            <name>A_ARG_TYPE_DeviceID</name>
+            <sendEventsAttribute>no</sendEventsAttribute>
+            <dataType>string</dataType>
+        </stateVariable>
+        <stateVariable>
+            <name>A_ARG_TYPE_Result</name>
+            <sendEventsAttribute>no</sendEventsAttribute>
+            <dataType>int</dataType>
+        </stateVariable>
+        <stateVariable>
+            <name>A_ARG_TYPE_RegistrationReqMsg</name>
+            <sendEventsAttribute>no</sendEventsAttribute>
+            <dataType>bin.base64</dataType>
+        </stateVariable>
+        <stateVariable>
+            <name>A_ARG_TYPE_RegistrationRespMsg</name>
+            <sendEventsAttribute>no</sendEventsAttribute>
+            <dataType>bin.base64</dataType>
+        </stateVariable>
+        <stateVariable>
+            <name>AuthorizationGrantedUpdateID</name>
+            <sendEventsAttribute>no</sendEventsAttribute>
+            <dataType>ui4</dataType>
+        </stateVariable>
+        <stateVariable>
+            <name>AuthorizationDeniedUpdateID</name>
+            <sendEventsAttribute>no</sendEventsAttribute>
+            <dataType>ui4</dataType>
+        </stateVariable>
+        <stateVariable>
+            <name>ValidationSucceededUpdateID</name>
+            <sendEventsAttribute>no</sendEventsAttribute>
+            <dataType>ui4</dataType>
+        </stateVariable>
+        <stateVariable>
+            <name>ValidationRevokedUpdateID</name>
+            <sendEventsAttribute>no</sendEventsAttribute>
+            <dataType>ui4</dataType>
+        </stateVariable>
+    </serviceStateTable>
+</scpd>
index 37e9c84..395a8a3 100644 (file)
@@ -96,6 +96,7 @@ VAPI_SOURCE_FILES = rygel-configuration.vala \
                    rygel-metadata-extractor.vala \
                    rygel-media-db-container.vala \
                    rygel-media-db-object-factory.vala \
+                   rygel-media-receiver-registrar.vala \
                    rygel-log-handler.vala
 
 rygel_VALAFLAGS = \
diff --git a/src/rygel/rygel-media-receiver-registrar.vala b/src/rygel/rygel-media-receiver-registrar.vala
new file mode 100644 (file)
index 0000000..3772c21
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2008 Zeeshan Ali <zeenix@gmail.com>.
+ *
+ * Author: Zeeshan Ali <zeenix@gmail.com>
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+using GUPnP;
+
+/**
+ * Basic implementation of MS MediaReceiverRegistrar service version 1.
+ */
+public class Rygel.MediaReceiverRegistrar: Service {
+    public const string UPNP_ID =
+                    "urn:microsoft.com:serviceId:X_MS_MediaReceiverRegistrar";
+    public const string UPNP_TYPE =
+                    "urn:microsoft.com:service:X_MS_MediaReceiverRegistrar:1";
+    public const string DESCRIPTION_PATH =
+                    "xml/X_MS_MediaReceiverRegistrar1.xml";
+
+    public override void constructed () {
+        this.action_invoked["IsAuthorized"] += this.is_authorized_cb;
+        this.action_invoked["IsValidated"] += this.is_authorized_cb;
+        this.action_invoked["RegisterDevice"] += this.register_device_cb;
+    }
+
+    /* IsAuthorized and IsValided action implementations (fake) */
+    private void is_authorized_cb (MediaReceiverRegistrar registrar,
+                                   owned ServiceAction    action) {
+        action.set ("Result", typeof (int), 1);
+
+        action.return ();
+    }
+
+    private void register_device_cb (MediaReceiverRegistrar registrar,
+                                     owned ServiceAction    action) {
+        action.set ("RegistrationRespMsg",
+                    typeof (string),
+                    "WhatisSupposedToBeHere");
+
+        action.return ();
+    }
+}
index fa7dc8d..de0f93a 100644 (file)
@@ -78,6 +78,12 @@ public class Rygel.Plugin : GUPnP.ResourceFactory {
                                           ConnectionManager.UPNP_TYPE,
                                           ConnectionManager.DESCRIPTION_PATH,
                                           typeof (SourceConnectionManager));
+
+        this.add_resource (resource_info);
+        resource_info = new ResourceInfo (MediaReceiverRegistrar.UPNP_ID,
+                                       MediaReceiverRegistrar.UPNP_TYPE,
+                                       MediaReceiverRegistrar.DESCRIPTION_PATH,
+                                       typeof (MediaReceiverRegistrar));
         this.add_resource (resource_info);
     }