C# Class NewTOAPIA.HidDevice

Inheritance: IDisposable
显示文件 Open project: Wiladams/NewTOAPIA Class Usage Examples

Public Properties

Property Type Description
DeviceFileHandle SafeFileHandle
DevicePath string
ProductID short
VendorID short

Public Methods

Method Description
CreateInputReport ( ) : InputReport

Virtual method to create an input report for this device. Override to use.

Dispose ( ) : void

Dispose method

GetDevices ( ) : IEnumerable
GetVendorName ( short vendorId ) : string
HidDevice ( string devicePathName ) : System
Initialize ( string devicePathName ) : void
ToString ( ) : string

Protected Methods

Method Description
Dispose ( bool bDisposing ) : void

Disposer called by both dispose and finalise

HandleDataReceived ( InputReport oInRep ) : void

virtual handler for any action to be taken when data is received. Override to use.

HandleDeviceRemoved ( ) : void

Virtual handler for any action to be taken when a device is removed. Override to use.

ReadCompleted ( IAsyncResult iResult ) : void

Callback for above. Care with this as it will be called on the background thread from the async read

Write ( OutputReport oOutRep ) : void

Write an output report to the device.

Private Methods

Method Description
BeginAsyncRead ( ) : void

Kicks off an asynchronous read which completes when data is read or when the device is disconnected. Uses a callback.

Method Details

CreateInputReport() public method

Virtual method to create an input report for this device. Override to use.
public CreateInputReport ( ) : InputReport
return InputReport

Dispose() public method

Dispose method
public Dispose ( ) : void
return void

Dispose() protected method

Disposer called by both dispose and finalise
protected Dispose ( bool bDisposing ) : void
bDisposing bool True if disposing
return void

GetDevices() public static method

public static GetDevices ( ) : IEnumerable
return IEnumerable

GetVendorName() public static method

public static GetVendorName ( short vendorId ) : string
vendorId short
return string

HandleDataReceived() protected method

virtual handler for any action to be taken when data is received. Override to use.
protected HandleDataReceived ( InputReport oInRep ) : void
oInRep InputReport The input report that was received
return void

HandleDeviceRemoved() protected method

Virtual handler for any action to be taken when a device is removed. Override to use.
protected HandleDeviceRemoved ( ) : void
return void

HidDevice() public method

public HidDevice ( string devicePathName ) : System
devicePathName string
return System

Initialize() public method

public Initialize ( string devicePathName ) : void
devicePathName string
return void

ReadCompleted() protected method

Callback for above. Care with this as it will be called on the background thread from the async read
protected ReadCompleted ( IAsyncResult iResult ) : void
iResult IAsyncResult Async result parameter
return void

ToString() public method

public ToString ( ) : string
return string

Write() protected method

Write an output report to the device.
protected Write ( OutputReport oOutRep ) : void
oOutRep OutputReport Output report to write
return void

Property Details

DeviceFileHandle public_oe property

public SafeFileHandle DeviceFileHandle
return SafeFileHandle

DevicePath public_oe property

public string DevicePath
return string

ProductID public_oe property

public short ProductID
return short

VendorID public_oe property

public short VendorID
return short