CustomDevice CustomDevice CustomDevice CustomDevice Class

Definition

Represents a custom device.

public sealed class CustomDevicepublic sealed class CustomDevicePublic NotInheritable Class CustomDevicepublic sealed class CustomDevice
Attributes
Windows 10 requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Devices.Custom.CustomDeviceContract (introduced v1)

Remarks

Properties

InputStream InputStream InputStream InputStream

The input stream.

public IInputStream InputStream { get; }public IInputStream InputStream { get; }Public ReadOnly Property InputStream As IInputStreampublic IInputStream InputStream { get; }
Attributes
Additional features and requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Devices.Custom.CustomDeviceContract (introduced v1)

OutputStream OutputStream OutputStream OutputStream

The output stream.

public IOutputStream OutputStream { get; }public IOutputStream OutputStream { get; }Public ReadOnly Property OutputStream As IOutputStreampublic IOutputStream OutputStream { get; }
Attributes
Additional features and requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Devices.Custom.CustomDeviceContract (introduced v1)

Methods

FromIdAsync(String, DeviceAccessMode, DeviceSharingMode) FromIdAsync(String, DeviceAccessMode, DeviceSharingMode) FromIdAsync(String, DeviceAccessMode, DeviceSharingMode) FromIdAsync(String, DeviceAccessMode, DeviceSharingMode)

Creates a CustomDevice object asynchronously for the specified Id.

public static IAsyncOperation<CustomDevice> FromIdAsync(String deviceId, DeviceAccessMode desiredAccess, DeviceSharingMode sharingMode)public static IAsyncOperation<CustomDevice> FromIdAsync(String deviceId, DeviceAccessMode desiredAccess, DeviceSharingMode sharingMode)Public Static Function FromIdAsync(deviceId As String, desiredAccess As DeviceAccessMode, sharingMode As DeviceSharingMode) As IAsyncOperation( Of CustomDevice )public static IAsyncOperation<CustomDevice> FromIdAsync(String deviceId, DeviceAccessMode desiredAccess, DeviceSharingMode sharingMode)
Parameters
deviceId
System.String System.String System.String System.String

The Id of the device .

Returns

Returns a custom device.

Attributes
Additional features and requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Devices.Custom.CustomDeviceContract (introduced v1)
Capabilities
optical

GetDeviceSelector(Guid) GetDeviceSelector(Guid) GetDeviceSelector(Guid) GetDeviceSelector(Guid)

Gets a device selector.

public static string GetDeviceSelector(Guid classGuid)public static string GetDeviceSelector(Guid classGuid)Public Static Function GetDeviceSelector(classGuid As Guid) As stringpublic static string GetDeviceSelector(Guid classGuid)
Parameters
classGuid
System.Guid System.Guid System.Guid System.Guid

The Device Interface Class GUID of the device interface to create a device selector for.

Returns
string string string string

The device selector.

Attributes
Additional features and requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Devices.Custom.CustomDeviceContract (introduced v1)

Remarks

For more info about the Device Interface Class GUID, see Overview of Device Interface Classes.

SendIOControlAsync(IIOControlCode, IBuffer, IBuffer) SendIOControlAsync(IIOControlCode, IBuffer, IBuffer) SendIOControlAsync(IIOControlCode, IBuffer, IBuffer) SendIOControlAsync(IIOControlCode, IBuffer, IBuffer)

Sends an IO control code.

public IAsyncOperation<uint> SendIOControlAsync(IIOControlCode ioControlCode, IBuffer inputBuffer, IBuffer outputBuffer)public IAsyncOperation<uint> SendIOControlAsync(IIOControlCode ioControlCode, IBuffer inputBuffer, IBuffer outputBuffer)Public Function SendIOControlAsync(ioControlCode As IIOControlCode, inputBuffer As IBuffer, outputBuffer As IBuffer) As IAsyncOperation( Of uint )public IAsyncOperation<uint> SendIOControlAsync(IIOControlCode ioControlCode, IBuffer inputBuffer, IBuffer outputBuffer)
Parameters
ioControlCode
IIOControlCode IIOControlCode IIOControlCode IIOControlCode

The IO control code.

inputBuffer
IBuffer IBuffer IBuffer IBuffer

The input buffer.

outputBuffer
IBuffer IBuffer IBuffer IBuffer

The output buffer.

Returns

The result of the async operation.

Attributes
Additional features and requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Devices.Custom.CustomDeviceContract (introduced v1)

Remarks

SendIOControlAsync(IIOControlCode, IBuffer, IBuffer) is like TrySendIOControlAsync(IIOControlCode, IBuffer, IBuffer), except this method throws an exception if the operation fails. If you want to handle any exceptions that occur during the operation, use the SendIOControlAsync(IIOControlCode, IBuffer, IBuffer) method. If you just want to be notified whether the operation is successful, but not handle any specific exceptions, use TrySendIOControlAsync(IIOControlCode, IBuffer, IBuffer).

TrySendIOControlAsync(IIOControlCode, IBuffer, IBuffer) TrySendIOControlAsync(IIOControlCode, IBuffer, IBuffer) TrySendIOControlAsync(IIOControlCode, IBuffer, IBuffer) TrySendIOControlAsync(IIOControlCode, IBuffer, IBuffer)

Sends an IO control code. A return value indicates whether the operation succeeded.

public IAsyncOperation<bool> TrySendIOControlAsync(IIOControlCode ioControlCode, IBuffer inputBuffer, IBuffer outputBuffer)public IAsyncOperation<bool> TrySendIOControlAsync(IIOControlCode ioControlCode, IBuffer inputBuffer, IBuffer outputBuffer)Public Function TrySendIOControlAsync(ioControlCode As IIOControlCode, inputBuffer As IBuffer, outputBuffer As IBuffer) As IAsyncOperation( Of bool )public IAsyncOperation<bool> TrySendIOControlAsync(IIOControlCode ioControlCode, IBuffer inputBuffer, IBuffer outputBuffer)
Parameters
ioControlCode
IIOControlCode IIOControlCode IIOControlCode IIOControlCode

The IO control code.

inputBuffer
IBuffer IBuffer IBuffer IBuffer

The input buffer.

outputBuffer
IBuffer IBuffer IBuffer IBuffer

The output buffer.

Returns

true if the operation is successful; otherwise, false.

Attributes
Additional features and requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Devices.Custom.CustomDeviceContract (introduced v1)

Remarks

TrySendIOControlAsync(IIOControlCode, IBuffer, IBuffer) is like SendIOControlAsync(IIOControlCode, IBuffer, IBuffer), except this method doesn't throw an exception if the operation fails. Instead, it returns false. If you want to handle any exceptions that occur during the operation, use the SendIOControlAsync(IIOControlCode, IBuffer, IBuffer) method.