LBT-VRU03の情報をストアアプリから拾うための仕様を探るメモ

対応してそうなプロファイル

SpecificationName AssignedNumber
developer.bluetooth.org

Generic Access 0x1800
https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.generic_access.xml
Immediate Alert 0x1802
https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.immediate_alert.xml
Link Loss 0x1803
https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.link_loss.xml
Tx Power 0x1804
https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.tx_power.xml
Battery Service 0x180f
https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.battery_service.xml

TextBlock1.Text =  Await GetBleDeviceServices()

  

Async Function GetBleDeviceServices() As Task(Of String) 
    Dim Devices As DeviceInformationCollection = Await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(BluetoothLEDevice.GetDeviceSelector()) 
    If (Devices.Count = 0) Then 
        Return "デバイスが接続されていないかペアリング済みのデバイスでは対応していません" 
    End If

    Dim Text As New StringBuilder 
    Text.AppendLine("GattDeviceService 対応BLEデバイス") 
    Text.AppendLine("")

    For Each Device As DeviceInformation In Devices 
        Dim BleDevice As BluetoothLEDevice = Await BluetoothLEDevice.FromIdAsync(Device.Id) 
         Text.AppendLine(String.Format("** {0} でサポートされる GattDeviceService:", Device.Name)) 
        For Each GattService As GattDeviceService In BleDevice.GattServices 
            Text.AppendLine(GattService.Uuid.ToString) 
        Next 
        Text.AppendLine("") 
        Text.AppendLine("") 
    Next

    Return Text.ToString 
 End Function