summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Georg <mail@jensge.org>2021-02-14 15:37:12 +0100
committerJens Georg <mail@jensge.org>2021-02-14 15:48:24 +0100
commitd22620045084277d5f5c516089c3418dd3f8a453 (patch)
tree8829fb4341d551bf3b624b5f5de6047d87c6dc5f
parent335e64f75c7b8015034a3e50e011408e13ab66f1 (diff)
downloadgupnp-d22620045084277d5f5c516089c3418dd3f8a453.tar.gz
examples: Update get-volume.js to use new API
-rwxr-xr-xexamples/get-volume.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/examples/get-volume.js b/examples/get-volume.js
index 81b1345..b8118f9 100755
--- a/examples/get-volume.js
+++ b/examples/get-volume.js
@@ -29,25 +29,25 @@
imports.gi.versions.GUPnP = "1.2"
const Mainloop = imports.mainloop;
+const GObject = imports.gi.GObject;
const GUPnP = imports.gi.GUPnP;
-const CONTENT_DIR = "urn:schemas-upnp-org:service:RenderingControl:2";
+const CONTENT_DIR = "urn:schemas-upnp-org:service:RenderingControl:1";
function _on_ready () {
}
function _on_sp_available (cp, proxy) {
- print ("Got Proxy");
- for (var i = 0; i < 1000; ++i) {
- proxy.send_action_list ("GetVolume",
- ["InstanceId", "Channel"],
- [0, 0],
- [],
- []);
+ print ("Got Proxy ", proxy.get_location());
+ for (let i = 0; i < 1000; ++i) {
+ let action = GUPnP.ServiceProxyAction.new_from_list("GetVolume", ["InstanceId", "Channel"], [0, 0]);
+ proxy.call_action(action, null);
+ let [success, result] = action.get_result_list(["CurrentVolume"], [GObject.TYPE_FLOAT]);
+ print(result);
}
}
-var context = new GUPnP.Context ( {'interface': "lo"});
+var context = new GUPnP.Context ( {'interface': "wlp3s0"});
context.init(null);
var cp = new GUPnP.ControlPoint ( {'client': context, 'target' : CONTENT_DIR});
cp.connect ("service-proxy-available", _on_sp_available);