Radio.GetDeviceSelector Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns an Advanced Query Syntax (AQS) string used to enumerate or monitor Radio devices via DeviceInformation.FindAllAsync and related enumeration APIs.
public:
static Platform::String ^ GetDeviceSelector();
static winrt::hstring GetDeviceSelector();
public static string GetDeviceSelector();
function getDeviceSelector()
Public Shared Function GetDeviceSelector () As String
Returns
An AQS device selector string for enumerating radio devices.
Examples
One-time enumeration and continuous monitoring (C#):
using Windows.Devices.Enumeration;
using Windows.Devices.Radios;
// One-time enumeration
string selector = Radio.GetDeviceSelector();
var devices = await DeviceInformation.FindAllAsync(selector);
foreach (var device in devices)
{
var radio = await Radio.FromIdAsync(device.Id);
// App-specific: use radio for state management
}
// Continuous monitoring for hardware changes
var watcher = DeviceInformation.CreateWatcher(selector);
watcher.Added += async (sender, deviceInfo) => {
var radio = await Radio.FromIdAsync(deviceInfo.Id);
// App-specific: handle newly available radio
};
watcher.Removed += (sender, deviceInfoUpdate) => {
// App-specific: handle removed radio
};
watcher.Start();
Remarks
Relationship to GetRadiosAsync
The selector produces the same set of radios that GetRadiosAsync returns at call time.
Use the selector when you need to:
- Combine radio enumeration with other device filters in a single query.
- Receive device arrival/removal events through standard device watcher patterns.
- Defer enumeration until a watcher signals changes.
Usage patterns
Use the selector for one-time enumeration or continuous monitoring.