iOS Question iBLE value of services (solved)

f0raster0

Well-Known Member
Licensed User
Longtime User
From example BLE b4i
Adding the code below to the example I can read/show in a label3 the byte 0 of value of each service.
How can I read the value of each service separately?
example of services: 181A (Enviorement sensing), 180F (battery), etc

Thanks

B4X:
Try

        Log("DATA-HEX: "&Data)
        Dim DataByte() As Byte= Data
        For i=0 To DataByte.Length-1
            Log("Byte "&i&": "&DataByte(i)& " string: "&BytesToString(DataByte,0,DataByte.Length,"UTF-8"))
        Next
        lbl2.Text = DataByte.Length&" D: "& Data
        'lbl2.Text = BytesToString(Data, 0, Data.Length, "UTF8")
        Label3.Text =Data(0)
 
    Catch
        Log(LastException)
        lbl2.Text = "Error reading data as string"
    End Try

For service 181A,
Log:
Device: 181A
Name: 2A6F
DATA in HEX: <B4IArray: 0x1559ac30>
Byte 0: 0 In string:
Byte 1: 0 In string:
Byte 2: 0 In string:
Byte 3: 0 In string:
Name: 2A6D
DATA in HEX: <B4IArray: 0x15562e70>
Byte 0: 107 In string: k
Byte 1: 0 In string: k
Byte 2: 0 In string: k
Byte 3: 0 In string: k
Disconnected: <B4IExceptionWrapper: (null)>

Edit: Maybe the question could be how read all the information of service 181A only without stop reading the other services.
 
Last edited:

f0raster0

Well-Known Member
Licensed User
Longtime User
Thanks, Not sure how ask this question..

I'd like to read the value of a specific service then show those values,
for example:
the value of service 180F in label3 and the value of service 181A in label4

I added a button1 then I can read only the services:
B4X:
Sub Button1_Click
    clv.Clear 
    manager.ReadData("180F")
    manager.ReadData("181A")
End sub

but I don't know how get the data from "Try .. Catch" and show those values in label3 and label4
 
Last edited:
Upvote 0
Top