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
For service 181A,
Log:
Edit: Maybe the question could be how read all the information of service 181A only without stop reading the other services.
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: