I need help with parsing the BLE HM10 device name to a selection list

I’m working on an app for model railroading using BLE HM10. Using the standard BLE extension, I can populate the device selection list. Two items - I want the selection list to be only the BLE units on the layout. I intend to name the BLE units with “AA” (or some other unique two letter combination) and then have the app list only those units with a name beginning with the two-letter combination. The second part would be to parse out the two-letter combination.

As example, the device name will include the two-letter combination, the AAR car type (HM for coal hopper, XM for standard boxcar) and the railroad initials and road number. One name would be AAHMC&O_300402. What I want the selection list to display would be only the “HMC&O_300402.”

On the layout will be up to 40 BLE units. I don’t want any other “local” BLE units to appear in the selection list.

Any advice/recommendations will be appreciated.

Kurt Thompson

Here are draggable blocks to filter as you requested.

Drag them into your Blocks Workspace one by one, top to bottom.

blocks

blocks1

I am unfortunately unable to test them, as I have no BLE devices.

Also see

There's a thread on multiple BLE connections.

In the procedure you made, there is a second block labeled Device Name Fragment. In my copy of the software, I can’t find the procedure block that has the second portion. Can you direct me to where you found that block or how to generate it? I’ve looked through the mutator buttons for procedures and can’t find it.

I tried to pull the two procedure blocks over into my project. They would not appear in the project. I’m manually copying them over. I was able to copy the other three blocks of code you provided from your reply to my project (IDE).

Thanks,

Kurt Thompson

DeviceNameFragment is the name of the input parameter to one of my two value procedures.

If you are building a procedure from scratch, you add procedure parameters to it using its blue mutator button, then rename them to taste.

Draggable blocks from this board should be downloable as .png files to your hard drive.

From the hard drive those .png files should be draggable directly to your blocks workspace.