I am working on upgrading desktop app to run on windows 10 with BLE support. I modified the app to target to corresponding windows version as described in this question (How can I reference the Windows 8 Runtime in console). Now trying to do step by step as in this example (Using BLE GATT services with Windows 10). First of all I need run ble scan as follows:
var devices = deviceInformation.FindAllAsync(GattDeviceService.GetDeviceSelectorFromUuid(GattServiceUuids.HeartRate));
if (devices != null)
{
foreach (DeviceInformation device in devices)
{
// add device into your UI here
}
}
But on compilation i get error related to foreach loop, here is the error:
Error CS1579 foreach statement cannot operate on variables of type 'Windows.Foundation.IAsyncOperation' because 'Windows.Foundation.IAsyncOperation' does not contain a public definition for 'GetEnumerator'