hjavier Member Licensed User Longtime User Sep 28, 2013 #1 So I am working through with the example with the link below and I am getting the following: Searching for devices Sears Demo, 00:07:80:68:91:6F Discovering services. main_ble_connected (B4A line: 156) managerBLE.ReadCharacteristic(c) HERE IS THE ERROR java.lang.RuntimeException: Object should first be initialized (BleCharacteristic). at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:46) at anywheresoftware.b4a.objects.BleManager.ReadCharacteristic(BleManager.java:93) at b4a.searsdemo.main._ble_connected(main.java:437) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169) at anywheresoftware.b4a.BA$3.run(BA.java:307) at android.os.Handler.handleCallback(Handler.java:730) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5103) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method) It looks like I am not able to get characteristics. Sub BLE_Connected (Services AsMap) cs.Initialize Dim s AsBleService = Services.GetValueAt(0) 'Read the manufacturer characteristic Dim c As BleCharacteristic = s.GetCharacteristics.Get("a32bdfa7-9952-4e54-8d5b-44b7be5fbba5") managerBLE.ReadCharacteristic(c) End Sub
So I am working through with the example with the link below and I am getting the following: Searching for devices Sears Demo, 00:07:80:68:91:6F Discovering services. main_ble_connected (B4A line: 156) managerBLE.ReadCharacteristic(c) HERE IS THE ERROR java.lang.RuntimeException: Object should first be initialized (BleCharacteristic). at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:46) at anywheresoftware.b4a.objects.BleManager.ReadCharacteristic(BleManager.java:93) at b4a.searsdemo.main._ble_connected(main.java:437) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169) at anywheresoftware.b4a.BA$3.run(BA.java:307) at android.os.Handler.handleCallback(Handler.java:730) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5103) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method) It looks like I am not able to get characteristics. Sub BLE_Connected (Services AsMap) cs.Initialize Dim s AsBleService = Services.GetValueAt(0) 'Read the manufacturer characteristic Dim c As BleCharacteristic = s.GetCharacteristics.Get("a32bdfa7-9952-4e54-8d5b-44b7be5fbba5") managerBLE.ReadCharacteristic(c) End Sub
Erel B4X founder Staff member Licensed User Longtime User Sep 29, 2013 #2 Call Log(s.GetCharacteristics). You will see which characteristics are available. Upvote 0
hjavier Member Licensed User Longtime User Sep 30, 2013 #3 It looks like I am only getting 1 characteristics, there should be 8 more that the device is servicing. Searching for devices Sears Demo, 00:07:80:68:91:6F Discovering services. Services: 00001800-0000-1000-8000-00805f9b34fb (MyMap) {00002a00-0000-1000-8000-00805f9b34fb=android.bluetooth.BluetoothGattCharacteristic@421343b8} CR: true: 00002a00-0000-1000-8000-00805f9b34fb cr: Sears Demo Upvote 0
It looks like I am only getting 1 characteristics, there should be 8 more that the device is servicing. Searching for devices Sears Demo, 00:07:80:68:91:6F Discovering services. Services: 00001800-0000-1000-8000-00805f9b34fb (MyMap) {00002a00-0000-1000-8000-00805f9b34fb=android.bluetooth.BluetoothGattCharacteristic@421343b8} CR: true: 00002a00-0000-1000-8000-00805f9b34fb cr: Sears Demo
hjavier Member Licensed User Longtime User Sep 30, 2013 #4 I got it working I needed to change Dim s As BleService = Services.GetValueAt(0) to Dim s As BleService = Services.GetValueAt(1) to get the characteritics of the second service. Upvote 0
I got it working I needed to change Dim s As BleService = Services.GetValueAt(0) to Dim s As BleService = Services.GetValueAt(1) to get the characteritics of the second service.