From 489cdd1932da862e27f4cf4c582f2ed951a12caa Mon Sep 17 00:00:00 2001 From: Jactry Zeng Date: Fri, 29 Oct 2021 16:52:56 +0800 Subject: [PATCH] include: Add IDeviceWatcher interface. Signed-off-by: Jactry Zeng Signed-off-by: Alexandre Julliard --- include/windows.devices.enumeration.idl | 50 +++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/include/windows.devices.enumeration.idl b/include/windows.devices.enumeration.idl index 20e4df9d33d..7cde49224a1 100644 --- a/include/windows.devices.enumeration.idl +++ b/include/windows.devices.enumeration.idl @@ -30,6 +30,7 @@ import "windows.foundation.idl"; namespace Windows { namespace Devices { namespace Enumeration { + typedef enum DeviceWatcherStatus DeviceWatcherStatus; typedef enum Panel Panel; interface IDeviceInformation; @@ -41,6 +42,7 @@ namespace Windows { runtimeclass DeviceInformation; runtimeclass DeviceInformationUpdate; runtimeclass DeviceThumbnail; + runtimeclass DeviceWatcher; runtimeclass EnclosureLocation; } } @@ -59,6 +61,9 @@ namespace Windows interface Windows.Foundation.Collections.IMapView; interface Windows.Foundation.IAsyncOperation; interface Windows.Foundation.IAsyncOperation; + interface Windows.Foundation.TypedEventHandler; + interface Windows.Foundation.TypedEventHandler; + interface Windows.Foundation.TypedEventHandler; } } } @@ -82,6 +87,16 @@ namespace Windows namespace Windows { namespace Devices { namespace Enumeration { + enum DeviceWatcherStatus + { + Created = 0, + Started = 1, + EnumerationCompleted = 2, + Stopping = 3, + Stopped = 4, + Aborted = 5 + }; + enum Panel { Unknown = 0, @@ -120,6 +135,32 @@ namespace Windows { [propget] HRESULT Properties([out, retval] Windows.Foundation.Collections.IMapView **value); } + [ + exclusiveto(Windows.Devices.Enumeration.DeviceWatcher), + uuid(c9eab97d-8f6b-4f96-a9f4-abc814e22271), + ] + interface IDeviceWatcher : IInspectable + { + [eventadd] HRESULT Added([in] Windows.Foundation.TypedEventHandler *handler, [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT Added([in] EventRegistrationToken token); + [eventadd] HRESULT Updated([in] Windows.Foundation.TypedEventHandler *handler, [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT Updated([in] EventRegistrationToken token); + [eventadd] HRESULT Removed([in] Windows.Foundation.TypedEventHandler *handler, [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT Removed([in] EventRegistrationToken token); + [eventadd] HRESULT EnumerationCompleted([in] Windows.Foundation.TypedEventHandler *handler, [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT EnumerationCompleted([in] EventRegistrationToken token); + [eventadd] HRESULT Stopped([in] Windows.Foundation.TypedEventHandler *handler, [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT Stopped([in] EventRegistrationToken token); + [propget] HRESULT Status([out, retval] Windows.Devices.Enumeration.DeviceWatcherStatus *status); + HRESULT Start(); + HRESULT Stop(); + } + [ exclusiveto(Windows.Devices.Enumeration.EnclosureLocation), uuid(42340a27-5810-459c-aabb-c65e1f813ecf) @@ -166,6 +207,15 @@ namespace Windows { interface Windows.Storage.Streams.IInputStream; } + [ + marshaling_behavior(agile), + ] + runtimeclass DeviceWatcher + { + [default] interface Windows.Devices.Enumeration.IDeviceWatcher; + interface Windows.Devices.Enumeration.IDeviceWatcher2; + } + [ marshaling_behavior(agile) ]