joshuajnoble/blepdroid

Is connectToService necessary?

Opened this issue · 3 comments

I've modified the RFDuino hello example to connect to a LightBlue Bean using the Bean transport UUID.
The sketch finds the Bean, but does not connect to the Bean. I get the following error.
I noticed that connectToService is not being used even though it is mentioned in the documentation.
Is that the missing piece?

-23 23:27:40.112 16197-16197/processing.test.ble_hello I/art﹕ Late-enabling -Xcheck:jni
10-23 23:27:40.292 16197-16197/processing.test.ble_hello W/System﹕ ClassLoader referenced unknown path: /data/app/processing.test.ble_hello-1/lib/arm64
10-23 23:27:40.412 16197-16197/processing.test.ble_hello I/processing.test.ble_hello﹕ PROCESSING onStart
10-23 23:27:40.442 16197-16239/processing.test.ble_hello D/OpenGLRenderer﹕ Use EGL_SWAP_BEHAVIOR_PRESERVED: true
10-23 23:27:40.532 16197-16239/processing.test.ble_hello I/Adreno﹕ QUALCOMM build : 4ad80b1, Ibc10b8cc61
Build Date : 05/09/16
OpenGL ES Shader Compiler Version: XE031.06.00.02
Local Branch : mybranch19667140
Remote Branch : quic/LA.BR.1.3.3_rb1.16
Remote Branch : NONE
Reconstruct Branch : NOTHING
10-23 23:27:40.532 16197-16239/processing.test.ble_hello I/OpenGLRenderer﹕ Initialized EGL, version 1.4
10-23 23:27:40.602 16197-16236/processing.test.ble_hello I/System.out﹕ OK
10-23 23:27:40.602 16197-16236/processing.test.ble_hello I/System.out﹕ Blepdroid starting Blepdroid(PApplet _parent)
10-23 23:27:40.782 16197-16197/processing.test.ble_hello I/System.out﹕ BlepDroid on create
10-23 23:27:40.812 16197-16197/processing.test.ble_hello I/System.out﹕ service started ???
10-23 23:27:40.822 16197-16197/processing.test.ble_hello I/System.out﹕ BlepDroid on onResume
10-23 23:27:40.842 16197-16197/processing.test.ble_hello I/System.out﹕ BluetoothLeService onBind
10-23 23:27:40.842 16197-16197/processing.test.ble_hello I/System.out﹕ ServiceConnection onServiceConnected
10-23 23:27:40.842 16197-16197/processing.test.ble_hello I/System.out﹕ BluetoothLeService getService
10-23 23:27:40.842 16197-16197/processing.test.ble_hello I/System.out﹕ Initializing BluetoothManager.
10-23 23:27:40.842 16197-16197/processing.test.ble_hello I/System.out﹕ Have a bluetooth manager
10-23 23:27:40.852 16197-16197/processing.test.ble_hello I/System.out﹕ ServiceConnection able to initialize Bluetooth
10-23 23:27:59.382 16197-16197/processing.test.ble_hello I/System.out﹕ on pause
10-23 23:27:59.402 16197-16197/processing.test.ble_hello D/AndroidRuntime﹕ Shutting down VM
10-23 23:27:59.412 16197-16197/processing.test.ble_hello E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: processing.test.ble_hello, PID: 16197
java.lang.NoSuchMethodError: No virtual method keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView; in class Ljava/util/concurrent/ConcurrentHashMap; or its super classes (declaration of 'java.util.concurrent.ConcurrentHashMap' appears in /system/framework/core-libart.jar)
at blepdroid.BluetoothLeService.disconnectAll(BluetoothLeService.java:228)
at blepdroid.Blepdroid.onPause(Blepdroid.java:191)
at android.app.Fragment.performPause(Fragment.java:2379)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1019)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1148)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1130)
at android.app.FragmentManagerImpl.dispatchPause(FragmentManager.java:1967)
at android.app.FragmentController.dispatchPause(FragmentController.java:185)
at android.app.Activity.performPause(Activity.java:6395)
at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1312)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3367)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3340)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3315)
at android.app.ActivityThread.access$1100(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1355)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:171)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Have you tried this again lately? I'm pretty sure this is due to needing to update the way that the Android libraries for BLE are called.

@joshuajnoble the last time I tried I still had an issue with this.
Could you let me know if there is anything in the library that if RFDuino-dependent, or is the library suppose to work with any BLE devices given the correct UUIDs?

It should work with any BLE devices given the correct UUIDs, I've used them with a few different devices and service/characteristic sets. The connectToService method isn't needed any more since you're really just picking the characteristics after having scanned the service.