#!/bin/sh

lAudioTip=$1

script_path=`echo $0 | awk -F '/' '{for(i=2;i<NF;i++) printf"/"$i}'`
echo $script_path

AlarmLed=`cat $script_path/alarmLed.ini | ./busybox grep "alarmLed:" | ./busybox grep -v grep | sed 's/alarmLed://g' | sed 's/\r//g' | sed 's/\n//g' | sed "s/$(echo -e '\015')//g"`
if [ $? != 0 ]; then
	echo "cann't found alarmLed ini config file"
	exit -1
fi

if [ "$lAudioTip" != "no" ];then
	./simple_adec_bind_ao -r 8000 -t g711a -i audio/alarmLedTestStart.pcm
fi

if [ "$AlarmLed" = "yes" ];then
	XmGpio sethigh 2 12
	sleep 3
	XmGpio setlow 2 12
fi

if [ "$lAudioTip" != "no" ];then
	./simple_adec_bind_ao -r 8000 -t g711a -i audio/alarmLedTestEnd.pcm
fi
