diff options
author | Thierry Bultel <thierry.bultel@iot.bzh> | 2019-04-24 14:28:01 +0200 |
---|---|---|
committer | Thierry Bultel <thierry.bultel@iot.bzh> | 2019-04-24 12:34:31 +0000 |
commit | 224f667013ae930b3698eb896889edbf1c0cf2c5 (patch) | |
tree | efabd608de839e6493b4a8148b958d79184c9c53 /bin/4a-api | |
parent | 76c7d5f13902ee2a58a05c0de01394650bcb4613 (diff) | |
parent | 4d67fb6cfb56d0abd8ec1c9149b88efd4828935d (diff) |
Merge branch 'sandbox/tbultel/avirt'
This migrates all the commits that were on the now-deprecated
iot.bzh github.
Bug-AGL: SPEC-2259
Change-Id: I98820a409cd02ee977e0383c1be227dc22344099
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
Diffstat (limited to 'bin/4a-api')
-rwxr-xr-x | bin/4a-api | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/bin/4a-api b/bin/4a-api new file mode 100755 index 0000000..694397f --- /dev/null +++ b/bin/4a-api @@ -0,0 +1,78 @@ +#!/bin/bash + +# load shell lib +. $(dirname $BASH_SOURCE)/lib4a-tools.sh + +cmd=$1 +shift + +function usage() { + log "Usage: $0 <cmd> [opts]" + log "Commands:" + log " help: show this help" + log " api <verb> [args]: send direct request to API verb with args" + log " roles: get AHL roles" + log " hals [-a|--all] [-v|--verbose]: get HALs status" + log " mediascanner ... : interact with mediascanner service" + log " example: 4a-api mediascanner media_result \"\"" + log " mediaplayer ... : interact with mediaplayer service" + log " example: 4a-api mediaplayer playlist \"\"" + log " radio ... : interact with radio service" + exit 1 +} + +case $cmd in + roles) + 4a-client ahl-4a get_roles "" + ;; + api) + 4a-client "$@" + ;; + hals) + verbose=false + all=false + while [[ -n "$1" ]]; do + case $1 in + -a|--all) all=true;; + -v|--verbose) verbose=true;; + -av) all=true; verbose=true;; + esac + shift + done + 4a-client 4a-hal-manager loaded "{'verbose':$verbose,'all':$all}" + ;; + mediascanner) + mediascanner-client "$@" + ;; + mediaplayer) + mediaplayer-client "$@" + ;; + radio) + echo "TODO" + ;; + help|-h|--help) + usage + ;; + *) + error "Invalid command" + usage + ;; +esac + +# commandes HAL manager: +# 4a-hal-manager loaded +# 4a-hal-manager loaded { "verbose": true } <= +metadata +# 4a-hal-manager loaded { "all": true } <= hals avec un json +# 4a-hal-manager loaded { "all": true, "verbose":true } + +# open/close multimedia +#afb-client-demo -H -d $WS4A << EOF +#multimedia { "action":"open" } +#multimedia { "action":"close" } +#EOF + +# volume multimedia +#afb-client-demo -H -d $WS4A << EOF +#multimedia { "action":"open" } +#multimedia { "action":"close" } +#EOF |