DeviceConnectionChangeTrigger DeviceConnectionChangeTrigger DeviceConnectionChangeTrigger DeviceConnectionChangeTrigger Class

Definition

Represents a trigger that launches a background task when the connection status of a device changes.

public : sealed class DeviceConnectionChangeTrigger : IBackgroundTrigger, IDeviceConnectionChangeTriggerpublic sealed class DeviceConnectionChangeTrigger : IBackgroundTrigger, IDeviceConnectionChangeTriggerPublic NotInheritable Class DeviceConnectionChangeTrigger Implements IBackgroundTrigger, IDeviceConnectionChangeTrigger// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Properties

CanMaintainConnection CanMaintainConnection CanMaintainConnection CanMaintainConnection

Gets whether the system can maintain a connection to the specified device.

public : PlatForm::Boolean CanMaintainConnection { get; }public bool CanMaintainConnection { get; }Public ReadOnly Property CanMaintainConnection As bool// You can use this property in JavaScript.
Value
PlatForm::Boolean bool bool bool

True if the system can maintain a connection to the specified device; Otherwise, false. If false, an attempt to register a trigger with MaintainConnection = true will throw an exception. The default value of this property is true for Bluetooth LE devices and false for all other device types.

DeviceId DeviceId DeviceId DeviceId

Gets the device Id associated with the device.

public : PlatForm::String DeviceId { get; }public string DeviceId { get; }Public ReadOnly Property DeviceId As string// You can use this property in JavaScript.
Value
PlatForm::String string string string

The device Id associated with the device.

Remarks

When monitoring Bluetooth LE devices, the DeviceId must reference an interface on the Bluetooth LE device object. The device Id in this case can be the values returned by the GetDeviceSelector. Alternatively, the DeviceId can reference an interface on a GattDeviceService object and valid values for the device Id is any value returned by GetDeviceSelectorFromShortId or GetDeviceSelectorFromUuid.

When monitoring other Bluetooth devices, the device Id can be any value returned by the GetDeviceSelector on RfCommDeviceService or BluetoothDevice.

MaintainConnection MaintainConnection MaintainConnection MaintainConnection

Gets or sets whether the system should automatically attempt to keep the referenced device connected.

public : PlatForm::Boolean MaintainConnection { get; set; }public bool MaintainConnection { get; set; }Public ReadWrite Property MaintainConnection As bool// You can use this property in JavaScript.
Value
PlatForm::Boolean bool bool bool

True of the system should try to keep the device connected; Otherwise, false. Default is false.

Methods

FromIdAsync(String) FromIdAsync(String) FromIdAsync(String) FromIdAsync(String)

Begins an asynchronous operation to get the DeviceConnectionChangeTrigger associated with the specified Id.

public : static IAsyncOperation<DeviceConnectionChangeTrigger> FromIdAsync(PlatForm::String deviceId)public static IAsyncOperation<DeviceConnectionChangeTrigger> FromIdAsync(String deviceId)Public Static Function FromIdAsync(deviceId As String) As IAsyncOperation( Of DeviceConnectionChangeTrigger )// You can use this method in JavaScript.
Parameters
deviceId
PlatForm::String String String String

The device Id with which to find the associated trigger.

Returns