Zerone
Zerone

Reputation: 566

How to detect Bluetooth activated laptops in range in Windows using C#

I'm interested in creating a wireless network of laptops using Bluetooth developed in C#.

I want to get the list of Bluetooth activated devices in range ( preferable computers, not dongles, headsets or phones). I don't think I need to use a Bluetooth adapter specific stack coz I have seen Windows searching for Bluetooth devices in range. How can I run such a search in my C# app and list the computers in range?

Please help me to do this, also let me know if my effort is wrong. Thank you.

Upvotes: 1

Views: 2807

Answers (1)

ahawker
ahawker

Reputation: 3374

There is a nice C# Bluetooth library available in 32feet.NET.

If you have no need for any of the additional features it offers and you wish to do the P/Invoke on your own, documentation can be found here; specifically the BluetoothFindFirstDevice and BluetoothFindNextDevice for device discovery.

Additionally, you can use windows sockets to do device/service discovery. Information on that can be found here.

If you wish to specifically filter out types of Bluetooth devices, you will want to look at the ulClassOfDevice field in the BluetoothDeviceInfo.

Upvotes: 3

Related Questions