<!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: Server mode</h1> <h2>Configuration file examples</h2> <p>You may find some predefined <a href="conf-server-ex.html">configuration files</a> in cfg-data/Server-mode and cfg-data/Bemused-emulation directories. 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=Server GuiAppDesc=Application decription</pre> <pre>[Protocol]=Server One=Exec(echo "Hello world!"); ...</pre> <h2>[Protocol] section</h2> <p> A short example:</p> <pre>[Protocol]=Server (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><a href="set.html">Set(...);</a></li> <li><a href="set.html">ExecAndSet(...);</a></li> <li>Timer(...);</li> <li>Load(...);</li> <li>Include(...);</li> <li>Send(...);</li> <li>ExecAndSend(...);</li> <li>Get(...);</li> <li>End();</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 write quite complex commands inside <strong>Exec()</strong>, for example:</p> <pre>1=Exec(D=`dcop | grep digikam`;\ if [ "x$D" = "x" ]; then \ digikam & \ else \ dcop $D MainApplication-Interface quit;\ fi);</pre> <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> <p>Modes supports inheritance - in example below mode <strong>child</strong> is inherited from modes <strong>parent1</strong> and <strong>parent2</strong>.</p> <pre>0=Exec(kdialog --msgbox 0) 1=Exec(kdialog --msgbox 1) 2=Exec(kdialog --msgbox 2) [Mode]=child : parent1,parent2 1=Exec(kdialog --msgbox 1_in_Mode_2) 2=Exec(kdialog --msgbox 2_in_Mode_2) [ModeEnd] [Mode]=parent1 3=Exec(kdialog --msgbox 3_in_Mode_p1) [ModeEnd] [Mode]=parent2 4=Exec(kdialog --msgbox 4_in_Mode_p2) [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 parent modes (if it exists) and then in default mode.</p> <p><strong>Note:</strong> As a result it needs to use (EnterMode) and (ExitMode) <a href="ev-handlers.html">"events"</a> very carefully in default mode.</p> <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>Set() command</h3> <p>These commands used to control and customize GUI of the client. See detailed description <a href="set.html">here.</a></p> <p>It is possible to change:</p> <ul> <li>caption of screen</li> <li>title and status fields</li> <li>arrange icons from predefined <a href="set-icons.html">icon set</a>,</li> <li>change background and foreground color,</li> <li>change font size</li> <li>change icon layouts</li> <li>use internal vibrator of the phone</li> <li>set fullscreen mode</li> <li>set debug mode</li> <li><a href="set-text.html">show text</a> on the screen of cell phone</li> <li><a href="set-list.html">show list</a> on the screen of cell phone</li> <li>add custom <a href="set-menu.html">menus</a></li> </ul> <table border="0" cellspacing="0" rules="rows" class="no-padding"> <tr> <td style="vertical-align: top; text-align: center;"> <img src="data/client-test.png" border="1" alt="Example of how the client can look like" /> </td> <td style="vertical-align: top; text-align: center;"> <img src="data/jc/fileManager2.png" border="1" alt="Example of how the client can look like" /> </td> </tr> </table> <h3>ExecAndSet() command</h3> <p>Format: ExecAndSet(tag,command)</p> <p>This command similar to the Set(), but uses the output of command specified as a string to set GUI elements of the client specified in tag field. See detailed description <a href="set.html">here.</a></p> <pre>5=ExecAndSet(title,dcop amarok player nowPlaying); 6=ExecAndSet(status,date)</pre> <h3>Timer()</h3> <p>Format:</p> <p><strong>Timer(key, timeout, maxTimes)</strong> or</p> <p><strong>Timer(key, cancel|pause|continue|reset|restart)</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 'dcop amarok player nowPlaying' command 2 times with timeout equal to 5 sec and set result to the title field of the client:</p> <pre>1=Timer(TimerCmd, 5, 2) TimerCmd=ExecAndSet(title, dcop amarok player nowPlaying)</pre> <p>The following command run 'date' command every 10 sec and set result to the status field of the client:</p> <pre>2=Timer(Timer2, 10, 0) Timer2=ExecAndSet(status, 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>3=Timer(TimerName,cancel)</pre> <p>To reset timer use the following command:</p> <pre>4=Timer(TimerName,reset)</pre> <p>To completely restart timer use the following command:</p> <pre>5=Timer(TimerName,restart)</pre> <p>This command resets timer and resets counter of timer's executions</p> <p>Also, see <a href="set.html#data-caching">note</a> about data caching.</p> <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>Send() command</h3> <p>Format:</p> <p><strong>Send(string, string_value)</strong> or</p> <p><strong>Send(byte, byte_value1, byte_value2,...)</strong></p> <p>Sends to the the client specified string or sequence of bytes. This command is used in Bemused server emulation.</p> <pre>1=Send(string, simple_string)</pre> <p>byte_valueX is string representation of 1 - 255 values. Send(byte, ...) command sends to the the client specified bytes of data, one by one. Mainly this command is used to Bemused server emulation.</p> <pre>2=Send(bytes,35,42,0)</pre> <h3>ExecAndSend() command</h3> <p>Format:</p> <p><strong>ExecAndSend(tag,command)</strong></p> <p>This command similar to the Send(tag, ...), but uses the output of command specified as a string to send. So, it is possible to execute dynamically created command. This command is used in Bemused server emulation.</p> <pre>3=ExecAndSend(string,date) 4=Exec(echo "Set(title,dynamic title)">/tmp/command.txt);\ ExecAndSend(string,cat /tmp/command.txt)</pre> <a name="sec-get"></a> <h3>Get() command</h3> <p>Format:</p> <p><strong>Get(screen_size|cover_size|icon_size|icon_padding|model|version|cursor|password|ping)</strong> or</p> <p><strong>Get(is_exists,icon,16|32|48|64|96|128,_icon_name_)</strong></p> <p><strong>Get(is_exists,cover,_cover_name_)</strong></p> <p>This command used to retrieve from phone some information.</p> <pre>1=Get(screeen_size) 2=Get(model) 3=Get(is_exists,icon,16,next) 4=Get(is_exists,cover,cover_art) 5=Get(cover_size) 6=Get(version) 7=Get(cursor) 8=Get(ping) 9=Get(password)</pre> <p><strong>Get(screeen_size)</strong> used to get screen size of cell phone. As a response to this command two replies will be send: <strong>SizeX(width,)</strong> and <strong>SizeY(height,)</strong>. SizeX(width,) reply will be the first one.</p> <p><strong><a name="sec-cover-size">Get(cover_size)</a></strong> used to determine maximal size of cover image which can be shown by <strong>Set(cover, ...)</strong> command. As a response to this command one reply will be send: <strong>CoverSize(_size_,)</strong></p> <p>If client layout is not initialized or set to <strong><a href="set.html#sec-layout">default</a></strong> or <strong><a href="set.html#sec-layout">"3x4"</a></strong> then returned cover size can be set to <strong>-1</strong></p> <p><strong>Get(icon_size)</strong> used to determine size of used icon set. As a response to this command one reply will be send: <strong>IconSize(_size_,)</strong>. It is possible to change icon size with <strong><a href="set-parameter.html">Set(parameter,icon_size,...)</a></strong> command. </p> <p><strong>Get(icon_padding)</strong> used to determine icon padding. As a response to this command one reply will be send: <strong>IconPadding(_size_,)</strong>. It is possible to change icon padding with <strong><a href="set-parameter.html">Set(parameter,icon_padding,...)</a></strong> command. </p> <p><strong>Get(model)</strong> used to get "microedition.platform" property of J2ME client. For many phones this property contains manufacturer and model number (like "SonyEricssonK750i/R1CA021" for SE-K750). As a response to this command <strong>Model(,_string_)</strong> reply will be sent.</p> <p><strong>Get(is_exists,...)</strong> used to determine was cover image or icon with given name and size uploaded to phone or not. As a response to this command <strong>IconExists(_size_,_icon_name_)/CoverExists(,_cover_name_)</strong> or <strong>IconNotExists(_size_,_icon_name_)/CoverNotExists(,_cover_name_)</strong> reply will be sent.</p> <p>Note for <strong>Get(is_exists,cover...)</strong>command: If client layout is not initialized or set to <strong><a href="set.html#sec-layout">default</a></strong> or <strong><a href="set.html#sec-layout">"3x4"</a></strong> then returned reply can be <strong>CoverNotExists(,_cover_name_)</strong> despite of existense of cover.</p> <p><strong>Get(version)</strong> used to retrieve J2ME/Android client version. As a response to this command <strong>Version(,_version_)</strong> reply will be sent.</p> <p><strong>Get(cursor)</strong> user to determine cursor position on <a href="set-window.html">Image screen</a> of J2ME client. Two replies <strong>PosX(x_coord,)</strong> and <strong>PosY(y_coord,)</strong> will be sent. PosX() event will be first one. If current screen of the client is not <a href="set-window.html">Image screen</a> then no replies will be sent.</p> <p><strong>Get(ping)</strong> user to send "keepalive" messages to J2ME/Android client. As a response to this command <strong>Ping</strong> reply will be sent.</p> <p><strong>Get(password)</strong> user to ask password from J2ME/Android client. As a response to this command <strong>_PASSWORD_(,_password_)</strong> reply will be sent. This reply handled by anyRemote internally, so generally users should not worry about it.</p> <p>Password should be stored in <strong>$HOME/.anyRemote/password</strong> file in a plain text.</p> <h3>End() command</h3> <p>Format:</p> <p><strong>End()</strong></p> <p>This command used only if <strong>-s web:xxxx</strong> command line option is used. This commmand used internally and should not be used in configuration files. The purpose of the command is to inform build-in <strong><a href="web.html">web server</a></strong> about fact what command sequence is fully processed</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>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>