BluetoothLE Updates 2024

The recent update to the BluetoothLE Extension has issues with functionality and documentation. My question is when might this be addressed? Almost every IOT device uses BluetoothLE - it seems that this should be a priority. Whom shall I contact?

I have listed some issues that I experienced below:

  1. The "MIT App Inventor Extensions" page (MIT App Inventor Extensions) identifies the latest version as: 20240822. This version is incompatible with applications that use the prior versions - which includes any online demo that I have found.

  2. Online documentation (MIT App Inventor + Internet of Things) is out-of-date with the current implementation. This page also provides a link to the file: edu.mit.appinventor.ble-20230728.aix.

  3. When using the extension in the Designer, it does not provide a pallet of blocks to choose from. For example, I added the BluetoothLE Extension to by main screen (Screen1) as BluetoothLE1. If I click on that in the designer, nothing happens.

However, there is a "Any BluetoothLE" provided under "Any Component". If I click on that I get the pallet of blocks as expected.

  1. Tool-Tips are broken: When you hover over a "block" the resulting information presented is mostly incomplete or has broken links.

I look forward to a response.

In what way have you found it to be incompatible?

Did you by chance turn on a toolkit? This is a known bug with all extensions and the toolkit feature that has to be addressed.

Which blocks specifically are you seeing have incomplete information?

I have just run up against (possibly) the same problem. An app under development that was working fine, will now no longer work when the BLE extension ( Extension Version: 20230728 Date Built: 2023-07-28) is added in the designer. In the app, screen1 is used as a flash screen, which immediately opens screen2 - but no components appear on my phone (I'm using a wifi connection). I started to remove suspects until the second screen would open - and it's the BLE extension.
I found that if I built an apk and installed this, it appears to work ok.
I tried using usb connection and got the following runtime error (below) - if that's of any help.

mit app error
Error from Companion: java.lang.RuntimeException: invalid syntax in eval form: :631:1: caught exception in inliner for # - java.lang.RuntimeException: no such class: edu.mit.appinventor.ble.BluetoothLE gnu.bytecode.ObjectType.getReflectClass(ObjectType.java:179) gnu.bytecode.ClassType.getModifiers(ClassType.java:103) gnu.bytecode.ClassType.isInterface(ClassType.java:471) gnu.expr.InlineCalls.checkType(InlineCalls.java:56) gnu.expr.InlineCalls.visit(InlineCalls.java:49) gnu.expr.InlineCalls.visitSetExpValue(InlineCalls.java:363) gnu.expr.InlineCalls.visitSetExpValue(InlineCalls.java:28) gnu.expr.ExpVisitor.visitSetExp(ExpVisitor.java:114) gnu.expr.InlineCalls.visitSetExp(InlineCalls.java:369) gnu.expr.InlineCalls.visitSetExp(InlineCalls.java:28) gnu.expr.SetExp.visit(SetExp.java:406) gnu.expr.ExpVisitor.visit(ExpVisitor.java:55) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.InlineCalls.visitBeginExp(InlineCalls.java:272) gnu.expr.InlineCalls.visitBeginExp(InlineCalls.java:28) gnu.expr.BeginExp.visit(BeginExp.java:156) gnu.expr.ExpVisitor.visit(ExpVisitor.java:51) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.InlineCalls.visitBeginExp(InlineCalls.java:272) gnu.expr.InlineCalls.visitBeginExp(InlineCalls.java:28) gnu.expr.BeginExp.visit(BeginExp.java:156) gnu.expr.ExpVisitor.visit(ExpVisitor.java:51) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.InlineCalls.visitLetExp(InlineCalls.java:317) gnu.expr.InlineCalls.visitLetExp(InlineCalls.java:28) gnu.expr.LetExp.visit(LetExp.java:207) gnu.expr.ExpVisitor.visit(ExpVisitor.java:51) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.InlineCalls.visit(InlineCalls.java:28) gnu.expr.LambdaExp.visitChildrenOnly(LambdaExp.java:1664) gnu.expr.LambdaExp.visitChildren(LambdaExp.java:1651) gnu.expr.InlineCalls.visitScopeExp(InlineCalls.java:279) gnu.expr.InlineCalls.visitLambdaExp(InlineCalls.java:349) gnu.expr.InlineCalls.visitLambdaExp(InlineCalls.java:28) gnu.expr.LambdaExp.visit(LambdaExp.java:1640) gnu.expr.ExpVisitor.visit(ExpVisitor.java:55) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.InlineCalls.visit(InlineCalls.java:28) gnu.expr.ExpVisitor.visitAndUpdate(ExpVisitor.java:161) gnu.expr.ExpVisitor.visitExps(ExpVisitor.java:175) gnu.expr.ApplyExp.visitArgs(ApplyExp.java:415) gnu.kawa.reflect.CompileInvoke.validateApplyInvoke(CompileInvoke.java:23) java.lang.reflect.Method.invoke(Native Method) gnu.expr.InlineCalls.maybeInline(InlineCalls.java:467) gnu.expr.QuoteExp.validateApply(QuoteExp.java:150) gnu.expr.ReferenceExp.validateApply(ReferenceExp.java:191) gnu.kawa.functions.CompilationHelpers.validateApplyToArgs(CompilationHelpers.java:66) java.lang.reflect.Method.invoke(Native Method) gnu.expr.InlineCalls.maybeInline(InlineCalls.java:467) gnu.expr.QuoteExp.validateApply(QuoteExp.java:150) gnu.expr.ReferenceExp.validateApply(ReferenceExp.java:191) gnu.expr.InlineCalls.visitApplyExp(InlineCalls.java:119) gnu.expr.InlineCalls.visitApplyExp(InlineCalls.java:28) gnu.expr.ApplyExp.visit(ApplyExp.java:410) gnu.expr.ExpVisitor.visit(ExpVisitor.java:55) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.QuoteExp.validateApply(QuoteExp.java:162) gnu.expr.ReferenceExp.validateApply(ReferenceExp.java:191) gnu.kawa.functions.CompilationHelpers.validateApplyToArgs(CompilationHelpers.java:66) java.lang.reflect.Method.invoke(Native Method) gnu.expr.InlineCalls.maybeInline(InlineCalls.java:467) gnu.expr.QuoteExp.validateApply(QuoteExp.java:150) gnu.expr.ReferenceExp.validateApply(ReferenceExp.java:191) gnu.expr.InlineCalls.visitApplyExp(InlineCalls.java:119) gnu.expr.InlineCalls.visitApplyExp(InlineCalls.java:28) gnu.expr.ApplyExp.visit(ApplyExp.java:410) gnu.expr.ExpVisitor.visit(ExpVisitor.java:51) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.InlineCalls.visitBeginExp(InlineCalls.java:272) gnu.expr.InlineCalls.visitBeginExp(InlineCalls.java:28) gnu.expr.BeginExp.visit(BeginExp.java:156) gnu.expr.ExpVisitor.visit(ExpVisitor.java:51) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.InlineCalls.visit(InlineCalls.java:28) gnu.expr.LambdaExp.visitChildrenOnly(LambdaExp.java:1664) gnu.expr.LambdaExp.visitChildren(LambdaExp.java:1651) gnu.expr.InlineCalls.visitScopeExp(InlineCalls.java:279) gnu.expr.InlineCalls.visitLambdaExp(InlineCalls.java:349) gnu.expr.InlineCalls.visitLambdaExp(InlineCalls.java:28) gnu.expr.ExpVisitor.visitModuleExp(ExpVisitor.java:103) gnu.expr.ModuleExp.visit(ModuleExp.java:482) gnu.expr.ExpVisitor.visit(ExpVisitor.java:51) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.InlineCalls.inlineCalls(InlineCalls.java:33) gnu.expr.Compilation.walkModule(Compilation.java:994) gnu.expr.Compilation.process(Compilation.java:1965) gnu.expr.ModuleInfo.loadByStages(ModuleInfo.java:330) gnu.expr.ModuleExp.evalModule1(ModuleExp.java:238) gnu.expr.ModuleExp.evalModule(ModuleExp.java:198) gnu.expr.Language.eval(Language.java:943) gnu.expr.Language.eval(Language.java:883) gnu.expr.Language.eval(Language.java:865) com.google.appinventor.components.runtime.util.AppInvHTTPD.serve(AppInvHTTPD.java:197) com.google.appinventor.components.runtime.util.NanoHTTPD$HTTPSession.run(NanoHTTPD.java:489) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) java.lang.Thread.run(Thread.java:1012)

And what happens when you use the latest version of the BLE extension?

Also try the latest version of the companion app

And click "Not Now" if you get an "outdated" warning

Taifun

1 Like

I installed the latest BLE extension. Screen 1 simply has a button which opens screen2. This has a bunch of text boxes, but no code blocks. On my phone via aicompanion, the text boxes do not appear if the screen has the BLE extension. If I delete it, the text boxes appear. If I add the extension, they vanish. I will now check to see if I have the latest aicompanion...

So, I updated both my PC and phone to the latest aicompanion and BLE extension.
I now find that it does not matter whether I drag the extension in or not - screen2 will not load.
The only way that I can get screen2 to load is to delete the BLE extension from the palette.

Is this using companion 2.73ad2? If so, what Android version are you running and what is your phone make and model?

Companion 273a (not 2) Android 13 Phone Redmi Note 11
hope that helps...

what about trying 2.73ad2? See again

Taifun

hi, yes, sorry I missed that - but am very glad to report that the minimal app now behaves as intended, after installing 273ad2.
Many, many thanks for that!
Dave

In regard to incompatibility, I am supporting an app written by someone else using a prior version that implements a scan to retrieve a list of devices, and then required the user to select the device from a list returned by the scan. This app is several years old. However, the people that use it are used to the process.

I understand that the original "scan" function was deprecated and new methods that require additional parameters. They may provide the same functionality. However, the only real documentation is the names of the methos and its parameters.

It would be very helpful to have additional information on the functionality, intended use scenario and possibly some examples.

The only thing worse than no documentation is incorrect documentation.

This is not true. You can certainly continue to use StartScanning/StopScanning. The other versions of the function are provided for convenience, e.g., if you know the name of the device you want to scan for.

@ewpatton First, thank you for your time and patience. I am supporting an app that was written several years ago, and I am having to (re-)learn a lot.

I believe that one issue is complicating everything for me - I suspect that the extension is not loading like other "components".

When using the extension in the Designer, it does not provide a pallet of blocks to choose from. For example, I added the BluetoothLE Extension to by main screen (Screen1) as BluetoothLE1. If I click on that in the designer, nothing happens.

However, there is a "Any BluetoothLE" provided under "Any Component". If I click on that I get the pallet of blocks as expected.

Many of the blocks from "Any BluetoothLE" have a dop-down to select a component or require a parameter named "for component"

In your original reply, you asked if I had turned on a "toolkit". I did not do that explicitly. I am not sure what a toolkit is. How can I check that?

Thanks
Mark

Under project properties (the gears button) check if BlockToolkit is set to default.

THANK YOU!, That appears to have been the issue.

@All - I am impressed at the (short) response time and your patience.