- Sun Sep 14, 2008 2:56 am
Yes, the MAC is the device's address, which is globally unique. From memory I think it's 48 bits long.
A bluetooth device (e.g. the PDA) can do an inquiry scan and receive the MACs of all visible devices within range, and can also attempt communication with a specific MAC, even if that device has not been configured to be visible in scans.
When you tell a PC or PDA to show nearby devices ( e.g. to choose what to pair with), it first does an inquiry scan to produce a list of MACs, then polls each MAC for its name and device type. Once paired, it knows the MAC, and can continue to communicate with that device even if it is no longer visible to scans ( this is typical for BT earpieces and some phones, where you tell it to be visible for a short time to allow pairing).
Because you only want to detect the presence or absence of a device, you can make use of these functions built in to the bluetooth protocol and don't acually need to send any data, and so don't need any additional intelligence at the 'far' end, and don't need to pair with the device.
The PDA would be configured with the specific MAC it was looking for, so no problems with other BT devices.
I'm not too familiar with the bluetooth API on PDAs, but I would imagine there is probably a call to get the name/device type for a given MAC - if so, you could use this for your purpose - success/failure of this function would give you the on/off state.
However it may be the case that the PDA's OS tries to be too clever and keeps the names cached, and so may not actually try to communicate when you ask the name a secondtime- you'd need to do some tests to see. I have seen Windows do things like this when I was messing with BT modules - after changing a device's name or device type it was difficult to persuade Windoze to see the new name.