C# Class LDHID, LitDev

Mostrar archivo Open project: litdev1/LitDev Class Usage Examples

Public Methods

Method Description
AddDevice ( Primitive, VID, Primitive, PID, Primitive, name ) : Primitive,

Add a HID connected device from its VID and PID. The VID and PID are 4 character (hex) values, and can be found from: Device Manager->Properties->Details->Hardware ids For example: HID\VID_046D PID_C215 REV_0204 has VID "046D" and PID "C215". Only add a device once.

FindDevices ( ) : Primitive,

List all found HID (Human Interface Devices).

GetBits ( Primitive, data ) : Primitive,

Get an 8 element array of 1s and 0s indicating which bit of a byte are set.

InputLength ( Primitive, name ) : Primitive,

Get the input record length for a HID device.

Output ( Primitive, name, Primitive, data ) : Primitive,

Send data to the HID device. This must be an array of bytes (0 to 255). The array must be indexed from 1 and have size OutputLength.

OutputLength ( Primitive, name ) : Primitive,

Get the output record length for a HID device.

SetBits ( Primitive, data ) : Primitive,

Set a byte from an 8 element array of 1s and 0s indicating which bit of a byte are set.

Private Methods

Method Description
CreateDevice ( string VID, string PID, string name ) : bool
DeviceExists ( int VID, int PID, string name ) : bool
FindAllDevices ( ) : List>
GetDevice ( string name ) : HID_Device
_OnDeviceChanged ( object sender, HIDChangedEventArgs args ) : void
_OnDeviceRemoved ( object sender, EventArgs, args ) : void

Method Details

AddDevice() public static method

Add a HID connected device from its VID and PID. The VID and PID are 4 character (hex) values, and can be found from: Device Manager->Properties->Details->Hardware ids For example: HID\VID_046D PID_C215 REV_0204 has VID "046D" and PID "C215". Only add a device once.
public static AddDevice ( Primitive, VID, Primitive, PID, Primitive, name ) : Primitive,
VID Primitive, The device VID.
PID Primitive, The device PID.
name Primitive, A name for the device.
return Primitive,

FindDevices() public static method

List all found HID (Human Interface Devices).
public static FindDevices ( ) : Primitive,
return Primitive,

GetBits() public static method

Get an 8 element array of 1s and 0s indicating which bit of a byte are set.
public static GetBits ( Primitive, data ) : Primitive,
data Primitive, A byte number (0 to 255).
return Primitive,

InputLength() public static method

Get the input record length for a HID device.
public static InputLength ( Primitive, name ) : Primitive,
name Primitive, The device name.
return Primitive,

Output() public static method

Send data to the HID device. This must be an array of bytes (0 to 255). The array must be indexed from 1 and have size OutputLength.
public static Output ( Primitive, name, Primitive, data ) : Primitive,
name Primitive, The HID device name.
data Primitive, The data to send.
return Primitive,

OutputLength() public static method

Get the output record length for a HID device.
public static OutputLength ( Primitive, name ) : Primitive,
name Primitive, The HID device name.
return Primitive,

SetBits() public static method

Set a byte from an 8 element array of 1s and 0s indicating which bit of a byte are set.
public static SetBits ( Primitive, data ) : Primitive,
data Primitive, An 8 element array of 1s and 0s (small bit first).
return Primitive,