public void StartEnumeration()

in BluetoothLEExplorer/BluetoothLEExplorer/Models/GattSampleContext.cs [433:498]


        public void StartEnumeration()
        {
            // Additional properties we would like about the device.
            if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 5))
            {
                string[] requestedProperties =
                {
                    "System.Devices.GlyphIcon",
                    "System.Devices.Aep.Category",
                    "System.Devices.Aep.ContainerId",
                    "System.Devices.Aep.DeviceAddress",
                    "System.Devices.Aep.IsConnected",
                    "System.Devices.Aep.IsPaired",
                    "System.Devices.Aep.IsPresent",
                    "System.Devices.Aep.ProtocolId",
                    "System.Devices.Aep.Bluetooth.Le.IsConnectable",
                    "System.Devices.Aep.SignalStrength",
                    "System.Devices.Aep.Bluetooth.LastSeenTime",
                    "System.Devices.Aep.Bluetooth.Le.IsConnectable",
                };

                // BT_Code: Currently Bluetooth APIs don't provide a selector to get ALL devices that are both paired and non-paired.
                deviceWatcher = DeviceInformation.CreateWatcher(
                    BTLEDeviceWatcherAQSString,
                    requestedProperties,
                    DeviceInformationKind.AssociationEndpoint);
            }
            else
            {
                string[] requestedProperties =
                {
                    "System.Devices.GlyphIcon",
                    "System.Devices.Aep.Category",
                    "System.Devices.Aep.ContainerId",
                    "System.Devices.Aep.DeviceAddress",
                    "System.Devices.Aep.IsConnected",
                    "System.Devices.Aep.IsPaired",
                    "System.Devices.Aep.IsPresent",
                    "System.Devices.Aep.ProtocolId",
                    "System.Devices.Aep.Bluetooth.Le.IsConnectable",
                    "System.Devices.Aep.SignalStrength",
                };

                // BT_Code: Currently Bluetooth APIs don't provide a selector to get ALL devices that are both paired and non-paired.
                deviceWatcher = DeviceInformation.CreateWatcher(
                    BTLEDeviceWatcherAQSString,
                    requestedProperties,
                    DeviceInformationKind.AssociationEndpoint);
            }

            // Register event handlers before starting the watcher.
            deviceWatcher.Added += DeviceWatcher_Added;
            deviceWatcher.Updated += DeviceWatcher_Updated;
            deviceWatcher.Removed += DeviceWatcher_Removed;
            deviceWatcher.EnumerationCompleted += DeviceWatcher_EnumerationCompleted;
            deviceWatcher.Stopped += DeviceWatcher_Stopped;

            ClearAllDevices();

            deviceWatcher.Start();
            IsEnumerating = true;
            EnumerationFinished = false;

            UpdateAdvertisementFilter(new BluetoothLEAdvertisementFilter());
            StartAdvertisementWatcher(BluetoothLEScanningMode.Active);
        }