Android Question Bluetooth BLE with Blood Glucose Monitor


Licensed User
Longtime User
Hello everyone, i just started playing around with the Bluetooth BLE library both (written by erel and the Bluetooth BLE extended version). So far i can connect and read the different services that the specific device i'm using can work with.

I'm not too familiar with this type of communication, i was wondering if someone who has the expertise with BLE can point me in the right direction. I need to read all the records stored in this device, by reading on this post I can see that i need to write to the device to tell it what records i want to read, in this case i need to send two bytes
        byte[] data = new byte[2];
        data[0] = 0x01; // Report Stored records
        data[1] = 0x01; // All records
The BLE extended library has a
property, but i need to send bytes instead of a string.

I apologize if i'm not asking the right question, but i need to figure out how to read all the records stored in this device. Below is my code so far.

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
   Dim manager As BleManager
   Private cs As List
   Dim timer1 As Timer
   Dim map1 As Map
    Dim c As BleCharacteristic
    Dim random1 As RandomAccessFile
    Dim conv As ByteConverter
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    If FirstTime Then
     Log("Supported: " & manager.BleSupported)
   End If
   timer1.Initialize("timer1", 1000)

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Activity_Click
   Log("Searching for devices")
   manager.Scan(10000, Null)
End Sub

Sub ble_DeviceFound (Name As String, MacAddress As String)
   Log(Name & ", " & MacAddress)
   If Name <> Null Then
   If Name =  "Beurer GL50EVO" Then
   manager.Connect(MacAddress, True)
   End If
   End If
End Sub

Sub BLE_Connected (Services As Map)
   Log("services map size: " & Services.Size)
   map1 = Services
'''   For Each s As BleService In Services.Values
'''     Log($"** Reading service: ${s.Uuid} **"$)
'''    For Each key As String In s.GetCharacteristics.Keys
'''     Log(key)
'''      Dim c1 As BleCharacteristic = s.GetCharacteristics.Get(key)
'''      Log($"Reading char: ${key}"$)
'''      manager.ReadCharacteristic(c1)
'''    Next
'''   Next

      Dim s As BleService = Services.Get("00001808-0000-1000-8000-00805f9b34fb")'Services.GetValueAt(0)
      c = s.GetCharacteristics.Get("00002a18-0000-1000-8000-00805f9b34fb")
    manager.SetCharacteristicNotification(c, True)

End Sub

Sub BLE_CharacteristicRead (Success As Boolean, Characteristic As BleCharacteristic)
   Log("CR: " & Success & ": " & Characteristic.Uuid)
       Dim buffer() As Byte
    buffer = Characteristic.GetValue
    Dim buffer_int(buffer.Length) As Int
    Log("converted: " & conv.StringFromBytes(buffer, "UTF8"))


    If Success Then
          For i=0 To buffer.length - 1            
    End If
End Sub

Sub BLE_CharacteristicChanged (Characteristic As BleCharacteristic)
   Log("Change: " & Characteristic.GetStringValue(0))    'Get one byte of data from HM-10
End Sub

Sub ble_Disconnected
End Sub

Sub ble_DiscoveryFinished
End Sub

Sub timer1_Tick
   'timer1.Enabled = False
End Sub

As you guys can see according to the device's specs:



0x10808 is the Glucose service and 0x2A18 is the glucose measurement characteristic, but i need to first write the Record Access Control Point at 0x2A52 to let the device know what records i want to read, in this case is the two bytes mentioned above 0x01 for report store records and 0x01 for All records.

Does any one have any suggestions or advice on how to go about this, please let me know.

Thanks guys!