Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

James Robertson http://www.r0bertson.co.uk

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Detect the presence of a Bluetooth device

This example shows how to check for the presence of a mobile phone. The code was based on the article 'Implementing Bluetooth Proximity Detection with Asterisk, Part II' http://snipr.com/1vvi5 [nerdvittles.com]

#!/usr/bin/ruby
#file: whereib.rb

deviceid = '00:0E:6D:29:38:EB'
devicename = 'Nokia 6600'

count = 0
while count < 1
  if `hcitool name #{deviceid}`.chomp == devicename 
    puts devicename + ' IN RANGE'
    puts Time.now
  else
    puts devicename + ' OUT OF RANGE'
    puts Time.now
  end
  sleep 7
end  
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS