Radio Class

Definition

Represents a radio device on the system.

public ref class Radio sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class Radio final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class Radio
Public NotInheritable Class Radio
Inheritance
Object Platform::Object IInspectable Radio
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

Your code uses static members of this class like GetRadiosAsync, GetDeviceSelector, and FromIdAsync to query for radios and to retrieve instantiated Radio objects representing particular radios on the device.

Note that your code should call RequestAccessAsync at least once, from the UI thread, before trying to call SetStateAsync. This is because in some regions, with some user settings choices, attempting to change radio state requires user permission. In this situation, calling RequestAccessAsync shows the user a prompt asking if they want to allow your app to have permission to control the radio. If your app is running on a device that requires user permission and your code hasn't requested and received permission, then SetStateAsync will fail for lack of user permission.

Properties

Kind

Gets an enumeration value that describes what kind of radio this object represents.

Name

Gets the name of the radio represented by this object.

State

Gets the current state of the radio represented by this object.

Methods

FromIdAsync(String)

A static method that retrieves a Radio object. The method accepts the 'Device.Id' found through Windows.Devices.Enumeration.DeviceInformation.FindAllAsync. This procedure is more reliable than using GetRadiosAsync to obtain a radio in situations where a USB Radio has failed or been removed on a Windows 10 workstation. In this instance of a failed or removed radio, GetRadiosAsync returns no bluetooth radio. FindAllAsync, in contrast, returns a valid Id that can be passed to FromIdAsync to obtain the radio object, which will report itself as now being in the state of 'Disabled'.

GetDeviceSelector()

A static method that returns an Advanced Query Syntax (AQS) string to be used to enumerate or monitor Radio devices with Windows.Devices.Enumeration.DeviceInformation.FindAllAsync and related methods.

GetRadiosAsync()

A static, asynchronous method that retrieves a collection of Windows.Devices.Radios.Radio objects representing radio devices which existed on the system at the time the program launched. Additions or removals of radios are ignored by subsequent calls.

RequestAccessAsync()

An asynchronous method that retrieves a value indicating what access the current user has to the radio represented by this object. In circumstances where user permission is required to access the radio, this method prompts the user for permission. Consequently, always call this method on the UI thread.

SetStateAsync(RadioState)

An asynchronous operation that attempts to set the state of the radio represented by this object.

Events

StateChanged

Event raised by a state change in the radio represented by this object. When a USB Bluetooth radio is removed or otherwise goes offline, no state change is reported.

Applies to