Skip to main content

BaseDevice Class

Package: GHIElectronics.Endpoint.Devices.UsbHost
Namespace: GHIElectronics.Endpoint.Devices.UsbHost

A USB device that the program uses: Keyboard, Mouse, Joystick, HidDevice, Printer or RawDevice, opened with the DeviceName that its UsbHostController event gives. Its events come on the device's own thread. When the device is unplugged, Disconnected is raised. A device stays alive until it is disposed.

public abstract class BaseDevice : IDisposable

Nested Types​

TypeKindSummary
BaseDevice.DisconnectedEventHandlerDelegateThe event handler type for when the device disconnects.

Properties​

Connected​

public bool Connected { get; }

Whether or not the device is connected.

Returns bool

DeviceName​

public string DeviceName { get; }

What the device was opened with: "/dev/input/event2", "/dev/hidraw0", "/dev/usb/lp0", "/dev/bus/usb/001/005"

Returns string

ProductId​

public ushort ProductId { get; }

The device's product id.

Returns ushort

Type​

public DeviceType Type { get; }

The device's type.

Returns DeviceType

VendorId​

public ushort VendorId { get; }

The device's vendor id.

Returns ushort

Methods​

Dispose()​

public void Dispose()

Stops the device's events (one being delivered finishes first) and closes it

Events​

Disconnected​

public event DisconnectedEventHandler Disconnected

The event is fired when the device disconnects.