CustomDevice CustomDevice CustomDevice CustomDevice Class

Definition

Represents a custom device.

public : sealed class CustomDevice : ICustomDevice
public sealed class CustomDevice : ICustomDevice
Public NotInheritable Class CustomDevice Implements ICustomDevice
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0) Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Devices.Custom.CustomDeviceContract (introduced v1)

Properties

InputStream InputStream InputStream InputStream

The input stream.

public : IInputStream InputStream { get; }
public IInputStream InputStream { get; }
Public ReadOnly Property InputStream As IInputStream
var iInputStream = customDevice.inputStream;

OutputStream OutputStream OutputStream OutputStream

The output stream.

public : IOutputStream OutputStream { get; }
public IOutputStream OutputStream { get; }
Public ReadOnly Property OutputStream As IOutputStream
var iOutputStream = customDevice.outputStream;

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 DeviceInformation.Id.

public : static IAsyncOperation<CustomDevice> FromIdAsync(Platform::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 )
var iAsyncOperation = Windows.Devices.Custom.CustomDevice.fromIdAsync(deviceId, desiredAccess, sharingMode);
Parameters
deviceId
Platform::String String String String

The DeviceInformation.Id of the device .

Returns
Additional features and requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0) Windows 10 Fall Creators Update (introduced v10.0.16299.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 Platform::String GetDeviceSelector(Platform::Guid classGuid)
public static string GetDeviceSelector(Guid classGuid)
Public Static Function GetDeviceSelector(classGuid As Guid) As string
var string = Windows.Devices.Custom.CustomDevice.getDeviceSelector(classGuid);
Parameters
classGuid
Platform::Guid Guid Guid Guid

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

Returns
Platform::String string string string

The device selector.

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) SendIOControlAsync(IIOControlCode, IBuffer, IBuffer)

Sends an IO control code.

public : IAsyncOperation<unsigned int> 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 )
var iAsyncOperation = customDevice.sendioControlAsync(ioControlCode, inputBuffer, 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.

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) TrySendIOControlAsync(IIOControlCode, IBuffer, IBuffer)

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

public : IAsyncOperation<Platform::Boolean> 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 )
var iAsyncOperation = customDevice.trySendIOControlAsync(ioControlCode, inputBuffer, 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.

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.