You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
2.0 KiB
Bash

#!/bin/sh
. /usr/share/libubox/jshn.sh
. /usr/libexec/delos/delos-wps-handle
. /usr/libexec/delos/delos-wps-clone-handle
case "$1" in
list)
echo '{ "enable": { "mode":"value", "pin":0 }, "get_status": { }, "clone": { }, "get_pin_status": { "device":"value" }, "get_interface_status": { } }'
;;
call)
case "$2" in
enable)
read input
json_load "$input"
json_get_var mode mode
[ -n "$mode" ] || { echo '{"error":"no mode argument given"}'; exit 0; }
case "$mode" in
wps_pbc)
json=$(start_wps_pbc)
# return json object
echo "$json"
;;
wps_pin)
json_get_var pin pin
[ -n "$mode" ] || { echo '{"error":no pin argument given"}' ; exit 0;};
json=$(start_wps_pin $pin)
echo "$json"
;;
esac
;;
get_status)
json=$(get_wps_status)
# return json object
echo "$json"
;;
get_pin_status)
read input
json_load "$input"
json_get_var device device
json=$(get_wps_pin_status $device)
# return json object
echo "$json"
;;
clone)
json=$(start_wps_clone)
echo "$json"
;;
get_interface_status)
json=$(get_interface_state)
echo "$json"
;;
esac
;;
esac