Android Question BLE2 read Characteristics

Blueforcer

Well-Known Member
Licensed User
Longtime User
Hello,

im trying to read some values from our Pool-Messurement system.
For testing purpose the system sends every 1sec the same string.

i have set the notify via
B4X:
Starter.manager.SetNotify("49535343-fe7d-4ae5-8fa9-9fafd205e455","49535343-1e4d-4bd9-ba61-23c647249616",True)

after this the DataAvailable event raise every second. So far so good.
but now i have problems to read the strings.

in DataAvailable my code is:
B4X:
Sub DataAvailable (Service As String, Characteristics As Map)
    Log("Value: " & Characteristics.GetValueAt(0))
End Sub

but there are different values and not the same as it should be
B4X:
Found: RN42N-A63B, D8:80:39:F0:F6:5B, RSSI = -57, (MyMap) {1=[B@2fa92978, 9=[B@20796851, 0=[B@112048b6}
Discovering services.
Connected
Setting descriptor. Success = true
writing descriptor: true
Value: [B@13aa99b7
Value: [B@35036524
Value: [B@391b388d
Value: [B@25e03a42
Value: [B@3451a53
Value: [B@21a3af90
Value: [B@b8fd089
Value: [B@10bbb88e
Value: [B@1dfd08af
Value: [B@3bc34bc
Value: [B@349bec45
Value: [B@2abecf9a
Value: [B@19b80cb
Value: [B@3875e0a8
Value: [B@1e9407c1
Value: [B@1faa4b66
Value: [B@155f5ea7
Value: [B@49c5f54
Value: [B@2a985efd
Value: [B@47fb7f2

What is wrong? is there a other way to read the values in this Characteristic as strings?
 

Blueforcer

Well-Known Member
Licensed User
Longtime User
nevermind :(

with this code it works!
B4X:
    For i = 0 To Characteristics.Size - 1
        Dim data1() As Byte =  Characteristics.GetValueAt(i)
        Log(bc.StringFromBytes(data1,"UTF-8"))
    Next
 
Upvote 0
Top