Android Question BLE2 library problem

jefflynn1974

Member
Licensed User
Longtime User
Hi,
I'm trying to migrate one of my projects from the old BleExtEx library to BLE2. My problem is that I get the following error on every write attempt.

** Service (starter) Create **
** Service (starter) Start **
State: 12
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Found: null, 00:1E:C0:27:4B:69, RSSI = -63, (MyMap) {1=[B@785da70, 7=[B@1f2c51e9}
Discovering services.
Connected
PrivServ[3]: 0000180f-0000-1000-8000-00805f9b34fb
Error occurred on line: 41 (Starter)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.keywords.Common.CallSubDebug(Common.java:852)
at b4a.example.main._writedata_click(main.java:625)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:702)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:336)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:157)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:78)
at android.view.View.performClick(View.java:5217)
at android.view.View$PerformClick.run(View.java:20983)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6117)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:341)
at anywheresoftware.b4a.debug.Debug.CallSubNew(Debug.java:287)
... 25 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:323)
... 26 more
Caused by: java.lang.RuntimeException: Error writing data to: 00002a19-0000-1000-8000-00805f9b34fb
at anywheresoftware.b4a.objects.BleManager2.WriteData(BleManager2.java:266)
at b4a.example.starter._writedata(starter.java:189)
... 29 more
** Activity (main) Pause, UserClosed = true **

The line 41 is the write command.
B4X:
manager.WriteData(PrivServ,CharWrite,data)
 

JordiCP

Expert
Licensed User
Longtime User
Are you sure the "CharWrite" characteristic you are using is writable?
If the discovered service has more than one Characteristic, you must check their properties to get which is/are the writable one(s)
 
Upvote 0
Top