in

Detect mobile device in range using C# for Windows Mobile 6.1/6.5 over Bluetooth

Hello,

I am a TOTALLY newbie as far as bluetooth is concerned, however, I need a simple and reliable way (in C# or C#-accessible format) for a Windows Mobile 6.1/6.5 device to detect the presence of another Windows Mobile 6.1/6.5 device, without needing to have both devices running the same bluetooth stack, i.e. Microsoft or Broadcom bluetooth stacks.

I don't care about pairing my Admin WM device to any of the (client) WM devices or accessing services or data within those WM devices...I just need to know if a (client) WM device is in range (provided that the search is initiated from the Admin WM device), OR, If the Admin WM device is in range (provided that the search is initiated from a (client) WM device).

I don't know beforehand what bluetooth stack will be running on any of the Windows Mobile devices (clients) to search for, however, I should be able to use one of the available major bluetooth stacks in the WM platform for the Admin WM device that will be used to search for/locate other WM devices (Admin device).

FIY, if the device location code has to run on my Admin WM device, I can have a list of the MAC ID addresses of any (client) WM devices I might need to search for in the future. Is knowing the Bluetooth MAC ID of the (client) WM device useful for the device detection process over Bluetooth?

Alternatively, if the device location code is run on the (client) WM devices, then I am thinking I could use the name of the Admin WM device (say, AdminBTDevice) that the (client) WM device should look for. Is that useful for the device detection process over Bluetooth?

The whole WM device detection should be transparent to the user of the (client) WM device, i.e. they should not do anything (other than having their phone switched on), and they must not be aware that this is happening, i.e. their device is being searched for by the Admin WM device, etc.

Finally, I need to be able to switch on the Bluetooth service on the (client) WM device (if it is switched off) and then restore it to its previous state after the device has been detected.
I just need the C# code to do this both on Microsoft *and* Broadcom bluetooth stacks operating within devices running Windows Mobile 6.1/6.5 (the code to switch on/off the bluetooth service on the WM client will be running locally on the WM client and will be invoked remotely).

Can this be accomplished using C# .Net CF 2.0 and how (I need working examples, please), or is there some (not very expensive or free) software library you have used or know that I could incorporate in my application so as to achieve such functionality?

I appreciate your thoughts and help on this matter.
Movie Stars

Solution: Detect mobile device in range using C# for Windows Mobile 6.1/6.5 over Bluetooth

look at this article: http://www.codeproject.com/KB/mobile/Bluetooth_connection_C_.aspx

knowing BT address of client device would help you as you don't need to perform SDP query each time. instead, just request some 'rare' service and get 'not supported' for devices in range and timeout for out-of-range ones.