I have put together a stand alone xPL application that will scan bluetooth devices as well as attempt to ping devices in a list supplied by a mysql database table. This lets you run multiple versions of the application for better location detail. It has been a while since I worked with it and there are separate Mac and Linux versions. Not sure I have much time to do anything with it in the near future. If there is any interest let me know.
Thanks,
Greg
On Mar 17, 2012, at 7:43 AM, Jim Duda wrote:
> On 03/16/2012 10:27 AM, Emmanuel Grout wrote:
>>
>> 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
>
> Emmanuel,
>
> Using Socket code inside the main Misterhouse loop isn't going to work
> very well. You should read up on Process_Item in www.misterhouse.net
> in the Docs section. Network_Item might help to, but I'm not sure
> it can be used with Net::Bluetooth (I suspect not).
>
> If you have a script which does the work for you, you can have
> the script be called by Process_Item, and have the results dumped
> to a file which you can interrogate the results from.
>
> Alternatively, you could possibly put your subroutine above as a call
> within Process_Item and avoid using a shell script. In a nutshell,
> Process_Item exexutes a "fork" from misterhouse and allows things to
> be done in their own process thread.
>
> Hope that sends you in a better direction.
>
> Jim
>
>
>
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
>
http://p.sf.net/sfu/sfd2d-msazure> ________________________________________________________
> To unsubscribe from this list, go to:
http://sourceforge.net/mail/?group_id=1365>
>
> !DSPAM:4f649547331628652212316!
>
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure________________________________________________________
To unsubscribe from this list, go to:
http://sourceforge.net/mail/?group_id=1365