quick_blue icon indicating copy to clipboard operation
quick_blue copied to clipboard

Bluetooth name is empty [Windows]

Open batuhanarslan opened this issue 4 years ago • 13 comments

When i start scan on Windows, bluetooth devices are listed. But their names are empty. However I can see their rssi and MACs.

a

batuhanarslan avatar Aug 25 '21 14:08 batuhanarslan

Sorry I'm too busy these days to resolve this issue. PRs are welcome

Sunbreak avatar Aug 25 '21 15:08 Sunbreak

I'd like to close it without further info

Sunbreak avatar Feb 04 '22 07:02 Sunbreak

@Sunbreak I was also facing this. I think it should be reopened.

fotiDim avatar Mar 15 '22 22:03 fotiDim

Could you provider more info?

Sunbreak avatar Mar 16 '22 02:03 Sunbreak

Again one of the cases where BluetoothLEExplorer works. You seem to be using Advertisement().LocalName(). In BluetoothLEExplorer I see ShortenedLocalName and CompleteLocalName with section values 0x08 and 0x09 respectively.

fotiDim avatar Mar 18 '22 20:03 fotiDim

Again one of the cases where BluetoothLEExplorer works. You seem to be using Advertisement().LocalName(). In BluetoothLEExplorer I see ShortenedLocalName and CompleteLocalName with section values 0x08 and 0x09 respectively.

I tested ShortenedLocalName and CompleteLocalName but they didn't work

I review the code of BluetoothLEExplorer and find it use both DeviceWatcher and BluetoothLEAdvertisementWatcher.

The name is in DeviceInformation from DeviceWatcher. Advertisement is added afterwards

The logic is too complicated. I could use either BluetoothLEAdvertisementWatcher or DeviceWatcher but not both.

  • DeviceWatcher is necessary if you'd like to show name
  • BluetoothLEAdvertisementWatcher is necessary if you'd like to show manufacturerData

Sunbreak avatar Mar 19 '22 14:03 Sunbreak

#71 is a simple workaround. We could use DeviceWatcher if not feasible. Looking forward to your guys feadback

Sunbreak avatar Mar 20 '22 10:03 Sunbreak

I only had partial success with this. Only some devices report their name back and some others just report a generic "Bluetooth" name. image

fotiDim avatar Mar 21 '22 11:03 fotiDim

I would try DeviceWatcher later.

But don't expect too much. C++/WinRT is too complicated for a plugin.

Bluetooth example from win32 may be a better solution: https://github.com/timsneath/win32/blob/main/example/bluetooth.dart

Sunbreak avatar Mar 21 '22 12:03 Sunbreak

@srtonz Do you have an idea why the name is empty?

Maybe we could learn some from device-name-testing of https://github.com/JRHarrison167/flutter_reactive_ble?

Sunbreak avatar Mar 28 '22 01:03 Sunbreak

@Sunbreak, it's been a while that I looked at it.

Purely from memory I think the BLE spec doesn't require for the device name to be included in the advertisement packet, but it does require a Device Name characteristic. See https://www.bluetooth.org/DocMan/handlers/DownloadDoc.ashx?doc_id=521059 sections 3.2.2.1 and 12.1 for details.

If I remember correctly the implementation in https://github.com/JRHarrison167/flutter_reactive_ble/commit/5af9ab42f3814f39c7a3602a75ec635b8d93cfba#diff-70fd061af48289fdc73361282bf0f58d42283cc57b84a00c170697ee2f2f17c8R127-R155 is naive and slow, but did correctly fetch the device name.

I think we ended up using DeviceWatcher to solve this issue, but that of course comes with a different set of challenges :-)

srtonz avatar Mar 28 '22 01:03 srtonz

Thanks a lot. I'll try https://github.com/timsneath/win32/pull/392 first

If not feasible I would try DeviceWatcher later

Sunbreak avatar Mar 28 '22 04:03 Sunbreak

Hi, Is this PR a fix for this issue? If so, I was hoping you could issue a new quick_blue release, are you thinking about it? Thanks

nunof avatar Aug 06 '23 09:08 nunof