Using Ruby to detect Bluetooth proximity
deviceid = '00:12:D1:E6:57:BE' range = '' count = 0 while count < 1 # assuming the bt device is already connected get the signal strength value. range = `hcitool rssi #{deviceid}`.chomp if range.length > 0 puts range[/\w+$/] else puts 'connecting to the bluetooth device ...' Thread.new{`rfcomm connect 0 #{deviceid}`} end sleep 7 end