public static async Task <GattCharacteristic> GetCharacteristicForHandleAsync(this GattDeviceService service, uint handle) { var result = await service.GetCharacteristics2Async(); var ret = result.FirstOrDefault(c => c.AttributeHandle == handle); if (ret == null) { foreach (var c in result) { Debug.WriteLine( String.Format("Attribute Handle UUID={0} AttributeHandle={1} ", c.Uuid, c.AttributeHandle)); } throw new Exception( String.Format("Could not get characteristics from handle with ID={0}", handle)); } return(ret); }