diff options
author | Zeeshan Ali (Khattak) <zeeshanak@gnome.org> | 2010-02-18 19:41:08 +0200 |
---|---|---|
committer | Zeeshan Ali (Khattak) <zeeshanak@gnome.org> | 2010-02-18 19:52:36 +0200 |
commit | f90245774fe9fa8fc08d2fd088dd4b65f6b633ca (patch) | |
tree | 8ffdcb48718fd95f8ebc84a3bae6ba1e64d7a688 | |
parent | 7f5527effae18f7d8262e915ac8ad4ca3f5dee77 (diff) | |
download | rygel-f90245774fe9fa8fc08d2fd088dd4b65f6b633ca.tar.gz |
core: Implement GetTransferProgress action of CDS
-rw-r--r-- | data/xml/ContentDirectory.xml | 70 | ||||
-rw-r--r-- | src/rygel/rygel-content-directory.vala | 33 |
2 files changed, 68 insertions, 35 deletions
diff --git a/data/xml/ContentDirectory.xml b/data/xml/ContentDirectory.xml index 32741041..728cfe35 100644 --- a/data/xml/ContentDirectory.xml +++ b/data/xml/ContentDirectory.xml @@ -125,14 +125,6 @@ feature provided by your editor. <dataType>string</dataType> </stateVariable> -<!-- Optional state variables that are not implemented yet - <stateVariable> - <Optional/> - <name>SortExtensionCapabilities</name> - <sendEventsAttribute>no</sendEventsAttribute> - <dataType>string</dataType> - </stateVariable> - <stateVariable> <Optional/> <name>A_ARG_TYPE_TransferStatus</name> @@ -160,6 +152,14 @@ feature provided by your editor. <dataType>string</dataType> </stateVariable> +<!-- Optional state variables that are not implemented yet + <stateVariable> + <Optional/> + <name>SortExtensionCapabilities</name> + <sendEventsAttribute>no</sendEventsAttribute> + <dataType>string</dataType> + </stateVariable> + <stateVariable> <Optional/> <name>A_ARG_TYPE_TagValueList</name> @@ -377,6 +377,33 @@ feature provided by your editor. </argumentList> </action> + <action> + <Optional/> + <name>GetTransferProgress</name> + <argumentList> + <argument> + <name>TransferID</name> + <direction>in</direction> + <relatedStateVariable>A_ARG_TYPE_TransferID</relatedStateVariable> + </argument> + <argument> + <name>TransferStatus</name> + <direction>out</direction> + <relatedStateVariable>A_ARG_TYPE_TransferStatus</relatedStateVariable> + </argument> + <argument> + <name>TransferLength</name> + <direction>out</direction> + <relatedStateVariable>A_ARG_TYPE_TransferLength</relatedStateVariable> + </argument> + <argument> + <name>TransferTotal</name> + <direction>out</direction> + <relatedStateVariable>A_ARG_TYPE_TransferTotal</relatedStateVariable> + </argument> + </argumentList> + </action> + <!-- Optional actions that are not implemented yet <action> <Optional/> @@ -494,33 +521,6 @@ feature provided by your editor. <action> <Optional/> - <name>GetTransferProgress</name> - <argumentList> - <argument> - <name>TransferID</name> - <direction>in</direction> - <relatedStateVariable>A_ARG_TYPE_TransferID</relatedStateVariable> - </argument> - <argument> - <name>TransferStatus</name> - <direction>out</direction> - <relatedStateVariable>A_ARG_TYPE_TransferStatus</relatedStateVariable> - </argument> - <argument> - <name>TransferLength</name> - <direction>out</direction> - <relatedStateVariable>A_ARG_TYPE_TransferLength</relatedStateVariable> - </argument> - <argument> - <name>TransferTotal</name> - <direction>out</direction> - <relatedStateVariable>A_ARG_TYPE_TransferTotal</relatedStateVariable> - </argument> - </argumentList> - </action> - - <action> - <Optional/> <name>CreateReference</name> <argumentList> <argument> diff --git a/src/rygel/rygel-content-directory.vala b/src/rygel/rygel-content-directory.vala index 2b439da0..049b7cd8 100644 --- a/src/rygel/rygel-content-directory.vala +++ b/src/rygel/rygel-content-directory.vala @@ -103,6 +103,8 @@ public class Rygel.ContentDirectory: Service { this.action_invoked["Search"] += this.search_cb; this.action_invoked["CreateObject"] += this.create_object_cb; this.action_invoked["ImportResource"] += this.import_resource_cb; + this.action_invoked["GetTransferProgress"] += + this.get_transfer_progress_cb; this.query_variable["TransferIDs"] += this.query_transfer_ids; @@ -184,6 +186,37 @@ public class Rygel.ContentDirectory: Service { value.set_string (this.create_transfer_ids ()); } + /* GetTransferProgress action implementation */ + private virtual void get_transfer_progress_cb ( + ContentDirectory content_dir, + owned ServiceAction action) { + uint32 transfer_id; + + action.get ("TransferID", + typeof (uint32), + out transfer_id); + + foreach (var import in this.active_imports) { + if (import.transfer_id == transfer_id) { + action.set ("TransferStatus", + typeof (string), + import.status_as_string, + "TransferLength", + typeof (int64), + import.bytes_copied, + "TransferTotal", + typeof (int64), + import.bytes_total); + action.return (); + + return; + } + } + + // Reaching here means we didn't find the transfer of interest + action.return_error (717, "No such file transfer"); + } + /* GetSystemUpdateID action implementation */ private void get_system_update_id_cb (ContentDirectory content_dir, owned ServiceAction action) { |