Android Question ble problem

Umberto Bianchi

Member
Licensed User
Longtime User
Hi,
I need to extract data from Geonaute BLE HRM heart rate monitor.

I need Heart rate measurement.

I used Ble.b4a example and have this log,
don't discover "0x2a37"
Where is my error ?
Thank you for your attention
Umberto

** Service (starter) Destroy **
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Found: Geonaute BLE HRM
ID: D0:5F:B8:10:B9:CC
RSSI: -45
AdvData: (MyMap) {1=[B@43082548, 2=[B@43082560, 9=[B@43082578}
Discovering services.
Connected
id: 00002a00-0000-1000-8000-00805f9b34fb->47656F6E6175746520424C452048524D
id: 00002a01-0000-1000-8000-00805f9b34fb->0000
id: 00002a02-0000-1000-8000-00805f9b34fb->00
id: 00002a03-0000-1000-8000-00805f9b34fb->000000000000
id: 00002a04-0000-1000-8000-00805f9b34fb->FA00400600005802
id: 00002a38-0000-1000-8000-00805f9b34fb->01
id: 00002a23-0000-1000-8000-00805f9b34fb->CCB9100000B85FD0
id: 00002a24-0000-1000-8000-00805f9b34fb->5A5432364200
id: 00002a25-0000-1000-8000-00805f9b34fb->30303030303100
id: 00002a26-0000-1000-8000-00805f9b34fb->56312E3400
id: 00002a27-0000-1000-8000-00805f9b34fb->56312E3000
id: 00002a28-0000-1000-8000-00805f9b34fb->56312E3400
id: 00002a29-0000-1000-8000-00805f9b34fb->43617264696F73706F727400
id: 00002a2a-0000-1000-8000-00805f9b34fb->FE006578706572696D656E74616C
id: 00002a50-0000-1000-8000-00805f9b34fb->010D0000001001
id: 00002a19-0000-1000-8000-00805f9b34fb->64
 

Umberto Bianchi

Member
Licensed User
Longtime User
Sub DataAvailable (Service As String, Characteristics As Map)
pbReadData.Visible = False
' clv.Add(CreateServiceItem(Service), 30dip, "")
' For Each id As String In Characteristics.Keys
' clv.Add(CreateCharacteristicItem(id, Characteristics.Get(id)), 40dip, "")
' Next
'''''''02/02/2016
Dim bc As ByteConverter
Dim data As String

' Log($"Time: $Time{DateTime.Now}"$)
clv.Add(CreateServiceItem(Service), 30dip, "")
For Each id As String In Characteristics.Keys
clv.Add(CreateCharacteristicItem(id, Characteristics.Get(id)), 40dip, "")
data = bc.HexFromBytes( Characteristics.Get(id) )
Log("id: " & id & "->" & data)
Next
End Sub
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Please use [code]code here...[/code] tags when posting code.

All characteristics should be included in this map. Even unreadable characteristics. It looks like this characteristic is not found.

Try to download a BLE scanner app from Google Play and see whether it finds this characteristic.

You can still call SetNotify to try to create a notification for this char. However it will probably not work.
 
Upvote 0

Umberto Bianchi

Member
Licensed User
Longtime User
I use a BLE scanner app, and the UUID: 00002A37-0000..... properties: NOYIFY and Value: Notification or indications disabled.

It's possibol to enabled it with code?

Thank you

Umberto
 
Upvote 0

Umberto Bianchi

Member
Licensed User
Longtime User
occurse this error:
LogCat connected to: 0123456789ABCDEF
--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Found: Geonaute BLE HRM
ID: D0:5F:B8:10:B9:CC
RSSI: -63
AdvData: (MyMap) {1=[B@431a13e8, 2=[B@431a1400, 9=[B@431a1418}
Discovering services.
Connected
setting notification
Error occurred on line: 77 (Starter)
java.lang.RuntimeException: Characterisic not found: 00002a37-0000-1000-8000-00805f9b34fb
at anywheresoftware.b4a.objects.BleManager2.getChar(BleManager2.java:240)
at anywheresoftware.b4a.objects.BleManager2.SetNotify(BleManager2.java:213)
at b4a.example.starter._manager_dataavailable(starter.java:218)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:697)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:336)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.BA$2.run(BA.java:328)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5340)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
at dalvik.system.NativeStart.main(Native Method)
java.lang.RuntimeException: java.net.SocketException: Socket closed
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:165)
at anywheresoftware.b4a.BA$2.run(BA.java:328)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5340)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.net.SocketException: Socket closed
at libcore.io.Posix.sendtoBytes(Native Method)
at libcore.io.Posix.sendto(Posix.java:156)
at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:177)
at libcore.io.IoBridge.sendto(IoBridge.java:510)
at java.net.PlainSocketImpl.write(PlainSocketImpl.java:527)
at java.net.PlainSocketImpl.access$100(PlainSocketImpl.java:46)
at java.net.PlainSocketImpl$PlainSocketOutputStream.write(PlainSocketImpl.java:269)
at java.io.BufferedOutputStream.flushInternal(BufferedOutputStream.java:185)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:85)
at anywheresoftware.b4a.shell.ShellConnector.sendControlMessage(ShellConnector.java:62)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:294)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
... 10 more
 
Upvote 0
Top