Bluetooth Presence Monitoring
Hello the list :)
I want to monitor my presence using my Bluetooth cell phone so I did this :
######################################
use Net::Bluetooth;
########################################################################
# Ping BT device
########################################################################
sub Check_BT() {
my $BT_obj = Net::Bluetooth->newsocket("RFCOMM");
die "socket error $!\n" unless(defined($BT_obj));
if($BT_obj->connect(@_, 1) != 0) { print_log "@_ is dead"; }
else { print_log "@_ is alive"; }
$BT_obj->close();
}
########################################################################
# Main
########################################################################
if (new_second 20) { &Check_BT('AC:A8:E5:18:5B:F1'); }
If I restart MH it will work for the first time only, however this is working fine from the shell ?!
I think I am doing something wrong with the socket inside MH but can't figure what.
Any ideas ?
Good day to all !
Emmanuel