#!/bin/sh
usage(){
	echo "Usage: $0 -timeout [<timeout>]|-off|-on"
}


if [ $# -eq 0 ]; then
        usage
        exit 1
fi
if [ $# -eq 1 ]; then
	if [ 0$1 == 0"-off" ]; then
		/usr/bin/ICTApplication/ICTCliGateLite -call GreenManager:setScreensaverState -args bool:false
		exit 0
	else
		if [ 0$1 == 0"-on" ]; then
			/usr/bin/ICTApplication/ICTCliGateLite -call GreenManager:setScreensaverState -args bool:true
			exit 0
		else
			if [ 0$1 == 0"-timeout" ]; then
			    /usr/bin/ICTApplication/ICTCliGateLite -call SettingsManager:getSettingValue -args ScreenSaverDelay
			    exit $?			
		 	else
			    usage
			    exit 1
			fi
		fi
	fi
else
	if [ $# -eq 2 ]; then
		if  [ 0$1 == 0"-timeout" ]; then
			/usr/bin/ICTApplication/ICTCliGateLite -call SettingsManager:setSettingValue -args ScreenSaverDelay string:$2
			exit $?			
		else
			usage
			exit 1
		fi
	else
		usage
		exit 1
	fi
fi
