Anuj Tamrakar
Anuj Tamrakar

Reputation: 81

Read data via bluetooth using c#

I am using Lecia Disto e7100i which basically measures distance and area using laser. This device has bluetooth and can be paired with windows. I am trying to develop an wpf app that reads the mesaured data using c#

There is no sdk that comes along with the device. I have tried to use 32feet.Net but since there is no proper documentation I don't know where to start.

Is there any way that I can do to solve my problem?

Upvotes: 2

Views: 9042

Answers (3)

RKalra
RKalra

Reputation: 569

To get started, you can try:

var client = new BluetoothClient();
// Select the bluetooth device
var dlg = new SelectBluetoothDeviceDialog();
DialogResult result = dlg.ShowDialog(this);
if (result != DialogResult.OK)
{
    return;
}
BluetoothDeviceInfo device = dlg.SelectedDevice;
BluetoothAddress addr = device.DeviceAddress;
Console.WriteLine(device.DeviceName);
BluetoothSecurity.PairRequest(addr, "PIN"); // set the pin here or take user input
device.SetServiceState(BluetoothService.HumanInterfaceDevice, true);
Thread.Sleep(100); // Precautionary
if (device.InstalledServices.Length == 0)
{
    // handle appropriately
}
client.Connect(addr, BluetoothService.HumanInterfaceDevice);

Also make sure that

  • Device appears in "Bluetooth devices" in the "Control panel".
  • Device is HID or change code accordingly.

Hope it helps. Cheers!

Upvotes: 1

Denis Schaf
Denis Schaf

Reputation: 2721

This is not a full response, instead its more of a guideline on how to resolve your issue:

  1. Pair the device with your Computer
  2. Run the included software that displays the data somehow
  3. Use WireShark to analyze the traffic
  4. see if it is a standard protocol type or something custom
  5. understand the protocol and reimplement it using c# and BluetoothSockets

Upvotes: 2

Liquid Core
Liquid Core

Reputation: 1

Try this demo project, and the following articles after that one.

Try to follow this tutorial

Here you can see a direct answer by the mantainer of 32feet, with which you can get in touch

Check also this answer

Upvotes: 1

Related Questions