That has nothing to do with the Extension and everything to do with the hardware's program. The program must include a name. If the manufacturer has applied a name, all of the detectors from one manufacturer will most likely have an identical name, which would be good for filtering-out (assuming only one or two detector manufactures). If, on the other hand, each device you want to list is actually named, then you can filter-in those which may be much quicker if you know the total number of devices as you can stop the scan once the required devices have been found.
I doubt this is the case but if the devices you wish to find are always the same ones, then a scan of available devices is not required. The App can store the device addresses and simply connect only with them.
Concerning the number of devices being in the hundreds, that is bound to slow down a Smartphone because of the intrinsic design of BLE itself. Use a Clock Timer to allow all the devices to be found and added to the list.
Okay, so the solution should be the following: All devices, I want to use, contains "BTG" in the name. So I scan for a specific short period of time, then stop the scan and add all devices that contains "BTG" in the name to a list. Then repeat the process to find more devices with the correct name and add them to my list – if not there yet. Right?
I'm wondering what environment do you want to scan/find devices in when there are tens or hundreds of devices available there. If previously found devices are known, they should be saved in a list (TinyDB) and it can then be queried which of the devices found during scanning (in an environment with many devices) are already contained in the saved list. Only devices that are already known can be listed.
So answer the question, what environment are we talking about, where dozens of devices can be listed. And which of these devices should be listed - for what reasons? And which other users might also have access to these devices during this time?
I admit that I haven't worked with the BLE extension very often, so I'm not familiar with all the possible scenarios. So what exactly is the aim/purpose of your app?
I don't see any device with "BTG" in the list (of your screenshot).
Btw, the .FoundDeviceName_index method seems to return an empty string. Is yours different?
Okay: I use a Powermeter that measures electrical measurements and give them via Bluetooth to an Android App. There is an ugly app from the manufacturer, so I sniffed the communication and made my own app. The Powermeters has different names, but all names contains BTG. The App includes a Bluetooth search that list all devices that contains BTG in the name. I choose one of them and the device is connected. The connected device is stored in the app cache and when I restart the app it will automatically search for this Powermeter.
Now, my problem happens when I try to use this Powermeter on a fair. The app starts to scan devices and put all devices to the BluetoothLE.DeviceList (that is generated automatically, when I use When BluetoothLE.DeviceFound) from where the app should copy the ones with the right name to my own list and select the right one to connect. But when there are too many devices around it crashed (or will get very very slowly - not useable anymore).
My though was that it should be possible to filter the devices before they are put to BluetoothLE.DeviceList to prevent that crash.
My Block looks like this. I think I do nearly the same. (I use Buttons instead of a listview because the device needs to operate from an Android TV without touchscreen, too)
Well, your posts go in a direction that actually has nothing to do with the original topic anymore. So these should be moved to a new topic again - but not under the "Bugs" category.
Maybe some PU can do that, since I don't have much time at the moment.
What is interesting is that devices are found one-at-a-time. Snag is, the Extension, in an ideal environment, finds devices in a short space of time, possibly too quickly to test each as they are found, but we can try (untested code!):
I have asked MIT Guru Evan Patton if he can add a new function to the Extension to filter the BLE Device List on-the-fly. Note that we have never required this before so it isn't a priority - but since Evan is currently working on an Extension update, we might get lucky!
Great. Thx, ChrisWard. Perhaps this will be solved with 2023 Bluetooth LE extension. I will try to make more experiments on the next fair. (Don't know how to simulate hundreds of BLE devices else...)
Yes, I think so. However, you must add at least one .Connect block to the Blocks area to get the android.permission.BLUETOOTH_CONNECT permission declared in the Manifest.
According to my tests, this permission is generally required, even if it's just about listing (scanning) BLE devices. (I've already pointed this out elsewhere and let @ewpatton know about it.)
For Android 11 and earlier it does the same thing it always did. BLUETOOTH and BLUETOOTH_ADMIN were install time permissions so there wasn't a need to perform runtime permission requests. With Android 12+, we have to add new permissions (as discussed elsewhere) and ask for them at the appropriate times. The problem at the moment with the BLE extension is that one of the APIs we use in some properties actually requires CONNECT permission (e.g., DeviceList) even though we haven't actually connected to the device yet, such as when one presents the list of devices to pick from. In the next beta version I'll be adjusting the permissions to account for this.
Here is the screenshot of the apk application in the classic environment. But I don't understand the link between what you are asking me to do and the fact that all the aia applications used with the companion systematically cause the error message concerning Bluetooth. Can you explain to me the relationship between the
Good morning, could you post or send me the .aia file of this apk [mod edit personal info removed, use the community Private Message feature instead]. Please
I allowed a couple minutes of searching. hoping for the most complete list.
Even though the expected device was not viisble i still tried to connect to all.. However all attempts to connect predictably fail as the HC-05 device is not visible.
Im new and this is my first post so i might be missing something obvious.
The results with the second app where identical, so i figured there was noneed to upload anything
Thanks
Beto
"According to the HC-05 datasheet it is using Bluetooth Version 2.0 (Bluetooth Classic) while you are trying to access it with Bluetooth Low Energy (BLE), which was introduced in Bluetooth Version 4.0. You have to use a different module or write to it using classic Bluetooth." (*)