Remote Control using Telnet
|Applicable only for the following:|
|PCH NMT models:||A100/110/B110|
If you want to build an application that controls your NMT you can use a plain telnet connection and execute the following commands. Needless to say, before you can use any of these commands you need to install a telnet server on the NMT.
Remote control emulation
You can emulate the IR remote control that came with the NMT. This works for all applications.
echo KEYCODE > /tmp/irkey
Replace the string KEYCODE with any of the following key codes:
|Command||Key code||Command||Key code|
The keycode for the numeric keys is 0xF1 + the number of the key. For example the key 0 is $((0xF1)), the key 1 is $((0xF2)), 2 is $((0xF3)), etc. These codes act just like the keys on the IR remote. If you press a key multiple times it will replace the number with an alphanumeric character.
If you want to emulate a keyboard you can send the value of the ASCII characters. You can use the decimal values as the key code, or use the hexadecimal value and write it like $((0xAA)).
Telling Gaya to navigate to an URL
You can instruct Gaya - the HTML browser and responsible for the main user interface - to navigate to an external or internal URL.
echo -n "http://localhost:8883/start.cgi" >> /tmp/gaya_bc
Manually starting a media file
It is possible to manually start playing a media file or DVD image.
To start a DVD use the following command:
amp_test /path/to/file --dfb:quiet -osd32 -bgnd:/bin/logo.jpg
To play a MP3 track
mono -audio -prebuf 100 -bgimg -single /path/to/file -dram 1
To play a video file
mono -nogui -single /path/to/file -dram 1
To play a playlist of audio files
mono -audio -bgimg -playlist /path/to/playlist -dram 1
Stopping all application before starting a media file
If you start playing a file while another file is already playing or Gaya is running, you are going to cause a lot of problems and make the NMT very unstable.
To prevent these problem you need to stop all applications before running the command above.
echo 212 > /tmp/irkey sleep 1 killall mono killall pod killall gaya killall amp_test sleep 1
Starting the media player using nohup
If you execute one of the commands above you will notice that you no longer can emulate the remote control. This is because the commands above keep running and do not return to the command line until playback of the files has finished.
To solve this problem you need a small tool called nohup. Unfortunately nohup is not part of the firmware. It is part of busybox26 which is commonly used to provide telnet access to the NMT. If busybox26 is not present on the NMT, your application need to install a copy.
/bin/busybox26 nohup mono -nogui -single /path/to/file -dram 1 > /dev/null 2>&1 &
Restarting Gaya after playing a media file
Another problem you may run into is that Gaya does not restart after playing the file.
To make sure that Gaya restarts you need to create a shell script that runs the mono command and restarts gaya afterwards.
echo "mono -nogui -single /path/to/file -dram 1 > /dev/null 2>&1" > /tmp/runmono echo "gaya http://localhost:8883/start.cgi > /dev/null 2>&1" >> /tmp/runmono /bin/busybox26 nohup sh /tmp/runmono > /dev/null 2>&1 &
This final example will stop playback of any current file, start a video file and restart gaya after the file is done playing. During playback you can still send commands to the NMT for controlling playback.
echo 212 > /tmp/irkey sleep 1 killall mono killall pod killall gaya killall amp_test sleep 1 echo "mono -nogui -single /path/to/file -dram 1 > /dev/null 2>&1" > /tmp/runmono echo "gaya http://localhost:8883/start.cgi > /dev/null 2>&1" >> /tmp/runmono /bin/busybox26 nohup sh /tmp/runmono > /dev/null 2>&1 &