afm-util/install: use of web socket connection
authorJosé Bollo <jose.bollo@iot.bzh>
Thu, 16 Nov 2017 16:38:26 +0000 (17:38 +0100)
committerJosé Bollo <jose.bollo@iot.bzh>
Fri, 24 Nov 2017 16:44:57 +0000 (17:44 +0100)
Change-Id: I8bda689a377d676c4b190e1b54cdc115006c9829
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
scripts/CMakeLists.txt
scripts/afm-debug [changed mode: 0644->0755]
scripts/afm-install [new symlink]
scripts/afm-util

index bf0846c..e0f80ac 100644 (file)
@@ -20,6 +20,7 @@ cmake_minimum_required(VERSION 2.8)
 
 if(NOT USE_SDK)
        install(PROGRAMS afm-util DESTINATION ${CMAKE_INSTALL_BINDIR})
+       install(PROGRAMS afm-install DESTINATION ${CMAKE_INSTALL_BINDIR})
        if(AGL_DEVEL)
                install(PROGRAMS afm-debug DESTINATION ${CMAKE_INSTALL_BINDIR})
        endif()
old mode 100644 (file)
new mode 100755 (executable)
diff --git a/scripts/afm-install b/scripts/afm-install
new file mode 120000 (symlink)
index 0000000..5bde063
--- /dev/null
@@ -0,0 +1 @@
+afm-util
\ No newline at end of file
index bbab51b..4d86218 100755 (executable)
@@ -1,34 +1,8 @@
 #!/bin/bash
 
-if [ "x" = "x${DBUS_SESSION_BUS_ADDRESS}" ]; then
-       DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$UID/bus"
-fi
-export DBUS_SESSION_BUS_ADDRESS
-
-pretty() {
-       sed '   /^method return .*/d
-               s/^Error org.freedesktop.DBus.Error.Failed: "\?\(.*\)"\?$/ERROR: \1/
-               s/^   string "\(.*\)"/\1/
-               s:[[{,]:&\n:g
-               s: *[]}]:\n&:g
-       ' |
-       sed '   s:^ *::
-               s: *$::
-               /[]}],*$/ {x;s:...::;x}
-               G
-               /[[{]\n/ {x;s:$:   :;x}
-               s:^\(.*[^\n]\)\n\( *\)$:\2\1:
-       '
-}
-
 send() {
-       dbus-send --session --print-reply \
-               --dest=org.AGL.afm.user \
-               /org/AGL/afm/user \
-               org.AGL.afm.user.$1 \
-               "string:$2" |
-       pretty
-       return ${PIPESTATUS[0]}
+       afb-client-demo -H -d unix:/run/afm/apis/ws/afm-main "$1" "$2" |
+       awk '$1=="ON-REPLY-FAIL"{$1="ERROR:";$2="";print;exit 1;}NR>1'
 }
 
 case "$1" in