Android Question BLE2 read Characteristics

Discussion in 'Android Questions' started by Blueforcer, Dec 22, 2016.

  1. Blueforcer

    Blueforcer Active Member Licensed User


    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
    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:
    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
    Found: RN42N-A63B, D8:80:39:F0:F6:5B, RSSI = -57, (MyMap) {1=[B@2fa92978, 9=[B@207968510=[B@112048b6}
    Discovering services.
    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?
  2. Blueforcer

    Blueforcer Active Member Licensed User

    nevermind :(

    with this code it works!
    For i = 0 To Characteristics.Size - 1
    Dim data1() As Byte =  Characteristics.GetValueAt(i)
  3. Erel

    Erel Administrator Staff Member Licensed User

    Note that you cannot treat raw bytes as a string unless the data is actually a string (text).

    Otherwise you can print it with bc.HexFromBytes.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice