public void get_status() { int result = NativeHidApiLibAdapter.hid_write(device, cmd.GetStatus.Pointer, new IntPtr(cmd.GetStatus.Length)); checkResult(result); read(); }
private void initialize() { var res = NativeHidApiLibAdapter.hid_enumerate(vid, pid); if (res == IntPtr.Zero) { throw new DeviceNotConnectedException(); } info = (hid_device_info)Marshal.PtrToStructure(res, typeof(hid_device_info)); }
private byte[] read() { IntPtr length = new IntPtr(32); IntPtr data = getBuffer(new byte[32]); int result = NativeHidApiLibAdapter.hid_read(device, data, length); var arr = new byte[result]; Marshal.Copy(data, arr, 0, result); return(arr); }
public void fire() { int result = NativeHidApiLibAdapter.hid_write(device, cmd.Fire.Pointer, new IntPtr(cmd.Fire.Length)); checkResult(result); }
public void turnLedOn() { int result = NativeHidApiLibAdapter.hid_write(device, cmd.Led_On.Pointer, new IntPtr(cmd.Led_On.Length)); checkResult(result); }
private void openDevice() { StringBuilder path = new StringBuilder(info.path, info.path.Length); device = NativeHidApiLibAdapter.hid_open_path(path); }
public void Dispose() { NativeHidApiLibAdapter.hid_close(device); cmd.Dispose(); }