#!/bin/sh

HELP="Usage: $0 <func> <param1> <param2> ..."

show_log() {
	    # 重定向到串口输出，不会被管道捕获
	    echo "/onboarding/mesh_test] ^^^ $*" > /dev/console
}

result=""

script_operate() {
	local method=$1

	if [ "$method" == "mesh_gpio_test_start" ]; then
		ubus call onboarding mesh_gpio_test_start
		return 1
	elif [ "$method" == "get_mesh_gpio_result" ]; then
		result=`ubus call onboarding get_mesh_gpio_test_result`
		echo "$result"
		return 1
	else
		return 0
	fi
}

script_operate $@
if [ $? -ne 1 ]; then
    show_log $HELP
	exit 1
fi
exit 0
