Minor BLE Extension Documentation Mistake

The WriteStrings blocks says the values parameter is "A list of values to write to the device." If a list is passed I get an error:

"Unable to convert ______ of type gnu.lists.FString to type java.lang.String"

If I pass just the string, it works. :smiley:

I saw a reference to this back in 2019 as well:
https://groups.google.com/g/mitappinventortest/c/vyUSz-uwQN4/m/ILTj23HDAwAJ

Actually, this is a bug in the extension. The documentation correctly identifies what it should be doing and the error has to do with the nested types within the list of provided values and the fact that we are not handling the types properly there.

Hi, is that extension open source?
I dont find it here: appinventor-extensions/appinventor/components/src/com/google/appinventor/components/runtime at master · mit-cml/appinventor-extensions · GitHub

Here is a beta version that I think should fix the problem.

edu.mit.appinventor.ble.aix (202.3 KB)

Each extension is on its own branch in that repo. The BluetoothLE extension is on extension/bluetoothle branch.

1 Like

I knew there was some PR that would allow BLE to be added to the iOS companion. Why not just add BLE as a component for both iOS and Android?

I've been working on BLE support for iOS but it is not yet done. Eventually, I would like to move the functionality into core, but I want to think about how to do that effectively while also addressing some issues that I have with the existing BLE extension. The way extensions were first architected forced some design decisions that I do not think are appropriate for a core component. If we do make those changes, we would also have to account for this in App Inventor itself to upgrade all projects currently using the extension to use the core implementation instead, which will be a difficult thing to implement.

(added to FAQ)

If we do make those changes, we would also have to account for this in App Inventor itself to upgrade all projects currently using the extension to use the core implementation instead, which will be a difficult thing to implement.

Can an extension offer a redundant implementation of core functionality? Could you allow existing projects that were implemented with and work with the BLE extension to continue as is with a no-longer maintained extension? Projects could then transition to the core implementation when they are able. It wouldn't have to be implemented. Or, maybe not enable/provide the BLE as a core feature if a project has imported the BLE extension. (Sorry if these sound like foolish ignorant suggestions.)

Here is a beta version that I think should fix the problem.

Sorry, no. I still get the error.

Below is the error and the code that causes it. If I remove the 'make a list' block and connect the join directly, it works.

I uploaded the extension and checked the version is 20240322-beta. I tried using it with the companion app and as an installed apk.


Here's another attempt. I forgot to short-circuit a loop and I think that leads to the last error mentioned.

edu.mit.appinventor.ble.aix (202.3 KB)

1 Like

Here's another attempt

That works. Thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.