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.

class BaseDevice : public IDisposable {};

Nested Types​

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

Properties​

Connected​

bool Connected() const;

Whether or not the device is connected.

Returns bool

DeviceName​

std::string DeviceName() const;

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

Returns string

ProductId​

uint16_t ProductId() const;

The device's product id.

Returns ushort

Type​

DeviceType Type() const;

The device's type.

Returns DeviceType

VendorId​

uint16_t VendorId() const;

The device's vendor id.

Returns ushort

Methods​

Dispose()​

void Dispose();

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

Events​

Disconnected​

Core::Event<...> Disconnected;

The event is fired when the device disconnects.