[BUG] MetaWearBleService

Hi,

the MetaWearBleService.java file have a lot of bugs.

My configurator is:

Metawar with coin vibrator

Nexus 5 with Android L Developer preview.

After tried to test the accelerometer i have encountered this bug:

09-06 15:09:06.266: E/AndroidRuntime(27913): FATAL EXCEPTION: main
09-06 15:09:06.266: E/AndroidRuntime(27913): Process: com.mbientlab.metawear.app, PID: 27913
09-06 15:09:06.266: E/AndroidRuntime(27913): java.lang.RuntimeException: Error receiving broadcast Intent { act=com.mbientlab.com.metawear.api.MetaWearBleService.Action.NOTIFICATION_RECEIVED flg=0x10 (has extras) } in com.mbientlab.metawear.api.MetaWearBleService$3@3b74770d
09-06 15:09:06.266: E/AndroidRuntime(27913): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:870)
09-06 15:09:06.266: E/AndroidRuntime(27913): at android.os.Handler.handleCallback(Handler.java:738)
09-06 15:09:06.266: E/AndroidRuntime(27913): at android.os.Handler.dispatchMessage(Handler.java:95)
09-06 15:09:06.266: E/AndroidRuntime(27913): at android.os.Looper.loop(Looper.java:135)
09-06 15:09:06.266: E/AndroidRuntime(27913): at android.app.ActivityThread.main(ActivityThread.java:5070)
09-06 15:09:06.266: E/AndroidRuntime(27913): at java.lang.reflect.Method.invoke(Native Method)
09-06 15:09:06.266: E/AndroidRuntime(27913): at java.lang.reflect.Method.invoke(Method.java:372)
09-06 15:09:06.266: E/AndroidRuntime(27913): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:836)
09-06 15:09:06.266: E/AndroidRuntime(27913): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:631)
09-06 15:09:06.266: E/AndroidRuntime(27913): Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.Collection.iterator()' on a null object reference
09-06 15:09:06.266: E/AndroidRuntime(27913): at com.mbientlab.metawear.api.controller.Accelerometer$Register$4.notifyCallbacks(Accelerometer.java:74)
09-06 15:09:06.266: E/AndroidRuntime(27913): at com.mbientlab.metawear.api.MetaWearBleService$3.onReceive(MetaWearBleService.java:158)
09-06 15:09:06.266: E/AndroidRuntime(27913): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:860)
09-06 15:09:06.266: E/AndroidRuntime(27913): ... 8 more

Comments

  • edited September 2014
    the bug makes impossible to connect the metaweat to the device even if you uninstall and reinstall the application. Only after the reboot of the device the app start responding. 

    This is another bug:

    09-06 15:30:57.022: E/AndroidRuntime(11015): FATAL EXCEPTION: main
    09-06 15:30:57.022: E/AndroidRuntime(11015): Process: com.mbientlab.metawear.app, PID: 11015
    09-06 15:30:57.022: E/AndroidRuntime(11015): java.lang.RuntimeException: Error receiving broadcast Intent { act=com.mbientlab.com.metawear.api.MetaWearBleService.Action.NOTIFICATION_RECEIVED flg=0x10 (has extras) } in com.mbientlab.metawear.api.MetaWearBleService$3@313cd0c3
    09-06 15:30:57.022: E/AndroidRuntime(11015): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:870)
    09-06 15:30:57.022: E/AndroidRuntime(11015): at android.os.Handler.handleCallback(Handler.java:738)
    09-06 15:30:57.022: E/AndroidRuntime(11015): at android.os.Handler.dispatchMessage(Handler.java:95)
    09-06 15:30:57.022: E/AndroidRuntime(11015): at android.os.Looper.loop(Looper.java:135)
    09-06 15:30:57.022: E/AndroidRuntime(11015): at android.app.ActivityThread.main(ActivityThread.java:5070)
    09-06 15:30:57.022: E/AndroidRuntime(11015): at java.lang.reflect.Method.invoke(Native Method)
    09-06 15:30:57.022: E/AndroidRuntime(11015): at java.lang.reflect.Method.invoke(Method.java:372)
    09-06 15:30:57.022: E/AndroidRuntime(11015): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:836)
    09-06 15:30:57.022: E/AndroidRuntime(11015): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:631)
    09-06 15:30:57.022: E/AndroidRuntime(11015): Caused by: java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
    09-06 15:30:57.022: E/AndroidRuntime(11015): at com.mbientlab.metawear.api.MetaWearBleService$3.onReceive(MetaWearBleService.java:156)
    09-06 15:30:57.022: E/AndroidRuntime(11015): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:860)
    09-06 15:30:57.022: E/AndroidRuntime(11015): ... 8 more

  • edited September 2014
    You're going to have to provide more information than a log output.  What functions did you call?  In what order did you call them?  What was the sequence of events that led up to the crash?  

    Second one seems like a firmware issue, the device should not be sending 1 byte messages through that characteristic.  Again, I need to know what was done up to that point so I can reproduce it.

    In the meantime, I will add some checks to avoid the exceptions.
This discussion has been closed.