Hi all,
after connecting to a chip via ble2, I'm trying to talk to him. In the first instance I printed all the characteristics of the service.
Then I wrote a command: "E".
Now I am trying to get an answer, but I have some difficulties.
To activate the DataAvailable routine I need to set:
It's true?
previously I have defined the characterisctic:
UUID is the Erel routine that construct UUID.
The characteristic exists.
But SetNotify has an error:
So far I have always connected with the features of BleCentral (by Erel - ReadChar and WriteChar) and now I need support to use other characteristics.
Now I have near 25 characteristics on the chip and I need to know how manage read, write and DataAvailable.
Does anyone have any examples?
Does anyone know why I get this error?
I have B4A 9.01 and Ble2 1,38
Thanks all
Marcom
after connecting to a chip via ble2, I'm trying to talk to him. In the first instance I printed all the characteristics of the service.
Then I wrote a command: "E".
Now I am trying to get an answer, but I have some difficulties.
To activate the DataAvailable routine I need to set:
B4X:
manager.SetNotify(ServiceId, C301_risposta, True)
previously I have defined the characterisctic:
B4X:
C301_risposta= UUID("C301")
The characteristic exists.
But SetNotify has an error:
B4X:
starter_manager_connected (java line: 470)
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.bluetooth.BluetoothGattDescriptor.setValue(byte[])' on a null object reference
at anywheresoftware.b4a.objects.BleManager2.setNotify(BleManager2.java:322)
at anywheresoftware.b4a.objects.BleManager2.SetNotify(BleManager2.java:311)
at com.mamavi.slimup.starter._manager_connected(starter.java:470)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at anywheresoftware.b4a.BA$2.run(BA.java:370)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:7000)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
So far I have always connected with the features of BleCentral (by Erel - ReadChar and WriteChar) and now I need support to use other characteristics.
Now I have near 25 characteristics on the chip and I need to know how manage read, write and DataAvailable.
Does anyone have any examples?
Does anyone know why I get this error?
I have B4A 9.01 and Ble2 1,38
Thanks all
Marcom