Skip to content

Instantly share code, notes, and snippets.

@elbruno
Created April 23, 2014 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elbruno/11221168 to your computer and use it in GitHub Desktop.
Save elbruno/11221168 to your computer and use it in GitHub Desktop.
using System;
using InTheHand.Net.Sockets;
namespace ConsoleApplication1
{
class Program
{
static void Main()
{
var bluetoothClient = new BluetoothClient();
var devices = bluetoothClient.DiscoverDevices();
Console.WriteLine("Bluetooth devices");
foreach (var device in devices)
{
var blueToothInfo =
string.Format(
"- DeviceName: {0}{1} Connected: {2}{1} Address: {3}{1} Last seen: {4}{1} Last used: {5}{1}",
device.DeviceName, Environment.NewLine, device.Connected, device.DeviceAddress, device.LastSeen,
device.LastUsed);
blueToothInfo += string.Format(" Class of device{0} Device: {1}{0} Major Device: {2}{0} Service: {3}",
Environment.NewLine, device.ClassOfDevice.Device, device.ClassOfDevice.MajorDevice,
device.ClassOfDevice.Service) ;
Console.WriteLine(blueToothInfo);
Console.WriteLine();
}
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment