Problem connecting to MetaWear Motion R
Hi,
I have used the MetaWear starter app as a framework for my own code. When connecting to the MetaWear Motion R board it works perfect. So I've ported all the code relating to connecting via BLE to my own app, but every other time I connect I get the following error:
03-16 14:31:38.301 28712-28712/com.example.android.vpt E/MetaWear: Error connecting
java.lang.RuntimeException: onConnectionStateChanged reported non-zero status: 133
at com.mbientlab.metawear.MetaWearBleService$2$2.run(MetaWearBleService.java:1008)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7229)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
My code for connecting looks like this:
...
serviceBinder = (MetaWearBleService.LocalBinder) service;
serviceBinder.executeOnUiThread();
...
[btDevice is returned in the same way as the in com.mbientlab.bletoolbox.scanner startBleScan method
and seems to contain a valid object when it's debugged]
...
serviceBinder.clearCachedState(btDevice);
// Create a MetaWear board object for the Bluetooth Device
mMWBoard1 = serviceBinder.getMetaWearBoard(btDevice);
mMWBoard1.setConnectionStateHandler(stateHandler);
mMWBoard1.connect();
...
Any ideas for what is causing the error and how to solve it?
This discussion has been closed.
Comments