#!/usr/bin/perl
-# Author: Tim Pope
+# $Id$
+# -*- perl -*- vim: ft=perl sw=4 sts=4
# Monitors a bluetooth mobile phome for calls. You'll need to bind rfcomm1 to
# your mobile phone's SP service. You'll also need my Device::Nokia module
use Device::Nokia;
my $number;
my %status;
+my $quiton;
+my $daemonize;
my $gsm = new Device::Nokia( port => '/dev/rfcomm1', log => 'file,/dev/null');
initialize($gsm) || die "Could not initialize modem: $!";
-daemonize() if (shift eq "-d");
+while($_=shift) {
+ $daemonize=1 if ($_ eq "-d");
+ $quiton=1 if ($_ eq "-b");
+}
+
+daemonize() if $daemonize;
while(1) {
%status=("is_active"=>1);
}
undef $status{"number"} if (!$number && $status{"callsetup"}==0 && $status{"call"}==0);
output_status(%status);
+ death() if ($status{"source"}==0 && $status{"callsetup"}==0 && $status{"call"}==0 && $quiton);
}
$gsm->disconnect();
#print "Chillin'...\n";