Working With Bluetooth Devices Using C# – Part 1



Working With Bluetooth Devices Using C# – Part 1

32feet.NET is a shared-source project to make personal area networking technologies such as Bluetooth, Infrared (IrDA) and more, easily accessible from .NET code.

Supports desktop, mobile or embedded systems. The project currently consists of the following libraries:-

  • Bluetooth
  • IrDA
  • Object Exchange

In this post I’ll show how to find Bluetooth devices using C# code.


Download Demo Project

First download assemblies, the create new project and add those assemblies.

Add using for using InTheHand.Net.Sockets;

BluetoothClient bc = new BluetoothClient();

Use BluetoothClient to discover bluetooth devices:

public BluetoothDeviceInfo[] DiscoverDevices();

public BluetoothDeviceInfo[] DiscoverDevices(int maxDevices);

public BluetoothDeviceInfo[] DiscoverDevices(int maxDevices, bool authenticated, bool remembered, bool unknown);

*** DiscoverDevices takes about 20-30 seconds to complete.

List<Device> devices = new List<Device>();

BluetoothClient bc = new BluetoothClient();

BluetoothDeviceInfo[] array = bc.DiscoverDevices();

int count = array.Length;

for (int i = 0; i < count; i++)


    Device device = new Device(array[i]);



public class Device


    public string DeviceName { get; set; }

    public bool Authenticated { get; set; }

    public bool Connected { get; set; }

    public ushort Nap { get; set; }

    public uint Sap { get; set; }

    public DateTime LastSeen { get; set; }

    public DateTime LastUsed { get; set; }

    public bool Remembered { get; set; }


    public Device(BluetoothDeviceInfo device_info)


        this.Authenticated = device_info.Authenticated;

        this.Connected = device_info.Connected;

        this.DeviceName = device_info.DeviceName;

        this.LastSeen = device_info.LastSeen;

        this.LastUsed = device_info.LastUsed;

        this.Nap = device_info.DeviceAddress.Nap;

        this.Sap = device_info.DeviceAddress.Sap;

        this.Remembered = device_info.Remembered;



    public override string ToString()


        return this.DeviceName;



Download Demo Project

Add comment
facebook linkedin twitter email

Leave a Reply


  1. online13/03/2010 ב 05:08

    ler todo o blog, muito bom

  2. Gili25/03/2010 ב 22:47

    Hi Shai,
    Ahla code, but it doesnt seem to work with devices made by BroadCom Corporation.
    any other solution for us?

  3. shair25/03/2010 ב 23:57

    Hi Gili,

    Please contact me through “Blog Contact” and I’ll help solve this issue with BroadCom products.


  4. Murali10/05/2010 ב 15:18


    Thanks for the useful post and code.

    I am a kind of new bee in bluetooth technologies. I am experimenting with my Health related application, I am actually preparing some demo.

    My problem is I cant download assemblies from their website. Could you kindly help me by guiding to find the direct link to download them.

    Help is highly apreciated.


  5. Nuno Moreira15/05/2010 ב 12:13

    How can we detect if a service is present in a device ? I mean, when i connect to a device i want to know if a specified Service is already installed…

    Thanks in advance

  6. shair15/05/2010 ב 13:20


    I have this example on the Bluetooth Radar project in codeplex, you an download the source and how it is done.


  7. lavanya07/07/2010 ב 12:41

    hi it says 33feet does not support bluetooth stack. my laptop is 3000 g530s
    there is no bluetooth. but i use a dongle of bluesoleil. even then its shows not suppported. kindly help

  8. Romy King24/02/2012 ב 13:26

    how do u retrieve the mac address of a bluetooth device in c#?????plz help by replying at…i am trying to get mac address of a searched device…