[rygel/wip/track-changes: 9/18] server: Implement ServiceResetToken
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel/wip/track-changes: 9/18] server: Implement ServiceResetToken
- Date: Mon, 22 Oct 2012 08:47:25 +0000 (UTC)
commit dcdaf086769f0db35adb55359fe58798f00331e7
Author: Jens Georg <jensg openismus com>
Date: Thu Oct 11 16:04:44 2012 +0200
server: Implement ServiceResetToken
Currently it appears as if the server did a Service Reset Procedure
(cf. UPnP-av-ContentDirectory-v3-Service.pdf, Section 2.3.7.1, pg 51) when it
was shut down.
data/xml/ContentDirectory.xml.in | 18 ++++++++++++++++
src/librygel-core/uuid.vapi | 10 +++++++++
src/librygel-server/rygel-content-directory.vala | 24 ++++++++++++++++++++++
3 files changed, 52 insertions(+), 0 deletions(-)
---
diff --git a/data/xml/ContentDirectory.xml.in b/data/xml/ContentDirectory.xml.in
index 1d8ba50..2e156c4 100644
--- a/data/xml/ContentDirectory.xml.in
+++ b/data/xml/ContentDirectory.xml.in
@@ -25,6 +25,11 @@
<dataType>string</dataType>
</stateVariable>
+ <stateVariable sendEvents="no">
+ <name>ServiceResetToken</name>
+ <dataType>string</dataType>
+ </stateVariable>
+
<stateVariable sendEvents="yes">
<name>LastChange</name>
<dataType>string</dataType>
@@ -156,6 +161,19 @@
</action>
<action>
+ <name>GetServiceResetToken</name>
+ <argumentList>
+ <argument>
+ <name>ResetToken</name>
+ <direction>out</direction>
+ <relatedStateVariable>
+ ServiceResetToken
+ </relatedStateVariable>
+ </argument>
+ </argumentList>
+ </action>
+
+ <action>
<name>GetFeatureList</name>
<argumentList>
<argument>
diff --git a/src/librygel-core/uuid.vapi b/src/librygel-core/uuid.vapi
index 1279ccc..914ebaf 100644
--- a/src/librygel-core/uuid.vapi
+++ b/src/librygel-core/uuid.vapi
@@ -4,4 +4,14 @@ namespace UUID {
public static void unparse ([CCode (array_length = false)] uchar[] uuid,
[CCode (array_length = false)] uchar[] output);
+ public static string get () {
+ var id = new uchar[16];
+ var unparsed = new uchar[51];
+
+ UUID.generate (id);
+ UUID.unparse (id, unparsed);
+ unparsed[50] = '\0';
+
+ return (string) unparsed;
+ }
}
diff --git a/src/librygel-server/rygel-content-directory.vala b/src/librygel-server/rygel-content-directory.vala
index 93c8aa8..bfa3f7c 100644
--- a/src/librygel-server/rygel-content-directory.vala
+++ b/src/librygel-server/rygel-content-directory.vala
@@ -74,6 +74,8 @@ internal class Rygel.ContentDirectory: Service {
private LastChange last_change;
+ private string service_reset_token;
+
public override void constructed () {
this.cancellable = new Cancellable ();
@@ -100,6 +102,8 @@ internal class Rygel.ContentDirectory: Service {
"http://www.upnp.org/schemas/av/avs-v1-20060531.xsd\">" +
"</Features>";
+ this.service_reset_token = UUID.get ();
+
this.action_invoked["Browse"].connect (this.browse_cb);
this.action_invoked["Search"].connect (this.search_cb);
this.action_invoked["CreateObject"].connect (this.create_object_cb);
@@ -140,6 +144,12 @@ internal class Rygel.ContentDirectory: Service {
/* Connect LastChange related signals */
this.query_variable["LastChange"].connect (this.query_last_change);
+ /* Connect ServiceResetToken related signals */
+ this.query_variable["ServiceResetToken"].connect
+ (this.query_service_reset_token);
+ this.action_invoked["GetServiceResetToken"].connect
+ (this.get_service_reset_token_cb);
+
this.http_server.run.begin ();
}
@@ -540,4 +550,18 @@ internal class Rygel.ContentDirectory: Service {
this.last_change.add_event (entry);
}
+
+ /* ServiceResetToken */
+ private void get_service_reset_token_cb (Service content_dir,
+ ServiceAction action) {
+ action.set ("ResetToken", typeof (string), this.service_reset_token);
+ action.return ();
+ }
+
+ private void query_service_reset_token (Service content_dir,
+ string variable,
+ ref GLib.Value value) {
+ value.init (typeof (string));
+ value.set_string (this.service_reset_token);
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]