1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="data/default.css">
<title>anyRemote - control PC with Bluetooth cell phone</title>
<link rel="stylesheet" type="text/css" href="data/default.css">
<link rel="icon" href="data/anyRemote32.png" type="image/png">
<link rel="shortcut icon" href="data/anyRemote16.png" type="image/png" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="anyRemote project page - Bluetooth remote control tool">
</head>
<body><div id="body">
<h1>Configuration file format: AT mode</h1>
<h2>Configuration file examples</h2>
</p>
<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.
<h2>Format</h2>
<p><b>Comments</b><p>Line starting with a <b>%</b> considered as a comment line.
<ul type="disc"><pre class="screen">
<span><strong class="command">%This is comment</strong></span>
</pre>
</ul>
<p>Long command can be splitted into the several lines. You have to put backslash (<b>\</b>) as the <b>last</b>
character to continue a command to the next line.
<ul type="disc"><pre class="screen">
<span><strong class="command">1=Exec(echo "this is first line");\</strong></span>
<span><strong class="command"> Exec(echo "this is second line");</strong></span>
</pre>
</ul>
<br>
<p><h3>Parameters section</h3>
<p><b>AutoConnect=false</b> <p>Auto-connect to phone on startup, default value is false. Used when anyRemote is in AT-mode.
<p><b>AutoRepeat=false</b> <p>
Auto repeat feature (as on PC keyboard - about 10 events per second). Usefull for mouse emulation, for example.
Default value is false.
<p><b>Baudrate=19200</b> <p>Baudrate to use; default value is 19200
<p><b>CharSet=8859-1</b> <p>Charset to use; default value is 8859-1. Used when anyRemote is in AT-mode.
<p><b>Device=/dev/rfcommX</b> <p>Connect string. Default value is <i>bluetooth:19</i> (which is
used in Server mode, so You have to set this parameter up if plans to use anyRemote in AT mode)
<p><b>Log=true|false|debug</b>
<p>Print or not to print logging info to the file <i>$HOME/.anyRemote/anyremote.log</i>, default value is false.
Use <i>Log=debug</i> for verbose logging.
<p>By default all logging informationin will be stored in <i>$HOME/.anyRemote/anyremote.log</i> file.
This could be altered by setting <i>AR_TMPDIR</i> environment variable.
If <i>AR_TMPDIR</i> environment variable is set then logging information will be printed to
<i>${AR_TMPDIR}/anyremote.log.${USER}</i>
<p><b>RetrySecs=60</b>
<p>Duration in seconds beetween attempts to reconnect to the phone in case
if connection fails. Default value is 60. Works in conjunction with AutoConnect parameter. Used when anyRemote is in AT-mode.
<p><b>Screen=true</b> <p>Send or don't send any commands (SendCKPD(), etc.) to the phone.
Default value is false.
<p><b>CmerOn=AT+CMER=3,1,0,0,0</b> <p>
AT+CMER command which enters phone in "echo" mode. In "echo" mode phone will send
key codes of buttons pressed over bluetooth; no default value. If this parameter is not specified program
will try to determine it automatically. Used when anyRemote is in AT-mode.
<p><b>CmerOff=AT+CMER=0,0,0,0,0</b> <p>
AT+CMER command which exits phone from "echo" mode; no default value. If this parameter is not s
pecified program will try to determine it automatically. Used when anyRemote is in AT-mode.
<p><b>ToMainMenu=E</b> <p>
CKPD sequence which used to reach main screen of the phone from any of phone's menus.
On Motorola-V500 to press "Red Cancel" button is enough to get out from any menu.
Default value is empty string. This parameter is a kind of shortcut which allows not to
specify SendCKPD(E) command (see below) for each Key_Code. Used when anyRemote is in AT-mode.
<p><b>GuiAppName="application name"</b>
<p><b>GuiAppBinary="name of executable"</b>
<p><b>GuiAppRun="command do determine is application running or not; must returns OK or NOK"</b>
<p><b>GuiAppIcon="icon name"</b>
<p><b>GuiAppType=Application|Custom|Example</b>
<p>These parameters is used by GUI frontends only.
<ul type="disc"><pre class="screen">
<span><strong class="command">GuiAppName=Amarok</strong></span>
<span><strong class="command">GuiAppBinary=amarok</strong></span>
<span><strong class="command">GuiAppRun=echo 'A=`dcop | grep amarok`; if [ "x$A" == "x" ]; then echo NOK; else echo OK; fi' | bash -f -s</strong></span>
<span><strong class="command">GuiAppIcon=amarok.png</strong></span>
<span><strong class="command">GuiAppType=Application</strong></span>
</pre>
</ul>
</p>
<br>
<p><h3>[Aliases] section</h3>
<p>Format:
<p><b>Key_Code=New_alias</b>
<p>Different phones uses the different keycodes, for example: Button 1 on Motorola generates keycode 1
but the same button on Sagem generates keycode 49. So, if You plans to use this tools with different phones,
it could be useful to redefine:
<ul type="disc"><pre class="screen">
<span><strong class="command">1=One</strong></span>
<span><strong class="command">49=One</strong></span>
</pre>
</ul>
</p>
and then use "One" in <b>[Keys]</b> section instead of "1" or "49":
<ul type="disc"><pre class="screen">
<span><strong class="command">[Keys]</strong></span>
<span><strong class="command">One=Exec(echo "Hello world!");</strong></span>
<span><strong class="command">...</strong></span>
</pre>
</ul>
<br>
<p><h3>[Keys] section</h3>
<p> A short example:
<ul type="disc"><pre class="screen">
<span><strong class="command">[Keys]</strong></span>
<span><strong class="command">(Init)=Exec(kdialog --msgbox "Initialized");</strong></span>
<span><strong class="command">(InCall)=Exec(kdialog --msgbox "A call from $(CallId)");Make(remote,off);</strong></span>
<span><strong class="command">(EndCall)=Make(remote,on);Exec(kdialog --msgbox CALL_END)</strong></span>
<span><strong class="command">(Connect)=Exec(kdialog --msgbox "Connected")</strong></span>
<span><strong class="command">(Disconnect)=Exec(kdialog --msgbox "Disconnected")</strong></span>
<span><strong class="command">1=Exec(kdialog --msgbox 1)</strong></span>
<span><strong class="command">2=Exec(kdialog --msgbox 2)</strong></span>
<span><strong class="command">3=Exec(kdialog --msgbox 3)</strong></span>
<span><strong class="command">4=Exec(kdialog --msgbox 4)</strong></span>
<span><strong class="command">5=Exec(kdialog --msgbox 5)</strong></span>
<span><strong class="command">[End]</strong></span>
</pre>
</ul>
<p>Format:
<p><b>Key_Codes=Command1;Command2;Command3;....</b>
<p>Where <b>CommandX</b> could be:
<ul>
<li>Exec(...);</li>
<li><a href="emulate.html">Emulate(...);</a></li>
<li>Exit;</li>
<li>SetMode(...); <i>deprecated, use Make(mode,....)</i></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>
<p><b>Exec() command</b>
<ul type="disc"><pre class="screen">
<span><strong class="command">1=Exec(kdialog --msgbox 1)</strong></span>
<span><strong class="command">2=Exec(kdialog --msgbox 2)</strong></span>
</pre>
</ul>
<p></p>
<p>It is possible to define multi-key commands
<ul type="disc"><pre class="screen">
<span><strong class="command">3 1=Exec(kdialog --msgbox 3_1)</strong></span>
<span><strong class="command">3 2=Exec(kdialog --msgbox 3_2)</strong></span>
<span><strong class="command">3 3 1=Exec(kdialog --msgbox 3_3_1)</strong></span>
</pre>
</ul>
<p></p>
<p>It is not good idea to define:
<ul type="disc"><pre class="screen">
<span><strong class="command">3 3=Exec(kdialog --msgbox 3_3)</strong></span>
<span><strong class="command">3 3 1=Exec(kdialog --msgbox 3_3_1)</strong></span>
</pre>
</ul>
<p></p>
<p>simultaneously, since only one command will works (which one - depends on search order).
<p>It is possible to group keymappings in so-called "mode" to set more than one command to the key:
<ul type="disc"><pre class="screen">
<span><strong class="command">1=Exec(kdialog --msgbox 1)</strong></span>
<span><strong class="command">2=Exec(kdialog --msgbox 2)</strong></span>
<span><strong class="command">[Mode]=1</strong></span>
<span><strong class="command">1=Exec(kdialog --msgbox 1_in_Mode_1)</strong></span>
<span><strong class="command">2=Exec(kdialog --msgbox 2_in_Mode_1)</strong></span>
<span><strong class="command">[ModeEnd]</strong></span>
<span><strong class="command">[Mode]=2</strong></span>
<span><strong class="command">1=Exec(kdialog --msgbox 1_in_Mode_2)</strong></span>
<span><strong class="command">2=Exec(kdialog --msgbox 2_in_Mode_2)</strong></span>
<span><strong class="command">[ModeEnd]</strong></span>
</pre>
</ul>
<p></p>
<p>It is possible to write quite complex commands inside <b>Exec()</b>, for example:
<ul type="disc"><pre class="screen">
<span><strong class="command">1=Exec(echo 'D=`dcop | grep digikam`; if [ "x$D" == "x" ]; then digikam& else dcop $D MainApplication-Interface quit;' | bash -f -s)</strong></span>
</pre>
</ul>
<p><b>Macro() command</b>
<p>This command used to create new keymapping:
<ul type="disc"><pre class="screen">
<span><strong class="command">1=Macro(Macro1)</strong></span>
<span><strong class="command">Macro1=Exec(kdialog --msgbox 1);Exec(kdialog --msgbox 2)</strong></span>
</pre>
</ul>
<p>Macro() command can contain condition:
<ul type="disc"><pre class="screen">
<span><strong class="command">1=Macro(Macro2, if [ -f /tmp/file_name ]; then true; else false; fi; echo $?)</strong></span>
<span><strong class="command">Macro2=Exec(kdialog --msgbox "Condition is OK")</strong></span>
</pre>
</ul>
<p>Conditional Macro() will be execute only if a result of execution of command is equal to string "<b>0</b>".
<p><b>Note</b>: In shells result code of command execution stored in <b>$?</b> environment variable.
<p><b>Timer()</b>
<p>Format: Timer(key, timeout, maxTimes) or
<p>Timer(key, cancel|pause|continue)
<p>This command sets/removes a timer for the <b>key</b> specified. A command sequence, associated with this
<b>key</b> will be executed periodically.
<p>For example, the following commands run 'ls -1' command 2 times with timeout equal to 5 sec:
<ul type="disc"><pre class="screen">
<span><strong class="command">7=Timer(TimerCmd, 5, 2)</strong></span>
<span><strong class="command">TimerCmd=Exec(ls -1)</strong></span>
</pre>
</ul>
<p>The following command run 'date' command every 10 sec:
<ul type="disc"><pre class="screen">
<span><strong class="command">8=Timer(Timer2, 10, 0)</strong></span>
<span><strong class="command">Timer2=Exec(date)</strong></span>
</pre>
</ul>
<p>It is impossible to have two active timer commands with the same <b>key</b>.
</p>
To delete existing timer use the following command:
<ul type="disc"><pre class="screen">
<span><strong class="command">9=Timer(TimerName,cancel)</strong></span>
</pre>
</ul>
<p></p>
<p><b>Load() command</b>
<p>This command used to load commands from file and execute them:
<ul type="disc"><pre class="screen">
<span><strong class="command">1=Load(file_name.cmds)</strong></span>
</pre>
</ul>
<p><b>Include() command</b>
<p>This command used to include definitions from external configuration file:
<ul type="disc"><pre class="screen">
<span><strong class="command">1=Include(xmms.cfg)</strong></span>
</pre>
</ul>
Only [Keys], [Aliases] and [Alarms] sections will be loaded (Parameters section will not be loaded).
Definitions from included file will not rewrite existing definitions if any.
<p>
<b>Make()</b>
<p>Format: Make(flush|disconnect|mode|remote|var[,....])
<p>This command used control local state of anyRemote.
<ul type="disc"><pre class="screen">
<span><strong class="command">0=Make(flush)</strong></span>
<span><strong class="command">1=Make(mode,mode_2)</strong></span>
<span><strong class="command">2=Make(remote,on)</strong></span>
<span><strong class="command">3=Make(var,my_var,date)</strong></span>
</pre>
</ul>
See detailed description <a href="make.html">here</a>.
<p><b>SendCKPD() command</b>
<ul type="disc"><pre class="screen">
<span><strong class="command">1=Exec(kdialog --msgbox 1);SendCKPD(E PAUSE E)</strong></span>
</pre>
</ul>
<p></p>
<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 <b>PAUSE</b> to make a 1-second pause before next CKPD command will be sent.
This command works when anyRemote is in AT-mode.
<p></p>
<b>Exit</b>
<p>Exit command used to exit from application.
<ul type="disc"><pre class="screen">
<span><strong class="command">2=Exit;</strong></span>
</pre>
</ul>
<p></p>
<b>SetMode()</b>
<p>Change current keymapping group (do not mix this with AT/Server mode !).
<p>
<ul type="disc"><pre class="screen">
<span><strong class="command">*=SetMode(xmms)</strong></span>
<span><strong class="command">1=Exec(kdialog --msgbox "1 is pressed")</strong></span>
<span><strong class="command">[Mode]=xmms</strong></span>
<span><strong class="command">1=Exec(xmmsctrl play)</strong></span>
<span><strong class="command">[ModeEnd]</strong></span>
</pre>
</ul>
Alse see description of (EnterMode) and (ExitMode) event handlers below.
<p></p>
<p><h3>There are several "events" could be triggered:</h3>
<p>(Init) event will be fired when anyRemote is initialized:
<ul type="disc"><pre class="screen">
<span><strong class="command">(Init)=Exec(kdialog --msgbox "Initialized")</strong></span>
</pre>
</ul>
<p></p>
<p>(Exit) event will be fired when anyRemote is exiting:
<ul type="disc"><pre class="screen">
<span><strong class="command">(Exit)=Exec(rm -f /tmp/tmp.log)</strong></span>
</pre>
</ul>
<p></p>
<p>(Connect) event will be fired when connection established:
<ul type="disc"><pre class="screen">
<span><strong class="command">(Connect)=Exec(kdialog --msgbox "Connected now")</strong></span>
</pre>
</ul>
<p></p>
<p>(Disconnect) event will be fired when connection is lost:
<ul type="disc"><pre class="screen">
<span><strong class="command">(Disconnect)=Exec(kdialog --msgbox Disconnected)</strong></span>
</pre>
</ul>
<p></p>
<p> Auto-lock example:
<ul type="disc"><pre class="screen">
<span><strong class="command">(Connect)=Exec(killall kdesktop_lock)</strong></span>
<span><strong class="command">(Disconnect)=Exec(kdesktop_lock --forcelock)</strong></span>
</pre>
</ul>
<p> Incoming call handling.
<ul type="disc"><pre class="screen">
<span><strong class="command">(InCall)=Exec(kdialog --msgbox "Incoming call")</strong></span>
</pre>
</ul>
<p></p>
<p> End of call handling.
<ul type="disc"><pre class="screen">
<span><strong class="command">(EndCall)=Exec(kdialog --msgbox "Call ends")</strong></span>
</pre>
</ul>
<p></p>
<p> Auto-mute example (amixer utility should be installed):
<ul type="disc"><pre class="screen">
<span><strong class="command">(InCall)=Exec(amixer sset Master,0 mute);Make(remote,off)</strong></span>
<span><strong class="command">(EndCall)=Make(remote,on);Exec(amixer sset Master,0 unmute)</strong></span>
</pre>
</ul>
<p>
<p>If mode is changed by SetMode() then (ExitMode) event for current keymapping group and (EnterMode) event for
the new keymapping group will be fired:
<ul type="disc"><pre class="screen">
<span><strong class="command">*=SetMode(XMMS)</strong></span>
<span><strong class="command">(ExitMode)=Exec(kdialog --msgbox "Exiting from current mode")</strong></span>
<span><strong class="command">[Mode]=XMMS</strong></span>
<span><strong class="command">% Do some initialization steps</strong></span>
<span><strong class="command">(EnterMode)=Exec(kdialog --msgbox "Enter to XMMS mode");Exec(xmms)</strong></span>
<span><strong class="command">% Do some cleanup steps</strong></span>
<span><strong class="command">(ExitMode)=Exec(kdialog --msgbox "Exiting from XMMS mode");Exec(killall xmms)</strong></span>
</pre>
</ul>
<p></p>
<p><h3>Variable substitution:</h3>
<p>In Exec(), Make(var,...), Load(), Include() commands is it possible to use several predefined internal "variables".
<p>Caller ID will be substituted (if determined) instead of $(CallId):
<ul type="disc"><pre class="screen">
<span><strong class="command">(InCall)=Exec(kdialog --msgbox $(CallId))</strong></span>
</pre>
</ul>
<p></p>
<p>Current mode be substituted instead of $(Mode):
<ul type="disc"><pre class="screen">
<span><strong class="command">3=SetMode(xmms);Exec(kdialog --msgbox "New mode is $(Mode)")</strong></span>
</pre>
</ul>
<p></p>
<p>Directory in which resides used cfg.file will be substituted instead of $(CfgDir):
<ul type="disc"><pre class="screen">
<span><strong class="command">3=ExecAndSet(list,replace,Cfg Files,ls -1 $(CfgDir))</strong></span>
</pre>
</ul>
<p></p>
<p>In addition to the predifined internal variables it is possible to define custom internal variables with
<a href="make.html">Make(var,....)</a> syntax.
<br>
<h3>[Alarms] section</h3>
<p> Format:
<p><b>Alarm_file=command1;command2;...</b>
<p>When file Alarm_file will be created, then command1, command2 ... will be executed.
<ul type="disc"><pre class="screen">
<span><strong class="command">/tmp/alarm1=SendCKPD(* 1 *)</strong></span>
</pre>
</ul>
<p></p>
<p>In principle, (since this just keyboard emulation stuff) smart guys ;-) could even make a call with this feature.
<p> For example, the following command will dial number 1111111, waits 6 seconds, then finish the call and type "* 3 *"
on screen of phone (valid for Motorola-V500).
<ul type="disc"><pre class="screen">
<span><strong class="command">/tmp/alarm3=SendCKPD(E 1 1 1 1 1 1 1 S PAUSE PAUSE PAUSE PAUSE PAUSE PAUSE E E * 3 *)</strong></span>
</pre>
</ul>
<p></p>
</div>
<div id="sidebar">
<p class="section">Information</p>
<ul>
<li><a href="index.html">About</a></li>
<li><a href="dload.html">Download</a></li>
<li><a href="pre.html">Prerequisites</a></li>
<li><a href="docs.html">Documentation</a></li>
<li><a href="frontend.html">FrontEnds</a></li>
</ul>
<p class="section">Documentation</p>
<ul>
<li><a href="pre-setup.html">Before install</a></li>
<li><a href="install.html">Compilation and installation</a></li>
<li><a href="mode.html">Which mode to choose ?</a></li>
<li><a href="use.html">How to use anyRemote</a></li>
<li><a href="setup-server.html">Setup: Server mode</a></li>
<li><a href="setup-at.html">Setup: AT mode</a></li>
<li><a href="conf-server.html">Configurational file format: Server Mode</a></li>
<li><a href="conf-at.html">Configurational file format: AT Mode</a></li>
<li><a href="dcop.html">DCOP support</a></li>
<li><a href="web.html">Web interface</a></li>
<li><a href="faq.html">FAQ</a></li>
</ul>
<p class="section">AT mode</p>
<ul>
<li><a href="setup-at.html">Setup: AT mode</a></li>
<li><a href="conf-at.html">Configurational file format: AT mode</a></li>
<li><a href="conf-at.html">Configurational file examples: AT mode</a></li>
</ul>
</div>
<div id="hdr">
<div id="logo"><a href="index.html"><img src="data/anyRemote.png" alt="Home"></a></div>
<!--div id="banner"><img src="data/anyRemote.png" alt=""></div-->
<p class="none"></p>
<div id="hdrNav">
<a href="index.html">About</a> ·
<a href="dload.html">Download</a> ·
<a href="docs.html">Documentation</a> ·
<a href="frontend.html">FrontEnds</a> ·
<a href="contacts.html">Contacts</a> ·
</div>
</div>
<div id="copyright">
Maintained by <a href="mailto:anyremote@mail.ru">anyRemote</a><br>
</div>
</body></html>
|