Android Question read data from BLE

tonga

Member
Licensed User
Longtime User
Hi all,

I'm just started with BLE. I need to read the values inside the Characteristics (byte, char, int... ) that a microprocessor+BLE send to my tablet and that I see. I'm using "BLE_Example".
Someone can help me?

Thanks!
 

tonga

Member
Licensed User
Longtime User
Hi,
the connection to peripheral is ok and the code is praticallythecode of BLE_Example. I append the picture of tablet during the execution. The data that I wish to extract are in the Characteristics XXXX...34f1 (uint8) and XXXX...34f2 (int). I hope that may be useful
 

Attachments

  • 20170216_105827a.jpg
    20170216_105827a.jpg
    302.2 KB · Views: 208
Upvote 0

tonga

Member
Licensed User
Longtime User
the code:

Public Sub ReadData
For Each s As String In ConnectedServices
manager.ReadData(s)
Log("SERVICE="&"00000000-0000-1000-8000-00805f9b34f0")
Log("CHARACTERISTIC1="&"00000000-0000-1000-8000-00805f9b34f1")
Log("CHARACTERISTIC2="&"00000000-0000-1000-8000-00805f9b34f2")

Next
End Sub

and the relative log:

** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Found: capled, 00:A0:50:FE:44:EB, RSSI = -52, (MyMap) {1=[B@ea9f200, 9=[B@2183a39, 7=[B@724587e, 0=[B@ce441df}
Discovering services.
Connected
SERVICE=00000000-0000-1000-8000-00805f9b34f0
CHARACTERISTIC1=00000000-0000-1000-8000-00805f9b34f1
CHARACTERISTIC2=00000000-0000-1000-8000-00805f9b34f2
SERVICE=00000000-0000-1000-8000-00805f9b34f0
CHARACTERISTIC1=00000000-0000-1000-8000-00805f9b34f1
CHARACTERISTIC2=00000000-0000-1000-8000-00805f9b34f2
SERVICE=00000000-0000-1000-8000-00805f9b34f0
CHARACTERISTIC1=00000000-0000-1000-8000-00805f9b34f1
CHARACTERISTIC2=00000000-0000-1000-8000-00805f9b34f2
SERVICE=00000000-0000-1000-8000-00805f9b34f0
CHARACTERISTIC1=00000000-0000-1000-8000-00805f9b34f1
CHARACTERISTIC2=00000000-0000-1000-8000-00805f9b34f2
SERVICE=00000000-0000-1000-8000-00805f9b34f0
CHARACTERISTIC1=00000000-0000-1000-8000-00805f9b34f1
 
Upvote 0

tonga

Member
Licensed User
Longtime User
From Main:

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
End Sub

From Starter:

Sub Manager_DataAvailable (ServiceId As String, Characteristics As Map)
CallSub3(Main, "DataAvailable", ServiceId, Characteristics)
End Sub
 
Upvote 0
Top