Tips & tricks

Enhance security with password

In Server-mode it is possible to set password which will be requested from java client.

To make this it needs to run anyRemote with -password commandline option.

The password phrase should be stored in $HOME/.anyRemote/password file in plain text.

Keepalive messages

If java client on the phone disconnects from PC after some inactivity period it is possible to send keepalive messages to handle this. It just needs to add command like

Timer(_PING_,300,0);

to the $HOME/.anyRemote/hook_connect file and add command

Timer(_PING_,cancel);

to the $HOME/.anyRemote/hook_disconnect file.

In the line above 300 is a number of seconds between Get(ping) requests.

Customization of java client initialization/exiting and connect/disconnect commands.

It is possible to add custom commands to (Init), (Connect), (Disconnect) and (Exit) event handlers.

To do this it needs to create file

and put all needed commands there. That commands will be executed after commands defined in appropriate event handler command sequence.

Support for non-UTF8 encodings

Anyremote java client supports only UTF8 encoding. If You system configured to use other encoding (e.g ISO-8859-15 used in Western Europe) then it is possible to handle this.

It just needs to add commands like

Make(var,from_utf,by_value,|iconv -t ISO-8859-15 -f UTF8);
Make(var,  to_utf,by_value,|iconv -f ISO-8859-15 -t UTF8);

to the $HOME/.anyRemote/hook_init file.

Be sure iconv utility is installed in You system.

Volume control with amixer or pacmd utilities.

If managed application does not allow to control volume, then anyRemote will use ALSA or PulseAudio directly. And using of the PulseAudio will be a preferred.

In this case it needs to have amixer or pacmd utilities installed on Your system.

By default anyRemote will control

If it needs to control sound volume with non-default parameters, it is possible to add definitions of the following variables

to the $HOME/.anyRemote/hook_init file.

For example, default setup for ALSA:

Make(var,default_mixer_up,by_value,amixer sset Master,0 5%+ -q);
Make(var,default_mixer_down,by_value,amixer sset Master,0 5%- -q);
Make(var,default_mixer_mute,by_value,amixer sset Master,0 toggle -q);
Make(var,default_mixer_get,by_value,amixer sget Master,0|\
                        grep '\['|head -1|cut -f 2 -d "["|cut -f 1 -d "]"|sed "s/%//");
Make(var,default_mixer_set,by_value,amixer -q sset Master,0 );

or default setup for PulseAudio:

Make(var,default_sink,LANG=C;pactl stat|grep "Default Sink"|cut -f 2 -d ":"|tr -d ' ');
Make(var,default_mixer_down,by_value,$(CfgDir)/Utils/pulse-audio-ctl.sh down $(default_sink));
Make(var,default_mixer_up,by_value,$(CfgDir)/Utils/pulse-audio-ctl.sh up $(default_sink));
Make(var,default_mixer_mute,by_value,$(CfgDir)/Utils/pulse-audio-ctl.sh mute $(default_sink));
Make(var,default_mixer_get,by_value,$(CfgDir)/Utils/pulse-audio-ctl.sh get $(default_sink));
Make(var,default_mixer_set,by_value,$(CfgDir)/Utils/pulse-audio-ctl.sh set $(default_sink) );