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(IDisposable): ...

Nested Types​

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

Properties​

Connected​

Connected: bool # @property

Whether or not the device is connected.

Returns bool

DeviceName​

DeviceName: str # @property

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

Returns string

ProductId​

ProductId: int # @property

The device's product id.

Returns ushort

Type​

Type: DeviceType # @property

The device's type.

Returns DeviceType

VendorId​

VendorId: int # @property

The device's vendor id.

Returns ushort

Methods​

Dispose()​

def Dispose(self) -> None:

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

Events​

Disconnected​

Disconnected # += / -= handler

The event is fired when the device disconnects.