Custom​Device Custom​Device Custom​Device Class

Definition

Represents a custom device.

public sealed class CustomDevice : ICustomDevicepublic sealed class CustomDevice : ICustomDevicePublic NotInheritable Class CustomDevice Implements ICustomDevice
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

The input stream.

public IInputStream InputStream { get; }public IInputStream InputStream { get; }Public ReadOnly Property InputStream As IInputStream
Value
IInputStream IInputStream IInputStream

The input stream.

Attributes

OutputStream OutputStream OutputStream

The output stream.

public IOutputStream OutputStream { get; }public IOutputStream OutputStream { get; }Public ReadOnly Property OutputStream As IOutputStream
Value
IOutputStream IOutputStream IOutputStream

The output stream.

Attributes

Methods

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

Creates a CustomDevice object asynchronously for the specified DeviceInformation.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 )
Parameters
deviceId
System.String System.String System.String

The DeviceInformation.Id of the device .

desiredAccess
DeviceAccessMode DeviceAccessMode DeviceAccessMode

The desired access.

sharingMode
DeviceSharingMode DeviceSharingMode DeviceSharingMode

The sharing mode.

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)

Gets a device selector.

public static string GetDeviceSelector(Guid classGuid)public static string GetDeviceSelector(Guid classGuid)Public Static Function GetDeviceSelector(classGuid As Guid) As string
Parameters
classGuid
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

The device selector.

Attributes

Remarks

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

See Also

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 )
Parameters
ioControlCode
IIOControlCode IIOControlCode IIOControlCode

The IO control code.

inputBuffer
IBuffer IBuffer IBuffer

The input buffer.

outputBuffer
IBuffer IBuffer IBuffer

The output buffer.

Returns

The result of the async operation.

Attributes

Remarks

SendIOControlAsync is like TrySendIOControlAsync, 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 method. If you just want to be notified whether the operation is successful, but not handle any specific exceptions, use TrySendIOControlAsync.

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 )
Parameters
ioControlCode
IIOControlCode IIOControlCode IIOControlCode

The IO control code.

inputBuffer
IBuffer IBuffer IBuffer

The input buffer.

outputBuffer
IBuffer IBuffer IBuffer

The output buffer.

Returns

true if the operation is successful; otherwise, false.

Attributes

Remarks

TrySendIOControlAsync is like SendIOControlAsync, 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 method.