<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>anyRemote · Control your computer with your phone</title> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta name="description" content="anyRemote project page - Bluetooth remote control tool" /> <link rel="stylesheet" href="data/master.css" type="text/css" media="all" title="Default Style" charset="utf-8" /> <script src="data/effects.js" type="text/javascript" charset="utf-8"></script> <link rel="alternate" title="Feed" href="data/feed.xml" type="application/rss+xml" /> <link rel="icon" href="data/logo-favicon.png" type="image/png" /> <link rel="shortcut icon" href="data/logo-favicon.png" type="image/png" /> </head> <body id="docs"> <a class="skip" name="top"> </a> <a class="skip" href="#content">Skip to content</a> <div id="head"> <div id="logo"> <h1><a href="index.html"><img src="data/logo-head.png" alt="logo" /> anyRemote</a></h1> </div> <div id="navigation"><div class="padding"> <a href="index.html"><span>About</span></a> <a href="frontend.html"><span>Screenshots</span></a> <a href="dload.html"><span>Download</span></a> <a href="docs.html" class="active"><span>Documentation</span></a> <a href="faq.html"><span>FAQ</span></a> <a href="contacts.html"><span>Contact</span></a> <a href="thanks.html"><span>Special Thanks</span></a> </div></div> </div> <div id="sidebar"><div class="padding"> <dl class="info"> <dt>Information</dt> <dd> <p>Please use the two sidebar boxes below to browse through the anyRemote Documentation!</p> </dd> </dl> <dl class="docs"> <dt>Documentation</dt> <dd> <ul> <li><a href="pre-setup.html">Before install</a></li> <li><a href="pre.html">Software prerequisites</a></li> <li><a href="install.html">Compilation and installation</a></li> <li><a href="mode.html">Which mode to choose ?</a></li> <li><strong>Setup</strong> <ul> <li><a href="setup-at.html">Setup: AT mode</a> <ul> <li><a href="event.html">Event reporting</a></li> <li><a href="ckpd-emulation.html">Keypad emulation events</a></li> </ul> </li> <li><a href="setup-server.html">Setup: Server mode</a></li> </ul> </li> <li><a href="use.html">How to use anyRemote</a> <ul> <li><a href="android-client.html">Android Client</a></li> <li><a href="use-jc.html">J2ME Client</a></li> <li><a href="web.html">Web Interface</a></li> <li><a href="cm-xml.html">XML Services Interface</a></li> <li><a href="cfg-howto.html">How to create simple configuration file</a></li> <li><a href="bemused.html">Bemused Support</a></li> <li><a href="iviewer.html">Command Fusion iViewer support</a></li> </ul> </li> <li><a href="devices.html">Tested devices</a></li> <li><a href="phones.html">Phone specific details</a></li> <li><a href="tips-tricks.html">Tips & tricks</a></li> <li><a href="man.html">Man page</a></li> </ul> </dd> </dl> <dl class="docs-advanced"> <dt>Advanced</dt> <dd> <ul> <li><a href="http://elpraga.bshellz.net/HOWTOstartanyRemoteatboottime.html">miniHOWTO: start anyRemote at boot time and create a multimedia computer</a> (externally maintained)</li> <li><strong>Format of configuration files</strong> <ul> <li><strong>Server mode</strong> <ul> <li><a href="conf-server.html">Configuration file format</a></li> <li><a href="conf-server-ex.html">Configuration file examples</a></li> <li><a href="set.html">Set(...) / ExecAndSet(...) commands</a></li> <li><a href="set-fm.html">Set(filemanager ... ) command</a></li> <li><a href="set-icons.html">Set(icons ...) command and available icon set</a></li> <li><a href="set-list.html">Set(list ... ) and Set(iconlist ... ) commands</a></li> <li><a href="set-menu.html">Set(menu ... ) command</a></li> <li><a href="set-parameter.html">Set(parameter, ... ) commands</a></li> <li><a href="set-text.html">Set(text ... ) command</a></li> <li><a href="set-window.html">Set(image ... ) command</a></li> </ul> </li> <li><strong>AT mode</strong> <ul> <li><a href="conf-at.html">Configurational file format</a></li> <li><a href="conf-at-ex.html">Configurational file examples</a></li> </ul> </li> <li><strong>Common</strong> <ul> <li><a href="make.html">Make(...) command</a></li> <li><a href="emulate.html">Emulate(...) command</a></li> <li><a href="dbus.html">Dbus(...) command</a></li> <li><a href="vars.html">Variable substitution</a></li> <li><a href="ev-handlers.html">Event handlers</a></li> <li><a href="icon-themes.html">Icon themes for J2ME client</a></li> </ul> </li> </ul> </li> <li><a href="ir.html">anyRemote and InfraRed</a></li> </ul> </dd> </dl> <dl class="contact"> <dt>Contact</dt> <dd> <p>We will be pleased for any questions, suggestions, patches and examples of configuration files!</p> <ul> <li>Post in the <a href="http://sourceforge.net/forum/?group_id=162923">Forum</a></li> <li>Please, send e-mails to <a href="mailto:anyremote@mail.ru">anyremote@mail.ru</a></li> </ul> </dd> </dl> <!--HOSTINGLOGO--> </div></div> <!-- sidebar --> <div id="content"><div class="padding"> <a class="skip" name="content"> </a> <h1>Configuration file format: AT mode</h1> <h2>Configuration file examples</h2> <p>You may find some predefined <a href="conf-at-ex.html">configuration files</a> in cfg-data/AT-mode directory. After investigation of these configuration files You became more familiar with its format.</p> <h2>Format</h2> <p>Line starting with a <strong>%</strong> considered as a comment line.</p> <pre>%This is a comment</pre> <p>Long command can be splitted into the several lines. You have to put backslash (<strong>\</strong>) as the <strong>last</strong> character to continue a command to the next line.</p> <pre>1=Exec(echo "this is first line");\ Exec(echo "this is second line");</pre> <h2>Parameters section</h2> <p><strong>GuiAppName="application name"</strong></p> <p><strong>GuiAppBinary="name of executable"|"command which returns name of executable"</strong></p> <p><strong>GuiAppRun="command do determine is application running or not; must returns OK or NOK"</strong></p> <p><strong>GuiAppIcon="icon name"</strong></p> <p><strong>GuiAppType=Application|Custom|Example</strong></p> <p><strong>GuiAppModes=Server|AT|Bemused</strong></p> <p><strong>GuiAppDesc=Some text</strong></p> <p>These parameters is used by GUI frontends only.</p> <pre>GuiAppName=Amarok GuiAppBinary=amarok GuiAppRun=echo 'A=`dcop | grep amarok`; \ if [ "x$A" == "x" ]; then echo NOK; \ else echo OK; fi' | bash -f -s GuiAppIcon=amarok.png GuiAppType=Application GuiAppModes=AT GuiAppDesc=Application decription</pre> <pre>[Protocol]=AT One=Exec(echo "Hello world!"); ...</pre> <h2>[Protocol] section</h2> <p> A short example:</p> <pre>[Protocol]=AT (Init)=\ Exec(kdialog --msgbox "Initialized"); (Connect)=\ Exec(kdialog --msgbox "Connected") (Disconnect)=\ Exec(kdialog --msgbox "Disconnected") 1=Exec(kdialog --msgbox 1) 2=Exec(kdialog --msgbox 2) 3=Exec(kdialog --msgbox 3) 4=Exec(kdialog --msgbox 4) 5=Exec(kdialog --msgbox 5) [End]</pre> <h3>Format:</h3> <p><strong>Key_Codes=Command1;Command2;Command3;....</strong></p> <p>Where <strong>CommandX</strong> could be:</p> <ul> <li>Exec(...);</li> <li><a href="emulate.html">Emulate(...);</a></li> <li>Exit;</li> <li>Macro(...);</li> <li><a href="make.html">Make(...);</a></li> <li>Timer(...);</li> <li>Load(...);</li> <li>Include(...);</li> <li>SendCKPD(...);</li> </ul> <h3>Exec() command</h3> <pre>1=Exec(kdialog --msgbox 1) 2=Exec(kdialog --msgbox 2)</pre> <p>anyRemote uses <a href="http://linux.die.net/man/3/popen">popen</a> system call in Exec() command. This means that command will be executed inside <strong>/bin/sh</strong> command interpreter.</p> <p>It is possible to define multi-key commands</p> <pre>3 1=Exec(kdialog --msgbox 3_1) 3 2=Exec(kdialog --msgbox 3_2) 3 3 1=Exec(kdialog --msgbox 3_3_1)</pre> <p>It is not good idea to define:</p> <pre>3 3=Exec(kdialog --msgbox 3_3) 3 3 1=Exec(kdialog --msgbox 3_3_1)</pre> <p>simultaneously, since only one command will works (which one - depends on search order).</p> <p>It is possible to group keymappings in so-called "mode" to set more than one command to the key:</p> <pre>1=Exec(kdialog --msgbox 1) 2=Exec(kdialog --msgbox 2) [Mode]=1 1=Exec(kdialog --msgbox 1_in_Mode_1) 2=Exec(kdialog --msgbox 2_in_Mode_1) [ModeEnd] [Mode]=2 1=Exec(kdialog --msgbox 1_in_Mode_2) 2=Exec(kdialog --msgbox 2_in_Mode_2) [ModeEnd]</pre> <p>If current mode is not default mode <i>(see <strong><a href="make.html">Make(mode ...);</a></strong> command)</i>, then firstly key will be searched in current mode and if not found then it will be searched in default mode. As a result it needs to use (EnterMode) and (ExitMode) <a href="ev-handlers.html">"events"</a> very carefully in default mode.</p> <p>It is possible to write quite complex commands inside <strong>Exec()</strong>, for example:</p> <pre>1=Exec(echo 'D=`dcop | grep digikam`; \ if [ "x$D" == "x" ]; then digikam \ else dcop $D MainApplication-Interface quit;' | bash -f -s)</pre> <h3>Macro() command</h3> <p>This command used to create new keymapping:</p> <pre>1=Macro(Macro1) Macro1=Exec(kdialog --msgbox 1);Exec(kdialog --msgbox 2)</pre> <p>Macro() command can contains condition:</p> <pre>0=Make(var,macro_test,echo "0"); 1=Macro(Macro1,by_value,$(macro_test)); 2=Macro(Macro2, if [ -f /tmp/file_name ];\ then true; else false; fi; echo $?) Macro2=Exec(kdialog --msgbox "Condition is OK")</pre> <p>Conditional Macro() will be execute only if a result of variable substitution or execution of the command is equal to string "<strong>0</strong>".</p> <p><strong>Note</strong>: In shells result code of command execution stored in <strong>$?</strong> environment variable.</p> <h3>Timer() command</h3> <p>Format:</p> <p><strong>Timer(key, timeout, maxTimes)</strong> or</p> <p><strong>Timer(key, cancel|pause|continue)</strong></p> <p>This command sets/removes a timer for the <strong>key</strong> specified. A command sequence, associated with this <strong>key</strong> will be executed periodically.</p> <p>For example, the following commands run 'ls -1' command 2 times with timeout equal to 5 seconds:</p> <pre>7=Timer(TimerCmd, 5, 2) TimerCmd=Exec(ls -1)</pre> <p>The following command run 'date' command every 10 seconds:</p> <pre>8=Timer(Timer2, 10, 0) Timer2=Exec(date)</pre> <p>It is impossible to have two active timer commands with the same <strong>key</strong>.</p> <p>To delete existing timer use the following command:</p> <pre>9=Timer(TimerName,cancel)</pre> <h3>Load() command</h3> <p>This command used to load commands from file and execute them:</p> <pre>1=Load(file_name.cmds)</pre> <h3>Include() command</h3> <p>This command used to include definitions from external configuration file:</p> <pre>1=Include(xmms.cfg)</pre> <p>Definitions from included file will not rewrite any of existing definitions.</p> <h3>Make() command</h3> <p>Format:</p> <p><strong>Make(flush|disconnect|mode|remote|var|alarm[,....])</strong></p> <p>This command used control local state of anyRemote.</p> <pre>0=Make(flush) 1=Make(mode,mode_2) 2=Make(remote,on) 3=Make(var,my_var,date)</pre> <p>See detailed description <a href="make.html">here</a>.</p> <h3>SendCKPD() command</h3> <pre>1=Exec(kdialog --msgbox 1);SendCKPD(E PAUSE E)</pre> <p>This command sends CKPD sequence back to phone and could be useful if You can't lock the keyboard and needs to clean-up phone screen after each key pressing on phone keypad. It is possible to use word <strong>PAUSE</strong> to make a 1-second pause before next CKPD command will be sent. This command works when anyRemote is in AT-mode.</p> <h3>Exit</h3> <p>Exit command used to exit from application.</p> <pre>2=Exit;</pre> <h3>Event handlers</h3> <p>There are several "events" could be triggered. See <a href="ev-handlers.html">Event handlers</a> page for details.</p> <h3>Variable substitution</h3> <p>In Exec(), Make(var,...), Load(), Include() commands is it possible to use internal "variables". See <a href="vars.html">Variable substitution</a> page for details.</p> </div></div> <!-- content --> <div id="foot"> <p>Maintained by <a href="mailto:anyremote@mail.ru">anyRemote</a>. Website by <a href="http://www.martinlettner.info">m.lettner</a>.</p> </div> </body> </html>