[Solved] How do I list results of BLE scan to include BOTH the Device Name and Device ID?

I am scanning for BLE devices then listing the results on screen. I can list the Device Names without a problem, and the Device IDs without a problem, but I would like to show both of these together on each line of the list. I have tried various approaches including join text (see below failure), but no luck so far. Any suggestions appreciated!

1 Like

As a matter of point, “text items” implies more than one item. The list viewer is a tool to see and select different entries from a LIST, so I assume that you may need to assign a LIST, which could be two individual text strings, as opposed to a string.

So, you do not join the two text; you assign each text component “Device Ids” and “Device Names” to a “create a list” block, which then is assigned to the list viewer.

1 Like

Thanks. I saw this image in the list viewer docs:

But I can not find the “Create a list” block in ThunkableX. I tried the simple List block:

image

I put Device IDs as the first line and Device Names as the second, but that just resulted in all the Device IDs squeezed onto the first line of the listviewer and all of the Device Names squeezed onto the second line.

So I am still stumped.

2 Likes

I see. You want name#1 to be besides id#1, and name#2 besides id#2, etc.

That will take some doing.

You will have to parse both lists (names and ids), grabbing each element of both list in parallel and associate them in a resulting combined list. There is no free lunch, the logic you want will not happen just because you need it, you will have to code it.

An alternative would be to have two listview, side by side, with the first one on the left having the name, and the right one on the right the id. The issue would be that those, if they need to scroll, would not do so synchronously.
Having a composite list, with both the name and id, would mean that selection would pick up an element that is neither a device name nor a device id, and would need to be split to return something that could be used.

2 Likes

OK, that makes sense. I will give it a shot. Shouldn’t be too difficult…:rofl:

Thanks!

1 Like

Hi @zimbu-bcb,

@CBVG has been giving you excellent advice! I’m just letting you know that the ‘list’ block you refer to is exactly the same as the ‘create list with’ block - we just renamed it.

Thanks for jumping in, Jane. That’s what I assumed; I have some experience with MIT AI2 where the support docs are sometimes “a little bit” out of sync with reality.

I’m just testing out whether the ThunkableX platform is ready to handle BLE apps yet or not. From my experiments yesterday, it seems to not be quite there yet. I was hoping to build an app to configure beacons, so I definitely need a “BLE When Strings Received” block, a disconnect BLE block, and some ability to include both Service UUIDs and Characteristic UUIDs.

But it seems pretty solid so far for communicating with Arduinos, so that’s a nice step in the right direction. Hopefully the BLE coder at Thunkable X can keep up the hard work!

Thanks!

2 Likes

Can I ask you to check if you can get anything out of the list of BLE device names? I can only get a list of ID’s, but when I try to display names, there are only blank fields. Thanks.

1 Like

Actually, it shows some names sometimes…

How did you manage to show names. Also, how can I count the number of Bluetooth Devices in a list of .DeviceFound. I am able to display the list but cannot count the number of elements in it.

1 Like

In the list blocks. There is this block

Have you tried it? Also, I suggest you check out this example

https://x.thunkable.com/copy/2b15204588729bb5cd9c94e1e511c279

1 Like

Yes I tried the list option. It seems to scan all devices using .DeviceList but I cannot count the number of devices detected for some reason. I might use the Classic Bluetooth extension by Pura Vida to help.

I’ll check this out later today. I’ll add the feature and get back to you!

I have this solution

4 Likes

You are responding on a post where the last reply was 2 years ago.

1 Like

sorry, i was it recently

2 Likes

Still… it helped me.

2 Likes