Bluetooth remote control

aim

remote control (here: page-up and page down buttons)

dependencies

optional

comments

The intention of this program is to demonstrate the simplicity of writing a personal bluetooth remote control. The following code is designed to remote control with a Motorola v600 the buttons (e.g. page-up and page-down) and thus control any X application. The purpose was to change the slides in a gthumb-presentation with my mobile phone.


#!/usr/bin/perl -w
use strict;
my $mobile_hello="+MBAN: Copyright 2000-2002 Motorola, Inc.";
my $mobile_init="at+cmer=3,1,0,0,0\r";
open(BLUETOOTH, "+>/dev/rfcomm0");

while ( <BLUETOOTH> )
{
chomp(my $eingabe = $_ );
if ( "$eingabe" eq "$mobile_hello" ){print BLUETOOTH $mobile_init;}

elsif ( "$eingabe" eq '+CKEV: "5",0' ){system("./xsendkey 27");}
elsif ( "$eingabe" eq '+CKEV: "U",0' ){system("./xsendkey 99");}
elsif ( "$eingabe" eq '+CKEV: "D",0' ){system("./xsendkey 105");}
elsif ( "$eingabe" eq '+CKEV: ":C",0' ){system("./xsendkey 105");}
elsif ( "$eingabe" eq '+CKEV: ":X",0' ){system("./xsendkey 99");}
elsif ( "$eingabe" eq '+CKEV: ":R",0' ){system("./xsendkey 27");}
elsif ( "$eingabe" eq '+CKEV: ":L",0' ){system("./xsendkey 26");}

print $_;
}
close(BLUETOOTH);

back