Platforms to show: All Mac Windows Linux Cross-Platform

WindowsDeviceWatcherMBS class   New in 24.3

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Bluetooth MBS WinFrameworks Plugin 24.3 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
Enumerates devices dynamically, so that the app receives notifications if devices are added, removed, or changed after the initial enumeration is complete.

An app calls Start to begin the search for devices. During this initial enumeration, the DeviceWatcher raises an Added event for each device that's found, until all devices are found. The DeviceWatcher raises an EnumerationCompleted event when the initial enumeration is complete, and continues to raise events if a device is added, updated, or removed.
The following diagram shows how the DeviceWatcher transitions between the states represented by DeviceWatcherStatus enumeration.

The Start method can only be called when the DeviceWatcher is in the Created, Stopped or Aborted state. The Status property indicates the DeviceWatcher state. When re-starting the watcher, wait for the Stopped event before calling Start.
Stop transitions the DeviceWatcher to the Stopping state and completes immediately. The watcher will transition to the Stopped state once all events that are already in the process of being raised have completed.
Apps may wait for the Stopped event if they need to know when the DeviceWatcher has stopped. Callers must wait for the Stopped event before they can call Start to restart the watcher. Callers may unsubscribe from events if they do not want to receive any additional events after Stop but do not want to wait for the Stopped event.

Device Class

Constant Value Description
DeviceClassAll 0 Indicates that the user wants to enumerate all devices.
DeviceClassAudioCapture 1 Indicates that the user wants to enumerate all audio capture devices.
DeviceClassAudioRender 2 Indicates that the user wants to enumerate all audio rendering devices.
DeviceClassImageScanner 5 Indicates that the user wants to enumerate all scanning devices.
DeviceClassLocation 6 Indicates that the user wants to enumerate all location aware devices.
DeviceClassPortableStorageDevice 3 Indicates that the user wants to enumerate all portable storage devices.
DeviceClassVideoCapture 4 Indicates that the user wants to enumerate all video capture devices.

Status

Constant Value Description
StatusStatusAborted 5 The watcher has aborted operation. No subsequent events will be raised.
StatusStatusCreated 0 This is the initial state of a Watcher object. During this state clients can register event handlers.
StatusStatusEnumerationCompleted 2 The watcher has completed enumerating the initial collection. Items can still be added, updated or removed from the collection.
StatusStatusStarted 1 The watcher transitions to the Started state once Start is called. The watcher is enumerating the initial collection. Note that during this enumeration phase it is possible to receive Updated and Removed notifications but only to items that have already been Added.
StatusStatusStopped 4 The client has called Stop and the watcher has completed all outstanding events. No further events will be raised.
StatusStatusStopping 3 The client has called Stop and the watcher is still in the process of stopping. Events may still be raised.

This class has no sub classes.

Blog Entries

Release notes


The items on this page are in the following plugins: MBS WinFrameworks Plugin.


WindowsDeviceModeMBS   -   WindowsDirectoryChangeMBS


The biggest plugin in space...