[Follow-up on issue #13] Cannot connect with mac address on Android

Following on https://github.com/mbientlab/MetaWear-SDK-Android/issues/13 :

This is super weird. I just tested it again on a stock S7, same problem : 

07-21 09:59:21.482 16284-16297/com.mbientlab.metawear.tutorial.freefalldetector D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=5 device=FF:44:46:AA:21:AF
07-21 09:59:21.487 16284-16297/com.mbientlab.metawear.tutorial.freefalldetector D/BluetoothGatt: refresh() - device: FF:44:46:AA:21:AF
07-21 09:59:21.490 16284-16297/com.mbientlab.metawear.tutorial.freefalldetector D/BluetoothGatt: close()
07-21 09:59:21.491 16284-16297/com.mbientlab.metawear.tutorial.freefalldetector D/BluetoothGatt: unregisterApp() - mClientIf=5
07-21 09:59:21.499 16284-16448/com.mbientlab.metawear.tutorial.freefalldetector E/freefall: Error connecting
                                                                                            java.lang.RuntimeException: Non-zero connection changed status (133)
                                                                                                at com.mbientlab.metawear.android.BtleService$1$2.run(BtleService.java:112)
                                                                                                at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
                                                                                                at java.util.concurrent.FutureTask.run(FutureTask.java:237)


Could this be in the _way_ it's compiled ? What can I be overlooking ? Is the sensor somehow broken or in a bad state ?

On a side note, I'm looking for a quick fix so I can continue working on this app with the sensor. Is there a way to make a scan directly in code, like in Swift  ?

MBLMetaWearManager.shared().startScan(forMetaWearsAllowDuplicates: false, handler: { array in
for device in array {
print("Found MetaWear: \(device)")
}
})

Comments

  • I've seen that thread : http://community.mbientlab.com/discussion/1611/onconnectionstatechanged-reported-non-zero-status-133 but I've tested the Freefall app on three different android devices and I have the same problem :

    07-20 12:30:07.397 6167-6167/com.mbientlab.metawear.tutorial.freefalldetector D/BluetoothGatt: connect() - device: FF:44:46:AA:21:AF, auto: false
    07-20 12:30:07.397 6167-6167/com.mbientlab.metawear.tutorial.freefalldetector D/BluetoothGatt: registerApp()
    07-20 12:30:07.407 6167-6167/com.mbientlab.metawear.tutorial.freefalldetector D/BluetoothGatt: registerApp() - UUID=8d3c79b1-8297-4d52-b7dd-c0fc6cce1593
    07-20 12:30:07.457 6167-6177/com.mbientlab.metawear.tutorial.freefalldetector D/BluetoothGatt: onClientRegistered() - status=0 clientIf=6
    07-20 12:30:07.517 6167-6167/com.mbientlab.metawear.tutorial.freefalldetector I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@270cef02 time:2235749
    07-20 12:30:12.492 6167-6177/com.mbientlab.metawear.tutorial.freefalldetector D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=6 device=FF:44:46:AA:21:AF
    07-20 12:30:12.492 6167-6177/com.mbientlab.metawear.tutorial.freefalldetector D/BluetoothGatt: refresh() - device: FF:44:46:AA:21:AF
    07-20 12:30:12.532 6167-6177/com.mbientlab.metawear.tutorial.freefalldetector D/BluetoothGatt: close()
    07-20 12:30:12.532 6167-6177/com.mbientlab.metawear.tutorial.freefalldetector D/BluetoothGatt: unregisterApp() - mClientIf=6
    07-20 12:30:12.542 6167-6358/com.mbientlab.metawear.tutorial.freefalldetector E/freefall: Error connecting
                                                                                              java.lang.RuntimeException: Non-zero connection changed status (133)
                                                                                                  at com.mbientlab.metawear.android.BtleService$1$2.run(BtleService.java:112)
                                                                                                  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
                                                                                                  at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                                                  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                                                                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                                                                  at java.lang.Thread.run(Thread.java:818)

    The Metawear app (that scans and does not connect directly via the mac address) can connect to the sensor on these phones, so it's not a problem with the phones.

    Any idea on how to solve this problem ?
    Thanks
  • edited July 2017
    Those status codes are internal codes returned from the BlueDroid C code.  As mentioned in the linked thread, there isn't much you can do except try again and/or reset the Bluetooth adapter.
  • The Android example apps use a separate library to handle the BLE scanning and UI elements.

    You can try resetting the BT adapter to see if that helps however, as already stated, the only thing to do is to attempt to connect again.
This discussion has been closed.