Since version 2.0 format of configurational file was changed. Description of format of configurational file for versions 1.X could be found here.
You may find some predefined configuration files in cfg-examples/AT-style directory:
All examples have on-screen help binded to "* *" (press "*" two times).
I hope after investigation of these configuration files You'll become more familiar with its format.
Description of configurational file format (AT-style)
AutoConnect=false
Auto-connect to phone on startup, default value is false. Used when anyRemote is in AT-style.
AutoRepeat=false
Auto repeat feature (as on PC keyboard - about 10 events per second). Usefull for mouse emulation, for example. Default value is false.
Baudrate=19200
Baudrate to use; default value is 19200
CharSet=8859-1
Charset to use; default value is 8859-1. Used when anyRemote is in AT-style.
Device=/dev/rfcommX
Device to connect; default value is /dev/rfcomm0
Log=true
Print or not to print logging info to the file /tmp/anyremote.log, default value is false.
Debug=true
Print or not to print verbose logging info to the file /tmp/anyremote.log, default value is true.Works only if Log=true.
RetrySecs=60
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)
Screen=true
Send or don't send any commands (SendCKPD(), etc.) to phone. Default value is false.
CmerOn=AT+CMER=3,1,0,0,0
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-style.
CmerOff=AT+CMER=0,0,0,0,0
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-style.
ToMainMenu=E
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-style.
[Aliases] section
Format:
Key_Code=New_alias
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:
1=One 49=Oneand then use "One" in [Keys] section instead of "1" or "49"
[Keys] section
A short example:
[Keys] (Init)=Exec(kdialog --msgbox "Initialized"); (InCall)=Exec(kdialog --msgbox "A call from $(CallId)");RemoteOff; (EndCall)=RemoteOn;Exec(kdialog --msgbox CALL_END) (Connect)=Exec(kdialog --msgbox "Connected on $(Time)") (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]
Format:
Key_Codes=Command1;Command2;Command3;....
Where CommandX could be:
Exec() command
1=Exec(kdialog --msgbox 1) 2=Exec(kdialog --msgbox 2)
It is possible to define multi-key commands
3 1=Exec(kdialog --msgbox 3_1) 3 2=Exec(kdialog --msgbox 3_2) 3 3 1=Exec(kdialog --msgbox 3_3_1)
It is not good idea to define:
3 3=Exec(kdialog --msgbox 3_3) 3 3 1=Exec(kdialog --msgbox 3_3_1)
simultaneously, since only one command will works (which one - depends on search order).
It is possible to group keymappings in so-called "mode" to set more than one command to the key:
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]
It is possible to write rather complex commands inside Exec(), for example:
1=Exec(echo 'D=`dcop | grep digikam`; if [ "x$D" == "x" ]; then digikam& else dcop $D MainApplication-Interface quit;' | bash -f -s)
Macro() command
This command used to group several commands:
1=Macro(Macro1) Macro1=Exec(kdialog --msgbox 1);Exec(kdialog --msgbox 2)
Load() command
This command used to load commands from file and execute them:
1=Load(file_name.cmds)
Include() command
This command used to include definitions from [Keys] section from external cfg.file:
1=Include(xmms.cfg))
Only [Keys] section will be loaded (no [Aliases] and [Alarms]). Definitions from included file will not rewrite
existing definitions if any.
SendCKPD() command
1=Exec(kdialog --msgbox 1);SendCKPD(E PAUSE E)
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. Works when anyRemote is in AT-style.
There are several "internal" commands:
TempDisconnect used to temporary (1 minute) disconnecting from phone:
1=TempDisconnect;
Exit command used to exit from application:
2=Exit;
Switch off "remote control" functionality without disconnecting:
3=RemoteOff;
Switch on "remote control" functionality:
4=RemoteOn;
Auto-mute example (amixer utility should be installed, example is for soundcard #0):
(InCall)=Exec(amixer -c 0 sset Master,0 mute);RemoteOff (EndCall)=RemoteOn;Exec(amixer -c 0 sset Master,0 unmute)
Take a look to the order of commands above. RemoteOff command is the last one. If You change order to
(InCall)=RemoteOff;Exec(amixer -c 0 sset Master,0 mute)
then Exec(amixer -c 0 sset Master,0 mute) will not be executed.
Change mode:
5=SetMode(xmms)
There are several "events" could be triggered:
(Init) event will be fired when anyRemote is initialized:
(Init)=Exec(kdialog --msgbox "Initialized")
(Connect) event will be fired when connection established:
(Connect)=Exec(kdialog --msgbox "Connected on $(Time)")
(Disconnect) event will be fired when connection is lost:
(Disconnect)=Exec(kdialog --msgbox Disconnected)
If mode is changed by SetMode() then (ExitMode) event for current mode and (EnterMode) event for the new mode will be fired:
*=SetMode(XMMS) (ExitMode)=Exec(kdialog --msgbox "Exiting from current mode") [Mode]=XMMS % Do some initialization steps (EnterMode)=Exec(kdialog --msgbox "Enter to XMMS mode");Exec(xmms) % Do some cleanup steps (ExitMode)=Exec(kdialog --msgbox "Exiting from XMMS mode");Exec(killall xmms)
Auto-lock example:
(Connect)=Exec(killall kdesktop_lock) (Disconnect)=Exec(kdesktop_lock --forcelock)
Incoming call handling.
(InCall)=Exec(kdialog --msgbox "Incoming call")
End of call handling.
(EndCall)=Exec(kdialog --msgbox "Call ends")
Variable substitution:
In Exec(), SetMode(), Load(), Include() commands is it possible to use several predefined internal "variables".
Caller ID will be substituted (if determined) instead of $(CallId):
(InCall)=Exec(kdialog --msgbox $(CallId))
Current time will be substituted instead of $(Time):
2=Exec(kdialog --msgbox $(Time))
Current mode be substituted instead of $(Mode):
3=SetMode(xmms);Exec(kdialog --msgbox "New mode is $(Mode)")
Directory in which resides used cfg.file will be substituted instead of $(CfgDir):
3=ExecAndSet(list,replace,Cfg Files,ls -1 $(CfgDir))
[Alarms] section
Format:
Alarm_file=command1;command2;...
When file Alarm_file will be created, then command1, command2 ... will be executed.
/tmp/alarm1=SendCKPD(* 1 *)
In principle, (since this just keyboard emulation stuff) smart guys ;-) could even make a call with this feature.
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).
/tmp/alarm3=SendCKPD(E 1 1 1 1 1 1 1 S PAUSE PAUSE PAUSE PAUSE PAUSE PAUSE E E * 3 *)