%
% anyremote configuration file for parser testing. (Server-mode)
%

% STATUS unknown
% XTEST no
% SOUND no
% ENV no

GuiAppName=parser test
GuiAppType=Example
GuiAppBinary=true
GuiAppProtocols=Server
GuiAppDesc=Test of anyRemote configuration file parser.

[Protocol]=Server

(Init)=\
	Include($(CfgDir)/Utils/aliases-server.cfg);\
	Timer(TIMER1,1,5);\
	Timer(TIMER2,2,1);\
	Timer(TIMER3,3,1);\
	Timer(TIMER4,3,1);
	
%	Timer(EXIT_TIMER,5,0);
	
(Connect)=\
 	Set(parameter,debug,on);\
	Exec(echo Connected);\
	Set(status,status line);\
	Set(title,title line);\
	Make(alarm,/tmp/alarm_test,ALARM1);\
	Set(caption,Caption);\
	Set(icons,Example,\
		1,file,2,fit,3,fit,\
		4,fit,5,fit,6,fit,\
		7,minus,8,fit,9,plus,\
		*,question,0,no,#,fit);\
    Set(caption,List Example);
		
(Disconnect)=\
	Exec(echo Disconnected)

InCall($$)=\
	Exec($(CfgDir)/Utils/message.sh "Incoming call from $(Param)")

EndCall($$)=\
	Exec($(CfgDir)/Utils/message.sh "Call finished")

(Exit)=\
	Exec(echo "hello from exit handler")

0=Make(exit);
1=Make(var,TEST,by_value,11111);\
	Set(text,replace,Vars,TEST=$(TEST)\nHome=$(Home)\nBtAddr=$(BtAddr)\nMode=$(Mode)\nCfgDir=$(CfgDir)\nDevice=$(Device)\n\

7=Make(var,active_state,echo off);\
	Make(var,active_state,echo off);\
	Set(status,remote is $(active_state));\
	Make(remote,$(active_state));
	
9=Make(remote,on);\
	Make(var,active_state,echo on);\
	Set(status,remote is $(active_state));


Logging=$(Logging)\nServiceName=$(ServiceName)\naaa=$(AAA)\n\
FromEncoding=$(FromEncoding)\nToEncoding=$(ToEncoding)\n\
ScreenSize=$(ScreenSize)\nRefreshPage=$(RefreshPage)\nTEST=$(TEST)\n\
IpAddr=$(IpAddr)\nAutoConnect=$(AutoConnect)\nAutoRepeat=$(AutoRepeat)\n\
Baudrate=$(Baudrate)\nCharSet=$(CharSet)\nIViewer=$(IViewer)\n\
MixerCard=$(MixerCard));
	
* *=\
    Set(text,caption,Help);\
    Set(text,replace,SAME,This configuration file do nothing. It used to validate anyRemote configuration file parser.)

EXIT_TIMER=Make(exit)

TIMER1=\
	Exec(echo "hello from TIMER1")

TIMER2=\
	Exec(echo "hello from TIMER2");\
	Timer(TIMER1,pause);

TIMER3=\
	Exec(echo "hello from TIMER3");\
	Timer(TIMER1,continue);
TIMER4=\
	Exec(echo "hello from TIMER4");\
	Timer(TIMER1,cancel);

ALARM1=\
	Exec(echo "hello from ALARM1");

TEST_MACRO1=Macro(M1);
TEST_MACRO2=Macro(M2,echo 0);

TEST_EXECSET=\
	ExecAndSet(status,echo string);\
	ExecAndSet(status,echo $(variable));\
	ExecAndSet(title,echo string);\
	ExecAndSet(title,echo $(variable));

TEST_SET_M1=\
	Set(status,status line);\
	Set(status,$(variable));
	
TEST_SET_M2=\
	Set(title,title line);\
	Set(title,$(variable));

TEST_SET_LA=\
	Set(layout,default,ticker);\
	Set(layout,7x1,noticker,joystick_only,volume);\
	Set(layout,3x4,ticker,keypad_only);\
	Set(layout,3x4,ticker,$(variable);
	
TEST_SET_I=\
	Set(icons,List Example,1,fit,2,fit,3,fit,4,fit,5,fit,6,fit,7,fit,8,fit,9,fit,*,question,0,fit,#,fit);
	
TEST_SET_I2=\
	 Set(icons,SAME,1,fit,2,fit,3,fit,4,fit,5,fit,6,fit,7,fit,8,fit,9,$(variable),*,question,0,fit,#,fit);

TEST_SET_M=\
	Set(menu,replace,i1,i2,i3);\
	Set(menu,clear);\
	Set(menu,add,i4,i5,i6);\
	Set(menu,add,i4,$(variable),i6);

TEST_SET_L1=\
	Set(list,add,Example,Item1,Item2,Item3);\
	Set(list,clear);\
	Set(list,close);\
	Set(list,show);\
	Set(list,$(variable));\
	Set(list,close,clear);\
	Set(list,replace,Example,Item1,Item2,Item3);\
	Set(list,bg,0,0,0);\
	Set(list,fg,255,255,255);\
	Set(list,select,2);\
	Set(list,font,small);

TEST_EXECSET_L1=\
	ExecAndSet(list,add,Example,echo 'Item1,Item2,Item3');\
	ExecAndSet(list,replace,Example,echo 'Item1,Item2,Item3');\
	ExecAndSet(list,bg,echo '0,0,0);\
	ExecAndSet(list,fg,echo '255,255,255');\
	ExecAndSet(list,font,echo 'small');\
	ExecAndSet(list,$(variable));\
	ExecAndSet(list,add,Example,$(variable));\

TEST_SET_L2=\
	Set(iconlist,add,Example,Item1,Item2,Item3);\
	Set(iconlist,clear);\
	Set(iconlist,close);\
	Set(iconlist,show);\
	Set(iconlist,$(variable));\
	Set(iconlist,close,clear);\
	Set(iconlist,replace,Example,Item1,Item2,Item3);\
	Set(iconlist,bg,0,0,0);\
	Set(iconlist,fg,255,255,255);\
	Set(iconlist,select,2);\
	Set(iconlist,font,small);\
	ExecAndSet(iconlist,$(variable));\
	ExecAndSet(iconlist,add,title,$(variable));

TEST_SET_IM=\
	ExecAndSet(image,window,echo "$IMAGE_DIR/image.png");\
	ExecAndSet(image,cover,echo "$IMAGE_DIR/image.png");\
	Set(image,show);\
	Set(image,close);\
	Set(image,nocursor);\
	Set(image,dynamic_cursor);\
	Set(image,set_cursor,0,0);\
	ExecAndSet(image,icon,echo "$IMAGE_NAME,$IMAGE_DIR/image.png");\
	Set(image,remove,all);\
	Set(image,remove,icons);\
	Set(image,clear_cache);\
	Set(image,$(variable));
	
TEST_SET_T=\
	Set(text,add,title,an text example);\
	Set(text,clear);\
	Set(text,close);\
	Set(text,show);\
	Set(text,close,clear);\
	Set(text,$(variable));\
	Set(text,replace,title,one more dummy text);\
	Set(text,bg,0,0,0);\
	Set(text,fg,255,255,255);\
	Set(text,bg,0,$(variable),0);\
	Set(text,fg,255,$(variable),255);\
	Set(text,font,medium);\
	Set(text,font,$(variable));

TEST_EXECSET_T=\
	ExecAndSet(text,add,title,echo 'an text example');\
	ExecAndSet(text,replace,title,echo 'one more dummy text');\
	ExecAndSet(text,bg,echo '0,0,0');\
	ExecAndSet(text,fg,echo '255,255,255');\
	ExecAndSet(text,font,echo 'medium');\
	ExecAndSet(text,$(variable));\
	ExecAndSet(text,add,title,$(variable));
	
TEST_SET_OTHER=\
	Set(vibrate,5);\
	Set(vibrate,$(variable));\
	Set(popup,show,Hello world!);\
	Set(popup,show,$(variable));\
	Set(popup,hide);\
	Set(volume,50);\
	Set(volume,$(variable));\
	Set(parameter,debug,on);\
	Set(parameter,debug,$(variable));

TEST_MAKE_V=\
	Make(var,v1,echo $HOME);\
	Make(var,v2,by_value,dummy);

TEST_MAKE_M=\
	Make(mode,mode2);\
	Make(mode,$(variable));
	
TEST_MAKE_OTHER=\
	Make($(variable));\
	Make(stop);\
	Make(flush);\
	Make(disconnect);\
	Make(exit);\
	Make(remote,on);\
	Make(remote,$(variable));\
	Make(alarm,/tmp/alarm,ALARM_MACRO);\
	Make(none);

TEST_TIMER=\
	Timer(TIMER_MACRO, 5, 2);\
	Timer(TIMER_MACRO,cancel);\
	Timer(TIMER_MACRO,reset);\
	Timer(TIMER_MACRO,restart);\
	Timer(TIMER_MACRO,pause);

TEST_GET=\
	Get(screen_size);\
	Get(model);\
	Get(is_exists,16,next);\
	Get(cover_size);\
	Get(version);\
	Get(cursor);\
	Get(ping);\
	Get(icon_size);\
	Get(icon_padding);\
	Get(password);

TEST_SEND=\
	ExecAndSend(string, date);\
	Send(string, simple string);\
	Send(bytes, 35, 42, 0);

TEST_OTHERS=\
	Load(file_name.cmds);\
	Include(xmms.cfg);\
	Load(have spaces inside.cmds);\
	Include(have spaces inside.cfg);

TEST_DBUS1=\
	Dbus(connect,rhythmbox_connection,\
                org.gnome.Rhythmbox,\
                /org/gnome/Rhythmbox/Player,\
                org.gnome.Rhythmbox.Player);
		
TEST_DBUS2=\
	Dbus(close,rhythmbox_connection);

TEST_DBUS3=\
	Dbus(set,rhythmbox_connection, previous);\
	Dbus(set, rhythmbox_connection,next);\
	Dbus(get,rhythmbox_connection,getElapsed,uint,elapsed);\
	Dbus(set, rhythmbox_connection,setElapsed, uint,$(elapsed));

TEST_EMULATE=\
	Emulate(key,1);\
	Emulate(mouse, 3);\
	Emulate(mousedown,1, mousermove,100,100,mouseup,1);\
	Emulate(keydown,Control_L,key,c, keyup,Control_L);\
	Emulate(keydown,by_value,0xffe3, key,by_value,0x0063,keyup,0xffe3);

TEST_FILEMGR=\
	ExecAndSet(filemanager,replace,left, cd "`cat $(TmpDir)/ar_storedir_l.tmp`";echo `pwd`>$(TmpDir)/ar_storedir_l.tmp;ls -F --quoting-style=shell|sed 's/\*//;s/@//;s/,/\r/g;s/$/,/');\
	ExecAndSet(filemanager,replace,right,cd "`cat $(TmpDir)/ar_storedir_r.tmp`";echo `pwd`>$(TmpDir)/ar_storedir_r.tmp;ls -F --quoting-style=shell|sed 's/\*//;s/@//;s/,/\r/g;s/$/,/');\
	Set(filemanager,select,left, $(list_index_l));\
	Set(filemanager,select,right,$(list_index_r));

TEST_COVER=\
    Set(cover,clear);\
    Set(cover,noname,/tmp/zzz.png);\
    Set(cover,by_name,setup);\
    ExecAndSet(cover,noname,echo /tmp/zzz.png);\
    ExecAndSet(cover,by_name,echo setup);\
    Set(image,cover,/tmp/zzz.png);\
    ExecAndSet(image,cover,echo /tmp/zzz.png);\
    Set(image,window,/tmp/zzz.png);\
    ExecAndSet(image,window,echo /tmp/zzz.png);
	      
Back($$)  =Set(list,close);
Back      =Set(text,close);

[Mode]=TESTING2

(EnterMode)=Exec($(CfgDir)/Utils/message.sh "Enter to TESTING2 mode");\
(ExitMode)=Exec($(CfgDir)/Utils/message.sh "Exiting from TESTING2 mode");

[ModeEnd]

[End]
