X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=scripts%2Fafm-util;h=9df5284c312907a210a91c97e708f7d2142f44f7;hb=d6d9ef2d710c266b1b6247875a4f69d2ecac4018;hp=f5da0e1e52dfec8537bb032de043536990b25650;hpb=4ce25d0ddbcfe1111f0adbf63b4d73f19e926d8b;p=src%2Fapp-framework-main.git diff --git a/scripts/afm-util b/scripts/afm-util index f5da0e1..9df5284 100755 --- a/scripts/afm-util +++ b/scripts/afm-util @@ -1,11 +1,25 @@ #!/bin/sh if [ "x" = "x${DBUS_SESSION_BUS_ADDRESS}" ]; then - DBUS_SESSION_BUS_ADDRESS:=unix:path=/run/user/$UID/bus + DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$UID/bus" fi +export DBUS_SESSION_BUS_ADDRESS + +pretty() { + sed \ + -e '/^method return .*/d' \ + -e 's/^Error org.freedesktop.DBus.Error.Failed: "\?\(.*\)"\?$/ERROR: \1/' \ + -e 's/^ string "\(.*\)"/\1/' \ + -e 's/},/&\n/' +} send() { - dbus-send --session --dest=org.AGL.afm.user --print-reply /org/AGL/afm/user org.AGL.afm.user.$1 "string:$2" + dbus-send --session --print-reply \ + --dest=org.AGL.afm.user \ + /org/AGL/afm/user \ + org.AGL.afm.user.$1 \ + "string:$2" | + pretty } case "$1" in @@ -38,6 +52,16 @@ case "$1" in send start "\"$i\"" ;; + run-remote|start-remote) + i=$2 + send start '{"id":"'"$i"'","mode":"remote"}' + ;; + + once) + i=$2 + send once "\"$i\"" + ;; + terminate|kill) i=$2 send terminate "$i" @@ -45,12 +69,12 @@ case "$1" in stop|pause) i=$2 - send stop "$i" + send pause "$i" ;; resume|continue) i=$2 - send continue "$i" + send resume "$i" ;; state|status) @@ -82,17 +106,19 @@ The commands are: run id start id start an instance of the widget of id - terminate rid - kill rid terminate the running instance rid + once id run once an instance of the widget of id + + kill rid + terminate rid terminate the running instance rid stop rid - pause rid stop the running instance rid + pause rid pause the running instance rid resume rid - continue rid continue the previously rid + continue rid continue the previously paused rid - state rid - status rid get status of the running instance rid + status rid + state rid get status of the running instance rid EOC ;;