Added NuGet auto download and scan for names on peripheral
Also FYI current pub.dev version of 6.0.0-dev fails because the linux version links to a version that still calls .trimGATT
Thank you for this contribution.
I think the NUGET download can be improved like this: https://github.com/flutter/packages/blob/main/packages/local_auth/local_auth_windows/windows/CMakeLists.txt
I have a worry about the BluetoothLEDevice.formAddressAsync. First this is a async operaton, it will take extra time to complete and maybe block the discovery stream? Second I have no idea why there are two name properties(BluetoothLEDevice.Name and Advertisement.LocalName). In my test if I set the name in the advertisement, I can get it from the Advertisement.LocalName, So what is the BluetoothLEDevice.Name stand for? Should we use this name as advertisement name?
Also I notice you set the scanning mode to Active, Seems the watcher can listen scan response after this. I'm wondering if the name included in the scan response? if the name exists in the scan response, I think we can resolve it from the scan response instead of this async way.
if (type == winrt::Windows::Devices::Bluetooth::Advertisement::BluetoothLEAdvertisementType::ScanResponse ||
type == winrt::Windows::Devices::Bluetooth::Advertisement::BluetoothLEAdvertisementType::Extended)
{
// TODO: handle scan response here.
return;
}
Please adjust the NUGET part and remove the device name part temporarily, then I will merge this into the 6.0.0 branch.
Alos can you try to resolve the device name from the scan response? I'm prefer to use the scan response instead of the async operation to resolve the advertisement name.
I have pushed a new version of bluetooth_low_energy_linux, the error should be fixed after run flutter pub upgrade
I don't know how to extract the device name through the ScanResponse or Extended advertisement. We get two values from this dart code:
centralManager.discovered((result) {
String peripheralUUID = result.peripheral.uuid.toString();
String advertisementName = result.advertisement.name;
} );
For our devices:
The peripheralUUID name is correct on Windows but randomised on macOS/iOS, so we cannot use it for identification.
The advertisementName is empty on Windows but not on macOS/iOS. With the above change it is equal to the advertisementName received on iOS/macOS. This way we can use advertisementName to distinguish different bluetooth devices before connecting to them.
OK. I will try to resolve the device name with a better way later. You should do what I said in the last comment to make this pull request merged
Good news! I have confirmed that the missed device name is included in the scan response, I have pushed this to the 6.0.0 branch, you can pull the latest code and run the example in the bluetooth_low_energy_windows to see the difference.
Good news! I have confirmed that the missed device name is included in the scan response, I have pushed this to the 6.0.0 branch, you can pull the latest code and run the example in the bluetooth_low_energy_windows to see the difference.
That's amazing. Thank you. I will test the update.
Changed NuGet download to your way, still testing.
Ok, how do we get the device names in this new version? For now, I still get blanks under Windows with the newest version.
Ok, how do we get the device names in this new version? For now, I still get blanks under Windows with the newest version.
Can you see the log with AdvertisementType.scanResponse? Now the advertisement of one device can be normal advertisement or scan response, the name should be contained in one of them
Can you check the URL_HASH of googletest? The SHA256 I computed is different.
Can you check the URL_HASH of googletest? The SHA256 I computed is different.
That's the hash of the 0 length file. curl doesn't work to download the file.
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
My hash should be correct. Try:
wget "https://github.com/google/googletest/archive/v1.14.0.zip" && shasum -a 256 v1.14.0.zip returns
1f357c27ca988c3f7c6b4bf68a9395005ac6761f034046e9dde0896e3aba00e4
If you want, I can also remove the hash again for google_test.
Ok, how do we get the device names in this new version? For now, I still get blanks under Windows with the newest version.
Can you see the log with AdvertisementType.scanResponse? Now the advertisement of one device can be normal advertisement or scan response, the name should be contained in one of them
![]()
![]()
Good news, it is working now after rebasing with your newest changes! Your BLE library is the best one, we've tested a myriad of them. Thanks.
Let's merge the nuget changes?
That's the hash of the 0 length file. curl doesn't work to download the file.
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855My hash should be correct. Try:
wget "https://github.com/google/googletest/archive/v1.14.0.zip" && shasum -a 256 v1.14.0.zipreturns1f357c27ca988c3f7c6b4bf68a9395005ac6761f034046e9dde0896e3aba00e4If you want, I can also remove the hash again for google_test.
You are right. The damn Chinese network! Thank your for this merge request.
That's the hash of the 0 length file. curl doesn't work to download the file.
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855My hash should be correct. Try:wget "https://github.com/google/googletest/archive/v1.14.0.zip" && shasum -a 256 v1.14.0.zipreturns1f357c27ca988c3f7c6b4bf68a9395005ac6761f034046e9dde0896e3aba00e4If you want, I can also remove the hash again for google_test.You are right. The damn Chinese network! Thank your for this merge request.
Same here in Europe btw. :P Plain curl doesn't work for this link for some reason.

