Author Topic: Incorrect Device Names  (Read 359 times)

Offline tomitrescak

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Incorrect Device Names
« on: July 30, 2020, 06:55:25 AM »
Hello, I am currently evaluating your product, which we are thinking of using in our research project.
It seems that this is the only library that actually works in Unity on PC ATM, so great job,

My issue is that the demo you provide is not very usable, as instead of Device Names and Capability Names, we receieve addresses.
I tried to use the GetRemoteName, which comes up with a cryptic name "Bluetooth:{Address}", instead of actual name.
Only one of the devises actually showed its name.

This is the slightly modified code from the original Unity demo that I found in your github page:

Code: [Select]
private void FManager_OnDeviceFound(System.Object sender, IntPtr Radio, long Address)
{
        string name;
        FManager.GetRemoteName(Radio, Address, out name);

        Debug.Log($"Device '{name}' found: " + Address.ToString("X12"));

        // Add device into found devices list.
        FDevices.Add(Address);
}

This is what I see in Unity Log

Code: [Select]
Device 'Bluetooth 2c:41:a1:99:02:3b' found: 2C41A199023B
Same situation with capabilities.
Any advice on how to get redable names?

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3536
  • Karma: 1000
    • Wireless Communication Libraries
Re: Incorrect Device Names
« Reply #1 on: July 30, 2020, 07:44:25 AM »
Hello,

It is normal for Windows. It appears because Windows does not resolve device names during discovering and does not send actual HCI GetDeviceName command when you query a device's name from an application. (If we are talking about MS drivers).

There are 2 solutions (depending on the device type):

1. If your device is classic then try to resolve device's name after discovering completed (as it is shown in BluetoothManager demo app).
2. If your device is LE one use BeaconWatcher instead (refer to Beacons demo or better to this code: https://github.com/btframework/WeDo/blob/master/NET%20Edition/WeDo%20Framework/wclWeDoWatcher.cs)


 

Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13 14