Using bluetooth to count other bluetooth devices nearby?

I am looking for a way to have a arduino with bluetooth capability that can automatically pair with devices that come in range and count the number of devices.

The devices would also be arduino boards with bluetooth.

So the scenario would be a base arduino with bluetooth, and when its brother boards come in range it automatically can connect and identify its fellows and record them.

Is this a straight forward application for arduino? I'm not sure which bluetooth module I should be looking at and if they are capable of this dynamic pairing? Would I be better off using Wireless SD shield? Is it capable of recognizing connections automatically without any more pairing after inital setup?

I am looking for a way to have a arduino with bluetooth capability that can automatically pair with devices that come in range and count the number of devices.

Pairing implies that the other device allows it. There may be hundreds, or thousands, of bluetooth devices that pass by your device on a daily basis that tell it to go to hell when it tries to pair with them. You want to count them, or not?

What are you trying to accomplish? That is more important than how at this point.

Im pretty sure what you want to do is in a sense, not legal. By that I mean if you want to pair to other devices like phones and laptops, I sure that will go under invasion of privacy. Because technically you would have control or some kind of "LINK" to someone elses personal device. HOWEVER, some bluetooth modules have a SCAN function, in which they can detect other BT devices without needing to pair to them.

Same goes for arduino BT devices.

I could be wrong, it may not be invasion of privacy, but it still sounds wrong to do, or be able to do.

Though I have never tested it, this devices http://www.hobbytronics.co.uk/wireless/bluetooth/bluetooth-module datasheet states it does AT+INQ commands that enquires what BT devices are within range and what class of device they are. The command does not connect to the BT device (that's a different command) so should have no legal/ethical problems.

Thanks for all the replies.

The best way to describe it is like a capture the flag type of scenario. I have a number of bluetooth enabled devices that are all made by me. I want the base/flag device to connect automatically to its brother devices when they are in range so it can tell how many other devices are in its area. I'm not interested in anyone elses devices like phones and laptops.

I've been looking at the Xbee module instead, perhaps this would be a better way to achieve what I want?

XBee will have a lot greater range that might not suit your needs if your using a beacon to detect when the flag is in your home/enemy camp.

I can set it to lower power and potentially box it in a metal box with holes to reduce its range if needed. But 20-30m is ok really.