Basically I'd like to scan for BLE beacons and get their info:
1) MAC
2) name
3) RSSI
4) UUID
5) Major
6) Minor
7) Distance
8) Descriptor
So when a device is found I do BLE.connect but I'm not sure which characteristics correspond to the values above.
As soon as device info is obtained, I'd like to continue scanning as well.
Pseudocode of what I'd like to do:
while not discovery finished
{
scan
if BLEfound
{
get all charactertistics
read all characteristics
}
}
Here's a code that I have but really not sure if I'm placing the readCharacteristic in the right place below. Should I let the BLE device return the BLE characteristic read event before searching for the next characteristic? Also when should I fire scan command again to search for other BLE devices?
Sub BLE_Connected (Services As Map)
For Each s As BleService In Services.Values
For Each key As String In s.GetCharacteristics.Keys
Log(key)
Dim c As BleCharacteristic = s.GetCharacteristics.Get(key)
manager.ReadCharacteristic(c)
Next
Next
End Sub
Sub BLE_CharacteristicRead (Success As Boolean, Characteristic As BleCharacteristic)
Log("CR: " & Success & ": " & Characteristic.Uuid)
If Success Then Log("cr: " & Characteristic.GetStringValue(0))
End Sub
Thanks!