deleted deleted

deleted deleted   •   about 6 years ago

Getting a service using the short SIG service reference?

I am trying to get access to the Immediate Alert Service. I found the SIG list of approved Bluetooth LE service IDs:

The IDs listed there are all short IDs (16-bit). I tried using the code below to get access to the Immediate Alert Service using it's ID of 0x1811. However, I don't get any devices back from FindAllAsync(). What am I doing wrong? Note, the full GUID returned by GattCharacteristic.ConvertShortIdToUuid() is "00001811-0000-1000-8000-00805f9b34fb".

private async Task GetImmediateAlertService()
Guid immediateAlertSvcUuid = GattCharacteristic.ConvertShortIdToUuid(0x1811);
string aqs = GattDeviceService.GetDeviceSelectorFromUuid(immediateAlertSvcUuid);

DeviceInformationCollection devices = await DeviceInformation.FindAllAsync(
new string[] { "System.Devices.ContainerId" });

if (devices == null)
throw new ArgumentNullException("The devices collection is unassigned.");

if (devices.Count < 1)
throw new ArgumentOutOfRangeException("The devices collection is empty.");

DeviceInformation device = devices[0];

string deviceContainerId = "{" + device.Properties["System.Devices.ContainerId"] + "}";

// GattDeviceService.
service = await GattDeviceService.FromIdAsync(device.Id);

if (service == null)
throw new NullReferenceException("could not find the immediate alert service.");

return service;

  • 1 comment

  • Manager   •   about 6 years ago

    V.BTTN actually supports Immediate Alert Service 0x1802 and not Alert Notification Service (0x1811).

Comments are closed.